Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXi Yan2018-08-16 14:53:14 +0000
committerXi Yan2018-08-16 15:43:10 +0000
commiteaeacca6acd37400d458d7d93f4638e912c2d3b6 (patch)
tree0dc961b54f0a7ebeac7180a3d06c0fbbec86ba1d
parent946848efb11da8e1f7c8bef5c837522ef5588c55 (diff)
downloadeclipse.platform.swt-eaeacca6acd37400d458d7d93f4638e912c2d3b6.tar.gz
eclipse.platform.swt-eaeacca6acd37400d458d7d93f4638e912c2d3b6.tar.xz
eclipse.platform.swt-eaeacca6acd37400d458d7d93f4638e912c2d3b6.zip
Bug 210915 - Shell#getLocation() wrong after setVisible(false)
When shell is moved and then hidden, its location does not get updated to the latest location. The fix is to move the shell to the latest location before getting its position. Change-Id: I10b2725c2404eca65727b37aab88f0e0ee7657d2 Signed-off-by: Xi Yan <xixiyan@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java5
1 files changed, 5 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 b2bb140548..ae221daf6b 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
@@ -1126,6 +1126,11 @@ public boolean getFullScreen () {
@Override
Point getLocationInPixels () {
checkWidget ();
+ // Bug in GTK: when shell is moved and then hidden, its location does not get updated.
+ // Move it before getting its location.
+ if (!getVisible() && moved) {
+ setLocationInPixels(oldX, oldY);
+ }
int [] x = new int [1], y = new int [1];
GTK.gtk_window_get_position (shellHandle, x,y);
return new Point (x [0], y [0]);

Back to the top