Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Williams2017-07-19 18:55:22 +0000
committerEric Williams2017-07-19 19:18:01 +0000
commita41ace50d2855d495d0fcf97bc5e59092a213f13 (patch)
tree0e277892cd697adf92d51ee7a9c6365770752fa8
parent7e4fd5de61828ec322875113c05b3fb9ab38cf93 (diff)
downloadeclipse.platform.swt-a41ace50d2855d495d0fcf97bc5e59092a213f13.tar.gz
eclipse.platform.swt-a41ace50d2855d495d0fcf97bc5e59092a213f13.tar.xz
eclipse.platform.swt-a41ace50d2855d495d0fcf97bc5e59092a213f13.zip
Bug 519576: [GTK3] Use GTK CSS for background/foreground colors on
GTK3.14 and below GtkTreeView still uses the ":selected" selector on GTK3.20+, unlike most other GTK widgets. Therefore the selection CSS needs to change when setting the background/foreground. Change-Id: I926e168482550ca07622164bd0b1899cee43d0ff
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java6
1 files changed, 4 insertions, 2 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 7e564ad0a3..46e4cea20f 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
@@ -4474,7 +4474,8 @@ void setBackgroundGdkRGBA (long /*int*/ context, long /*int*/ handle, GdkRGBA rg
// Form background string
String name = OS.GTK_VERSION >= OS.VERSION(3, 20, 0) ? display.gtk_widget_class_get_css_name(handle)
: display.gtk_widget_get_name(handle);
- String selection = OS.GTK_VERSION >= OS.VERSION(3, 20, 0) ? " selection" : ":selected";
+ String selection = OS.GTK_VERSION >= OS.VERSION(3, 20, 0) &&
+ !name.contains("treeview") ? " selection" : ":selected";
String css = name + " {background-color: " + display.gtk_rgba_to_css_string(rgba) + ";}\n"
+ name + selection + " {background-color: " + display.gtk_rgba_to_css_string(selectedBackground) + ";}";
@@ -4987,7 +4988,8 @@ void setForegroundGdkRGBA (long /*int*/ handle, GdkRGBA rgba) {
String name = OS.GTK_VERSION >= OS.VERSION(3, 20, 0) ? display.gtk_widget_class_get_css_name(handle)
: display.gtk_widget_get_name(handle);
GdkRGBA selectedForeground = display.COLOR_LIST_SELECTION_TEXT_RGBA;
- String selection = OS.GTK_VERSION >= OS.VERSION(3, 20, 0) ? " selection" : ":selected";
+ String selection = OS.GTK_VERSION >= OS.VERSION(3, 20, 0) &&
+ !name.contains("treeview") ? " selection" : ":selected";
String css = "* {color: " + color + ";}\n"
+ name + selection + " {color: " + display.gtk_rgba_to_css_string(selectedForeground) + ";}";

Back to the top