Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Williams2016-02-02 20:42:11 +0000
committerEric Williams2016-03-09 14:53:03 +0000
commit345697d77606dfd42eba2882f0bc51d11576834e (patch)
tree964a178b65c8b1e3cf79e1988607e91789128535
parent662d97c28f11b71f2febb44e4935cc6491547031 (diff)
downloadeclipse.platform.swt-345697d77606dfd42eba2882f0bc51d11576834e.tar.gz
eclipse.platform.swt-345697d77606dfd42eba2882f0bc51d11576834e.tar.xz
eclipse.platform.swt-345697d77606dfd42eba2882f0bc51d11576834e.zip
Bug 487023: [GTK3.20] Update SWT to use proper GTK CSS nodes/selectors
PART 1: this patch addresses the globally loaded CSS in Device.init(). This affects ToolBar, ToolBar buttons, and Shell underpinnings. Once bug 483907 is merged, I will patch the background/foreground color machinery. Currently background CSS does not work reliably on GTK3.19+ and above due to changes in GTK. This results in some ToolBars having slightly lighter gray backgrounds, for example. Tested on GTK3.19.11, and 3.18. Change-Id: I628a0599ab0b242dead76e182ebaca0a526668b4 Signed-off-by: Eric Williams <ericwill@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java28
1 files changed, 20 insertions, 8 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 ba73938a4b..eb29d04f48 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
@@ -677,18 +677,30 @@ protected void init () {
}
systemFont = Font.gtk_new (this, defaultFont);
- /* Load CSS to remove dotted lines from GtkScrolledWindows. See Bug 464705. */
+ /* Load certain CSS globally to save native GTK calls */
if (OS.GTK3) {
long /*int*/ screen = OS.gdk_screen_get_default();
long /*int*/ provider = OS.gtk_css_provider_new();
+ String css = "";
if (screen != 0 && provider != 0) {
- String css =
- "GtkToolbar {padding-top: 4px; padding-bottom: 4px;}\n"
- + "GtkToolbar GtkButton {padding: 2px 4px 3px 4px;}\n"
- + ".undershoot.top, .undershoot.right, .undershoot.bottom, .undershoot.left {background-image: none;}\n"
- + "GtkToolbar GtkMenuButton {padding: 1px 0px 1px 0px;}\n";
- OS.gtk_style_context_add_provider_for_screen (screen, provider, OS.GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
- OS.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (null, css, true), -1, null);
+ if (OS.GTK_VERSION < OS.VERSION(3, 19, 0)) {
+ css =
+ "GtkToolbar {padding-top: 4px; padding-bottom: 4px;}\n"
+ + "GtkToolbar GtkButton {padding: 2px 4px 3px 4px;}\n"
+ + ".undershoot.top, .undershoot.right, .undershoot.bottom, .undershoot.left {background-image: none;}\n"
+ + "GtkToolbar GtkMenuButton {padding: 1px 0px 1px 0px;}\n";
+ } else {
+ css =
+ "toolbar {padding-top: 4px; padding-bottom: 4px;}\n"
+ + "toolbar button {padding: 2px;}"
+ + "toolbar button.popup {padding: 0px;}\n"
+ + "scrolledwindow undershoot.top, scrolledwindow undershoot.right, scrolledwindow undershoot.bottom, "
+ + "scrolledwindow undershoot.left {background-image: none;}\n";
+ }
+ if (css != null) {
+ OS.gtk_style_context_add_provider_for_screen (screen, provider, OS.GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ OS.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (null, css, true), -1, null);
+ }
}
}
}

Back to the top