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 <mariofutire@gmail.com>
This commit is contained in:
Andrea Odetti 2020-06-18 20:13:29 +01:00
parent 9282c5ddb9
commit 8502d4b0d9
2 changed files with 10 additions and 10 deletions

View file

@ -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. * 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) * 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) * (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 ## Build

View file

@ -100,15 +100,14 @@ void Video::keyReleaseEvent(QKeyEvent *event)
if (!event->isAutoRepeat()) if (!event->isAutoRepeat())
{ {
// Qt::Key_Alt does not seem to work // Qt::Key_Alt does not seem to work
// Qt::Key_AltGr works well // Qt::Key_AltGr & Qt::Key_Menu work well, but are on the same side
// and Left and Right Ctrl have the same key() value const int key = event->key();
const int vKey = event->nativeVirtualKey(); switch (key)
switch (vKey)
{ {
case 65507: // Left Ctrl case Qt::Key_AltGr:
Paddle::setButtonReleased(Paddle::ourOpenApple); Paddle::setButtonReleased(Paddle::ourOpenApple);
break; break;
case 65508: // Right Ctrl case Qt::Key_Menu:
Paddle::setButtonReleased(Paddle::ourClosedApple); Paddle::setButtonReleased(Paddle::ourClosedApple);
break; break;
} }
@ -122,13 +121,13 @@ void Video::keyPressEvent(QKeyEvent *event)
{ {
if (!event->isAutoRepeat()) if (!event->isAutoRepeat())
{ {
const int vKey = event->nativeVirtualKey(); const int key = event->key();
switch (vKey) switch (key)
{ {
case 65507: // Left Ctrl case Qt::Key_AltGr:
Paddle::setButtonPressed(Paddle::ourOpenApple); Paddle::setButtonPressed(Paddle::ourOpenApple);
break; break;
case 65508: // Right Ctrl case Qt::Key_Menu:
Paddle::setButtonPressed(Paddle::ourClosedApple); Paddle::setButtonPressed(Paddle::ourClosedApple);
break; break;
} }