Adapt WinKeyToggle plugin to KeyEvent handlers

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

@ -23,13 +23,12 @@ namespace plugin {
bool WinKeyToggle::enabled_; bool WinKeyToggle::enabled_;
EventHandlerResult WinKeyToggle::onKeyswitchEvent(Key &key, KeyAddr key_addr, uint8_t key_state) { EventHandlerResult WinKeyToggle::onKeyEvent(KeyEvent &event) {
if (!enabled_) if (!enabled_)
return EventHandlerResult::OK; return EventHandlerResult::OK;
if (key == Key_LeftGui || key == Key_RightGui) { if (event.key == Key_LeftGui || event.key == Key_RightGui) {
key = Key_NoKey; return EventHandlerResult::ABORT;
return EventHandlerResult::EVENT_CONSUMED;
} }
return EventHandlerResult::OK; return EventHandlerResult::OK;

@ -25,7 +25,7 @@ class WinKeyToggle: public kaleidoscope::Plugin {
public: public:
WinKeyToggle() {} WinKeyToggle() {}
EventHandlerResult onKeyswitchEvent(Key &key, KeyAddr key_addr, uint8_t key_state); EventHandlerResult onKeyEvent(KeyEvent &event);
void toggle() { void toggle() {
enabled_ = !enabled_; enabled_ = !enabled_;
} }

Loading…
Cancel
Save