From 40758472783d64e61389bf1dc3db77a5b73e8276 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Sun, 10 Sep 2023 17:41:51 +0200 Subject: [PATCH] backends/native: Use correct constructor for CLUTTER_TOUCH_CANCEL events We were using the generic constructor for BEGIN/UPDATE/END events, that have more data than CLUTTER_TOUCH_CANCEL. Since that function checks for the event type, we were awkwardly forwarding a NULL event here. Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/3016 Part-of: --- src/backends/native/meta-seat-impl.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/backends/native/meta-seat-impl.c b/src/backends/native/meta-seat-impl.c index f059efe0e..3db3753a9 100644 --- a/src/backends/native/meta-seat-impl.c +++ b/src/backends/native/meta-seat-impl.c @@ -1071,14 +1071,24 @@ meta_seat_impl_notify_touch_event_in_impl (MetaSeatImpl *seat_impl, evtype == CLUTTER_TOUCH_UPDATE) modifiers |= CLUTTER_BUTTON1_MASK; - event = - clutter_event_touch_new (evtype, - CLUTTER_EVENT_NONE, - time_us, - input_device, - sequence, - modifiers, - GRAPHENE_POINT_INIT (x, y)); + if (evtype == CLUTTER_TOUCH_CANCEL) + { + event = clutter_event_touch_cancel_new (CLUTTER_EVENT_NONE, + time_us, + input_device, + sequence); + } + else + { + event = + clutter_event_touch_new (evtype, + CLUTTER_EVENT_NONE, + time_us, + input_device, + sequence, + modifiers, + GRAPHENE_POINT_INIT (x, y)); + } queue_event (seat_impl, event); }