From bc08ad2fbbc127762b275c1db72ddd36b1fee8b4 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Tue, 6 Aug 2019 19:04:51 +0800 Subject: [PATCH] clutter/device-manager-evdev: Update device modifiers before queuing Until now we would: 1. Enqueue modifier key event on the stage. 2. Update device modifier state. 3. Dequeue and process modifier key event with NEW device modifier state. But if we consider optimizing out the queuing in some cases then there will become a problem: 1. Process modifier key event with OLD device modifier state. 2. Update device modifier state. To correct the above we now do: 1. Update device modifier state. 2. Queue/process modifier key event with NEW device modifier state. It appears commit dd940a71 which introduced the old behaviour was correct in the need to update the device modifier state, but is at least no longer correct (if it ever was) that it should be done after queuing the event. If queuing is working, as it is right now, then it makes no difference whether the device modifier state is updated before or after. Because both cases will come before the dequeing and processing. https://gitlab.gnome.org/GNOME/mutter/merge_requests/711 --- clutter/clutter/evdev/clutter-device-manager-evdev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/clutter/clutter/evdev/clutter-device-manager-evdev.c b/clutter/clutter/evdev/clutter-device-manager-evdev.c index 84b0aad49..dc8d4fb05 100644 --- a/clutter/clutter/evdev/clutter-device-manager-evdev.c +++ b/clutter/clutter/evdev/clutter-device-manager-evdev.c @@ -701,14 +701,14 @@ clutter_event_dispatch (GSource *g_source, if (!_clutter_input_device_get_stage (input_device)) goto out; - /* forward the event into clutter for emission etc. */ - _clutter_stage_queue_event (event->any.stage, event, FALSE); - - /* update the device states *after* the event */ + /* update the device states *before* the event */ event_state = seat->button_state | xkb_state_serialize_mods (seat->xkb, XKB_STATE_MODS_EFFECTIVE); _clutter_input_device_set_state (seat->core_pointer, event_state); _clutter_input_device_set_state (seat->core_keyboard, event_state); + + /* forward the event into clutter for emission etc. */ + _clutter_stage_queue_event (event->any.stage, event, FALSE); } out: