From 8502d4b0d964282fcda13a6aaa6e19c06c6bfb80 Mon Sep 17 00:00:00 2001 From: Andrea Odetti Date: Thu, 18 Jun 2020 20:13:29 +0100 Subject: [PATCH] Use AltGr and Menu to avoid overloading Ctrl keys. Unfortunately Alt does not work: not all key events are triggered. Signed-off-by: Andrea Odetti --- linux.md | 1 + source/frontends/qapple/video.cpp | 19 +++++++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/linux.md b/linux.md index 0ca4a2ac..2d7b612d 100644 --- a/linux.md +++ b/linux.md @@ -79,6 +79,7 @@ This is based on Qt, currently tested with 5.10 * the app runs at 60FPS with correction for uneven timer deltas. * full speed when disk spins execute up to 5 ms real wall clock of emulator code (then returns to Qt) * (standard) audio is supported and there are a few configuration options to tune the latency (default very conservative 200ms) +* Open Apple and Closed Apple can be emulated using AltGr and Menu (unfortunately, Alt does not work well) ## Build diff --git a/source/frontends/qapple/video.cpp b/source/frontends/qapple/video.cpp index 8727cfae..060a8cff 100644 --- a/source/frontends/qapple/video.cpp +++ b/source/frontends/qapple/video.cpp @@ -100,15 +100,14 @@ void Video::keyReleaseEvent(QKeyEvent *event) if (!event->isAutoRepeat()) { // Qt::Key_Alt does not seem to work - // Qt::Key_AltGr works well - // and Left and Right Ctrl have the same key() value - const int vKey = event->nativeVirtualKey(); - switch (vKey) + // Qt::Key_AltGr & Qt::Key_Menu work well, but are on the same side + const int key = event->key(); + switch (key) { - case 65507: // Left Ctrl + case Qt::Key_AltGr: Paddle::setButtonReleased(Paddle::ourOpenApple); break; - case 65508: // Right Ctrl + case Qt::Key_Menu: Paddle::setButtonReleased(Paddle::ourClosedApple); break; } @@ -122,13 +121,13 @@ void Video::keyPressEvent(QKeyEvent *event) { if (!event->isAutoRepeat()) { - const int vKey = event->nativeVirtualKey(); - switch (vKey) + const int key = event->key(); + switch (key) { - case 65507: // Left Ctrl + case Qt::Key_AltGr: Paddle::setButtonPressed(Paddle::ourOpenApple); break; - case 65508: // Right Ctrl + case Qt::Key_Menu: Paddle::setButtonPressed(Paddle::ourClosedApple); break; }