Skip to content

Commit

Permalink
add checked key to end of queue, and send all keys
Browse files Browse the repository at this point in the history
ensures that the main loop sends packets for all pending keyboard interactions

command to check keycode now adds to end of virtual key queue
  • Loading branch information
stevesims committed Dec 4, 2024
1 parent 8ce781b commit 186506f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion video/vdu_sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions video/video.ino
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ bool controlKeys = true; // Control keys enabled
#include "vdu_stream_processor.h"
#include "hexload.h"

std::unique_ptr<fabgl::Terminal> Terminal; // Used for CP/M mode
std::unique_ptr<fabgl::Terminal> Terminal; // Used for Terminal emulation mode (for CP/M, etc)
VDUStreamProcessor * processor; // VDU Stream Processor

#include "zdi.h" // ZDI debugging console
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -313,7 +313,7 @@ bool processTerminal() {
case TerminalState::Enabling: {
// Turn on the terminal
Terminal = std::unique_ptr<fabgl::Terminal>(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
Expand Down

0 comments on commit 186506f

Please sign in to comment.