From 1946e1de0b4e7c78df42ec4a30c560a31521ccc0 Mon Sep 17 00:00:00 2001 From: Michael Richters Date: Wed, 7 Apr 2021 00:38:44 -0500 Subject: [PATCH] Compile deprecated Layer code conditionally Signed-off-by: Michael Richters --- src/kaleidoscope/layers.cpp | 12 ------------ src/kaleidoscope/layers.h | 8 +++++++- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/kaleidoscope/layers.cpp b/src/kaleidoscope/layers.cpp index a5d47722..0f9b492a 100644 --- a/src/kaleidoscope/layers.cpp +++ b/src/kaleidoscope/layers.cpp @@ -152,18 +152,6 @@ Key Layer_::getKeyFromPROGMEM(uint8_t layer, KeyAddr key_addr) { return keyFromKeymap(layer, key_addr); } -// Deprecated -void Layer_::updateLiveCompositeKeymap(KeyAddr key_addr) { - // We could update the active keys cache here (as commented below), but I - // think that's unlikely to serve whatever purpose the caller had in - // mind. `Layer.lookup()` will still give the correct result, and without a - // `Key` value is specified, this function no longer serves a purpose. - - // #include "kaleidoscope/LiveKeys.h" - // int8_t layer = active_layer_keymap_[key_addr.toInt()]; - // live_keys.activate(key_addr, (*getKey)(layer, key_addr)); -} - void Layer_::updateActiveLayers(void) { // First, set every entry in the active layer keymap to point to the default // layer (layer 0). diff --git a/src/kaleidoscope/layers.h b/src/kaleidoscope/layers.h index f5401b71..0aa995a1 100644 --- a/src/kaleidoscope/layers.h +++ b/src/kaleidoscope/layers.h @@ -81,6 +81,7 @@ class Layer_ { // The `Runtime.lookupKey()` function replaces this one, for plugins that // still want to do this same check. +#ifndef NDEPRECATED DEPRECATED(LAYER_LOOKUP) static Key lookup(KeyAddr key_addr) { // First check the keyboard state array @@ -91,6 +92,8 @@ class Layer_ { } return key; } +#endif + static Key lookupOnActiveLayer(KeyAddr key_addr) { uint8_t layer = active_layer_keymap_[key_addr.toInt()]; return (*getKey)(layer, key_addr); @@ -125,12 +128,15 @@ class Layer_ { static Key getKeyFromPROGMEM(uint8_t layer, KeyAddr key_addr); +#ifndef NDEPRECATED DEPRECATED(LAYER_UPDATELIVECOMPOSITEKEYMAP) static void updateLiveCompositeKeymap(KeyAddr key_addr, Key mappedKey) { live_keys.activate(key_addr, mappedKey); } DEPRECATED(LAYER_UPDATELIVECOMPOSITEKEYMAP) - static void updateLiveCompositeKeymap(KeyAddr key_addr); + static void updateLiveCompositeKeymap(KeyAddr key_addr) {} +#endif + static void updateActiveLayers(void); private: