From 9399c984cca45f5d3cecf337c3dbe62c2d4470f7 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Mon, 13 Nov 2023 10:55:46 +0100 Subject: [PATCH] backends/native: Avoid redundant changes to sticky keys state mask Sticky keys configuration changes reset the pressed modifier state mask, even though the XKB state might already match with the expected new state. In those cases we can avoid the XKB state mask update completely. This also fixes a crash at initialization with sticky keys toggled on, since configuring the device a11y settings will trigger a XKB state mask merely reassuring the initial state with no modifiers pressed, while the connection between the ClutterSeat and the impl object has not been set up yet. This crash was introduced by commit 00bb4190b ("backends/native: Drop device_native->seat_impl field"). Part-of: --- src/backends/native/meta-input-device-native.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/backends/native/meta-input-device-native.c b/src/backends/native/meta-input-device-native.c index b8793825f..1cb33a39f 100644 --- a/src/backends/native/meta-input-device-native.c +++ b/src/backends/native/meta-input-device-native.c @@ -495,6 +495,10 @@ update_internal_xkb_state (MetaInputDeviceNative *device, xkb_mod_mask_t group_mods; struct xkb_state *xkb_state; + if (device->stickykeys_latched_mask == new_latched_mask && + device->stickykeys_locked_mask == new_locked_mask) + return; + g_rw_lock_writer_lock (&seat_impl->state_lock); xkb_state = meta_seat_impl_get_xkb_state_in_impl (seat_impl);