diff options
author | Andrey Butirsky <butirsky@gmail.com> | 2021-05-17 18:14:06 +0300 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-05-25 23:29:36 +0000 |
commit | e6b6f49d7128a5c7e1129c8d3a9e3af226d87593 (patch) | |
tree | cf67f73ca7c9800e78b962d5592ab507723a33f7 | |
parent | b67bbed1965ce9931a6280daeb1d2a05a3c905a5 (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: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/gui/platform/unix/qxkbcommon.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/gui/platform/unix/qxkbcommon.cpp b/src/gui/platform/unix/qxkbcommon.cpp index 459f6a16bb..4e254044de 100644 --- a/src/gui/platform/unix/qxkbcommon.cpp +++ b/src/gui/platform/unix/qxkbcommon.cpp @@ -552,6 +552,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) @@ -578,12 +584,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; } |