Add held DynamicMacros keys to the Keyboard HID report

DynamicMacros was missing a necessary `beforeReportingState()` handler that is
responsible for adding keys held by an active macro to the HID report.  This
handler is identical to the one used by the Macros plugin for the same purpose.

Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>
pull/1172/head
Michael Richters 3 years ago
parent 7dd8527aab
commit 7279c073e0
No known key found for this signature in database
GPG Key ID: 1288FD13E4EEF0C0

@ -240,6 +240,17 @@ EventHandlerResult DynamicMacros::onKeyEvent(KeyEvent &event) {
return EventHandlerResult::EVENT_CONSUMED; 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() { EventHandlerResult DynamicMacros::onNameQuery() {
return ::Focus.sendName(F("DynamicMacros")); return ::Focus.sendName(F("DynamicMacros"));
} }

@ -39,6 +39,7 @@ class DynamicMacros : public kaleidoscope::Plugin {
public: public:
EventHandlerResult onNameQuery(); EventHandlerResult onNameQuery();
EventHandlerResult onKeyEvent(KeyEvent &event); EventHandlerResult onKeyEvent(KeyEvent &event);
EventHandlerResult beforeReportingState(const KeyEvent &event);
EventHandlerResult onFocusEvent(const char *command); EventHandlerResult onFocusEvent(const char *command);
static void reserve_storage(uint16_t size); static void reserve_storage(uint16_t size);

Loading…
Cancel
Save