Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Ufimtsev2015-02-27 20:45:32 +0000
committerAlexander Kurtakov2015-03-10 21:40:42 +0000
commit827e21430e04d8fe42a25c2caeaa1eeed2cae429 (patch)
tree7d40679c31d3a2f463a7c959ee4ec13f419d2d55
parent39c3de2910097c8a1195e0b93a6ecc8d073bd214 (diff)
downloadeclipse.platform.swt-827e21430e04d8fe42a25c2caeaa1eeed2cae429.tar.gz
eclipse.platform.swt-827e21430e04d8fe42a25c2caeaa1eeed2cae429.tar.xz
eclipse.platform.swt-827e21430e04d8fe42a25c2caeaa1eeed2cae429.zip
Bug 455671 - [GTK] Location of Shell gets reset after reparenting #2
The fix involves not handling a configure-event when shell is invisible (configure event is triggered for move/resize events), and move it back to the right place when it is made visible again. Change-Id: I0f6a0d1b8c780fcd268a03a4363b731787aa0028 Signed-off-by: Leo Ufimtsev <lufimtse@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java9
1 files changed, 9 insertions, 0 deletions
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 9ee8b6780e..ec307426ee 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
@@ -1248,6 +1248,11 @@ long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ event) {
long /*int*/ gtk_configure_event (long /*int*/ widget, long /*int*/ event) {
int [] x = new int [1], y = new int [1];
OS.gtk_window_get_position (shellHandle, x, y);
+
+ if (!isVisible ()) {
+ return 0; //We shouldn't handle move/resize events if shell is hidden.
+ }
+
if (!moved || oldX != x [0] || oldY != y [0]) {
moved = true;
oldX = x [0];
@@ -2205,6 +2210,10 @@ public void setText (String string) {
@Override
public void setVisible (boolean visible) {
checkWidget();
+
+ if (moved) { //fix shell location if it was moved.
+ setLocation(oldX, oldY);
+ }
int mask = SWT.PRIMARY_MODAL | SWT.APPLICATION_MODAL | SWT.SYSTEM_MODAL;
if ((style & mask) != 0) {
if (visible) {

Back to the top