summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Butirsky <butirsky@gmail.com>2022-06-16 21:00:41 +0200
committerLiang Qi <liang.qi@qt.io>2022-06-27 11:03:15 +0200
commit0674ce13bd2487261957f719a7756f584b37036b (patch)
tree3fd1406d195b269ac7602ab8ae9564f5616bda64
parentf71e344ad44fb3f6b082e698d935ef8d8ebd910c (diff)
qxkbcommon: Map Super/Hyper to Meta early enough to have an effect
Super/Hyper keys are detected during a direct mapping phase, but the function returned before the translation to Meta could take place. Task-number: QTBUG-62102 Change-Id: I9f7ccfd757fa86dbc648951306deb1b43ccf4167 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Andrey Butirsky <butirsky@gmail.com> (cherry picked from commit b45b9090c3b66d541f57f8d049c22247f8c115ca) Reviewed-by: Liang Qi <liang.qi@qt.io>
-rw-r--r--src/platformsupport/input/xkbcommon/qxkbcommon.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/platformsupport/input/xkbcommon/qxkbcommon.cpp b/src/platformsupport/input/xkbcommon/qxkbcommon.cpp
index 313e861585..c505062d45 100644
--- a/src/platformsupport/input/xkbcommon/qxkbcommon.cpp
+++ b/src/platformsupport/input/xkbcommon/qxkbcommon.cpp
@@ -554,6 +554,12 @@ static int keysymToQtKey_internal(xkb_keysym_t keysym, Qt::KeyboardModifiers mod
auto it = std::lower_bound(KeyTbl.cbegin(), KeyTbl.cend(), searchKey);
if (it != KeyTbl.end() && !(searchKey < *it))
qtKey = it->qt;
+
+ // translate Super/Hyper keys to Meta if we're using them as the MetaModifier
+ if (superAsMeta && (qtKey == Qt::Key_Super_L || qtKey == Qt::Key_Super_R))
+ qtKey = Qt::Key_Meta;
+ if (hyperAsMeta && (qtKey == Qt::Key_Hyper_L || qtKey == Qt::Key_Hyper_R))
+ qtKey = Qt::Key_Meta;
}
if (qtKey)
@@ -582,12 +588,6 @@ static int keysymToQtKey_internal(xkb_keysym_t keysym, Qt::KeyboardModifiers mod
}
}
- // translate Super/Hyper keys to Meta if we're using them as the MetaModifier
- if (superAsMeta && (qtKey == Qt::Key_Super_L || qtKey == Qt::Key_Super_R))
- qtKey = Qt::Key_Meta;
- if (hyperAsMeta && (qtKey == Qt::Key_Hyper_L || qtKey == Qt::Key_Hyper_R))
- qtKey = Qt::Key_Meta;
-
return qtKey;
}