From 26c2633b2cfc2b58677fc4e18942fadd5108b35a Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Mon, 21 Aug 2023 16:08:07 +0200 Subject: [PATCH] clutter: Update device on touchpad gesture events With commit be3bca01a7 in place, we now possibly skip early calls to clutter_stage_repick_device() happening early during initialization. These were also indirectly the ones that eventually ended up in the first call to clutter_stage_pick_and_update_device() actually initializing the PointerDeviceEntry. With this no longer happening, we may end up with no PointerDeviceEntry implicitly set up after initialization, which may fail if the first event received from the seat pointer does not in fact trigger the clutter_stage_pick_and_update_device() call necessary to make things work from there on. And this does indeed happen on touchpads, since the first input event obtained after CLUTTER_DEVICE_ADDED is CLUTTER_TOUCHPAD_* instead of CLUTTER_MOTION. This finds an unset PointerDeviceEntry and crashes since the pointer device does still have no "presence" on the stage. Fix this by making CLUTTER_TOUCHPAD_* events also trigger a device update, so the fist event handled does always trigger the necessary device update. Fixes: be3bca01a7 ("clutter: Check that pointer has coordinates prior to repick") Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2978 Part-of: --- clutter/clutter/clutter-main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/clutter/clutter/clutter-main.c b/clutter/clutter/clutter-main.c index 963b15be0..a32537038 100644 --- a/clutter/clutter/clutter-main.c +++ b/clutter/clutter/clutter-main.c @@ -799,6 +799,9 @@ clutter_stage_handle_event (ClutterStage *stage, case CLUTTER_BUTTON_PRESS: case CLUTTER_TOUCH_BEGIN: case CLUTTER_TOUCH_UPDATE: + case CLUTTER_TOUCHPAD_PINCH: + case CLUTTER_TOUCHPAD_SWIPE: + case CLUTTER_TOUCHPAD_HOLD: update_device_for_event (stage, event, TRUE); break; default: