Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2016-12-05 18:59:53 +0000
committerAlexander Kurtakov2016-12-09 10:45:03 +0000
commitc522b03e3a4f934d453256d7bba55fbc4c375f6d (patch)
tree7bd664498a6b3cd6c9e67a4565dc6fe978c5a7bc
parentc42f0a2a8404ad2f273e2088f85f08d6eb19c9a1 (diff)
downloadeclipse.platform.swt-c522b03e3a4f934d453256d7bba55fbc4c375f6d.tar.gz
eclipse.platform.swt-c522b03e3a4f934d453256d7bba55fbc4c375f6d.tar.xz
eclipse.platform.swt-c522b03e3a4f934d453256d7bba55fbc4c375f6d.zip
Bug 508692 - Shells has wrong size under wayland
Reason for that is that is the usage of GtkWindow allocation for the shell size which would fail with CSD (Client Side Decoration) as window decorations, shadows and etc. are part of the window allocation. It exposes on Wayland and Broadway backends as they have no server side decorations at all. Change-Id: I2a17a2cd66f486c19c0ed0cb2055aa52a3c7f7e4 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c17
-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.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java9
5 files changed, 38 insertions, 4 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 82fd013c39..63fc6d8bd5 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
@@ -17794,6 +17794,23 @@ fail:
}
#endif
+#ifndef NO__1gtk_1window_1get_1size
+JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1window_1get_1size)
+ (JNIEnv *env, jclass that, jintLong arg0, jintArray arg1, jintArray arg2)
+{
+ jint *lparg1=NULL;
+ jint *lparg2=NULL;
+ OS_NATIVE_ENTER(env, that, _1gtk_1window_1get_1size_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail;
+ gtk_window_get_size((GtkWindow *)arg0, (gint *)lparg1, (gint *)lparg2);
+fail:
+ if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
+ if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0);
+ OS_NATIVE_EXIT(env, that, _1gtk_1window_1get_1size_FUNC);
+}
+#endif
+
#ifndef NO__1gtk_1window_1group_1add_1window
JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1window_1group_1add_1window)
(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
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 5d9e5c647b..a30205a0c5 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
@@ -1409,6 +1409,7 @@ char * OS_nativeFunctionNames[] = {
"_1gtk_1window_1get_1modal",
"_1gtk_1window_1get_1opacity",
"_1gtk_1window_1get_1position",
+ "_1gtk_1window_1get_1size",
"_1gtk_1window_1group_1add_1window",
"_1gtk_1window_1group_1new",
"_1gtk_1window_1group_1remove_1window",
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 a3ecea1b20..ffeece926b 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
@@ -1419,6 +1419,7 @@ typedef enum {
_1gtk_1window_1get_1modal_FUNC,
_1gtk_1window_1get_1opacity_FUNC,
_1gtk_1window_1get_1position_FUNC,
+ _1gtk_1window_1get_1size_FUNC,
_1gtk_1window_1group_1add_1window_FUNC,
_1gtk_1window_1group_1new_FUNC,
_1gtk_1window_1group_1remove_1window_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 85d47a870e..d4e9663195 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
@@ -14902,6 +14902,20 @@ public static final void gtk_window_resize(long /*int*/ handle, int x, int y) {
}
}
/**
+ * @param handle cast=(GtkWindow *)
+ * @param width cast=(gint *)
+ * @param height cast=(gint *)
+ */
+public static final native void _gtk_window_get_size(long /*int*/ handle, int[] width, int[] height);
+public static final void gtk_window_get_size(long /*int*/ handle, int[] width, int[] height) {
+ lock.lock();
+ try {
+ _gtk_window_get_size(handle, width, height);
+ } finally {
+ lock.unlock();
+ }
+}
+/**
* @param window cast=(GtkWindow *)
* @param widget cast=(GtkWidget *)
*/
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
index e82f0f433d..838ca4aee3 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
@@ -1548,10 +1548,11 @@ long /*int*/ gtk_key_press_event (long /*int*/ widget, long /*int*/ event) {
@Override
long /*int*/ gtk_size_allocate (long /*int*/ widget, long /*int*/ allocation) {
- GtkAllocation widgetAllocation = new GtkAllocation ();
- OS.gtk_widget_get_allocation (shellHandle, widgetAllocation);
- int width = widgetAllocation.width;
- int height = widgetAllocation.height;
+ int[] widthArray = new int [1];
+ int[] heightArray = new int [1];
+ OS.gtk_window_get_size(shellHandle, widthArray, heightArray);
+ int width = widthArray[0];
+ int height = heightArray[0];
// Bug 474235: on Wayland gtk_size_allocate() is called more frequently, causing an
// infinitely recursive resize call. This causes non-resizable Shells/Dialogs to

Back to the top