[gtk+] wayland: Break an implicit grab when asking to be resized



commit 47146dacffc162e6f1ce658d2fe3e9e890a916c3
Author: Rob Bradford <rob linux intel com>
Date:   Fri Jan 6 16:49:22 2012 +0000

    wayland: Break an implicit grab when asking to be resized
    
    An implicit grab is created inside GTK+ when the button is pressed down on a
    window. The semantics of wl_shell_surface_resize means that you don't get a
    corresponding release event that would ordinarily break the implicit grab. So
    we must do it as part of the resize request.

 gdk/wayland/gdkwindow-wayland.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index 53fc0d2..dec6338 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -1147,6 +1147,9 @@ gdk_wayland_window_begin_resize_drag (GdkWindow     *window,
 {
   GdkWindowImplWayland *impl;
   uint32_t grab_type;
+  GdkDeviceGrabInfo *button_implicit_grab;
+  gulong serial;
+  GdkDisplay *display;
 
   if (GDK_WINDOW_DESTROYED (window) ||
       !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
@@ -1197,6 +1200,25 @@ gdk_wayland_window_begin_resize_drag (GdkWindow     *window,
   wl_shell_surface_resize(impl->shell_surface,
                           _gdk_wayland_device_get_device (device),
                           timestamp, grab_type);
+
+  /* We need to break the implicit grab that we created with the button press.
+   * This is because of the semantics on wl_shell_surface_resize. That will
+   * absorb all the events until the resize is completed by the compositor.
+   * This includes the release event that would ordinarily remove the implicit
+   * grab.
+   */
+  display = gdk_window_get_display (window);
+  serial = _gdk_display_get_next_serial (display);
+  button_implicit_grab =
+    _gdk_display_has_device_grab (display, device, serial);
+
+  if (button_implicit_grab &&
+      button_implicit_grab->implicit)
+    {
+      button_implicit_grab->serial_end = serial;
+      button_implicit_grab->implicit_ungrab = FALSE;
+      _gdk_display_device_grab_update (display, device, device, serial);
+    }
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]