浏览代码

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 <fauxpark@gmail.com>

Co-authored-by: Ryan <fauxpark@gmail.com>
Joel Challis 2 年之前
父节点
当前提交
ec2414c074
共有 4 个文件被更改,包括 25 次插入14 次删除
  1. 6 6
      docs/feature_secure.md
  2. 4 4
      quantum/process_keycode/process_secure.c
  3. 10 4
      quantum/quantum_keycodes.h
  4. 5 0
      quantum/quantum_keycodes_legacy.h

+ 6 - 6
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
 

+ 4 - 4
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;
         }

+ 10 - 4
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)

+ 5 - 0
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.")