diff --git a/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.cpp b/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.cpp index c79d25c9..c80fd15a 100644 --- a/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.cpp +++ b/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.cpp @@ -240,6 +240,17 @@ EventHandlerResult DynamicMacros::onKeyEvent(KeyEvent &event) { return EventHandlerResult::EVENT_CONSUMED; } +EventHandlerResult DynamicMacros::beforeReportingState(const KeyEvent &event) { + // Here we add keycodes to the HID report for keys held in a macro sequence. + // This is necessary because Kaleidoscope doesn't know about the supplemental + // `active_macro_keys_[]` array. + for (Key key : active_macro_keys_) { + if (key != Key_NoKey) + Runtime.addToReport(key); + } + return EventHandlerResult::OK; +} + EventHandlerResult DynamicMacros::onNameQuery() { return ::Focus.sendName(F("DynamicMacros")); } diff --git a/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.h b/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.h index 93a0a2af..1678187f 100644 --- a/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.h +++ b/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.h @@ -39,6 +39,7 @@ class DynamicMacros : public kaleidoscope::Plugin { public: EventHandlerResult onNameQuery(); EventHandlerResult onKeyEvent(KeyEvent &event); + EventHandlerResult beforeReportingState(const KeyEvent &event); EventHandlerResult onFocusEvent(const char *command); static void reserve_storage(uint16_t size);