From ec2414c0742277488adf83d26451e07d0e0402de Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Tue, 25 Oct 2022 22:59:17 +0100 Subject: Deprecate `SECURE_*` keycodes for `QK_SECURE_*` (#18847) * Deprecate SECURE_* keycodes for QK_SECURE_* * Update keycode process * Update process_secure.c * Apply suggestions from code review Co-authored-by: Ryan Co-authored-by: Ryan --- docs/feature_secure.md | 12 ++++++------ quantum/process_keycode/process_secure.c | 8 ++++---- quantum/quantum_keycodes.h | 14 ++++++++++---- quantum/quantum_keycodes_legacy.h | 5 +++++ 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/docs/feature_secure.md b/docs/feature_secure.md index ee774b05a8..eaa2b601ae 100644 --- a/docs/feature_secure.md +++ b/docs/feature_secure.md @@ -26,12 +26,12 @@ SECURE_ENABLE = yes ## Keycodes -| Key | Description | -|------------------|--------------------------------------------------------------------------------| -| `SECURE_LOCK` | Revert back to a locked state | -| `SECURE_UNLOCK` | Forces unlock without performing a unlock sequence | -| `SECURE_TOGGLE` | Toggle directly between locked and unlock without performing a unlock sequence | -| `SECURE_REQUEST` | Request that user perform the unlock sequence | +| Key |Aliases | Description | +|---------------------|---------|--------------------------------------------------------------------------------| +| `QK_SECURE_LOCK` |`SE_LOCK`| Revert back to a locked state | +| `QK_SECURE_UNLOCK` |`SE_UNLK`| Forces unlock without performing a unlock sequence | +| `QK_SECURE_TOGGLE` |`SE_TOGG`| Toggle directly between locked and unlock without performing a unlock sequence | +| `QK_SECURE_REQUEST` |`SE_REQ` | Request that user perform the unlock sequence | ## Configuration diff --git a/quantum/process_keycode/process_secure.c b/quantum/process_keycode/process_secure.c index 3224104c99..894051fb33 100644 --- a/quantum/process_keycode/process_secure.c +++ b/quantum/process_keycode/process_secure.c @@ -23,19 +23,19 @@ bool preprocess_secure(uint16_t keycode, keyrecord_t *record) { bool process_secure(uint16_t keycode, keyrecord_t *record) { #ifndef SECURE_DISABLE_KEYCODES if (!record->event.pressed) { - if (keycode == SECURE_LOCK) { + if (keycode == QK_SECURE_LOCK) { secure_lock(); return false; } - if (keycode == SECURE_UNLOCK) { + if (keycode == QK_SECURE_UNLOCK) { secure_unlock(); return false; } - if (keycode == SECURE_TOGGLE) { + if (keycode == QK_SECURE_TOGGLE) { secure_is_locked() ? secure_unlock() : secure_lock(); return false; } - if (keycode == SECURE_REQUEST) { + if (keycode == QK_SECURE_REQUEST) { secure_request_unlock(); return false; } diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h index 8689b913ed..c5b9342b17 100644 --- a/quantum/quantum_keycodes.h +++ b/quantum/quantum_keycodes.h @@ -598,10 +598,10 @@ enum quantum_keycodes { QK_MAKE, QK_REBOOT, - SECURE_LOCK, - SECURE_UNLOCK, - SECURE_TOGGLE, - SECURE_REQUEST, + QK_SECURE_LOCK, + QK_SECURE_UNLOCK, + QK_SECURE_TOGGLE, + QK_SECURE_REQUEST, QK_CAPS_WORD_TOGGLE, @@ -857,6 +857,12 @@ enum quantum_keycodes { #define KO_ON QK_KEY_OVERRIDE_ON #define KO_OFF QK_KEY_OVERRIDE_OFF +// Secure +#define SE_LOCK QK_SECURE_LOCK +#define SE_UNLK QK_SECURE_UNLOCK +#define SE_TOGG QK_SECURE_TOGGLE +#define SE_REQ QK_SECURE_REQUEST + // Swap Hands #define SH_T(kc) (QK_SWAP_HANDS | (kc)) #define SH_TG (QK_SWAP_HANDS | OP_SH_TOGGLE) diff --git a/quantum/quantum_keycodes_legacy.h b/quantum/quantum_keycodes_legacy.h index f53b8ef72a..652aaaa9a8 100644 --- a/quantum/quantum_keycodes_legacy.h +++ b/quantum/quantum_keycodes_legacy.h @@ -84,6 +84,11 @@ #define JS_BUTTON30 QK_JOYSTICK_BUTTON_30 #define JS_BUTTON31 QK_JOYSTICK_BUTTON_31 +#define SECURE_LOCK QK_SECURE_LOCK +#define SECURE_UNLOCK QK_SECURE_UNLOCK +#define SECURE_TOGGLE QK_SECURE_TOGGLE +#define SECURE_REQUEST QK_SECURE_REQUEST + #define TERM_ON _Static_assert(false, "The Terminal feature has been removed from QMK. Please remove use of TERM_ON/TERM_OFF from your keymap.") #define TERM_OFF _Static_assert(false, "The Terminal feature has been removed from QMK.. Please remove use of TERM_ON/TERM_OFF from your keymap.") // #define RESET _Static_assert(false, "The RESET keycode has been removed from QMK.. Please remove use from your keymap.") -- cgit v1.2.3