diff options
author | Eric Williams | 2015-12-02 14:42:59 +0000 |
---|---|---|
committer | Eric Williams | 2016-04-01 14:12:03 +0000 |
commit | 429cd4e4ecbd8dbfaed902ac7f054c2adda254fe (patch) | |
tree | 8803bd3aa164fd8c4e2219bcaa242bc78a6f6c6e /bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java | |
parent | 2349244f390a9927eab593ddc499b71cb3f0a70b (diff) | |
download | eclipse.platform.swt-429cd4e4ecbd8dbfaed902ac7f054c2adda254fe.tar.gz eclipse.platform.swt-429cd4e4ecbd8dbfaed902ac7f054c2adda254fe.tar.xz eclipse.platform.swt-429cd4e4ecbd8dbfaed902ac7f054c2adda254fe.zip |
Bug 483097: [GTK3.16+] gtk_widget_override_color is deprecated
This patch is an overhaul of foreground colors for GTK3.16+. Similar to
bug 483096, this bug aims to fix and prevent future bugs that will arise
from gtk_widget_override_color() being deprecated. This also fixes the
last failing foreground test case on GTK3.16.
The main feature of this patch is that it converts all (but one case) of
foreground colors to use GTK's CSS machinery. Except for
Control.checkForeground(), this means that SWT's background and
foreground colors are entirely GTK CSS compatible.
An important change in this patch affects both CSS backgrounds and
foregrounds: since Control uses the same GtkCssProvider for a widget, we
need to cache background and foreground values when using CSS. For
example, when setting the background color of a widget that already has
a foreground color, we need to load not only the "new" background color
but also re-load the foreground color to ensure it isn't lost. This is
accomplished via Display.gtk_create_css_color_string().
Tested on GTK3.18, 3.16, 3.14, and 2.24. No additional AllNonBrowser
JUnit tests fail on GTK3 and GTK2.
Change-Id: Ib80f7c51ba2c1c2c922a8f8b51c947f93ac01260
Signed-off-by: Eric Williams <ericwill@redhat.com>
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java index 90fdeaea37..8bbf942ad7 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java @@ -565,9 +565,19 @@ void setFontDescription (long /*int*/ font) { } void setForegroundColor (GdkColor color) { - setForegroundColor (handle, color); - if (labelHandle != 0) setForegroundColor (labelHandle, color); - if (imageHandle != 0) setForegroundColor (imageHandle, color); + if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) { + GdkRGBA rgba = null; + if (color != null) { + rgba = display.toGdkRGBA (color); + } + parent.setForegroundColor (handle, rgba); + if (labelHandle != 0) parent.setForegroundColor (labelHandle, rgba); + if (imageHandle != 0) parent.setForegroundColor (imageHandle, rgba); + } else { + setForegroundColor (handle, color); + if (labelHandle != 0) setForegroundColor (labelHandle, color); + if (imageHandle != 0) setForegroundColor (imageHandle, color); + } } /** |