diff --git a/docs/UPGRADING.md b/docs/UPGRADING.md index 3af85881..6de349c1 100644 --- a/docs/UPGRADING.md +++ b/docs/UPGRADING.md @@ -1050,15 +1050,19 @@ The following headers and names have changed: - [Syster](plugins/Kaleidoscope-Syster.md) had the `kaleidoscope::Syster::action_t` type replaced by `kaleidoscope::plugin::Syster::action_t`. - [TapDance](plugins/Kaleidoscope-TapDance.md) had the `kaleidoscope::TapDance::ActionType` type replaced by `kaleidoscope::plugin::TapDance::ActionType`. -### Live Composite Keymap Cache +# Removed APIs -The live composite keymap, which contained a lazily-updated version of the current keymap, has been replaced. The `Layer.updateLiveCompositeKeymap()` functions have been deprecated, and depending on the purpose of the caller, it might be appropriate to use `live_keys.activate()` instead. +#### Old layer key event handler functions -When `handleKeyswitchEvent()` is looking up a `Key` value for an event, it first checks the value in the active keys cache before calling `Layer.lookup()` to get the value from the keymap. In the vast majority of cases, it won't be necessary to call `live_keys.activate()` manually, however, because simply changing the value of the `Key` parameter of an `onKeyswitchEvent()` handler will have the same effect. +The deprecated `Layer.handleKeymapKeyswitchEvent()` function was removed on **2022-03-03**. Any code that called it should now call `Layer.handleLayerKeyEvent()` instead, with `event.addr` set to the appropriate `KeyAddr` value if possible, and `KeyAddr::none()` otherwise. -Second, the `Layer.eventHandler()` function has been deprecated. There wasn't much need for this to be available to plugins, and it's possible to call `Layer.handleKeymapKeyswitchEvent()` directly instead. +The deprecated `Layer.eventHandler(key, addr, state)` function was removed on **2022-03-03**. Any code that refers to it should now call call `handleLayerKeyEvent(KeyEvent(addr, state, key))` instead. -# Removed APIs +#### Keymap cache functions + +The deprecated `Layer.updateLiveCompositeKeymap()` function was removed on **2022-03-03**. Plugin and user code probably shouldn't have been calling this directly, so there's no direct replacement for it. If a plugin needs to make changes to the `live_keys` structure (equivalent in some circumstances to the old "live composite keymap"), it can call `live_keys.activate(addr, key)`, but there are probably better ways to accomplish this goal (e.g. simply changing the value of `event.key` from an `onKeyEvent(event)` handler). + +The deprecated `Layer.lookup(addr)` function was removed on **2022-03-03**. Please use `Runtime.lookupKey(addr)` instead in most circumstances. Alternatively, if you need information about the current state of the keymap regardless of any currently active keys (which may have values that override the keymap), use `Layer.lookupOnActiveLayer(addr)` instead. #### `LEDControl.syncDelay` configuration variable diff --git a/src/kaleidoscope/layers.cpp b/src/kaleidoscope/layers.cpp index 68676e61..b7ff8c55 100644 --- a/src/kaleidoscope/layers.cpp +++ b/src/kaleidoscope/layers.cpp @@ -129,19 +129,6 @@ void Layer_::handleLayerKeyEvent(const KeyEvent &event) { } } -#ifndef NDEPRECATED -void Layer_::handleKeymapKeyswitchEvent(Key key, uint8_t key_state) { - if (key.getFlags() == (SYNTHETIC | SWITCH_TO_KEYMAP)) - handleLayerKeyEvent(KeyEvent(KeyAddr::none(), key_state, key)); -} - -Key Layer_::eventHandler(Key mappedKey, KeyAddr key_addr, uint8_t keyState) { - if (mappedKey.getFlags() == (SYNTHETIC | SWITCH_TO_KEYMAP)) - handleLayerKeyEvent(KeyEvent(key_addr, keyState, mappedKey)); - return mappedKey; -} -#endif - Key Layer_::getKeyFromPROGMEM(uint8_t layer, KeyAddr key_addr) { return keyFromKeymap(layer, key_addr); } diff --git a/src/kaleidoscope/layers.h b/src/kaleidoscope/layers.h index 3f38cdd2..9428cc28 100644 --- a/src/kaleidoscope/layers.h +++ b/src/kaleidoscope/layers.h @@ -26,10 +26,6 @@ #include "kaleidoscope_internal/shortname.h" #include "kaleidoscope_internal/deprecations.h" -#ifndef NDEPRECATED -#include "kaleidoscope/LiveKeys.h" -#endif - #define START_KEYMAPS __NL__ \ constexpr Key keymaps_linear[][kaleidoscope_internal::device.matrix_rows * kaleidoscope_internal::device.matrix_columns] PROGMEM = { @@ -81,19 +77,6 @@ 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 - Key key = live_keys[key_addr]; - // If that entry is clear, look up the entry from the active keymap layers - if (key == Key_Transparent) { - key = lookupOnActiveLayer(key_addr); - } - return key; - } -#endif - static Key lookupOnActiveLayer(KeyAddr key_addr) { uint8_t layer = active_layer_keymap_[key_addr.toInt()]; return (*getKey)(layer, key_addr); @@ -115,28 +98,11 @@ class Layer_ { static void handleLayerKeyEvent(const KeyEvent &event); -#ifndef NDEPRECATED - DEPRECATED(LAYER_HANDLE_KEYMAP_KEYSWITCH_EVENT) - static void handleKeymapKeyswitchEvent(Key keymapEntry, uint8_t keyState); - - DEPRECATED(LAYER_EVENTHANDLER) - static Key eventHandler(Key mappedKey, KeyAddr key_addr, uint8_t keyState); -#endif - typedef Key(*GetKeyFunction)(uint8_t layer, KeyAddr key_addr); static GetKeyFunction getKey; 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) {} -#endif - static void updateActiveLayers(void); private: diff --git a/src/kaleidoscope_internal/deprecations.h b/src/kaleidoscope_internal/deprecations.h index 09748cd9..fa6e9402 100644 --- a/src/kaleidoscope_internal/deprecations.h +++ b/src/kaleidoscope_internal/deprecations.h @@ -29,33 +29,6 @@ /* Messages */ -#define _DEPRECATED_MESSAGE_LAYER_UPDATELIVECOMPOSITEKEYMAP __NL__ \ - "`Layer.updateLiveCompositeKeymap()` is deprecated.\n" __NL__ \ - "The 'live composite keymap' cache has been replaced with the\n" __NL__ \ - "'active keys' cache, which now represents the state of the active\n" __NL__ \ - "keys at any given time. It is probably not necessary to directly\n" __NL__ \ - "update that cache from a plugin, but if you need to, please use\n" __NL__ \ - "the `live_keys.activate(key_addr, key)` function instead.\n" __NL__ \ - "This function will be removed after 2021-08-01." - -#define _DEPRECATED_MESSAGE_LAYER_EVENTHANDLER __NL__ \ - "`Layer.eventHandler()` is deprecated.\n" __NL__ \ - "Please use `Layer.handleKeymapKeyswitchEvent()` instead.\n" __NL__ \ - "This function will be removed after 2021-08-01." - -#define _DEPRECATED_MESSAGE_LAYER_HANDLE_KEYMAP_KEYSWITCH_EVENT __NL__ \ - "`Layer.handleKeymapKeyswitchEvent()` is deprecated.\n" __NL__ \ - "Please use `Layer.handleLayerKeyEvent()` instead.\n" __NL__ \ - "This function will be removed after 2021-08-01." - -#define _DEPRECATED_MESSAGE_LAYER_LOOKUP __NL__ \ - "`Layer.lookup(key_addr)` is deprecated.\n" __NL__ \ - "Please use `Runtime.lookupKey(key_addr)` instead. Alternatively, if you\n" __NL__ \ - "need to look up the current keymap entry without regard to current live\n" __NL__ \ - "key state(s) (i.e. the `live_keys` array, which normally overrides the\n" __NL__ \ - "keymap), you can use `Layer.lookupOnActiveLayer(key_addr)`.\n" __NL__ \ - "This function will be removed after 2021-08-01." - #define _DEPRECATED_MESSAGE_HANDLE_KEYSWITCH_EVENT __NL__ \ "`handleKeyswitchEvent()` has been deprecated.\n" __NL__ \ "Please use `Runtime.handleKeyEvent()` instead.\n" __NL__ \