mirror of
https://github.com/firewalkwithm3/qmk_firmware.git
synced 2024-11-23 03:50:28 +08:00
92a61aa0cd
Co-authored-by: Drashna Jaelre <drashna@live.com> Co-authored-by: Stefan Kerkmann <karlk90@pm.me>
39 lines
1,009 B
C
39 lines
1,009 B
C
// Copyright 2022 QMK
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#include "secure.h"
|
|
#include "process_secure.h"
|
|
#include "quantum_keycodes.h"
|
|
|
|
bool preprocess_secure(uint16_t keycode, keyrecord_t *record) {
|
|
if (secure_is_unlocking()) {
|
|
if (!record->event.pressed) {
|
|
secure_keypress_event(record->event.key.row, record->event.key.col);
|
|
}
|
|
|
|
// Normal keypresses should be disabled until the sequence is completed
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
bool process_secure(uint16_t keycode, keyrecord_t *record) {
|
|
#ifndef SECURE_DISABLE_KEYCODES
|
|
if (!record->event.pressed) {
|
|
if (keycode == SECURE_LOCK) {
|
|
secure_lock();
|
|
return false;
|
|
}
|
|
if (keycode == SECURE_UNLOCK) {
|
|
secure_unlock();
|
|
return false;
|
|
}
|
|
if (keycode == SECURE_TOGGLE) {
|
|
secure_is_locked() ? secure_unlock() : secure_lock();
|
|
return false;
|
|
}
|
|
}
|
|
#endif
|
|
return true;
|
|
} |