3644239
From 531d3f18481988494e77b5f1ded92a7f346ea14d Mon Sep 17 00:00:00 2001
3644239
From: Eric Williams
3644239
Date: Wed, 28 Oct 2015 10:52:36 -0400
3644239
Subject: Bug 480986: [Wayland] Workspace chooser won't launch
3644239
3644239
gtk_size_allocate() in Shell is called more often on Wayland. These
3644239
additional and unexpected calls trigger an infinite recursive call to
3644239
resizeBounds(), which causes non-resizable Shells/Dialogs to crash.
3644239
3644239
The fix is to only resize Shells that have the SWT.RESIZE attribute
3644239
enabled.
3644239
3644239
Tested on Gtk3.16 on Wayland, Gtk3.16 on X, and Gtk2.24. AllNonBrowser
3644239
JUnit test cases pass on Gtk3 running X. There are some irregularities
3644239
with test cases on Wayland, as outlined in bug 480893.
3644239
3644239
Change-Id: I55612d8486cdd512e275a8a7456e0197ed717c75
3644239
Signed-off-by: Eric Williams <ericwill@redhat.com>
3644239
---
3644239
 .../Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java           | 9 +++++++--
3644239
 1 file changed, 7 insertions(+), 2 deletions(-)
3644239
3644239
diff --git eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
3644239
index d65af5c..49ae036 100644
3644239
--- eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java	
3644239
+++ eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java	
3644239
@@ -1528,10 +1528,15 @@ long /*int*/ gtk_size_allocate (long /*int*/ widget, long /*int*/ allocation) {
3644239
 	OS.gtk_widget_get_allocation (shellHandle, widgetAllocation);
3644239
 	int width = widgetAllocation.width;
3644239
 	int height = widgetAllocation.height;
3644239
-	if (!resized || oldWidth != width || oldHeight != height) {
3644239
+
3644239
+	//	Bug 474235: on Wayland gtk_size_allocate() is called more frequently, causing an
3644239
+	//  infinitely recursive resize call. This causes non-resizable Shells/Dialogs to
3644239
+	//  crash. Fix: only call resizeBounds() on resizable Shells.
3644239
+	if ((!resized || oldWidth != width || oldHeight != height)
3644239
+			&& (OS.GTK3 && !OS.isX11() ? ((style & SWT.RESIZE) != 0) : true)) {  //Wayland
3644239
 		oldWidth = width;
3644239
 		oldHeight = height;
3644239
-		resizeBounds (width, height, true);
3644239
+		resizeBounds (width, height, true); //this is called to resize child widgets when the shell is resized.
3644239
 	}
3644239
 	return 0;
3644239
 }
3644239
-- 
3644239
cgit v0.11.2-4-g4a35
3644239