From 186506f3e245394fc395d254bffd7c76e22f130e Mon Sep 17 00:00:00 2001 From: Steve Sims Date: Wed, 4 Dec 2024 20:06:01 +0000 Subject: [PATCH] add checked key to end of queue, and send all keys ensures that the main loop sends packets for all pending keyboard interactions command to check keycode now adds to end of virtual key queue --- video/vdu_sys.h | 2 +- video/video.ino | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/video/vdu_sys.h b/video/vdu_sys.h index 92628a65..60c948f1 100644 --- a/video/vdu_sys.h +++ b/video/vdu_sys.h @@ -261,7 +261,7 @@ void VDUStreamProcessor::vdu_sys_video() { // Inject an updated virtual key event for a key, forcing a new keycode packet to be sent // NB must use a virtual key here, as we can't convert a keycode to a virtual key auto keyboard = getKeyboard(); - keyboard->injectVirtualKey((VirtualKey) key, keyboard->isVKDown((VirtualKey) key), true); + keyboard->injectVirtualKey((VirtualKey) key, keyboard->isVKDown((VirtualKey) key), false); } break; case VDP_BUFFER_PRINT: { // VDU 23, 0, &9B auto bufferId = readWord_t(); diff --git a/video/video.ino b/video/video.ino index 431843cb..463b8d0a 100644 --- a/video/video.ino +++ b/video/video.ino @@ -71,7 +71,7 @@ bool controlKeys = true; // Control keys enabled #include "vdu_stream_processor.h" #include "hexload.h" -std::unique_ptr Terminal; // Used for CP/M mode +std::unique_ptr Terminal; // Used for Terminal emulation mode (for CP/M, etc) VDUStreamProcessor * processor; // VDU Stream Processor #include "zdi.h" // ZDI debugging console @@ -143,7 +143,7 @@ void do_keyboard() { uint8_t modifiers; uint8_t vk; uint8_t down; - if (getKeyboardKey(&keycode, &modifiers, &vk, &down)) { + while (getKeyboardKey(&keycode, &modifiers, &vk, &down)) { // Handle some control keys // if (controlKeys && down) { @@ -313,7 +313,7 @@ bool processTerminal() { case TerminalState::Enabling: { // Turn on the terminal Terminal = std::unique_ptr(new fabgl::Terminal()); - Terminal->begin(_VGAController.get()); + Terminal->begin(_VGAController.get()); Terminal->connectSerialPort(VDPSerial); Terminal->enableCursor(true); // onVirtualKey is triggered whenever a key is pressed or released