Adapt Steno(GeminiPR) plugin to KeyEvent handlers

Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>
pull/1024/head
Michael Richters 4 years ago
parent b4ec77d6e1
commit a890b3ccf1
No known key found for this signature in database
GPG Key ID: 1288FD13E4EEF0C0

@ -30,17 +30,16 @@ EventHandlerResult GeminiPR::onNameQuery() {
return ::Focus.sendName(F("GeminiPR"));
}
EventHandlerResult GeminiPR::onKeyswitchEvent(Key &mapped_key, KeyAddr key_addr, uint8_t keyState) {
if (mapped_key < geminipr::START ||
mapped_key > geminipr::END)
EventHandlerResult GeminiPR::onKeyEvent(KeyEvent &event) {
if (event.key < geminipr::START || event.key > geminipr::END)
return EventHandlerResult::OK;
if (keyToggledOn(keyState)) {
uint8_t key = mapped_key.getRaw() - geminipr::START;
if (keyToggledOn(event.state)) {
uint8_t key = event.key.getRaw() - geminipr::START;
++keys_held_;
state_[key / 7] |= 1 << (6 - (key % 7));
} else if (keyToggledOff(keyState)) {
} else {
--keys_held_;
if (keys_held_ == 0) {

@ -30,7 +30,8 @@ class GeminiPR : public kaleidoscope::Plugin {
GeminiPR(void) {}
EventHandlerResult onNameQuery();
EventHandlerResult onKeyswitchEvent(Key &mapped_key, KeyAddr key_addr, uint8_t keyState);
EventHandlerResult onKeyEvent(KeyEvent &event);
private:
static uint8_t keys_held_;
static uint8_t state_[6];
@ -88,9 +89,9 @@ enum {
ZR,
END = ZR,
};
}
}
}
}
} // namespace geminipr
} // namespace steno
} // namespace plugin
} // namespace kaleidoscope
extern kaleidoscope::plugin::steno::GeminiPR GeminiPR;

Loading…
Cancel
Save