Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Williams2017-07-14 12:46:28 +0000
committerEric Williams2017-07-18 16:08:32 +0000
commit96f0522cddf7d1c748b48ed1d89b9374b0298000 (patch)
treef3e5cbb528aeac02a67e27c7b307d930bd936d47
parent2b5e88cf9f34cbada712e9b4a64a270452696c69 (diff)
downloadeclipse.platform.swt-96f0522cddf7d1c748b48ed1d89b9374b0298000.tar.gz
eclipse.platform.swt-96f0522cddf7d1c748b48ed1d89b9374b0298000.tar.xz
eclipse.platform.swt-96f0522cddf7d1c748b48ed1d89b9374b0298000.zip
Bug 519576: [GTK3] Use GTK CSS for background/foreground colors on
GTK3.14 and below This patch brings GTK CSS machinery to GTK 3.14. We already use GTK CSS for system colors on GTK 3.14, no reason why background/foreground colors can't use it either. Change-Id: Id8cc46abba9e2e5c333d3d0decf7f11c20d02117 Signed-off-by: Eric Williams <ericwill@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java27
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java34
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java36
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java20
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java50
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java49
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java49
18 files changed, 103 insertions, 189 deletions
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 9155eccaec..b00a45ce9b 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
@@ -949,7 +949,7 @@ void setForegroundGdkColor (GdkColor color) {
@Override
void setForegroundGdkRGBA (long /*int*/ handle, GdkRGBA rgba) {
assert OS.GTK3 : "GTK3 code was run by GTK2";
- if (OS.GTK_VERSION < OS.VERSION(3, 16, 0)) {
+ if (OS.GTK_VERSION < OS.VERSION(3, 14, 0)) {
super.setForegroundGdkRGBA(handle, rgba);
return;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java
index 6927e6f490..401664dd25 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java
@@ -1919,11 +1919,18 @@ void setBackgroundGdkRGBA (long /*int*/ context, long /*int*/ handle, GdkRGBA rg
// CSS to be parsed for various widgets within Combo
background = rgba;
String css = "* {\n";
+ String color;
if (rgba != null) {
- String color = display.gtk_rgba_to_css_string (rgba);
- css += "background: " + color + ";\n";
+ color = display.gtk_rgba_to_css_string (rgba);
+ } else {
+ if ((style & SWT.READ_ONLY) != 0) {
+ color = display.gtk_rgba_to_css_string (display.COLOR_WIDGET_BACKGROUND_RGBA);
+ } else {
+ color = display.gtk_rgba_to_css_string (display.COLOR_LIST_BACKGROUND_RGBA);
+ }
}
- css += "}\n";
+ css += "background: " + color + ";}";
+
// Cache background color
cssBackground = css;
String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.BACKGROUND);
@@ -1931,11 +1938,11 @@ void setBackgroundGdkRGBA (long /*int*/ context, long /*int*/ handle, GdkRGBA rg
// For read only Combos, we can just apply the background CSS to the GtkToggleButton.
gtk_css_provider_load_from_css (OS.gtk_widget_get_style_context(buttonHandle), finalCss);
} else {
- if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
- // For GTK3.16+, only the GtkEntry needs to be themed.
+ if (OS.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
+ // For GTK3.14+, only the GtkEntry needs to be themed.
gtk_css_provider_load_from_css (OS.gtk_widget_get_style_context(entryHandle), finalCss);
} else {
- // Maintain GTK3.14- functionality
+ // Maintain GTK3.12- functionality
setBackgroundGradientGdkRGBA (OS.gtk_widget_get_style_context (entryHandle), handle, rgba);
super.setBackgroundGdkRGBA (OS.gtk_widget_get_style_context (entryHandle), entryHandle, rgba);
}
@@ -1945,6 +1952,14 @@ void setBackgroundGdkRGBA (long /*int*/ context, long /*int*/ handle, GdkRGBA rg
}
@Override
+void setBackgroundGdkRGBA (GdkRGBA rgba) {
+ assert OS.GTK3 : "GTK3 code was run by GTK2";
+ super.setBackgroundGdkRGBA(rgba);
+ if (entryHandle != 0) setBackgroundGdkRGBA (entryHandle, rgba);
+ setBackgroundGdkRGBA (fixedHandle, rgba);
+}
+
+@Override
void setBackgroundGdkColor (GdkColor color) {
assert !OS.GTK3 : "GTK2 code was run by GTK3";
super.setBackgroundGdkColor (color);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
index 0e05077abf..aad4f885c2 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
@@ -336,7 +336,7 @@ void createHandle (int index, boolean fixed, boolean scrolled) {
@Override
long /*int*/ gtk_draw (long /*int*/ widget, long /*int*/ cairo) {
- if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
long /*int*/ context = OS.gtk_widget_get_style_context(widget);
GtkAllocation allocation = new GtkAllocation();
OS.gtk_widget_get_allocation (widget, allocation);
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 1c5652c8e3..7e564ad0a3 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
@@ -682,7 +682,7 @@ void checkForeground () {
*
* This can be removed on GTK3.16+.
*/
- if (OS.GTK_VERSION < OS.VERSION(3, 16, 0) && OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ if (OS.GTK_VERSION < OS.VERSION(3, 14, 0) && OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
setForegroundGdkRGBA (topHandle (), display.COLOR_WIDGET_FOREGROUND_RGBA);
}
}
@@ -2755,7 +2755,7 @@ public Image getBackgroundImage () {
GdkRGBA getContextBackgroundGdkRGBA () {
assert OS.GTK3 : "GTK3 code was run by GTK2";
long /*int*/ fontHandle = fontHandle ();
- if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
if (provider != 0) {
return display.gtk_css_parse_background (provider, null);
} else {
@@ -2775,7 +2775,7 @@ GdkRGBA getContextBackgroundGdkRGBA () {
GdkRGBA getContextColorGdkRGBA () {
assert OS.GTK3 : "GTK3 code was run by GTK2";
long /*int*/ fontHandle = fontHandle ();
- if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
return display.gtk_css_parse_foreground(provider, null);
} else {
long /*int*/ context = OS.gtk_widget_get_style_context (fontHandle);
@@ -4438,7 +4438,7 @@ private void _setBackground (Color color) {
} else {
state |= BACKGROUND;
}
- setBackgroundGdkRGBA (handle, rgba);
+ setBackgroundGdkRGBA (rgba);
}
} else {
GdkColor gdkColor = null;
@@ -4469,11 +4469,14 @@ private void _setBackground (Color color) {
void setBackgroundGdkRGBA (long /*int*/ context, long /*int*/ handle, GdkRGBA rgba) {
assert OS.GTK3 : "GTK3 code was run by GTK2";
- if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
+ GdkRGBA selectedBackground = display.getSystemColor(SWT.COLOR_LIST_SELECTION).handleRGBA;
+ if (OS.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
// 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 css = name + " {background-color: " + display.gtk_rgba_to_css_string (rgba) + ";}";
+ String selection = OS.GTK_VERSION >= OS.VERSION(3, 20, 0) ? " 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) + ";}";
// Cache background
cssBackground = css;
@@ -4483,6 +4486,7 @@ void setBackgroundGdkRGBA (long /*int*/ context, long /*int*/ handle, GdkRGBA rg
gtk_css_provider_load_from_css (context, finalCss);
} else {
OS.gtk_widget_override_background_color (handle, OS.GTK_STATE_FLAG_NORMAL, rgba);
+ OS.gtk_widget_override_background_color(handle, OS.GTK_STATE_FLAG_SELECTED, selectedBackground);
}
}
@@ -4552,6 +4556,11 @@ void setBackgroundGdkColor (GdkColor color) {
setBackgroundGdkColor (handle, color);
}
+void setBackgroundGdkRGBA(GdkRGBA rgba) {
+ assert OS.GTK3 : "GTK3 code was run by GTK2";
+ setBackgroundGdkRGBA (handle, rgba);
+}
+
void setBackgroundGdkRGBA (long /*int*/ handle, GdkRGBA rgba) {
assert OS.GTK3 : "GTK3 code was run by GTK2";
backgroundAlpha = 255;
@@ -4965,7 +4974,7 @@ void setForegroundGdkColor (GdkColor color) {
void setForegroundGdkRGBA (long /*int*/ handle, GdkRGBA rgba) {
assert OS.GTK3 : "GTK3 code was run by GTK2";
- if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
GdkRGBA toSet = new GdkRGBA();
if (rgba != null) {
toSet = rgba;
@@ -6178,14 +6187,14 @@ long /*int*/ windowProc (long /*int*/ handle, long /*int*/ arg0, long /*int*/ us
Control control = findBackgroundControl ();
boolean draw = control != null && control.backgroundImage != null;
if (OS.GTK3 && !draw && (state & CANVAS) != 0) {
- GdkRGBA rgba = new GdkRGBA();
- long /*int*/ context = OS.gtk_widget_get_style_context (handle);
- if (OS.GTK_VERSION < OS.VERSION(3, 18, 0)) {
+ if (OS.GTK_VERSION < OS.VERSION(3, 14, 0)) {
+ GdkRGBA rgba = new GdkRGBA();
+ long /*int*/ context = OS.gtk_widget_get_style_context (handle);
OS.gtk_style_context_get_background_color (context, OS.GTK_STATE_FLAG_NORMAL, rgba);
+ draw = rgba.alpha == 0;
} else {
- OS.gtk_style_context_get_background_color (context, OS.gtk_widget_get_state_flags(handle), rgba);
+ draw = (state & BACKGROUND) == 0;
}
- draw = rgba.alpha == 0;
}
if (draw) {
if (OS.GTK3) {
@@ -6228,5 +6237,4 @@ Point getWindowOrigin () {
return new Point (x [0], y [0]);
}
-
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java
index b71a106de6..717bffd051 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java
@@ -1355,13 +1355,39 @@ void setBackgroundGdkColor (GdkColor color) {
}
@Override
-void setBackgroundGdkRGBA (long /*int*/ context, long /*int*/ handle, GdkRGBA rgba) {
+void setBackgroundGdkRGBA (GdkRGBA rgba) {
assert OS.GTK3 : "GTK3 code was run by GTK2";
- if (rgba == null) {
- super.setBackgroundGdkRGBA(context, handle, display.COLOR_LIST_BACKGROUND_RGBA);
- } else {
- super.setBackgroundGdkRGBA(context, handle, rgba);
+ super.setBackgroundGdkRGBA(rgba);
+ if (calendarHandle != 0) {
+ setBackgroundGdkRGBA (calendarHandle, rgba);
}
+ super.setBackgroundGdkRGBA(rgba);
+
+}
+
+@Override
+void setBackgroundGdkRGBA (long /*int*/ context, long /*int*/ handle, GdkRGBA rgba) {
+ assert OS.GTK3 : "GTK3 code was run by GTK2";
+
+ // We need to override here because DateTime widgets use "background" instead of
+ // "background-color" as their CSS property.
+ if (OS.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
+ // 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 css = name + " {background: " + display.gtk_rgba_to_css_string (rgba) + ";}\n" +
+ name + selection + " {background: " + display.gtk_rgba_to_css_string(display.COLOR_LIST_SELECTION_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 {
+ super.setBackgroundGdkRGBA(context, handle, rgba);
+ }
}
@Override
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java
index 874759957d..6a9658fcd0 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java
@@ -434,7 +434,7 @@ void reskinChildren (int flags) {
@Override
void setWidgetBackground () {
- if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
GdkRGBA rgba = (state & BACKGROUND) != 0 ? getBackgroundGdkRGBA () : null;
super.setBackgroundGdkRGBA (handle, rgba);
} else {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java
index 1150cf2859..ed7d9226c7 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java
@@ -160,7 +160,7 @@ Rectangle getClientAreaInPixels () {
@Override
GdkRGBA getContextColorGdkRGBA () {
assert OS.GTK3 : "GTK3 code was run by GTK2";
- if (OS.GTK_VERSION >= OS.VERSION (3, 16, 0)) {
+ if (OS.GTK_VERSION >= OS.VERSION (3, 14, 0)) {
if (foreground != null) {
return foreground;
} else {
@@ -174,7 +174,7 @@ GdkRGBA getContextColorGdkRGBA () {
@Override
GdkRGBA getContextBackgroundGdkRGBA () {
assert OS.GTK3 : "GTK3 code was run by GTK2";
- if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
return super.getContextBackgroundGdkRGBA();
} else {
long /*int*/ context = OS.gtk_widget_get_style_context (fixedHandle);
@@ -334,6 +334,12 @@ void releaseWidget () {
}
@Override
+void setBackgroundGdkRGBA(long /*int*/ handle, GdkRGBA rgba) {
+ assert OS.GTK3 : "GTK3 code was run by GTK2";
+ super.setBackgroundGdkRGBA(fixedHandle, rgba);
+}
+
+@Override
void setBackgroundGdkColor (GdkColor color) {
assert !OS.GTK3 : "GTK2 code was run by GTK3";
super.setBackgroundGdkColor (color);
@@ -343,12 +349,6 @@ void setBackgroundGdkColor (GdkColor color) {
}
@Override
-void setBackgroundGdkRGBA(long /*int*/ handle, GdkRGBA rgba) {
- assert OS.GTK3 : "GTK3 code was run by GTK2";
- super.setBackgroundGdkRGBA(fixedHandle, rgba);
-}
-
-@Override
void setFontDescription (long /*int*/ font) {
super.setFontDescription (font);
setFontDescription (labelHandle, font);
@@ -357,7 +357,7 @@ void setFontDescription (long /*int*/ font) {
@Override
void setForegroundGdkRGBA (long /*int*/ handle, GdkRGBA rgba) {
assert OS.GTK3 : "GTK3 code was run by GTK2";
- if (OS.GTK_VERSION < OS.VERSION(3, 16, 0)) {
+ if (OS.GTK_VERSION < OS.VERSION(3, 14, 0)) {
super.setForegroundGdkRGBA(handle, rgba);
return;
}
@@ -367,7 +367,7 @@ void setForegroundGdkRGBA (long /*int*/ handle, GdkRGBA rgba) {
* to specify a foreground color before the text is set, store the
* color and wait until text is specified to apply it.
*/
- if (!text.isEmpty()) {
+ if (text != null && !text.isEmpty()) {
super.setForegroundGdkRGBA (labelHandle, rgba);
}
foreground = rgba;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
index 4f5c46dff3..43057c6497 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
@@ -496,7 +496,6 @@ void setAlignment () {
}
}
-
private void gtk_label_set_align (float xalign, float yalign) {
OS.gtk_label_set_xalign (labelHandle, xalign);
OS.gtk_label_set_yalign (labelHandle, yalign);
@@ -686,7 +685,7 @@ public void setText (String string) {
@Override
void setWidgetBackground () {
- if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
GdkRGBA rgba = (state & BACKGROUND) != 0 ? getBackgroundGdkRGBA () : null;
super.setBackgroundGdkRGBA (handle, rgba);
} else {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java
index bfbdac9eed..3fe8a6b6b1 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java
@@ -391,7 +391,7 @@ long /*int*/ gtk_button_release_event (long /*int*/ widget, long /*int*/ event)
@Override
long /*int*/ gtk_draw (long /*int*/ widget, long /*int*/ cairo) {
- if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
long /*int*/ context = OS.gtk_widget_get_style_context(widget);
GtkAllocation allocation = new GtkAllocation();
OS.gtk_widget_get_allocation (widget, allocation);
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 bdbf74231f..8c13845cd2 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
@@ -45,7 +45,6 @@ public class List extends Scrollable {
int selectionCountOnPress,selectionCountOnRelease;
static final int TEXT_COLUMN = 0;
- GdkRGBA background;
double cachedAdjustment, currentAdjustment;
/**
@@ -450,22 +449,6 @@ GdkColor getBackgroundGdkColor () {
return getBaseGdkColor ();
}
-@Override
-GdkRGBA getContextBackgroundGdkRGBA () {
- assert OS.GTK3 : "GTK3 code was run by GTK2";
- if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
- if (background != null) {
- return background;
- } else {
- // List is a GtkTreeView, same as Table/Tree: its default
- // background color is COLOR_LIST_BACKGROUND.
- return display.COLOR_LIST_BACKGROUND_RGBA;
- }
- } else {
- return super.getContextBackgroundGdkRGBA ();
- }
-}
-
/**
* Returns the zero-relative index of the item which currently
* has the focus in the receiver, or -1 if no item has focus.
@@ -1435,37 +1418,6 @@ void setBackgroundGdkColor (GdkColor color) {
}
@Override
-void setBackgroundGdkRGBA (long /*int*/ context, long /*int*/ handle, GdkRGBA rgba) {
- assert OS.GTK3 : "GTK3 code was run by GTK2";
- /* Setting the background color overrides the selected background color.
- * To prevent this, we need to re-set the default. This can be done with CSS
- * on GTK3.16+, or by using GtkStateFlags as an argument to
- * gtk_widget_override_background_color() on versions of GTK3 less than 3.16.
- */
- if (rgba == null) {
- background = display.COLOR_LIST_BACKGROUND_RGBA;
- } else {
- background = rgba;
- }
- GdkRGBA selectedBackground = display.getSystemColor(SWT.COLOR_LIST_SELECTION).handleRGBA;
- if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
- String name = OS.GTK_VERSION >= OS.VERSION(3, 20, 0) ? "treeview" : "GtkTreeView";
- String css = name + " {background-color: " + display.gtk_rgba_to_css_string(background) + ";}\n"
- + name + ":selected {background-color: " + display.gtk_rgba_to_css_string(selectedBackground) + ";}";
-
- // Cache background color
- cssBackground = css;
-
- // Apply background color and any foreground color
- String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.BACKGROUND);
- gtk_css_provider_load_from_css(context, finalCss);
- } else {
- super.setBackgroundGdkRGBA(context, handle, rgba);
- OS.gtk_widget_override_background_color(handle, OS.GTK_STATE_FLAG_SELECTED, selectedBackground);
- }
-}
-
-@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);
/*
@@ -1547,7 +1499,7 @@ public void setItems (String... items) {
@Override
void setForegroundGdkRGBA (GdkRGBA rgba) {
assert OS.GTK3 : "GTK3 code was run by GTK2";
- if (OS.GTK_VERSION >= OS.VERSION (3, 16, 0)) {
+ if (OS.GTK_VERSION >= OS.VERSION (3, 14, 0)) {
GdkRGBA toSet = rgba == null ? display.COLOR_LIST_FOREGROUND_RGBA : rgba;
setForegroundGdkRGBA (handle, toSet);
} else {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java
index fb7650831f..7f1d1ce844 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java
@@ -249,7 +249,7 @@ long /*int*/ gtk_button_release_event (long /*int*/ widget, long /*int*/ eventPt
@Override
long /*int*/ gtk_draw (long /*int*/ widget, long /*int*/ cairo) {
- if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
long /*int*/ context = OS.gtk_widget_get_style_context(widget);
GtkAllocation allocation = new GtkAllocation();
OS.gtk_widget_get_allocation (widget, allocation);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
index d49e3b0416..e82d864ba3 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
@@ -739,7 +739,7 @@ void createHandle (int index) {
if ((style & (SWT.NO_TRIM | SWT.BORDER | SWT.SHELL_TRIM)) == 0) {
OS.gtk_container_set_border_width (shellHandle, 1);
if (OS.GTK3) {
- if (OS.GTK_VERSION < OS.VERSION (3, 16, 0)) {
+ if (OS.GTK_VERSION < OS.VERSION (3, 14, 0)) {
OS.gtk_widget_override_background_color (shellHandle, OS.GTK_STATE_FLAG_NORMAL, new GdkRGBA());
}
} else {
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 2a008cfc81..f2a1126d30 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
@@ -745,7 +745,7 @@ void reskinChildren (int flags) {
@Override
void setBackgroundGdkRGBA (long /*int*/ context, long /*int*/ handle, GdkRGBA rgba) {
assert OS.GTK3 : "GTK3 code was run by GTK2";
- if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
// Form background string
String name = OS.GTK_VERSION >= OS.VERSION(3, 20, 0) ? "notebook header" : "GtkNotebook.header";
String css = name + " {background-color: " + display.gtk_rgba_to_css_string (rgba) + ";}";
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 a30efa44a7..45d03c992e 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
@@ -82,7 +82,7 @@ public class Table extends Composite {
boolean firstCustomDraw;
int drawState, drawFlags;
GdkColor drawForeground;
- GdkRGBA background, foreground, drawForegroundRGBA;
+ GdkRGBA foreground, drawForegroundRGBA;
Color headerBackground, headerForeground;
String headerCSSBackground, headerCSSForeground;
boolean ownerDraw, ignoreSize, ignoreAccessibility, pixbufSizeSet;
@@ -1421,21 +1421,9 @@ public TableColumn [] getColumns () {
}
@Override
-GdkRGBA getContextBackgroundGdkRGBA () {
- assert OS.GTK3 : "GTK3 code was run by GTK2";
- if (background != null) {
- return background;
- } else {
- // For Tables and Trees, the default background is
- // COLOR_LIST_BACKGROUND instead of COLOR_WIDGET_BACKGROUND.
- return display.COLOR_LIST_BACKGROUND_RGBA;
- }
-}
-
-@Override
GdkRGBA getContextColorGdkRGBA () {
assert OS.GTK3 : "GTK3 code was run by GTK2";
- if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
if (foreground != null) {
return foreground;
} else {
@@ -3361,37 +3349,6 @@ void setBackgroundGdkColor (GdkColor color) {
}
@Override
-void setBackgroundGdkRGBA (long /*int*/ context, long /*int*/ handle, GdkRGBA rgba) {
- assert OS.GTK3 : "GTK3 code was run by GTK2";
- /* Setting the background color overrides the selected background color.
- * To prevent this, we need to re-set the default. This can be done with CSS
- * on GTK3.16+, or by using GtkStateFlags as an argument to
- * gtk_widget_override_background_color() on versions of GTK3 less than 3.16.
- */
- if (rgba == null) {
- background = display.COLOR_LIST_BACKGROUND_RGBA;
- } else {
- background = rgba;
- }
- GdkRGBA selectedBackground = display.getSystemColor(SWT.COLOR_LIST_SELECTION).handleRGBA;
- if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
- String name = OS.GTK_VERSION >= OS.VERSION(3, 20, 0) ? "treeview" : "GtkTreeView";
- String css = name + " {background-color: " + display.gtk_rgba_to_css_string(background) + ";}\n"
- + name + ":selected {background-color: " + display.gtk_rgba_to_css_string(selectedBackground) + ";}";
-
- // Cache background color
- cssBackground = css;
-
- // Apply background color and any foreground color
- String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.BACKGROUND);
- gtk_css_provider_load_from_css(context, finalCss);
- } else {
- super.setBackgroundGdkRGBA(context, handle, rgba);
- OS.gtk_widget_override_background_color(handle, OS.GTK_STATE_FLAG_SELECTED, selectedBackground);
- }
-}
-
-@Override
void setBackgroundPixmap (Image image) {
ownerDraw = true;
recreateRenderers ();
@@ -3472,7 +3429,7 @@ void setFontDescription (long /*int*/ font) {
@Override
void setForegroundGdkRGBA (GdkRGBA rgba) {
assert OS.GTK3 : "GTK3 code was run by GTK2";
- if (OS.GTK_VERSION >= OS.VERSION (3, 16, 0)) {
+ if (OS.GTK_VERSION >= OS.VERSION (3, 14, 0)) {
foreground = rgba;
GdkRGBA toSet = rgba == null ? display.COLOR_LIST_FOREGROUND_RGBA : rgba;
setForegroundGdkRGBA (handle, toSet);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java
index 2945e2e871..131a0d04b4 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java
@@ -595,7 +595,7 @@ int setBounds (int x, int y, int width, int height, boolean move, boolean resize
@Override
void setBackgroundGdkRGBA (long /*int*/ context, long /*int*/ handle, GdkRGBA rgba) {
assert OS.GTK3 : "GTK3 code was run by GTK2";
- if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
// Form background string
String name = OS.GTK_VERSION >= OS.VERSION(3, 20, 0) ? "toolbar" : "GtkToolbar";
String css = name + " {background-color: " + display.gtk_rgba_to_css_string(rgba) + "}";
@@ -622,7 +622,7 @@ void setParentBackground () {
@Override
void setForegroundGdkRGBA (long /*int*/ handle, GdkRGBA rgba) {
assert OS.GTK3 : "GTK3 code was run by GTK2";
- if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
GdkRGBA toSet = new GdkRGBA();
if (rgba != null) {
toSet = rgba;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
index b81724cf5a..7cf2516202 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
@@ -1041,7 +1041,7 @@ void setForegroundColor (GdkColor color) {
void setBackgroundRGBA (long /*int*/ handle, GdkRGBA rgba) {
assert OS.GTK3 : "GTK3 code was run by GTK2";
- if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
// Form background string
long /*int*/ context = OS.gtk_widget_get_style_context(handle);
String name = OS.GTK_VERSION >= OS.VERSION(3, 20, 0) ? display.gtk_widget_class_get_css_name(handle)
@@ -1056,7 +1056,7 @@ void setBackgroundRGBA (long /*int*/ handle, GdkRGBA rgba) {
void setForegroundRGBA (long /*int*/ handle, GdkRGBA rgba) {
assert OS.GTK3 : "GTK3 code was run by GTK2";
- if (OS.GTK_VERSION < OS.VERSION(3, 16, 0)) {
+ if (OS.GTK_VERSION < OS.VERSION(3, 14, 0)) {
GdkRGBA selectedForeground = display.COLOR_LIST_SELECTION_TEXT_RGBA;
OS.gtk_widget_override_color (handle, OS.GTK_STATE_FLAG_NORMAL, rgba);
OS.gtk_widget_override_color (handle, OS.GTK_STATE_FLAG_SELECTED, selectedForeground);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java
index 6be9da75bc..fa0102b26e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java
@@ -765,7 +765,7 @@ public boolean open () {
OS.gtk_widget_realize (overlay);
long /*int*/ overlayWindow = OS.gtk_widget_get_window (overlay);
OS.gdk_window_set_override_redirect (overlayWindow, true);
- if (OS.GTK_VERSION < OS.VERSION (3, 16, 0)) {
+ if (OS.GTK_VERSION < OS.VERSION (3, 14, 0)) {
OS.gtk_widget_override_background_color (overlay, OS.GTK_STATE_FLAG_NORMAL, new GdkRGBA());
} else {
String name = OS.GTK_VERSION >= OS.VERSION(3, 20, 0) ? "window" : "GtkWindow";
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 602ad3fe5f..e4f041449a 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
@@ -90,7 +90,7 @@ public class Tree extends Composite {
boolean expandAll;
int drawState, drawFlags;
GdkColor drawForeground;
- GdkRGBA background, foreground, drawForegroundRGBA;
+ GdkRGBA foreground, drawForegroundRGBA;
boolean ownerDraw, ignoreSize, ignoreAccessibility, pixbufSizeSet;
int pixbufHeight, pixbufWidth;
TreeItem topItem;
@@ -1414,20 +1414,8 @@ public TreeColumn [] getColumns () {
}
@Override
-GdkRGBA getContextBackgroundGdkRGBA () {
- assert OS.GTK3 : "GTK3 code was run by GTK2";
- if (background != null) {
- return background;
- } else {
- // For Tables and Trees, the default background is
- // COLOR_LIST_BACKGROUND instead of COLOR_WIDGET_BACKGROUND.
- return display.COLOR_LIST_BACKGROUND_RGBA;
- }
-}
-
-@Override
GdkRGBA getContextColorGdkRGBA () {
- if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
if (foreground != null) {
return foreground;
} else {
@@ -3390,37 +3378,6 @@ void setBackgroundGdkColor (GdkColor color) {
}
@Override
-void setBackgroundGdkRGBA (long /*int*/ context, long /*int*/ handle, GdkRGBA rgba) {
- assert OS.GTK3 : "GTK3 code was run by GTK2";
- /* Setting the background color overrides the selected background color.
- * To prevent this, we need to re-set the default. This can be done with CSS
- * on GTK3.16+, or by using GtkStateFlags as an argument to
- * gtk_widget_override_background_color() on versions of GTK3 less than 3.16.
- */
- if (rgba == null) {
- background = display.COLOR_LIST_BACKGROUND_RGBA;
- } else {
- background = rgba;
- }
- GdkRGBA selectedBackground = display.getSystemColor(SWT.COLOR_LIST_SELECTION).handleRGBA;
- if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
- String name = OS.GTK_VERSION >= OS.VERSION(3, 20, 0) ? "treeview" : "GtkTreeView";
- String css = name + " {background-color: " + display.gtk_rgba_to_css_string(background) + ";}\n"
- + name + ":selected {background-color: " + display.gtk_rgba_to_css_string(selectedBackground) + ";}";
-
- // Cache background color
- cssBackground = css;
-
- // Apply background color and any foreground color
- String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.BACKGROUND);
- gtk_css_provider_load_from_css(context, finalCss);
- } else {
- super.setBackgroundGdkRGBA(context, handle, rgba);
- OS.gtk_widget_override_background_color(handle, OS.GTK_STATE_FLAG_SELECTED, selectedBackground);
- }
-}
-
-@Override
void setBackgroundPixmap (Image image) {
ownerDraw = true;
recreateRenderers ();
@@ -3501,7 +3458,7 @@ void setFontDescription (long /*int*/ font) {
@Override
void setForegroundGdkRGBA (GdkRGBA rgba) {
- if (OS.GTK_VERSION >= OS.VERSION (3, 16, 0)) {
+ if (OS.GTK_VERSION >= OS.VERSION (3, 14, 0)) {
foreground = rgba;
GdkRGBA toSet = rgba == null ? display.COLOR_LIST_FOREGROUND_RGBA : rgba;
setForegroundGdkRGBA (handle, toSet);

Back to the top