From b4ec77d6e1e322fce91996882bec41d21d38c1af Mon Sep 17 00:00:00 2001 From: Michael Richters Date: Tue, 6 Apr 2021 18:56:14 -0500 Subject: [PATCH] Adapt WinKeyToggle plugin to KeyEvent handlers Signed-off-by: Michael Richters --- .../src/kaleidoscope/plugin/WinKeyToggle.cpp | 7 +++---- .../src/kaleidoscope/plugin/WinKeyToggle.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/plugins/Kaleidoscope-WinKeyToggle/src/kaleidoscope/plugin/WinKeyToggle.cpp b/plugins/Kaleidoscope-WinKeyToggle/src/kaleidoscope/plugin/WinKeyToggle.cpp index 2cd3a328..50c376fc 100644 --- a/plugins/Kaleidoscope-WinKeyToggle/src/kaleidoscope/plugin/WinKeyToggle.cpp +++ b/plugins/Kaleidoscope-WinKeyToggle/src/kaleidoscope/plugin/WinKeyToggle.cpp @@ -23,13 +23,12 @@ namespace plugin { bool WinKeyToggle::enabled_; -EventHandlerResult WinKeyToggle::onKeyswitchEvent(Key &key, KeyAddr key_addr, uint8_t key_state) { +EventHandlerResult WinKeyToggle::onKeyEvent(KeyEvent &event) { if (!enabled_) return EventHandlerResult::OK; - if (key == Key_LeftGui || key == Key_RightGui) { - key = Key_NoKey; - return EventHandlerResult::EVENT_CONSUMED; + if (event.key == Key_LeftGui || event.key == Key_RightGui) { + return EventHandlerResult::ABORT; } return EventHandlerResult::OK; diff --git a/plugins/Kaleidoscope-WinKeyToggle/src/kaleidoscope/plugin/WinKeyToggle.h b/plugins/Kaleidoscope-WinKeyToggle/src/kaleidoscope/plugin/WinKeyToggle.h index 6c2dff90..baeb48da 100644 --- a/plugins/Kaleidoscope-WinKeyToggle/src/kaleidoscope/plugin/WinKeyToggle.h +++ b/plugins/Kaleidoscope-WinKeyToggle/src/kaleidoscope/plugin/WinKeyToggle.h @@ -25,7 +25,7 @@ class WinKeyToggle: public kaleidoscope::Plugin { public: WinKeyToggle() {} - EventHandlerResult onKeyswitchEvent(Key &key, KeyAddr key_addr, uint8_t key_state); + EventHandlerResult onKeyEvent(KeyEvent &event); void toggle() { enabled_ = !enabled_; }