diff options
| author | Alexander Kurtakov | 2013-03-15 15:44:40 +0000 |
|---|---|---|
| committer | Carolyn MacLeod | 2013-04-09 14:56:38 +0000 |
| commit | 597773cccad43b16ec48ecb7f575541ac7ff26b6 (patch) | |
| tree | a943632ccb3b19aa840ba6806ac18bf3cd001811 | |
| parent | e67e09a1099f3bb4a176333aedf09e7d458a4333 (diff) | |
| download | eclipse.platform.swt-597773cccad43b16ec48ecb7f575541ac7ff26b6.tar.gz eclipse.platform.swt-597773cccad43b16ec48ecb7f575541ac7ff26b6.tar.xz eclipse.platform.swt-597773cccad43b16ec48ecb7f575541ac7ff26b6.zip | |
Revert Control.setBackground on GTK3. Bug 403474
Looks like this would be tough to fix as one can't change a single css
property only in the way I tried it.
| -rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java index b09533d78d..c929cf0efd 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java @@ -3909,23 +3909,24 @@ public void setBackground (Color color) { void setBackgroundColor (long /*int*/ handle, GdkColor color) { if (OS.GTK3) { - + GdkRGBA rgba = null; + double alpha = 1; if (color == null) { if ((state & PARENT_BACKGROUND) != 0) { + alpha = 0; Control control = findBackgroundControl(); if (control == null) control = this; color = control.getBackgroundColor(); } } - String css ="GtkWidget {\n" + - " background-color: rgb("+((color.red >> 8) & 0xFF)+","+((color.green >> 8) & 0xFF)+","+((color.blue >> 8) & 0xFF)+");\n" + - "}\n"; - byte[] css_data = Converter.wcsToMbcs (null, css, true); - long /*int*/ context = OS.gtk_widget_get_style_context(handle); - long /*int*/ provider = OS.gtk_css_provider_new (); - OS.gtk_css_provider_load_from_data (provider, css_data, -1, null); - OS.gtk_style_context_add_provider (context, provider, OS.GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); - OS.g_object_unref (provider); + if (color != null) { + rgba = new GdkRGBA (); + rgba.alpha = alpha; + rgba.red = (color.red & 0xFFFF) / (float)0xFFFF; + rgba.green = (color.green & 0xFFFF) / (float)0xFFFF; + rgba.blue = (color.blue & 0xFFFF) / (float)0xFFFF; + } + OS.gtk_widget_override_background_color (handle, OS.GTK_STATE_FLAG_NORMAL, rgba); return; } int index = OS.GTK_STATE_NORMAL; |
