summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRodney Dawes <dobey.pwns@gmail.com>2021-10-04 16:31:30 -0400
committerRodney Dawes <dobey.pwns@gmail.com>2021-10-15 08:50:09 -0400
commitbaa7ef511bf40280448e5f0e721ddd6da3301f3b (patch)
tree858d62726f3a1796a442347468ed83a9716c5e70 /src
parent89ee92b6fadc34b28ce593160dd06bd771df3236 (diff)
downloadqtwayland-baa7ef511bf40280448e5f0e721ddd6da3301f3b.tar.gz
Fix the logic for decoding modifiers map in Wayland text input protocol
Correctly check for the flags in the modifiers map when we get it from the compositor, instead of modifying the map in the for loop conditional. [ChangeLog][QWaylandInputContext] Fix modifiers map decoding logic when receiving the map from the compositor. Fixes: QTBUG-97094 Pick-to: 6.2 5.15 5.12 Change-Id: Idad19f7b1f4560d40abbb5b31032360cfe915261 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/client/qwaylandinputcontext.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/client/qwaylandinputcontext.cpp b/src/client/qwaylandinputcontext.cpp
index 7262a6a4..645fd56a 100644
--- a/src/client/qwaylandinputcontext.cpp
+++ b/src/client/qwaylandinputcontext.cpp
@@ -389,8 +389,10 @@ void QWaylandTextInput::zwp_text_input_v2_input_method_changed(uint32_t serial,
Qt::KeyboardModifiers QWaylandTextInput::modifiersToQtModifiers(uint32_t modifiers)
{
Qt::KeyboardModifiers ret = Qt::NoModifier;
- for (int i = 0; modifiers >>= 1; ++i) {
- ret |= m_modifiersMap[i];
+ for (int i = 0; i < m_modifiersMap.size(); ++i) {
+ if (modifiers & (1 << i)) {
+ ret |= m_modifiersMap[i];
+ }
}
return ret;
}