From 6ecde6265a08163d47a834cb5591fdb22461d129 Mon Sep 17 00:00:00 2001 From: Andrey Butirsky Date: Thu, 20 May 2021 03:35:26 +0300 Subject: qxkbcommon: Keep lower case as Qt key when upper case is not in Latin1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ø Reviewed-by: Andrey Butirsky --- src/gui/platform/unix/qxkbcommon.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/gui/platform') 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}; -- cgit v1.2.3