Jelajahi Sumber

process_key_lock: clear entire key state in cancel_key_lock() (#26269)

cancel_key_lock() called UNSET_KEY_STATE(0x0), which expands to clearing
only bit 0 of key_state[0]. The lock state is a 256-bit map spread across
key_state[0..3], so every locked key other than keycode 0x00 stayed
latched after a cancel.

Zero all four words so cancel_key_lock() releases every locked key, as
its name and its public declaration in process_key_lock.h imply.
Arca Artem 2 bulan lalu
induk
melakukan
1d2f52e407
1 mengubah file dengan 5 tambahan dan 1 penghapusan
  1. 5 1
      quantum/process_keycode/process_key_lock.c

+ 5 - 1
quantum/process_keycode/process_key_lock.c

@@ -57,7 +57,11 @@ static inline uint16_t translate_keycode(uint16_t keycode) {
 
 void cancel_key_lock(void) {
     watching = false;
-    UNSET_KEY_STATE(0x0);
+    // Clear the full 256-bit state, otherwise every actually-locked key will still be latched.
+    key_state[0] = 0;
+    key_state[1] = 0;
+    key_state[2] = 0;
+    key_state[3] = 0;
 }
 
 bool process_key_lock(uint16_t *keycode, keyrecord_t *record) {