From 9c49b53c0800c4ad93874121a0af6edc504cc165 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sun, 9 Apr 2023 17:04:57 -0300 Subject: [PATCH] qt: Fix Print Screen key on Linux --- src/qt/qt_mainwindow.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 1801f6160..03db77721 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -1170,8 +1170,10 @@ x11_keycode_to_keysym(uint32_t keycode) finalkeycode = 0; # endif #endif - /* Special case for Ctrl+Pause. */ - if ((finalkeycode == 0x145) && (keyboard_recv(0x1d) || keyboard_recv(0x11d))) + /* Special case for Alt+Print Screen and Ctrl+Pause. */ + if ((finalkeycode == 0x137) && (keyboard_recv(0x38) || keyboard_recv(0x138))) + finalkeycode = 0x54; + else if ((finalkeycode == 0x145) && (keyboard_recv(0x1d) || keyboard_recv(0x11d))) finalkeycode = 0x146; if (rctrl_is_lalt && finalkeycode == 0x11D) @@ -1386,7 +1388,10 @@ MainWindow::keyPressEvent(QKeyEvent *event) processMacKeyboardInput(true, event); #else auto scan = x11_keycode_to_keysym(event->nativeScanCode()); - if (scan == 0x145) { + if (scan == 0x137) { + /* Special case for Print Screen. */ + keyboard_input(1, 0x12a); + } else if (scan == 0x145) { /* Special case for Pause. */ keyboard_input(1, 0xe11d); scan &= 0x00ff; @@ -1440,7 +1445,11 @@ MainWindow::keyReleaseEvent(QKeyEvent *event) processMacKeyboardInput(false, event); #else auto scan = x11_keycode_to_keysym(event->nativeScanCode()); - if (scan == 0x145) { + if (scan == 0x137) { + /* Special case for Print Screen. */ + keyboard_input(0, scan); + scan = 0x12a; + } else if (scan == 0x145) { /* Special case for Pause. */ keyboard_input(0, 0xe11d); scan &= 0x00ff;