Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti2013-03-19 18:50:46 +0000
committerCarolyn MacLeod2013-04-09 14:56:43 +0000
commitcdba6ca36f265bdaa435976a44451b31aa4d2164 (patch)
tree8f1946a919d8c61ba4b5285742483d1fe52c4d67
parent5099439f270943a0908a9f2c941adcec02b65028 (diff)
downloadeclipse.platform.swt-cdba6ca36f265bdaa435976a44451b31aa4d2164.tar.gz
eclipse.platform.swt-cdba6ca36f265bdaa435976a44451b31aa4d2164.tar.xz
eclipse.platform.swt-cdba6ca36f265bdaa435976a44451b31aa4d2164.zip
Bug 403191 - [GTK+3] Implement SwtFixed preferred height/width methods
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c18
-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.c1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java12
6 files changed, 43 insertions, 0 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 65a1081a23..51ae3117bc 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
@@ -15159,6 +15159,24 @@ fail:
}
#endif
+#ifndef NO__1gtk_1style_1context_1invalidate
+JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1style_1context_1invalidate)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ OS_NATIVE_ENTER(env, that, _1gtk_1style_1context_1invalidate_FUNC);
+/*
+ gtk_style_context_invalidate(arg0);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_style_context_invalidate)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong))fp)(arg0);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, _1gtk_1style_1context_1invalidate_FUNC);
+}
+#endif
+
#ifndef NO__1gtk_1style_1context_1restore
JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1style_1context_1restore)
(JNIEnv *env, jclass that, jintLong arg0)
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 1a5a81eef9..f1b60cd0a0 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
@@ -536,6 +536,7 @@
#define gtk_style_context_get_border_color_LIB LIB_GTK
#define gtk_style_context_get_padding_LIB LIB_GTK
#define gtk_style_context_get_border_LIB LIB_GTK
+#define gtk_style_context_invalidate_LIB LIB_GTK
#define gtk_hsv_to_rgb_LIB LIB_GTK
#define gtk_rgb_to_hsv_LIB LIB_GTK
#define gdk_window_set_background_pattern_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 0acbfdfb7a..cf200b60b1 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
@@ -1074,6 +1074,7 @@ char * OS_nativeFunctionNames[] = {
"_1gtk_1style_1context_1get_1color",
"_1gtk_1style_1context_1get_1font",
"_1gtk_1style_1context_1get_1padding",
+ "_1gtk_1style_1context_1invalidate",
"_1gtk_1style_1context_1restore",
"_1gtk_1style_1context_1save",
"_1gtk_1style_1context_1set_1state",
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 ad883f06bc..2153d5c936 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
@@ -1084,6 +1084,7 @@ typedef enum {
_1gtk_1style_1context_1get_1color_FUNC,
_1gtk_1style_1context_1get_1font_FUNC,
_1gtk_1style_1context_1get_1padding_FUNC,
+ _1gtk_1style_1context_1invalidate_FUNC,
_1gtk_1style_1context_1restore_FUNC,
_1gtk_1style_1context_1save_FUNC,
_1gtk_1style_1context_1set_1state_FUNC,
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 db9e5ca1d9..08d9de968f 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
@@ -10924,6 +10924,16 @@ public static final void gtk_style_context_get_border(long /*int*/ context, int
}
}
/** @method flags=dynamic */
+public static final native void _gtk_style_context_invalidate(long /*int*/ context);
+public static final void gtk_style_context_invalidate(long /*int*/ context) {
+ lock.lock();
+ try {
+ _gtk_style_context_invalidate(context);
+ } finally {
+ lock.unlock();
+ }
+}
+/** @method flags=dynamic */
public static final native void _gtk_style_context_save(long /*int*/ self);
public static final void gtk_style_context_save(long /*int*/ self) {
lock.lock();
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 af4a1a302c..aeb38c48c2 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
@@ -138,6 +138,18 @@ void createHandle (int index) {
byte [] swt_toolbar_flat = Converter.wcsToMbcs (null, "swt-toolbar-flat", true);
OS.gtk_widget_set_name (handle, swt_toolbar_flat);
}
+
+ /*
+ * Bug in GTK. For some reason, the toolbar style context does not read
+ * the CSS style sheet until the window containing the toolbar is shown.
+ * The fix is to call gtk_style_context_invalidate() which it seems to
+ * force the style sheet to be read.
+ */
+ if (OS.GTK3) {
+ long /*int*/ context = OS.gtk_widget_get_style_context (handle);
+ OS.gtk_style_context_invalidate (context);
+ }
+
/*
* Bug in GTK. GTK will segment fault if gtk_widget_reparent() is called
* on a tool bar or on a widget hierarchy containing a tool bar when the icon

Back to the top