Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Williams2019-04-03 11:24:09 -0400
committerEric Williams2019-04-03 11:24:53 -0400
commit58cbb11130181f062aef553ee21bcb21bc968945 (patch)
tree53ffff00510bf64788b7229b37c064189e964795
parent652ecd5221ea39cbe92243c26e773b75fd2a65cd (diff)
downloadeclipse.platform.swt-58cbb11130181f062aef553ee21bcb21bc968945.tar.gz
eclipse.platform.swt-58cbb11130181f062aef553ee21bcb21bc968945.tar.xz
eclipse.platform.swt-58cbb11130181f062aef553ee21bcb21bc968945.zip
Bug 545942: [GTK4] Ensure snippets work on GTK4
Remove last reference to gdk_window_get_display() on GTK4 to make Snippet39 run without crashing. Change-Id: I27886412cb67e713c760e29ed903f79b6cdba3ab Signed-off-by: Eric Williams <ericwill@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java11
1 files changed, 9 insertions, 2 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 b4fb19890f..83dc2f8f8f 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
@@ -3095,8 +3095,15 @@ void checkAndUnrabFocus () {
* assumes that GdkSeat are the same for parent and child, which seems to be the case.
*/
if (requiresUngrab() && !isMappedToPopup() && grabbedFocus) {
- long window = gtk_widget_get_window (shellHandle);
- long seat = GDK.gdk_display_get_default_seat(GDK.gdk_window_get_display(window));
+ long gdkResource, display;
+ if (GTK.GTK4) {
+ gdkResource = gtk_widget_get_surface (shellHandle);
+ display = GDK.gdk_surface_get_display(gdkResource);
+ } else {
+ gdkResource = gtk_widget_get_window (shellHandle);
+ display = GDK.gdk_window_get_display(gdkResource);
+ }
+ long seat = GDK.gdk_display_get_default_seat(display);
GDK.gdk_seat_ungrab(seat);
GTK.gtk_grab_remove(shellHandle);
grabbedFocus = false;

Back to the top