Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSopot Cela2015-04-29 11:15:00 +0000
committerSopot Cela2015-04-29 11:15:00 +0000
commit0172f58b0b3fd2312568b7f7c847854a4aca0f9b (patch)
treefeb39df30de8fb8eb5ef08f9e2e768b637150d68
parent7d57af003bec0929953db4cb04fa933d6e4530ce (diff)
downloadeclipse.platform.swt-0172f58b0b3fd2312568b7f7c847854a4aca0f9b.tar.gz
eclipse.platform.swt-0172f58b0b3fd2312568b7f7c847854a4aca0f9b.tar.xz
eclipse.platform.swt-0172f58b0b3fd2312568b7f7c847854a4aca0f9b.zip
Bug 465660 - [GTK3] Add support for setting preference on dark theme in
SWT/GTK3 Change-Id: I88b05320f1517a21654a1f7bfee781d30eab8a61 Signed-off-by: Sopot Cela <scela@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java19
1 files changed, 19 insertions, 0 deletions
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 5d59b5a0db..4d93979e6d 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
@@ -650,6 +650,12 @@ public class OS extends C {
public static final byte[] xalign = ascii("xalign");
public static final byte[] ypad = ascii("ypad");
public static final byte[] GTK_PRINT_SETTINGS_OUTPUT_URI = ascii("output-uri");
+
+ /*
+ * Needed to tell GTK 3 to prefer a dark or light theme in the UI.
+ * Improves the look of the Eclipse Dark theme in GTK 3 systems.
+ */
+ public static final byte[] gtk_application_prefer_dark_theme = ascii("gtk-application-prefer-dark-theme");
/* Named icons.
* See https://docs.google.com/spreadsheet/pub?key=0AsPAM3pPwxagdGF4THNMMUpjUW5xMXZfdUNzMXhEa2c&output=html
@@ -16761,4 +16767,17 @@ public static final void swt_fixed_resize(long /*int*/ fixed, long /*int*/ widge
lock.unlock();
}
}
+
+/*
+ * Method used to hint GTK 3 to natively
+ * prefer a dark or light theme.
+ */
+public static final void setDarkThemePreferred(boolean preferred){
+ if (!GTK3) return; //only applicable to GTK3
+ gdk_flush();
+ g_object_set(gtk_settings_get_default(), gtk_application_prefer_dark_theme,
+ preferred, 0);
+ g_object_notify(gtk_settings_get_default(),
+ gtk_application_prefer_dark_theme);
+}
}

Back to the top