backends/native: Fix handling order of key event

First create the event with the current xkb modifier mask, then
update the xkb_state and the modifier mask. This is how it happened
before commit 2e8d839708, and how it should stay.

Fixes: 2e8d839708 ("backends/native: Port to new event constructors")

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2951
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3162>
This commit is contained in:
Carlos Garnacho 2023-08-08 16:04:25 +02:00 committed by Marge Bot
parent dec8577e4b
commit f168866369

View File

@ -415,16 +415,6 @@ meta_seat_impl_notify_key_in_impl (MetaSeatImpl *seat_impl,
return;
}
}
keycode = meta_xkb_evdev_to_keycode (key);
/* We must be careful and not pass multiple releases to xkb, otherwise it gets
confused and locks the modifiers */
if (state != AUTOREPEAT_VALUE)
{
changed_state = xkb_state_update_key (seat_impl->xkb, keycode,
state ? XKB_KEY_DOWN : XKB_KEY_UP);
}
else
{
changed_state = 0;
@ -438,6 +428,16 @@ meta_seat_impl_notify_key_in_impl (MetaSeatImpl *seat_impl,
seat_impl->button_state,
time_us, key, state);
keycode = meta_xkb_evdev_to_keycode (key);
/* We must be careful and not pass multiple releases to xkb, otherwise it gets
confused and locks the modifiers */
if (state != AUTOREPEAT_VALUE)
{
changed_state = xkb_state_update_key (seat_impl->xkb, keycode,
state ? XKB_KEY_DOWN : XKB_KEY_UP);
}
if (!meta_input_device_native_process_kbd_a11y_event_in_impl (seat_impl->core_keyboard,
event))
queue_event (seat_impl, event);