From c11a1caf590b3c954eb2646d4694aff3ec900008 Mon Sep 17 00:00:00 2001 From: pika Date: Wed, 15 Oct 2025 21:58:18 -0500 Subject: [PATCH] fix: handle xkb_keymap_mod_get_mask returning 0 --- src/lib/platform/EiKeyState.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/platform/EiKeyState.cpp b/src/lib/platform/EiKeyState.cpp index fed0e249b..4bc2f64fc 100644 --- a/src/lib/platform/EiKeyState.cpp +++ b/src/lib/platform/EiKeyState.cpp @@ -129,8 +129,10 @@ std::uint32_t EiKeyState::convertModMask(xkb_mod_mask_t xkbModMaskIn) const const xkb_mod_mask_t xkbModMask = (1 << xkbModIdx); #endif - // Skip inactive modifiers. - if ((xkbModMaskIn & xkbModMask) != xkbModMask) + // Skip modifiers that have no XKB mask (not mapped to any real modifier) + // or are inactive. Without the xkbModMask == 0 check, modifiers with mask 0 + // incorrectly pass the test (0 & 0 == 0) and get processed as "active". + if (xkbModMask == 0 || (xkbModMaskIn & xkbModMask) != xkbModMask) continue; /* added in libxkbcommon 1.8.0 in the same commit so we have all or none */