From 379198828c446f7f0871f34a07b416d824964f95 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Tue, 3 May 2022 20:54:19 +0200 Subject: xcb: update xkb_state mask as much as possible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Though we can get xcb_xkb_state_notify_event_t for the change, but it looks like not enough, especially when a new usb barcode scanner was used, it should be a slave keyboard, and Qt only uses core_device_id for now. It should be enough to update xkb_state mask when we get key event. See also https://xkbcommon.org/doc/current/md_doc_quick_guide.html . Fixes: QTBUG-95933 Change-Id: Ie1e82c19edd777630c7f9057a3b2b8b7cad59e38 Reviewed-by: Tor Arne Vestbø (cherry picked from commit ef94aeef649f832bb201cb752407ce3ea5e66562) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/xcb/qxcbkeyboard.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index 79fef496b4..0666fac735 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -405,7 +405,7 @@ static xkb_layout_index_t lockedGroup(quint16 state) void QXcbKeyboard::updateXKBStateFromCore(quint16 state) { - if (m_config && !connection()->hasXKB()) { + if (m_config) { struct xkb_state *xkbState = m_xkbState.get(); xkb_mod_mask_t modsDepressed = xkb_state_serialize_mods(xkbState, XKB_STATE_MODS_DEPRESSED); xkb_mod_mask_t modsLatched = xkb_state_serialize_mods(xkbState, XKB_STATE_MODS_LATCHED); @@ -427,7 +427,7 @@ void QXcbKeyboard::updateXKBStateFromCore(quint16 state) void QXcbKeyboard::updateXKBStateFromXI(void *modInfo, void *groupInfo) { - if (m_config && !connection()->hasXKB()) { + if (m_config) { auto *mods = static_cast(modInfo); auto *group = static_cast(groupInfo); const xkb_state_component changedComponents -- cgit v1.2.3