From 9e0ca927f950d1d396e3f45f02e0a3e7dd5b0fff Mon Sep 17 00:00:00 2001 From: tengg Date: Wed, 22 Mar 2017 00:03:30 -0400 Subject: [PATCH 1/3] fixed a bug related to mod + Grave with combined ESC/Grave key This only applies to keymaps that has combined esc/grave. Here we call it theKEY. Think about the motion when we do shift + theKEY (typing ~), or CMD + theKEY (switching window on MAC). Based on the original code, we must do following sequence: press shift -> press theKEY -> release theKEY -> release shift. However, it is very possible and natural that we do this stroke sequence instead: press shift -> press theKEY -> release shift -> release theKEY. If we do the 2nd stroke sequence, the code will del_key(ESC) instead of (GRV) when we release theKEY. This caused some inconvenient issues and ghost typing. By adding a flag, this issue is eliminated and will not affect any other functions. --- keyboards/clueboard/keymaps/mac_optimized/keymap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/keyboards/clueboard/keymaps/mac_optimized/keymap.c b/keyboards/clueboard/keymaps/mac_optimized/keymap.c index 59f7ff24..bb1a5d3c 100644 --- a/keyboards/clueboard/keymaps/mac_optimized/keymap.c +++ b/keyboards/clueboard/keymaps/mac_optimized/keymap.c @@ -50,6 +50,7 @@ const uint16_t PROGMEM fn_actions[] = { void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { static uint8_t mods_pressed; + static bool mods_flag; switch (id) { case 0: @@ -62,6 +63,7 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { */ if (mods_pressed) { add_key(KC_GRV); + mod_flag = true; send_keyboard_report(); } else { add_key(KC_ESC); @@ -70,8 +72,9 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { } else { /* The key is being released. */ - if (mods_pressed) { + if (mod_flag) { del_key(KC_GRV); + mod_flag = false; send_keyboard_report(); } else { del_key(KC_ESC); From a89998b977ccb707767149c0fa4bbf614d4eefea Mon Sep 17 00:00:00 2001 From: tengg Date: Wed, 22 Mar 2017 00:28:59 -0400 Subject: [PATCH 2/3] fix typo --- keyboards/clueboard/keymaps/mac_optimized/keymap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/clueboard/keymaps/mac_optimized/keymap.c b/keyboards/clueboard/keymaps/mac_optimized/keymap.c index bb1a5d3c..bd9a76dc 100644 --- a/keyboards/clueboard/keymaps/mac_optimized/keymap.c +++ b/keyboards/clueboard/keymaps/mac_optimized/keymap.c @@ -49,7 +49,7 @@ const uint16_t PROGMEM fn_actions[] = { }; void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { - static uint8_t mods_pressed; + static uint8_t mod_pressed; static bool mods_flag; switch (id) { From 3cba7a43d976be973a4fe32a058b98f092f2e26e Mon Sep 17 00:00:00 2001 From: tengg Date: Wed, 22 Mar 2017 00:33:44 -0400 Subject: [PATCH 3/3] typo fixed --- keyboards/clueboard/keymaps/mac_optimized/keymap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keyboards/clueboard/keymaps/mac_optimized/keymap.c b/keyboards/clueboard/keymaps/mac_optimized/keymap.c index bd9a76dc..4a18e9a7 100644 --- a/keyboards/clueboard/keymaps/mac_optimized/keymap.c +++ b/keyboards/clueboard/keymaps/mac_optimized/keymap.c @@ -49,8 +49,8 @@ const uint16_t PROGMEM fn_actions[] = { }; void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { - static uint8_t mod_pressed; - static bool mods_flag; + static uint8_t mods_pressed; + static bool mod_flag; switch (id) { case 0: