summaryrefslogtreecommitdiffstats
path: root/src/gui/platform
diff options
context:
space:
mode:
authorAndrey Butirsky <butirsky@gmail.com>2021-05-20 03:35:26 +0300
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2021-05-25 15:29:49 +0000
commit6ecde6265a08163d47a834cb5591fdb22461d129 (patch)
tree106c5e2df18c91ba5628344fa3269e94a08fbbc3 /src/gui/platform
parent6519bcf85d4252da5bf70c12b4877adab523d252 (diff)
qxkbcommon: Keep lower case as Qt key when upper case is not in Latin1
Upper-casing a Latin1 character might move it out of Latin1 range, for example U+00B5 MICRO SIGN, which upper-case equivalent is U+039C GREEK CAPITAL LETTER MU. If that's the case, then map the original lower-case character. Fixes: QTBUG-93858 Pick-to: 5.15 6.0 6.1 Change-Id: Ibd86fbb7c70d620c0884015ec1c40aa6351e6320 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Andrey Butirsky <butirsky@gmail.com>
Diffstat (limited to 'src/gui/platform')
-rw-r--r--src/gui/platform/unix/qxkbcommon.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gui/platform/unix/qxkbcommon.cpp b/src/gui/platform/unix/qxkbcommon.cpp
index 3db84097c7..f53864cba1 100644
--- a/src/gui/platform/unix/qxkbcommon.cpp
+++ b/src/gui/platform/unix/qxkbcommon.cpp
@@ -545,7 +545,15 @@ static int keysymToQtKey_internal(xkb_keysym_t keysym, Qt::KeyboardModifiers mod
// numeric keypad keys
qtKey = Qt::Key_0 + (keysym - XKB_KEY_KP_0);
} else if (QXkbCommon::isLatin1(keysym)) {
+ // Upper-case first, since Qt::Keys are defined in terms of their
+ // upper-case versions.
qtKey = QXkbCommon::qxkbcommon_xkb_keysym_to_upper(keysym);
+ // Upper-casing a Latin1 character might move it out of Latin1 range,
+ // for example U+00B5 MICRO SIGN, which upper-case equivalent is
+ // U+039C GREEK CAPITAL LETTER MU. If that's the case, then map the
+ // original lower-case character.
+ if (!QXkbCommon::isLatin1(qtKey))
+ qtKey = keysym;
} else {
// check if we have a direct mapping
xkb2qt_t searchKey{keysym, 0};