From 41ea3cb1e908e139511cbbc59a534b484d1286bf Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Fri, 12 Jul 2024 08:41:23 +0200 Subject: [PATCH] Add focus support to ColormapOverlay Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/Colormap-Overlay.cpp | 7 ++++++- .../src/kaleidoscope/plugin/Colormap-Overlay.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/Kaleidoscope-Colormap-Overlay/src/kaleidoscope/plugin/Colormap-Overlay.cpp b/plugins/Kaleidoscope-Colormap-Overlay/src/kaleidoscope/plugin/Colormap-Overlay.cpp index d0cda221f4..7875f6853e 100644 --- a/plugins/Kaleidoscope-Colormap-Overlay/src/kaleidoscope/plugin/Colormap-Overlay.cpp +++ b/plugins/Kaleidoscope-Colormap-Overlay/src/kaleidoscope/plugin/Colormap-Overlay.cpp @@ -29,9 +29,10 @@ namespace kaleidoscope { namespace plugin { uint16_t ColormapOverlay::map_base_; +const uint8_t no_themes_ = 1; void ColormapOverlay::setup() { - map_base_ = ::LEDPaletteTheme.reserveThemes(1); + map_base_ = ::LEDPaletteTheme.reserveThemes(no_themes_); } bool ColormapOverlay::hasOverlay(KeyAddr k) { @@ -73,6 +74,10 @@ EventHandlerResult ColormapOverlay::beforeSyncingLeds() { return EventHandlerResult::OK; } +EventHandlerResult ColormapOverlay::onFocusEvent(const char *input) { + return ::LEDPaletteTheme.themeFocusEvent(input, PSTR("colormap.overlay"), map_base_, no_themes_); +} + } // namespace plugin } // namespace kaleidoscope diff --git a/plugins/Kaleidoscope-Colormap-Overlay/src/kaleidoscope/plugin/Colormap-Overlay.h b/plugins/Kaleidoscope-Colormap-Overlay/src/kaleidoscope/plugin/Colormap-Overlay.h index 949eaaf9d5..babd2e456e 100644 --- a/plugins/Kaleidoscope-Colormap-Overlay/src/kaleidoscope/plugin/Colormap-Overlay.h +++ b/plugins/Kaleidoscope-Colormap-Overlay/src/kaleidoscope/plugin/Colormap-Overlay.h @@ -58,6 +58,7 @@ class ColormapOverlay : public kaleidoscope::Plugin { EventHandlerResult onSetup(); EventHandlerResult beforeSyncingLeds(); + EventHandlerResult onFocusEvent(const char *input); private: static uint16_t map_base_;