From bca56cf2549419751a8f2f73bd920515b980e28b Mon Sep 17 00:00:00 2001 From: Aleksei Nikiforov Date: Tue, 03 Sep 2019 13:07:25 +0300 Subject: [PATCH] Qt xcb: remove false detects of Qt::GroupSwitchModifier In some cases, if X11 is configured with CapsLock as keyboard language switch key, and CapsLock is toggled via Shift+CapsLock key combination, toggled CapsLock is falsely detected as Qt::GroupSwitchModifier for subsequent key events. This change fixes this false detect, but doesn't fix detection of Qt::GroupSwitchModifier which is likely still broken. Fixes: QTBUG-49771 Fixes: QTBUG-95108 Fixes: QTBUG-95289 See also: https://codereview.qt-project.org/c/qt/qtbase/+/371421 See also: https://bugreports.qt.io/browse/QTBUG-95108?focusedCommentId=581870&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-581870 --- diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index 3caee3f..5e30f25 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -60,11 +60,11 @@ ret |= Qt::ShiftModifier; if (s & XCB_MOD_MASK_CONTROL) ret |= Qt::ControlModifier; - if (s & rmod_masks.alt) + if (rmod_masks.alt && ((s & rmod_masks.alt) == rmod_masks.alt)) ret |= Qt::AltModifier; - if (s & rmod_masks.meta) + if (rmod_masks.meta && ((s & rmod_masks.meta) == rmod_masks.meta)) ret |= Qt::MetaModifier; - if (s & rmod_masks.altgr) + if (rmod_masks.altgr && ((s & rmod_masks.altgr) == rmod_masks.altgr)) ret |= Qt::GroupSwitchModifier; return ret; }