From 6c6b27d30c550918a55f7271adf43c3f548fc58e Mon Sep 17 00:00:00 2001 From: Michael Richters Date: Mon, 21 Feb 2022 23:53:17 -0600 Subject: [PATCH] Deprecate MouseKeys public variables Signed-off-by: Michael Richters --- .../src/kaleidoscope/plugin/MouseKeys.cpp | 7 ++- .../src/kaleidoscope/plugin/MouseKeys.h | 44 +++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/plugins/Kaleidoscope-MouseKeys/src/kaleidoscope/plugin/MouseKeys.cpp b/plugins/Kaleidoscope-MouseKeys/src/kaleidoscope/plugin/MouseKeys.cpp index ab8c291e..58a9455c 100644 --- a/plugins/Kaleidoscope-MouseKeys/src/kaleidoscope/plugin/MouseKeys.cpp +++ b/plugins/Kaleidoscope-MouseKeys/src/kaleidoscope/plugin/MouseKeys.cpp @@ -34,7 +34,10 @@ namespace kaleidoscope { namespace plugin { -uint8_t MouseKeys::speed = 1; +#ifndef NDEPRECATED +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +uint8_t MouseKeys::speed = 1; uint16_t MouseKeys::speedDelay = 1; uint8_t MouseKeys::accelSpeed = 1; @@ -42,6 +45,8 @@ uint16_t MouseKeys::accelDelay = 64; uint8_t MouseKeys::wheelSpeed = 1; uint16_t MouseKeys::wheelDelay = 50; +#pragma GCC diagnostic pop +#endif // ============================================================================= // Configuration functions diff --git a/plugins/Kaleidoscope-MouseKeys/src/kaleidoscope/plugin/MouseKeys.h b/plugins/Kaleidoscope-MouseKeys/src/kaleidoscope/plugin/MouseKeys.h index 6483c578..a1f5a1af 100644 --- a/plugins/Kaleidoscope-MouseKeys/src/kaleidoscope/plugin/MouseKeys.h +++ b/plugins/Kaleidoscope-MouseKeys/src/kaleidoscope/plugin/MouseKeys.h @@ -23,16 +23,60 @@ #include "kaleidoscope/key_defs.h" // for Key #include "kaleidoscope/plugin.h" // for Plugin +// ============================================================================= +// Deprecated MouseKeys code +#include "kaleidoscope_internal/deprecations.h" // for DEPRECATED + +#define _DEPRECATED_MESSAGE_MOUSEKEYS_SPEED \ + "Direct access to the `MouseKeys.speed` variable has been deprecated.\n" \ + "Please refer to the MouseKeys documentation for instructions on how to\n" \ + "configure the plugin.\n" + +#define _DEPRECATED_MESSAGE_MOUSEKEYS_SPEED_DELAY \ + "Direct access to the `MouseKeys.speedDelay` variable has been deprecated.\n" \ + "Please refer to the MouseKeys documentation for instructions on how to\n" \ + "configure the plugin.\n" + +#define _DEPRECATED_MESSAGE_MOUSEKEYS_ACCEL_SPEED \ + "Direct access to the `MouseKeys.accelSpeed` variable has been deprecated.\n" \ + "Please refer to the MouseKeys documentation for instructions on how to\n" \ + "configure the plugin.\n" + +#define _DEPRECATED_MESSAGE_MOUSEKEYS_ACCEL_DELAY \ + "Direct access to the `MouseKeys.accelDelay` variable has been deprecated.\n" \ + "Please refer to the MouseKeys documentation for instructions on how to\n" \ + "configure the plugin.\n" + +#define _DEPRECATED_MESSAGE_MOUSEKEYS_WHEEL_SPEED \ + "Direct access to the `MouseKeys.wheelSpeed` variable has been deprecated.\n" \ + "Please refer to the MouseKeys documentation for instructions on how to\n" \ + "configure the plugin.\n" + +#define _DEPRECATED_MESSAGE_MOUSEKEYS_WHEEL_DELAY \ + "Direct access to the `MouseKeys.wheelDelay` variable has been deprecated.\n" \ + "Please refer to the MouseKeys documentation for instructions on how to\n" \ + "configure the plugin.\n" + + namespace kaleidoscope { namespace plugin { class MouseKeys : public kaleidoscope::Plugin { public: + +#ifndef NDEPRECATED + DEPRECATED(MOUSEKEYS_SPEED) static uint8_t speed; + DEPRECATED(MOUSEKEYS_SPEED_DELAY) static uint16_t speedDelay; + DEPRECATED(MOUSEKEYS_ACCEL_SPEED) static uint8_t accelSpeed; + DEPRECATED(MOUSEKEYS_ACCEL_DELAY) static uint16_t accelDelay; + DEPRECATED(MOUSEKEYS_WHEEL_SPEED) static uint8_t wheelSpeed; + DEPRECATED(MOUSEKEYS_WHEEL_DELAY) static uint16_t wheelDelay; +#endif static void setWarpGridSize(uint8_t grid_size); static void setSpeedLimit(uint8_t speed_limit);