From 29d9b2f7cfec936b3a923797acaf1e6e23a2d908 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Wed, 20 Aug 2014 20:23:58 +0200 Subject: [PATCH] wayland: unset sequence if the xdg surface is moved/resized through touch The latest implicit grab serial is used in order to start the compositor grab, If it belongs to a touch event, remove that touch sequence, as the rest of the sequence will be gone for good. This avoids stale sequences (and implicit grab info) after a window is moved/resized. https://bugzilla.gnome.org/show_bug.cgi?id=731380 --- gdk/wayland/gdkwindow-wayland.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c index 35062f3fd3..6875099d0e 100644 --- a/gdk/wayland/gdkwindow-wayland.c +++ b/gdk/wayland/gdkwindow-wayland.c @@ -1760,10 +1760,8 @@ gdk_wayland_window_begin_resize_drag (GdkWindow *window, guint32 timestamp) { GdkWindowImplWayland *impl; - GdkWaylandDisplay *wayland_display = - GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); - - uint32_t resize_edges; + GdkEventSequence *sequence; + uint32_t resize_edges, serial; if (GDK_WINDOW_DESTROYED (window) || !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) @@ -1813,10 +1811,15 @@ gdk_wayland_window_begin_resize_drag (GdkWindow *window, if (!impl->xdg_surface) return; + serial = _gdk_wayland_device_get_last_implicit_grab_serial (GDK_WAYLAND_DEVICE (device), + &sequence); + xdg_surface_resize (impl->xdg_surface, gdk_wayland_device_get_wl_seat (device), - _gdk_wayland_display_get_serial (wayland_display), - resize_edges); + serial, resize_edges); + + if (sequence) + gdk_wayland_device_unset_touch_grab (device, sequence); /* This is needed since Wayland will absorb all the pointer events after the * above function - FIXME: Is this always safe..? @@ -1833,8 +1836,8 @@ gdk_wayland_window_begin_move_drag (GdkWindow *window, guint32 timestamp) { GdkWindowImplWayland *impl; - GdkWaylandDisplay *wayland_display = - GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); + GdkEventSequence *sequence; + uint32_t serial; if (GDK_WINDOW_DESTROYED (window) || !WINDOW_IS_TOPLEVEL (window)) @@ -1845,9 +1848,13 @@ gdk_wayland_window_begin_move_drag (GdkWindow *window, if (!impl->xdg_surface) return; + serial = _gdk_wayland_device_get_last_implicit_grab_serial (GDK_WAYLAND_DEVICE (device), + &sequence); xdg_surface_move (impl->xdg_surface, gdk_wayland_device_get_wl_seat (device), - _gdk_wayland_display_get_serial (wayland_display)); + serial); + if (sequence) + gdk_wayland_device_unset_touch_grab (device, sequence); /* This is needed since Wayland will absorb all the pointer events after the * above function - FIXME: Is this always safe..?