diff options
author | tengg <tengg@users.noreply.github.com> | 2017-03-22 05:03:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-22 05:03:30 +0100 |
commit | 9e0ca927f950d1d396e3f45f02e0a3e7dd5b0fff (patch) | |
tree | 78883bca7dd8fdae1621115f47b018e92ccb2c89 /keyboards | |
parent | c36a4496eb190c72c492000f38ab4e98a3681fe4 (diff) | |
download | qmk_firmware-9e0ca927f950d1d396e3f45f02e0a3e7dd5b0fff.tar.gz qmk_firmware-9e0ca927f950d1d396e3f45f02e0a3e7dd5b0fff.tar.xz |
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.
Diffstat (limited to 'keyboards')
-rw-r--r-- | keyboards/clueboard/keymaps/mac_optimized/keymap.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/keyboards/clueboard/keymaps/mac_optimized/keymap.c b/keyboards/clueboard/keymaps/mac_optimized/keymap.c index 59f7ff243..bb1a5d3cb 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); |