From f5cecffab2a32db5db9177aab79226a00013db81 Mon Sep 17 00:00:00 2001 From: "Antoine R. Dumont" Date: Thu, 24 Jun 2021 04:24:31 +0200 Subject: keymap/ardumont: Fix substitute keycode reset step (#12675) It so happens that when releasing the control key prior to the main key (C-h, C-i, C-n, ...), the substituted keycode was continuously sent in a loop after that (even when releasing said key). The workaround so far was to type any other key to stop the loop. This commit fixes such behavior by resetting the substitution keycode sent when the ctrl released situation conditional is detected (and that the substitution keycode was on). --- keyboards/keyboardio/atreus/keymaps/ardumont/keymap.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'keyboards/keyboardio') diff --git a/keyboards/keyboardio/atreus/keymaps/ardumont/keymap.c b/keyboards/keyboardio/atreus/keymaps/ardumont/keymap.c index 3bde667ee9..6faabbc3ed 100644 --- a/keyboards/keyboardio/atreus/keymaps/ardumont/keymap.c +++ b/keyboards/keyboardio/atreus/keymaps/ardumont/keymap.c @@ -97,8 +97,7 @@ bool substitute_keycode(uint16_t keycode, keyrecord_t *record, uint8_t mod_state // Do not let QMK process the keycode further return false; } else { - // In case substitude_keycode is still being sent even after the release of - // the key + // In case substitude_keycode is still even after release of the key if (key_registered) { unregister_code(substitute_keycode); key_registered = false; @@ -106,6 +105,12 @@ bool substitute_keycode(uint16_t keycode, keyrecord_t *record, uint8_t mod_state return false; } } + } else { // ctrl got released + // In case substitude_keycode is still sent after release of the ctrl key + if (key_registered) { + unregister_code(substitute_keycode); + key_registered = false; + } } // Else, let QMK process the keycode as usual return true; -- cgit v1.2.1