From db887e63d708925ad759e3504a6bc9ceef4aeb8f Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Sat, 14 May 2022 15:07:08 -0700 Subject: Enhancement and fixes of "Secure" feature (#16958) --- quantum/quantum.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'quantum/quantum.c') diff --git a/quantum/quantum.c b/quantum/quantum.c index b54b46760c..ac3e2d90b4 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -571,3 +571,16 @@ const char *get_u16_str(uint16_t curr_num, char curr_pad) { last_pad = curr_pad; return get_numeric_str(buf, sizeof(buf), curr_num, curr_pad); } + +#if defined(SECURE_ENABLE) +void secure_hook_quantum(secure_status_t secure_status) { + // If keys are being held when this is triggered, they may not be released properly + // this can result in stuck keys, mods and layers. To prevent that, manually + // clear these, when it is triggered. + + if (secure_status == SECURE_PENDING) { + clear_keyboard(); + layer_clear(); + } +} +#endif -- cgit v1.2.3