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
This commit is contained in:
Carlos Garnacho 2014-08-20 20:23:58 +02:00
parent 2c36dc7592
commit 29d9b2f7cf

View File

@ -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..?