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

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

Loading…
Cancel
Save