Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Williams2018-03-07 19:25:32 +0000
committerEric Williams2018-04-30 17:38:38 +0000
commit7b0cb58a2aedcac5c0973ddf0a9b4ab467c9e875 (patch)
tree5c96c6aed481d1d6a3ace28cf81ee14aed7e4acc /bundles/org.eclipse.swt/Eclipse SWT PI/gtk
parentac26e5b193678c550d5c4460d9b7071c8275d183 (diff)
downloadeclipse.platform.swt-7b0cb58a2aedcac5c0973ddf0a9b4ab467c9e875.tar.gz
eclipse.platform.swt-7b0cb58a2aedcac5c0973ddf0a9b4ab467c9e875.tar.xz
eclipse.platform.swt-7b0cb58a2aedcac5c0973ddf0a9b4ab467c9e875.zip
Bug 500703: [GTK3.20+] Combo with SWT.READ_ONLY is garbled upon re-size
In GTK3.20+ two things inside GTK3 changed. First, certain widgets have their clips unioned with the clips of their parent widget. This can cause overdrawing in widgets like Combo. Second, the internal widget hierarchy of Combo changed, and most of the resizing is done by a GtkBox instead of GtkComboBox itself. These two changes combined caused this bug. The overdrawing causes the Combo to draw over its neighbouring widgets (like a label). The resize issue means that resizing the widget doesn't cause it get smaller: the x coordinates of the allocation and clip just become negative and the whole widget shifts to the left. The fix is to adjust the clip and allocation of the Combo and its children from the parent Composite's draw handler. This ensures that the Combo is drawn with correct coordinates and that it actually shrinks when resized, instead of just shifting. Tested on GTK3.22, X11 and Wayland. Window -> Preferences -> General -> Keys behaves as expected, and no AllNonBrowser JUnit tests fail. Change-Id: Ic603acfda924b0ca36b4f0ba07048f6762c99270 Signed-off-by: Eric Williams <ericwill@redhat.com>
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT PI/gtk')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c44
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java26
4 files changed, 74 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 85b5361401..674d32688d 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
@@ -13340,6 +13340,28 @@ JNIEXPORT jboolean JNICALL GTK_NATIVE(_1gtk_1widget_1get_1child_1visible)
}
#endif
+#ifndef NO__1gtk_1widget_1get_1clip
+JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1widget_1get_1clip)
+ (JNIEnv *env, jclass that, jintLong arg0, jobject arg1)
+{
+ GtkAllocation _arg1, *lparg1=NULL;
+ GTK_NATIVE_ENTER(env, that, _1gtk_1widget_1get_1clip_FUNC);
+ if (arg1) if ((lparg1 = getGtkAllocationFields(env, arg1, &_arg1)) == NULL) goto fail;
+/*
+ gtk_widget_get_clip((GtkWidget *)arg0, lparg1);
+*/
+ {
+ GTK_LOAD_FUNCTION(fp, gtk_widget_get_clip)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(GtkWidget *, GtkAllocation *))fp)((GtkWidget *)arg0, lparg1);
+ }
+ }
+fail:
+ if (arg1 && lparg1) setGtkAllocationFields(env, arg1, lparg1);
+ GTK_NATIVE_EXIT(env, that, _1gtk_1widget_1get_1clip_FUNC);
+}
+#endif
+
#ifndef NO__1gtk_1widget_1get_1default_1style
JNIEXPORT jintLong JNICALL GTK_NATIVE(_1gtk_1widget_1get_1default_1style)
(JNIEnv *env, jclass that)
@@ -14110,6 +14132,28 @@ JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1widget_1set_1can_1focus)
}
#endif
+#ifndef NO__1gtk_1widget_1set_1clip
+JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1widget_1set_1clip)
+ (JNIEnv *env, jclass that, jintLong arg0, jobject arg1)
+{
+ GtkAllocation _arg1, *lparg1=NULL;
+ GTK_NATIVE_ENTER(env, that, _1gtk_1widget_1set_1clip_FUNC);
+ if (arg1) if ((lparg1 = getGtkAllocationFields(env, arg1, &_arg1)) == NULL) goto fail;
+/*
+ gtk_widget_set_clip((GtkWidget *)arg0, lparg1);
+*/
+ {
+ GTK_LOAD_FUNCTION(fp, gtk_widget_set_clip)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(GtkWidget *, GtkAllocation *))fp)((GtkWidget *)arg0, lparg1);
+ }
+ }
+fail:
+ if (arg1 && lparg1) setGtkAllocationFields(env, arg1, lparg1);
+ GTK_NATIVE_EXIT(env, that, _1gtk_1widget_1set_1clip_FUNC);
+}
+#endif
+
#ifndef NO__1gtk_1widget_1set_1default_1direction
JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1widget_1set_1default_1direction)
(JNIEnv *env, jclass that, jint arg0)
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 cf583fd184..1bd6a98e1f 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
@@ -1066,6 +1066,7 @@ char * GTK_nativeFunctionNames[] = {
"_1gtk_1widget_1get_1allocation",
"_1gtk_1widget_1get_1can_1default",
"_1gtk_1widget_1get_1child_1visible",
+ "_1gtk_1widget_1get_1clip",
"_1gtk_1widget_1get_1default_1style",
"_1gtk_1widget_1get_1events",
"_1gtk_1widget_1get_1has_1window",
@@ -1116,6 +1117,7 @@ char * GTK_nativeFunctionNames[] = {
"_1gtk_1widget_1set_1app_1paintable",
"_1gtk_1widget_1set_1can_1default",
"_1gtk_1widget_1set_1can_1focus",
+ "_1gtk_1widget_1set_1clip",
"_1gtk_1widget_1set_1default_1direction",
"_1gtk_1widget_1set_1direction",
"_1gtk_1widget_1set_1double_1buffered",
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 d006679824..c999193244 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
@@ -1064,6 +1064,7 @@ typedef enum {
_1gtk_1widget_1get_1allocation_FUNC,
_1gtk_1widget_1get_1can_1default_FUNC,
_1gtk_1widget_1get_1child_1visible_FUNC,
+ _1gtk_1widget_1get_1clip_FUNC,
_1gtk_1widget_1get_1default_1style_FUNC,
_1gtk_1widget_1get_1events_FUNC,
_1gtk_1widget_1get_1has_1window_FUNC,
@@ -1114,6 +1115,7 @@ typedef enum {
_1gtk_1widget_1set_1app_1paintable_FUNC,
_1gtk_1widget_1set_1can_1default_FUNC,
_1gtk_1widget_1set_1can_1focus_FUNC,
+ _1gtk_1widget_1set_1clip_FUNC,
_1gtk_1widget_1set_1default_1direction_FUNC,
_1gtk_1widget_1set_1direction_FUNC,
_1gtk_1widget_1set_1double_1buffered_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java
index ff3427fa12..f361fc1325 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java
@@ -2896,6 +2896,32 @@ public class GTK extends OS {
}
}
/**
+ * @method flags=dynamic
+ * @param widget cast=(GtkWidget *)
+ */
+ public static final native void _gtk_widget_set_clip(long /*int*/ widget, GtkAllocation allocation);
+ public static final void gtk_widget_set_clip(long /*int*/ widget, GtkAllocation allocation) {
+ lock.lock();
+ try {
+ _gtk_widget_set_clip(widget, allocation);
+ } finally {
+ lock.unlock();
+ }
+ }
+ /**
+ * @method flags=dynamic
+ * @param widget cast=(GtkWidget *)
+ */
+ public static final native void _gtk_widget_get_clip(long /*int*/ widget, GtkAllocation allocation);
+ public static final void gtk_widget_get_clip(long /*int*/ widget, GtkAllocation allocation) {
+ lock.lock();
+ try {
+ _gtk_widget_get_clip(widget, allocation);
+ } finally {
+ lock.unlock();
+ }
+ }
+ /**
* @param widget cast=(GtkWidget *)
* @param has_window cast=(gboolean)
*/

Back to the top