summaryrefslogtreecommitdiff
path: root/src/wayland/meta-wayland-touch.c
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2017-12-21 11:30:16 +0100
committerCarlos Garnacho <carlosg@gnome.org>2017-12-21 12:37:20 +0100
commit798026498d9b8a0e3de1a2a69a6b22cbcc11db0c (patch)
treec16e851ec48062c5a0d1c4fd61e98c0d78a96650 /src/wayland/meta-wayland-touch.c
parent49f029571cc425a878e520310a8db616fa5c4b70 (diff)
downloadmutter-798026498d9b8a0e3de1a2a69a6b22cbcc11db0c.tar.gz
wayland: Only send full sequences of touch events to clients
If input happens to be grabbed somewhere along the shell, and ungrabbed while a touch operation is ongoing, the wayland bits will happily start sending wl_touch.update events from an undeterminate point, without clients having ever received wl_touch.down for that id. Consider those touches grabbed for the entirety of their lifetime, if wl_touch.down wasn't received by the client, no other events will. https://bugzilla.gnome.org/show_bug.cgi?id=776220
Diffstat (limited to 'src/wayland/meta-wayland-touch.c')
-rw-r--r--src/wayland/meta-wayland-touch.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/wayland/meta-wayland-touch.c b/src/wayland/meta-wayland-touch.c
index 6593d7c87..55b772588 100644
--- a/src/wayland/meta-wayland-touch.c
+++ b/src/wayland/meta-wayland-touch.c
@@ -56,6 +56,7 @@ struct _MetaWaylandTouchInfo
gfloat x;
gfloat y;
guint updated : 1;
+ guint begin_delivered : 1;
};
static void
@@ -278,6 +279,8 @@ handle_touch_begin (MetaWaylandTouch *touch,
wl_fixed_from_double (touch_info->x),
wl_fixed_from_double (touch_info->y));
}
+
+ touch_info->begin_delivered = TRUE;
}
static void
@@ -292,7 +295,7 @@ handle_touch_update (MetaWaylandTouch *touch,
sequence = clutter_event_get_event_sequence (event);
touch_info = touch_get_info (touch, sequence, FALSE);
- if (!touch_info)
+ if (!touch_info || !touch_info->begin_delivered)
return;
l = &touch_info->touch_surface->resource_list;
@@ -321,12 +324,15 @@ handle_touch_end (MetaWaylandTouch *touch,
if (!touch_info)
return;
- l = &touch_info->touch_surface->resource_list;
- wl_resource_for_each(resource, l)
+ if (touch_info->begin_delivered)
{
- wl_touch_send_up (resource, touch_info->slot_serial,
- clutter_event_get_time (event),
- touch_info->slot);
+ l = &touch_info->touch_surface->resource_list;
+ wl_resource_for_each(resource, l)
+ {
+ wl_touch_send_up (resource, touch_info->slot_serial,
+ clutter_event_get_time (event),
+ touch_info->slot);
+ }
}
g_hash_table_remove (touch->touches, sequence);