From d1d2e0e1bc93cccee4f46174c58bc5a511b63c92 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Tue, 23 Aug 2022 16:32:38 +0600 Subject: [PATCH 1/3] qt: Shortcut fixes * Make Pause key pause/resume the emulator * Make screenshot taking and C+A+D shortcuts work on fullscreen --- src/qt/qt_mainwindow.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 0ee5a3161..6b7562c28 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -1632,6 +1632,12 @@ void MainWindow::keyPressEvent(QKeyEvent* event) if (keyboard_ismsexit()) { plat_mouse_capture(0); } + + if ((video_fullscreen > 0) && (keyboard_recv(0x1D) || keyboard_recv(0x11D))) { + if (keyboard_recv(0x57)) ui->actionTake_screenshot->trigger(); + else if (keyboard_recv(0x58)) pc_send_cad(); + } + event->accept(); } @@ -1646,6 +1652,9 @@ void MainWindow::blitToWidget(int x, int y, int w, int h, int monitor_index) void MainWindow::keyReleaseEvent(QKeyEvent* event) { + if (event->key() == Qt::Key_Pause) { + plat_pause(dopause ^ 1); + } if (!send_keyboard_input) return; From 6d4751f471838dd7f81a70059cae0711e15a5a7d Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Sat, 3 Sep 2022 02:28:00 +0600 Subject: [PATCH 2/3] qt: Make the pause key pause the emulator if both Alts are held Also proper emulation for the pause key when both Alts aren't held --- src/qt/qt_mainwindow.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 6b7562c28..b240098b9 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -1615,7 +1615,18 @@ void MainWindow::keyPressEvent(QKeyEvent* event) if (send_keyboard_input && !(kbd_req_capture && !mouse_capture && !video_fullscreen)) { // Windows keys in Qt have one-to-one mapping. - if (event->key() == Qt::Key_Super_L || event->key() == Qt::Key_Super_R) { + if (event->key() == Qt::Key_Pause && !keyboard_recv(0x38) && !keyboard_recv(0x138)) { + if ((keyboard_recv(0x1D) || keyboard_recv(0x11D)) { + keyboard_input(1, 0x46); + } else { + keyboard_input(0, 0xE1); + keyboard_input(0, 0x1D); + keyboard_input(0, 0x45); + keyboard_input(0, 0xE1); + keyboard_input(1, 0x1D); + keyboard_input(1, 0x45); + } + } else if (event->key() == Qt::Key_Super_L || event->key() == Qt::Key_Super_R) { keyboard_input(1, event->key() == Qt::Key_Super_L ? 0x15B : 0x15C); } else #ifdef Q_OS_MACOS @@ -1653,7 +1664,9 @@ void MainWindow::blitToWidget(int x, int y, int w, int h, int monitor_index) void MainWindow::keyReleaseEvent(QKeyEvent* event) { if (event->key() == Qt::Key_Pause) { - plat_pause(dopause ^ 1); + if (keyboard_recv(0x38) && keyboard_recv(0x138)) { + plat_pause(dopause ^ 1); + } } if (!send_keyboard_input) return; From 915ed5ce53c8163fa3ff8a24126da9ab5057edf0 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Sat, 3 Sep 2022 02:31:03 +0600 Subject: [PATCH 3/3] Add missing bracket --- src/qt/qt_mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index b240098b9..cf2088bef 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -1616,7 +1616,7 @@ void MainWindow::keyPressEvent(QKeyEvent* event) { // Windows keys in Qt have one-to-one mapping. if (event->key() == Qt::Key_Pause && !keyboard_recv(0x38) && !keyboard_recv(0x138)) { - if ((keyboard_recv(0x1D) || keyboard_recv(0x11D)) { + if ((keyboard_recv(0x1D) || keyboard_recv(0x11D))) { keyboard_input(1, 0x46); } else { keyboard_input(0, 0xE1);