Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Williams2016-04-04 18:18:15 +0000
committerEric Williams2016-04-04 18:18:15 +0000
commitc45c50d4eb0964254583e7a949a66bd46c2c69e8 (patch)
tree3b5e5a9dd7a8785048e06807e4513754f8154099
parent3efcb608db7b67648f0faf639e4664e5c54508fb (diff)
downloadeclipse.platform.swt-c45c50d4eb0964254583e7a949a66bd46c2c69e8.tar.gz
eclipse.platform.swt-c45c50d4eb0964254583e7a949a66bd46c2c69e8.tar.xz
eclipse.platform.swt-c45c50d4eb0964254583e7a949a66bd46c2c69e8.zip
Bug 487023: [GTK3.20] Update SWT to use proper GTK CSS nodes/selectors
This patch covers the last few fixes and cases of GTK CSS that needs to be updated for 3.20. Version checks bumped to 3.20 from 3.19. Change-Id: I4195a38aff9393006a0868d2d5842d8384508bbf Signed-off-by: Eric Williams <ericwill@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java7
4 files changed, 16 insertions, 5 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
index 7c82cc6150..5bf4d76466 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
@@ -706,7 +706,7 @@ protected void init () {
long /*int*/ provider = OS.gtk_css_provider_new();
String css = "";
if (screen != 0 && provider != 0) {
- if (OS.GTK_VERSION < OS.VERSION(3, 19, 0)) {
+ if (OS.GTK_VERSION < OS.VERSION(3, 20, 0)) {
css =
"GtkToolbar {padding-top: 4px; padding-bottom: 4px;}\n"
+ "GtkToolbar GtkButton {padding: 4px 4px 4px 4px;}\n"
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 0905b522d7..768ba845db 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
@@ -603,7 +603,7 @@ Rectangle computeTrimInPixels (int x, int y, int width, int height) {
trim.x -= tmp.left;
trim.y -= tmp.top;
trim.width += tmp.left + tmp.right;
- if (OS.GTK_VERSION >= OS.VERSION (3, 19, 0)) {
+ if (OS.GTK_VERSION >= OS.VERSION (3, 20, 0)) {
Point widthNative = computeNativeSize(handle, trim.width, SWT.DEFAULT, true);
trim.height = widthNative.y;
} else {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java
index 2b0f892335..1346a30170 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java
@@ -271,8 +271,14 @@ void createHandle (int index) {
if (OS.GTK3) {
long /*int*/ context = OS.gtk_widget_get_style_context (handle);
double alpha = (background.getAlpha() & 0xFFFF) / (float)0xFFFF;
- String css = "GtkWindow {background-color: rgba(" + background.getRed() +", " +
- background.getGreen() +", " + background.getBlue() +", " + alpha + ");}";
+ String css;
+ if (OS.GTK_VERSION >= OS.VERSION(3, 20, 0)) {
+ css = "window {background-color: rgba(" + background.getRed() +", " +
+ background.getGreen() +", " + background.getBlue() +", " + alpha + ");}";
+ } else {
+ css = "GtkWindow {background-color: rgba(" + background.getRed() +", " +
+ background.getGreen() +", " + background.getBlue() +", " + alpha + ");}";
+ }
gtk_css_provider_load_from_css (context, css);
OS.gtk_style_context_invalidate (context);
} else {
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 cfb001969a..204ed4b628 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
@@ -768,7 +768,12 @@ public boolean open () {
if (OS.GTK_VERSION < OS.VERSION (3, 16, 0)) {
OS.gtk_widget_override_background_color (overlay, OS.GTK_STATE_FLAG_NORMAL, new GdkRGBA());
} else {
- String css = "GtkWindow {background-color: rgb(0,0,0);}";
+ String css;
+ if (OS.GTK_VERSION >= OS.VERSION(3, 20, 0)) {
+ css = "window {background-color: rgb(0,0,0);}";
+ } else {
+ css = "GtkWindow {background-color: rgb(0,0,0);}";
+ }
long /*int*/ provider = 0;
long /*int*/ context = OS.gtk_widget_get_style_context (overlay);
if (provider == 0) {

Back to the top