diff options
author | Xi Yan | 2018-07-24 16:51:35 +0000 |
---|---|---|
committer | Xi Yan | 2018-08-01 13:51:05 +0000 |
commit | 39c1d77a97d9228bcc48581f54842a54e717418b (patch) | |
tree | 3371591858b7423f5934896ccd3cf0a906d62d76 | |
parent | 94df671da60e1c8dadfd2fea6c26f892061b2c46 (diff) | |
download | eclipse.platform.swt-39c1d77a97d9228bcc48581f54842a54e717418b.tar.gz eclipse.platform.swt-39c1d77a97d9228bcc48581f54842a54e717418b.tar.xz eclipse.platform.swt-39c1d77a97d9228bcc48581f54842a54e717418b.zip |
Bug 530138 - [Wayland] Completion details are far away from the
completion list
Wayland does not have support for absolute coordinates. When a
GTK_WINDOW_POPUP is attached to another GTK_WINDOW_POPUP parent, it gets
positioned relatively to its parent, causing it to be far away from the
screen when its position in absolute coordinates. The fix is to use
gtk_window_set_transient_for to attach the GTK_WINDOW_POPUP to a
GTK_WINDOW_TOPLEVEL parent already mapped on screen.
Tested with completion list in child Eclipse on Wayland, GTK3.22.
Change-Id: Ic9d0b4f785a12c6a659546fc362fcc8c9b0ddc4c
Signed-off-by: Xi Yan <xixiyan@redhat.com>
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java | 15 |
1 files changed, 14 insertions, 1 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 319d775ea7..39c0c8a7d9 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 @@ -711,7 +711,20 @@ void createHandle (int index) { } if (shellHandle == 0) error (SWT.ERROR_NO_HANDLES); if (parent != null) { - GTK.gtk_window_set_transient_for (shellHandle, parent.topHandle ()); + /* + * Bug 530138: On Wayland, GTK_WINDOW_POPUP attached to a GTK_WINDOW_POPUP parent + * gets positioned relatively to the GTK_WINDOW_POPUP. We want to position it + * relatively to the GTK_WINDOW_TOPLEVEL surface. + */ + if (!OS.isX11()) { + Composite topLevelParent = parent; + while (topLevelParent != null && (topLevelParent.style & SWT.ON_TOP) != 0) { + topLevelParent = parent.getParent(); + } + GTK.gtk_window_set_transient_for(shellHandle, topLevelParent.topHandle()); + } else { + GTK.gtk_window_set_transient_for (shellHandle, parent.topHandle ()); + } GTK.gtk_window_set_destroy_with_parent (shellHandle, true); // if child shells are minimizable, we want them to have a // taskbar icon, so they can be unminimized |