Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Williams2016-04-04 14:17:20 +0000
committerEric Williams2016-04-04 15:16:57 +0000
commitefa2634e4209791dbdb491ab13cbca55a327fb0a (patch)
treef64cbc02e1513332731acd73783e57a1a8438ad3
parent38e82f316f2687dc81846e8fb0416a08e436791a (diff)
downloadeclipse.platform.swt-efa2634e4209791dbdb491ab13cbca55a327fb0a.tar.gz
eclipse.platform.swt-efa2634e4209791dbdb491ab13cbca55a327fb0a.tar.xz
eclipse.platform.swt-efa2634e4209791dbdb491ab13cbca55a327fb0a.zip
Bug 487023: [GTK3.20] Update SWT to use proper GTK CSS nodes/selectors
This patch updates CSS machinery in SWT to use proper GTK3.20 CSS nodes. We can do this dynamically with gtk_widget_class_get_css_name(), which returns the CSS name of the node. I.e.: GtkToolbar becomes toolbar, GtkTextView becomes textview, etc. TabFolder now overrides setBackgroundColor() as it needs a specialized string for GTK3.20: instead of notebook {background...} we need to use notebook header {background...}. Tested on GTK3.20, 3.18, 3.16, and 3.14. GTK2 is unaffected. No additional test failures for AllNonBrowser JUnit tests on GTK3 and GTK2. Change-Id: I049ebfc9ef5a371411ac09a7672e3c710d11201f Signed-off-by: Eric Williams <ericwill@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c32
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java15
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java33
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java28
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java23
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java10
13 files changed, 160 insertions, 23 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
index 10a751b8aa..44cf9df84b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
@@ -209,6 +209,18 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(GTK_1TYPE_1ACCESSIBLE)
}
#endif
+#ifndef NO_GTK_1WIDGET_1GET_1CLASS
+JNIEXPORT jintLong JNICALL OS_NATIVE(GTK_1WIDGET_1GET_1CLASS)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, GTK_1WIDGET_1GET_1CLASS_FUNC);
+ rc = (jintLong)GTK_WIDGET_GET_CLASS((GtkWidget *)arg0);
+ OS_NATIVE_EXIT(env, that, GTK_1WIDGET_1GET_1CLASS_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO_GTK_1WIDGET_1REQUISITION_1HEIGHT
JNIEXPORT jint JNICALL OS_NATIVE(GTK_1WIDGET_1REQUISITION_1HEIGHT)
(JNIEnv *env, jclass that, jintLong arg0)
@@ -18356,6 +18368,26 @@ JNIEXPORT jboolean JNICALL OS_NATIVE(_1gtk_1widget_1child_1focus)
}
#endif
+#ifndef NO__1gtk_1widget_1class_1get_1css_1name
+JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1widget_1class_1get_1css_1name)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, _1gtk_1widget_1class_1get_1css_1name_FUNC);
+/*
+ rc = (jintLong)gtk_widget_class_get_css_name((GtkWidgetClass *)arg0);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_widget_class_get_css_name)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GtkWidgetClass *))fp)((GtkWidgetClass *)arg0);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, _1gtk_1widget_1class_1get_1css_1name_FUNC);
+ return rc;
+}
+#endif
+
#if (!defined(NO__1gtk_1widget_1create_1pango_1layout__II) && !defined(JNI64)) || (!defined(NO__1gtk_1widget_1create_1pango_1layout__JJ) && defined(JNI64))
#ifndef JNI64
JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1widget_1create_1pango_1layout__II)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
index 1089b6f735..e6468fc726 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
@@ -366,6 +366,7 @@
#define gtk_widget_is_composited_LIB LIB_GTK
#define gtk_widget_get_allocation_LIB LIB_GTK
#define gtk_widget_get_name_LIB LIB_GTK
+#define gtk_widget_class_get_name_LIB LIB_GTK
#define gtk_widget_size_request_LIB LIB_GTK
#define gtk_widget_get_default_style_LIB LIB_GTK
#define gtk_widget_get_preferred_size_LIB LIB_GTK
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
index 9d4cca47bc..ee026eb8b2 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
@@ -43,6 +43,7 @@ char * OS_nativeFunctionNames[] = {
"GTK_1RANGE_1SLIDER_1START",
"GTK_1TEXTVIEW_1IM_1CONTEXT",
"GTK_1TYPE_1ACCESSIBLE",
+ "GTK_1WIDGET_1GET_1CLASS",
"GTK_1WIDGET_1REQUISITION_1HEIGHT",
"GTK_1WIDGET_1REQUISITION_1WIDTH",
"GTypeInfo_1sizeof",
@@ -1367,6 +1368,7 @@ char * OS_nativeFunctionNames[] = {
"_1gtk_1widget_1add_1accelerator",
"_1gtk_1widget_1add_1events",
"_1gtk_1widget_1child_1focus",
+ "_1gtk_1widget_1class_1get_1css_1name",
#ifndef JNI64
"_1gtk_1widget_1create_1pango_1layout__II",
#else
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
index fe646e9e2a..ffd28d8057 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
@@ -53,6 +53,7 @@ typedef enum {
GTK_1RANGE_1SLIDER_1START_FUNC,
GTK_1TEXTVIEW_1IM_1CONTEXT_FUNC,
GTK_1TYPE_1ACCESSIBLE_FUNC,
+ GTK_1WIDGET_1GET_1CLASS_FUNC,
GTK_1WIDGET_1REQUISITION_1HEIGHT_FUNC,
GTK_1WIDGET_1REQUISITION_1WIDTH_FUNC,
GTypeInfo_1sizeof_FUNC,
@@ -1377,6 +1378,7 @@ typedef enum {
_1gtk_1widget_1add_1accelerator_FUNC,
_1gtk_1widget_1add_1events_FUNC,
_1gtk_1widget_1child_1focus_FUNC,
+ _1gtk_1widget_1class_1get_1css_1name_FUNC,
#ifndef JNI64
_1gtk_1widget_1create_1pango_1layout__II_FUNC,
#else
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
index 310ab725dc..df219a54a6 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
@@ -861,6 +861,9 @@ public static final native int X_EVENT_TYPE(long /*int*/ xevent);
/** @param xevent cast=(XAnyEvent *) */
public static final native long /*int*/ X_EVENT_WINDOW(long /*int*/ xevent);
+/** @param widget cast=(GtkWidget *) */
+public static final native long /*int*/ GTK_WIDGET_GET_CLASS(long /*int*/ widget);
+
/** X11 Native methods and constants */
public static final int Above = 0;
public static final int Below = 1;
@@ -1808,6 +1811,18 @@ public static final long /*int*/ gtk_widget_get_name(long /*int*/ widget) {
lock.unlock();
}
}
+/** @method flags=dynamic
+ * @param widget_class cast=(GtkWidgetClass *)
+ */
+public static final native long /*int*/ _gtk_widget_class_get_css_name(long /*int*/ widget_class);
+public static final long /*int*/ gtk_widget_class_get_css_name(long /*int*/ widget_class) {
+ lock.lock();
+ try {
+ return _gtk_widget_class_get_css_name(widget_class);
+ } finally {
+ lock.unlock();
+ }
+}
public static final native void _GTK_WIDGET_SET_FLAGS(long /*int*/ wid, int flag);
public static final void GTK_WIDGET_SET_FLAGS(long /*int*/ wid, int flag) {
lock.lock();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
index 13e80d899f..9018659efc 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
@@ -954,7 +954,12 @@ void setForegroundColor (long /*int*/ handle, GdkRGBA rgba) {
// Form foreground string
String color = display.gtk_rgba_to_css_string(toSet);
- String css = "GtkButton {color: " + color + ";}";
+ String css;
+ if (OS.GTK_VERSION >= OS.VERSION(3, 20, 0)) {
+ css = "button {color: " + color + ";}";
+ } else {
+ css = "GtkButton {color: " + color + ";}";
+ }
// Cache foreground color
cssForeground = css;
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 315262e17f..0a7a62b6cc 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
@@ -4222,20 +4222,25 @@ private void _setBackground (Color color) {
}
void setBackgroundColor (long /*int*/ context, long /*int*/ handle, GdkRGBA rgba) {
- if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
- // Form background string
- String name = gtk_widget_get_name(handle);
- String css = name + " {background-color: " + display.gtk_rgba_to_css_string (rgba) + ";}";
-
- // Cache background
- cssBackground = css;
-
- // Apply background color and any cached foreground color
- String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.BACKGROUND);
- gtk_css_provider_load_from_css (context, finalCss);
- } else {
- OS.gtk_widget_override_background_color (handle, OS.GTK_STATE_FLAG_NORMAL, rgba);
- }
+ if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
+ // Form background string
+ String name;
+ if (OS.GTK_VERSION >= OS.VERSION(3, 20, 0)) {
+ name = display.gtk_widget_class_get_css_name(handle);
+ } else {
+ name = display.gtk_widget_get_name(handle);
+ }
+ String css = name + " {background-color: " + display.gtk_rgba_to_css_string (rgba) + ";}";
+
+ // Cache background
+ cssBackground = css;
+
+ // Apply background color and any cached foreground color
+ String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.BACKGROUND);
+ gtk_css_provider_load_from_css (context, finalCss);
+ } else {
+ OS.gtk_widget_override_background_color (handle, OS.GTK_STATE_FLAG_NORMAL, rgba);
+ }
}
void setBackgroundColorGradient (long /*int*/ context, long /*int*/ handle, GdkRGBA rgba) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
index af555afe0f..de4cce54d4 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
@@ -1906,6 +1906,34 @@ String gtk_rgba_to_css_string (GdkRGBA rgba) {
return new String (Converter.mbcsToWcs (null, buffer));
}
+String gtk_widget_get_name(long /*int*/ handle) {
+ long /*int*/ str = OS.gtk_widget_get_name (handle);
+ String name;
+ if (str == 0) {
+ name = "*";
+ } else {
+ int length = OS.strlen (str);
+ byte [] buffer = new byte [length];
+ OS.memmove (buffer, str, length);
+ name = new String (Converter.mbcsToWcs (null, buffer));
+ }
+ return name;
+}
+
+String gtk_widget_class_get_css_name(long /*int*/ handle) {
+ long /*int*/ str = OS.gtk_widget_class_get_css_name (OS.GTK_WIDGET_GET_CLASS(handle));
+ String name;
+ if (str == 0) {
+ name = "*";
+ } else {
+ int length = OS.strlen (str);
+ byte [] buffer = new byte [length];
+ OS.memmove (buffer, str, length);
+ name = new String (Converter.mbcsToWcs (null, buffer));
+ }
+ return name;
+}
+
/**
* Returns the default display. One is created (making the
* thread that invokes this method its user-interface thread)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
index 462f95e29e..eb5f380651 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
@@ -1355,8 +1355,14 @@ void setBackgroundColor (long /*int*/ context, long /*int*/ handle, GdkRGBA rgba
GdkColor defaultColor = getDisplay().COLOR_LIST_SELECTION;
GdkRGBA selectedBackground = display.toGdkRGBA (defaultColor);
if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
- String css = "GtkTreeView {background-color: " + display.gtk_rgba_to_css_string(background) + ";}\n"
- + "GtkTreeView:selected {background-color: " + display.gtk_rgba_to_css_string(selectedBackground) + ";}";
+ String css;
+ if (OS.GTK_VERSION >= OS.VERSION(3, 20, 0)) {
+ css = "treeview {background-color: " + display.gtk_rgba_to_css_string(background) + ";}\n"
+ + "treeview:selected {background-color: " + display.gtk_rgba_to_css_string(selectedBackground) + ";}";
+ } else {
+ css = "GtkTreeView {background-color: " + display.gtk_rgba_to_css_string(background) + ";}\n"
+ + "GtkTreeView:selected {background-color: " + display.gtk_rgba_to_css_string(selectedBackground) + ";}";
+ }
// Cache background color
cssBackground = css;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java
index 0b503629fb..690651b637 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java
@@ -743,6 +743,29 @@ void reskinChildren (int flags) {
}
@Override
+void setBackgroundColor (long /*int*/ context, long /*int*/ handle, GdkRGBA rgba) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
+ // Form background string
+ String name;
+ if (OS.GTK_VERSION >= OS.VERSION(3, 20, 0)) {
+ name = "notebook header";
+ } else {
+ name = "GtkNotebook";
+ }
+ String css = name + " {background-color: " + display.gtk_rgba_to_css_string (rgba) + ";}";
+
+ // Cache background
+ cssBackground = css;
+
+ // Apply background color and any cached foreground color
+ String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.BACKGROUND);
+ gtk_css_provider_load_from_css (context, finalCss);
+ } else {
+ OS.gtk_widget_override_background_color (handle, OS.GTK_STATE_FLAG_NORMAL, rgba);
+ }
+}
+
+@Override
int setBounds (int x, int y, int width, int height, boolean move, boolean resize) {
int result = super.setBounds (x, y, width, height, move, resize);
if ((result & RESIZED) != 0) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
index f6c42af815..5dc045e9a7 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
@@ -3175,8 +3175,14 @@ void setBackgroundColor (long /*int*/ context, long /*int*/ handle, GdkRGBA rgba
GdkColor defaultColor = getDisplay().COLOR_LIST_SELECTION;
GdkRGBA selectedBackground = display.toGdkRGBA (defaultColor);
if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
- String css = "GtkTreeView {background-color: " + display.gtk_rgba_to_css_string(background) + ";}\n"
- + "GtkTreeView:selected {background-color: " + display.gtk_rgba_to_css_string(selectedBackground) + ";}";
+ String css;
+ if (OS.GTK_VERSION >= OS.VERSION(3, 20, 0)) {
+ css = "treeview {background-color: " + display.gtk_rgba_to_css_string(background) + ";}\n"
+ + "treeview:selected {background-color: " + display.gtk_rgba_to_css_string(selectedBackground) + ";}";
+ } else {
+ css = "GtkTreeView {background-color: " + display.gtk_rgba_to_css_string(background) + ";}\n"
+ + "GtkTreeView:selected {background-color: " + display.gtk_rgba_to_css_string(selectedBackground) + ";}";
+ }
// Cache background color
cssBackground = css;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
index 5c836de3b3..0905b522d7 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
@@ -2199,8 +2199,14 @@ void setBackgroundColor (long /*int*/ context, long /*int*/ handle, GdkRGBA rgba
GdkColor defaultColor = getDisplay().COLOR_LIST_SELECTION;
GdkRGBA selectedBackground = display.toGdkRGBA (defaultColor);
if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
- String css = "GtkTextView {background-color: " + display.gtk_rgba_to_css_string(background) + ";}\n"
- + "GtkTextView:selected {background-color: " + display.gtk_rgba_to_css_string(selectedBackground) + ";}";
+ String css;
+ if (OS.GTK_VERSION >= OS.VERSION(3, 20, 0)) {
+ css = "textview text {background-color: " + display.gtk_rgba_to_css_string(background) + ";}\n"
+ + "textview:selected {background-color: " + display.gtk_rgba_to_css_string(selectedBackground) + ";}";
+ } else {
+ css = "GtkTextView {background-color: " + display.gtk_rgba_to_css_string(background) + ";}\n"
+ + "GtkTextView:selected {background-color: " + display.gtk_rgba_to_css_string(selectedBackground) + ";}";
+ }
// Cache background color
cssBackground = css;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
index fb8dc082e6..d290179e28 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
@@ -3165,8 +3165,14 @@ void setBackgroundColor (long /*int*/ context, long /*int*/ handle, GdkRGBA rgba
GdkColor defaultColor = getDisplay().COLOR_LIST_SELECTION;
GdkRGBA selectedBackground = display.toGdkRGBA (defaultColor);
if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
- String css = "GtkTreeView {background-color: " + display.gtk_rgba_to_css_string(background) + ";}\n"
- + "GtkTreeView:selected {background-color: " + display.gtk_rgba_to_css_string(selectedBackground) + ";}";
+ String css;
+ if (OS.GTK_VERSION >= OS.VERSION(3, 20, 0)) {
+ css = "treeview {background-color: " + display.gtk_rgba_to_css_string(background) + ";}\n"
+ + "treeview:selected {background-color: " + display.gtk_rgba_to_css_string(selectedBackground) + ";}";
+ } else {
+ css = "GtkTreeView {background-color: " + display.gtk_rgba_to_css_string(background) + ";}\n"
+ + "GtkTreeView:selected {background-color: " + display.gtk_rgba_to_css_string(selectedBackground) + ";}";
+ }
// Cache background color
cssBackground = css;

Back to the top