Skip to content

Commit

Permalink
Deprecate SECURE_* keycodes for QK_SECURE_* (#18847)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
zvecr and fauxpark authored Oct 25, 2022
1 parent 812001d commit ec2414c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 14 deletions.
12 changes: 6 additions & 6 deletions docs/feature_secure.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions quantum/process_keycode/process_secure.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
14 changes: 10 additions & 4 deletions quantum/quantum_keycodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand Down Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions quantum/quantum_keycodes_legacy.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.")

0 comments on commit ec2414c

Please sign in to comment.