diff --git a/docs/UPGRADING.md b/docs/UPGRADING.md index 6071c48c..a3aa5d03 100644 --- a/docs/UPGRADING.md +++ b/docs/UPGRADING.md @@ -1052,6 +1052,10 @@ The following headers and names have changed: # Removed APIs +#### `::handleKeyswitchEvent(Key key, KeyAddr key_addr, uint8_t state)` + +The old master function for processing key "events" was removed on **2022-03-03**. Functions that were calling this function should be rewritten to call `kaleidoscope::Runtime.handleKeyEvent(KeyEvent event)` instead. + #### `Keyboard::pressKey(Key key, bool toggled_on)` This deprecated function was removed on **2022-03-03**. Its purpose was to handle rollover events for keys that include modifier flags, and that handling is now done elsewhere. Any code that called it should now simply call `Keyboard::pressKey(Key key)` instead, dropping the second argument. diff --git a/plugins/Kaleidoscope-Cycle/src/kaleidoscope/plugin/Cycle.cpp b/plugins/Kaleidoscope-Cycle/src/kaleidoscope/plugin/Cycle.cpp index 31a6211d..bbfad444 100644 --- a/plugins/Kaleidoscope-Cycle/src/kaleidoscope/plugin/Cycle.cpp +++ b/plugins/Kaleidoscope-Cycle/src/kaleidoscope/plugin/Cycle.cpp @@ -19,7 +19,6 @@ #include #include #include "kaleidoscope/keyswitch_state.h" -#include "kaleidoscope/key_events.h" namespace kaleidoscope { namespace plugin { diff --git a/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.cpp b/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.cpp index 9b4a6e43..2285a857 100644 --- a/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.cpp +++ b/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.cpp @@ -17,7 +17,6 @@ #include "Kaleidoscope-DynamicMacros.h" #include "Kaleidoscope-FocusSerial.h" #include "kaleidoscope/keyswitch_state.h" -#include "kaleidoscope/key_events.h" namespace kaleidoscope { namespace plugin { diff --git a/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/src/kaleidoscope/device/keyboardio/Model01.cpp b/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/src/kaleidoscope/device/keyboardio/Model01.cpp index 61681091..0fb2e820 100644 --- a/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/src/kaleidoscope/device/keyboardio/Model01.cpp +++ b/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/src/kaleidoscope/device/keyboardio/Model01.cpp @@ -19,7 +19,6 @@ #include "Arduino.h" // for PROGMEM #include "kaleidoscope/device/keyboardio/Model01.h" // for Model01LEDDriver... -#include "kaleidoscope/key_events.h" #include "kaleidoscope/driver/keyscanner/Base_Impl.h" #ifndef KALEIDOSCOPE_VIRTUAL_BUILD diff --git a/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/device/keyboardio/Model100.cpp b/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/device/keyboardio/Model100.cpp index f13b5fdd..ea0f2a8e 100644 --- a/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/device/keyboardio/Model100.cpp +++ b/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/device/keyboardio/Model100.cpp @@ -19,7 +19,6 @@ #include "Arduino.h" // for PROGMEM #include "kaleidoscope/device/keyboardio/Model100.h" // for Model100LEDDriver... -#include "kaleidoscope/key_events.h" #include "kaleidoscope/driver/keyscanner/Base_Impl.h" #include "Wire.h" diff --git a/plugins/Kaleidoscope-Leader/src/kaleidoscope/plugin/Leader.cpp b/plugins/Kaleidoscope-Leader/src/kaleidoscope/plugin/Leader.cpp index edad67b5..3e7c833c 100644 --- a/plugins/Kaleidoscope-Leader/src/kaleidoscope/plugin/Leader.cpp +++ b/plugins/Kaleidoscope-Leader/src/kaleidoscope/plugin/Leader.cpp @@ -19,7 +19,6 @@ #include #include "kaleidoscope/keyswitch_state.h" #include "kaleidoscope/keyswitch_state.h" -#include "kaleidoscope/key_events.h" #include "kaleidoscope/KeyEventTracker.h" namespace kaleidoscope { diff --git a/plugins/Kaleidoscope-Macros/src/kaleidoscope/plugin/Macros.cpp b/plugins/Kaleidoscope-Macros/src/kaleidoscope/plugin/Macros.cpp index 7cbc000b..f34c0271 100644 --- a/plugins/Kaleidoscope-Macros/src/kaleidoscope/plugin/Macros.cpp +++ b/plugins/Kaleidoscope-Macros/src/kaleidoscope/plugin/Macros.cpp @@ -17,7 +17,6 @@ #include "Kaleidoscope-Macros.h" #include "Kaleidoscope-FocusSerial.h" #include "kaleidoscope/keyswitch_state.h" -#include "kaleidoscope/key_events.h" // ============================================================================= // Default `macroAction()` function definitions diff --git a/plugins/Kaleidoscope-Macros/src/kaleidoscope/plugin/Macros.h b/plugins/Kaleidoscope-Macros/src/kaleidoscope/plugin/Macros.h index d6e2ad8d..b3ecf060 100644 --- a/plugins/Kaleidoscope-Macros/src/kaleidoscope/plugin/Macros.h +++ b/plugins/Kaleidoscope-Macros/src/kaleidoscope/plugin/Macros.h @@ -21,7 +21,6 @@ #include "kaleidoscope/plugin/Macros/MacroKeyDefs.h" #include "kaleidoscope/plugin/Macros/MacroSteps.h" #include "kaleidoscope/keyswitch_state.h" -#include "kaleidoscope/key_events.h" // ============================================================================= // Define this function in a Kaleidoscope sketch in order to trigger Macros. diff --git a/plugins/Kaleidoscope-OneShot/src/kaleidoscope/plugin/OneShot.cpp b/plugins/Kaleidoscope-OneShot/src/kaleidoscope/plugin/OneShot.cpp index 16e7c9ea..2b4bc94f 100644 --- a/plugins/Kaleidoscope-OneShot/src/kaleidoscope/plugin/OneShot.cpp +++ b/plugins/Kaleidoscope-OneShot/src/kaleidoscope/plugin/OneShot.cpp @@ -18,7 +18,6 @@ #include #include #include "kaleidoscope/keyswitch_state.h" -#include "kaleidoscope/key_events.h" #include "kaleidoscope/layers.h" namespace kaleidoscope { diff --git a/plugins/Kaleidoscope-OneShot/src/kaleidoscope/plugin/OneShot.h b/plugins/Kaleidoscope-OneShot/src/kaleidoscope/plugin/OneShot.h index dbafc29b..a8961991 100644 --- a/plugins/Kaleidoscope-OneShot/src/kaleidoscope/plugin/OneShot.h +++ b/plugins/Kaleidoscope-OneShot/src/kaleidoscope/plugin/OneShot.h @@ -19,7 +19,6 @@ #include "kaleidoscope/Runtime.h" #include -#include "kaleidoscope/key_events.h" #include "kaleidoscope/KeyAddrBitfield.h" // ---------------------------------------------------------------------------- diff --git a/plugins/Kaleidoscope-SpaceCadet/src/kaleidoscope/plugin/SpaceCadet.cpp b/plugins/Kaleidoscope-SpaceCadet/src/kaleidoscope/plugin/SpaceCadet.cpp index 4bdcb951..d377bd75 100644 --- a/plugins/Kaleidoscope-SpaceCadet/src/kaleidoscope/plugin/SpaceCadet.cpp +++ b/plugins/Kaleidoscope-SpaceCadet/src/kaleidoscope/plugin/SpaceCadet.cpp @@ -19,7 +19,6 @@ #include #include #include "kaleidoscope/keyswitch_state.h" -#include "kaleidoscope/key_events.h" //#include diff --git a/plugins/Kaleidoscope-Syster/src/kaleidoscope/plugin/Syster.cpp b/plugins/Kaleidoscope-Syster/src/kaleidoscope/plugin/Syster.cpp index 070e0245..59d42728 100644 --- a/plugins/Kaleidoscope-Syster/src/kaleidoscope/plugin/Syster.cpp +++ b/plugins/Kaleidoscope-Syster/src/kaleidoscope/plugin/Syster.cpp @@ -18,7 +18,6 @@ #include #include #include "kaleidoscope/keyswitch_state.h" -#include "kaleidoscope/key_events.h" #undef SYSTER diff --git a/src/Kaleidoscope.h b/src/Kaleidoscope.h index bf457698..6f18da6c 100644 --- a/src/Kaleidoscope.h +++ b/src/Kaleidoscope.h @@ -81,7 +81,8 @@ void setup(); #include "kaleidoscope/KeyAddr.h" #include "kaleidoscope/KeyEvent.h" -#include "kaleidoscope/key_events.h" +#include "kaleidoscope/key_defs.h" +#include "kaleidoscope/keyswitch_state.h" #include "kaleidoscope/layers.h" #include "kaleidoscope_internal/sketch_exploration/sketch_exploration.h" #include "kaleidoscope/macro_map.h" diff --git a/src/kaleidoscope/hooks.h b/src/kaleidoscope/hooks.h index cda1710e..58faed8e 100644 --- a/src/kaleidoscope/hooks.h +++ b/src/kaleidoscope/hooks.h @@ -30,9 +30,6 @@ class Key; // Forward declaration required to enable friend declarations // in class Hooks. class kaleidoscope_; -#ifndef NDEPRECATED -extern void handleKeyswitchEvent(kaleidoscope::Key mappedKey, KeyAddr key_addr, uint8_t keyState); -#endif namespace kaleidoscope { namespace plugin { @@ -70,12 +67,6 @@ class Hooks { friend class ::kaleidoscope::plugin::LEDControl; friend void ::kaleidoscope::sketch_exploration::pluginsExploreSketch(); -#ifndef NDEPRECATED - // ::handleKeyswitchEvent(...) calls Hooks::onKeyswitchEvent. - friend void ::handleKeyswitchEvent(kaleidoscope::Key mappedKey, - KeyAddr key_addr, uint8_t keyState); -#endif - private: // The following private functions are just to be called by classes diff --git a/src/kaleidoscope/key_events.cpp b/src/kaleidoscope/key_events.cpp deleted file mode 100644 index eae4a95b..00000000 --- a/src/kaleidoscope/key_events.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* Kaleidoscope - Firmware for computer input devices - * Copyright (C) 2013-2018 Keyboard.io, Inc. - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -#ifndef NDEPRECATED -#include "kaleidoscope/Runtime.h" -#include "kaleidoscope/LiveKeys.h" -#include "kaleidoscope/hooks.h" -#include "kaleidoscope/keyswitch_state.h" -#include "kaleidoscope/layers.h" -#include "kaleidoscope/event_handler_result.h" - -// Deprecated. See `Runtime.handleKeyEvent()` -void handleKeyswitchEvent(Key key, KeyAddr key_addr, uint8_t key_state) { - // Perhaps we should call deprecated plugin event handlers here? - auto result = kaleidoscope::Hooks::onKeyswitchEvent(key, key_addr, key_state); - if (result == kaleidoscope::EventHandlerResult::ABORT) - return; - if (keyIsPressed(key_state)) - kaleidoscope::Runtime.addToReport(key); -} -#endif diff --git a/src/kaleidoscope/key_events.h b/src/kaleidoscope/key_events.h deleted file mode 100644 index 3a0ade75..00000000 --- a/src/kaleidoscope/key_events.h +++ /dev/null @@ -1,74 +0,0 @@ -/* Kaleidoscope - Firmware for computer input devices - * Copyright (C) 2013-2018 Keyboard.io, Inc. - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -#pragma once -#include - -#include "kaleidoscope/driver/keyscanner/Base.h" -#include "kaleidoscope/device/device.h" -#include "kaleidoscope/key_defs.h" -#include "kaleidoscope/keyswitch_state.h" -#include "kaleidoscope/KeyAddr.h" - -// UnknownKeyswitchLocation represents an invalid (as default constructed) -// key address. Note: This is not a constexpr as it turned out -// that the compiler would instanciate it and store it in RAM if -// not made a temporary. -// -#define UnknownKeyswitchLocation KeyAddr(KeyAddr::invalid_state) - -// Conversely, if an injected event *is* tied to a physical keyswitch and should -// be resolved by the current keymap, code can use Key_NoKey on the injected event -// with a real key address - -// sending events to the computer -/* The event handling starts with the Scanner calling handleKeyswitchEvent() for - * every non-idle key in the matrix, and it is the task of this method to figure - * out what to do, it is the main entry point. Keys that were off in the - * previous scan cycle, and are still off now, are considered idle, and - * handleKeyswitchEvent() is *not* called on them. - * - * This function will iterate through an array of handler functions, and stop as - * soon as one of them signals that the event has been handled. To make it - * possible to inject synthetic events, one can call handleKeyswitchEvent from - * within a custom handler (making the event handling recursive), with a - * different keycode. - * - * This is useful for example for one-shot modifiers, where we would like to - * temporarily disable the one-shot functionality, and have them work as a - * normal modifier instead. In this case, the keymap would contain a key with - * OSM flags set, and the event handler would remove the OSM flags, and let the - * system handle the key as it would have, without the OSM flags. So we simply - * clear the flags, and call handleKeyswitchEvent again, with the modifier keycode - * as the first argument. This way, we could insert an event, and have the whole - * chain re-process it, instead of registering the keycode ourselves with HID - * ourselves. Injecting allows any and all custom handlers to have a chance, - * too. - * - * For this reason, the handleKeyswitchEvent receives four arguments: the mapped key - * (or Key_NoKey if we do not want to override what is in the keymap), the matrix - * address of the key, so we can look up the code for it, and the current and - * previous state of the key, so we can determine what the event is. The - * currentState may be flagged INJECTED, which signals that the event was - * injected, and is not a direct result of a keypress, coming from the scanner. - */ - -#ifndef NDEPRECATED - -DEPRECATED(HANDLE_KEYSWITCH_EVENT) -void handleKeyswitchEvent(Key mappedKey, kaleidoscope::Device::Props::KeyScannerProps::KeyAddr key_addr, uint8_t keyState); - -#endif diff --git a/src/kaleidoscope_internal/deprecations.h b/src/kaleidoscope_internal/deprecations.h index b5e31ddd..6024f206 100644 --- a/src/kaleidoscope_internal/deprecations.h +++ b/src/kaleidoscope_internal/deprecations.h @@ -29,11 +29,6 @@ /* Messages */ -#define _DEPRECATED_MESSAGE_HANDLE_KEYSWITCH_EVENT __NL__ \ - "`handleKeyswitchEvent()` has been deprecated.\n" __NL__ \ - "Please use `Runtime.handleKeyEvent()` instead.\n" __NL__ \ - "This function will be removed after 2021-08-01." - #define _DEPRECATED_MESSAGE_ON_KEYSWITCH_EVENT_V1 __NL__ \ "The `onKeyswitchEvent()` event handler is deprecated.\n" __NL__ \ "Please replace it with an `onKeyEvent()` handler. See the documentation\n" __NL__ \