From b16b454bf16ac1d307d8519bede5b2aae04117af Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 8 Apr 2023 19:36:48 -0300 Subject: [PATCH 1/7] qt: Add another XKB alias for Japanese Num, --- src/qt/xkbcommon_keyboard.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qt/xkbcommon_keyboard.cpp b/src/qt/xkbcommon_keyboard.cpp index 1546b6faa..39f078820 100644 --- a/src/qt/xkbcommon_keyboard.cpp +++ b/src/qt/xkbcommon_keyboard.cpp @@ -124,7 +124,8 @@ static std::unordered_map xkb_keycodes = { {"FK15", 0x5f}, /* Japanese keys. */ - {"JPCM", 0x5c}, /* evdev KPJPCOMMA */ + {"JPCM", 0x5c}, /* Num, */ + {"KPDC", 0x5c}, {"HKTG", 0x70}, /* hiragana-katakana toggle */ {"AB11", 0x73}, /* \_ and Brazilian /? */ {"HZTG", 0x76}, /* hankaku-zenkaku toggle */ From 218f70baace279b8f6b88dd163e72e128afc328e Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 8 Apr 2023 19:39:11 -0300 Subject: [PATCH 2/7] qt: Map F13/F14/F15 using Apple equivalency again for Apple keyboards on Linux --- src/qt/evdev_keyboard.cpp | 10 ++++++---- src/qt/xkbcommon_keyboard.cpp | 9 ++++++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/qt/evdev_keyboard.cpp b/src/qt/evdev_keyboard.cpp index 3e66dc1ed..c227eba83 100644 --- a/src/qt/evdev_keyboard.cpp +++ b/src/qt/evdev_keyboard.cpp @@ -18,14 +18,14 @@ #include static std::unordered_map evdev_keycodes = { - {99, 0x54}, /* SYSRQ */ + {184, 0x46}, /* F14 => Scroll Lock (for Apple keyboards) */ {86, 0x56}, /* 102ND */ {87, 0x57}, /* F11 */ {88, 0x58}, /* F12 */ {117, 0x59}, /* KPEQUAL */ - {183, 0x5d}, /* F13 */ - {184, 0x5e}, /* F14 */ - {185, 0x5f}, /* F15 */ + {186, 0x5d}, /* F16 => F13 */ + {187, 0x5e}, /* F17 => F14 */ + {188, 0x5f}, /* F18 => F15 */ /* Japanese keys. */ {95, 0x5c}, /* KPJPCOMMA */ @@ -47,9 +47,11 @@ static std::unordered_map evdev_keycodes = { {97, 0x11d}, /* RIGHTCTRL */ {98, 0x135}, /* KPSLASH */ {99, 0x137}, /* SYSRQ */ + {183, 0x137}, /* F13 => SysRq (for Apple keyboards) */ {100, 0x138}, /* RIGHTALT */ {119, 0x145}, /* PAUSE */ {411, 0x145}, /* BREAK */ + {185, 0x145}, /* F15 => Pause (for Apple keyboards) */ {102, 0x147}, /* HOME */ {103, 0x148}, /* UP */ {104, 0x149}, /* PAGEUP */ diff --git a/src/qt/xkbcommon_keyboard.cpp b/src/qt/xkbcommon_keyboard.cpp index 39f078820..f2e39298d 100644 --- a/src/qt/xkbcommon_keyboard.cpp +++ b/src/qt/xkbcommon_keyboard.cpp @@ -102,6 +102,7 @@ static std::unordered_map xkb_keycodes = { {"NMLK", 0x45}, {"SCLK", 0x46}, + {"FK14", 0x46}, /* F14 => Scroll Lock (for Apple keyboards) */ {"KP7", 0x47}, {"KP8", 0x48}, {"KP9", 0x49}, @@ -119,9 +120,9 @@ static std::unordered_map xkb_keycodes = { {"LSGT", 0x56}, {"FK11", 0x57}, {"FK12", 0x58}, - {"FK13", 0x5d}, - {"FK14", 0x5e}, - {"FK15", 0x5f}, + {"FK16", 0x5d}, /* F16 => F13 */ + {"FK17", 0x5e}, /* F17 => F14 */ + {"FK18", 0x5f}, /* F18 => F15 */ /* Japanese keys. */ {"JPCM", 0x5c}, /* Num, */ @@ -146,8 +147,10 @@ static std::unordered_map xkb_keycodes = { {"KPDV", 0x135}, {"PRSC", 0x137}, {"SYRQ", 0x137}, + {"FK13", 0x137}, /* F13 => SysRq (for Apple keyboards) */ {"RALT", 0x138}, {"PAUS", 0x145}, + {"FK15", 0x145}, /* F15 => Pause (for Apple keyboards) */ {"BRK", 0x145}, {"HOME", 0x147}, {"UP", 0x148}, From 85330cd6dc7bf90c32f16c1ec3f4eb665d025a57 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 8 Apr 2023 19:41:09 -0300 Subject: [PATCH 3/7] qt: Remove a duplicate evdev mapping --- src/qt/evdev_keyboard.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/qt/evdev_keyboard.cpp b/src/qt/evdev_keyboard.cpp index c227eba83..4aad4e377 100644 --- a/src/qt/evdev_keyboard.cpp +++ b/src/qt/evdev_keyboard.cpp @@ -22,7 +22,6 @@ static std::unordered_map evdev_keycodes = { {86, 0x56}, /* 102ND */ {87, 0x57}, /* F11 */ {88, 0x58}, /* F12 */ - {117, 0x59}, /* KPEQUAL */ {186, 0x5d}, /* F16 => F13 */ {187, 0x5e}, /* F17 => F14 */ {188, 0x5f}, /* F18 => F15 */ From 68e49b75bcf8c7d21961a16bc74e64501aa3cc45 Mon Sep 17 00:00:00 2001 From: richardg867 Date: Sat, 8 Apr 2023 20:30:07 -0300 Subject: [PATCH 4/7] Jenkins: Clean pacman cache after update --- .ci/build.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.ci/build.sh b/.ci/build.sh index a61cdc7f9..fc7290f4a 100755 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -316,6 +316,9 @@ then pacman -S --needed --noconfirm "$pkg" done fi + + # Clean pacman cache when running under Jenkins to save disk space. + [ "$CI" = "true" ] && rm -rf /var/cache/pacman/pkg # Generate a new freetype DLL for this architecture. rm -f "$freetype_dll" From 897f6a44e86a84aa3fb9ffb6feede87abc01a4ca Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 8 Apr 2023 21:42:06 -0300 Subject: [PATCH 5/7] qt: Attempt fix for Pause key with the new mappers --- src/qt/qt_mainwindow.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 95b881e64..b51a8a360 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -1394,12 +1394,19 @@ MainWindow::keyPressEvent(QKeyEvent *event) keyboard_input(1, 0x1D); keyboard_input(1, 0x45); } - } else + } else { #ifdef Q_OS_MACOS processMacKeyboardInput(true, event); #else - keyboard_input(1, x11_keycode_to_keysym(event->nativeScanCode())); + auto scan = x11_keycode_to_keysym(event->nativeVirtualKey()); + if (scan == 0x145) { + /* Special case for Pause. */ + keyboard_input(1, scan & 0xff00); + scan &= 0x00ff; + } + keyboard_input(1, scan); #endif + } } if ((video_fullscreen > 0) && keyboard_isfsexit()) { @@ -1446,7 +1453,13 @@ MainWindow::keyReleaseEvent(QKeyEvent *event) #ifdef Q_OS_MACOS processMacKeyboardInput(false, event); #else - keyboard_input(0, x11_keycode_to_keysym(event->nativeScanCode())); + auto scan = x11_keycode_to_keysym(event->nativeVirtualKey()); + if (scan == 0x145) { + /* Special case for Pause. */ + keyboard_input(0, scan & 0xff00); + scan &= 0x00ff; + } + keyboard_input(0, scan); #endif } From b447cc85c91b3dd5b782c06d59e176803ab89840 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 8 Apr 2023 21:48:01 -0300 Subject: [PATCH 6/7] qt: Add AltGr XKB alias --- src/qt/xkbcommon_keyboard.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qt/xkbcommon_keyboard.cpp b/src/qt/xkbcommon_keyboard.cpp index f2e39298d..e3a058ed2 100644 --- a/src/qt/xkbcommon_keyboard.cpp +++ b/src/qt/xkbcommon_keyboard.cpp @@ -149,6 +149,7 @@ static std::unordered_map xkb_keycodes = { {"SYRQ", 0x137}, {"FK13", 0x137}, /* F13 => SysRq (for Apple keyboards) */ {"RALT", 0x138}, + {"ALGR", 0x138}, {"PAUS", 0x145}, {"FK15", 0x145}, /* F15 => Pause (for Apple keyboards) */ {"BRK", 0x145}, From 5b6965402abcebcbfb538f91771b6e68a0ed06fc Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 8 Apr 2023 21:49:04 -0300 Subject: [PATCH 7/7] qt: Fix key translation screw-up --- src/qt/qt_mainwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index b51a8a360..89e010702 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -1398,7 +1398,7 @@ MainWindow::keyPressEvent(QKeyEvent *event) #ifdef Q_OS_MACOS processMacKeyboardInput(true, event); #else - auto scan = x11_keycode_to_keysym(event->nativeVirtualKey()); + auto scan = x11_keycode_to_keysym(event->nativeScanCode()); if (scan == 0x145) { /* Special case for Pause. */ keyboard_input(1, scan & 0xff00); @@ -1453,7 +1453,7 @@ MainWindow::keyReleaseEvent(QKeyEvent *event) #ifdef Q_OS_MACOS processMacKeyboardInput(false, event); #else - auto scan = x11_keycode_to_keysym(event->nativeVirtualKey()); + auto scan = x11_keycode_to_keysym(event->nativeScanCode()); if (scan == 0x145) { /* Special case for Pause. */ keyboard_input(0, scan & 0xff00);