diff options
author | Gergely Nagy <algernon@madhouse-project.org> | 2016-11-19 11:32:09 +0100 |
---|---|---|
committer | Gergely Nagy <algernon@madhouse-project.org> | 2016-11-19 11:32:09 +0100 |
commit | ffa5b1e7ea6697acf9ebfcade1149031642f7870 (patch) | |
tree | 6ad5aa88a107c38631b87b61bbdf75803ea10c1c /quantum/quantum.c | |
parent | a06115df19a74d39b08758472b221e630c3680d3 (diff) |
Add a timeout to space-cadet shift.
When one holds a Space Cadet shift, to have it act as a shift, so that
mouse behaviour changes, when released without any other key pressed, it
still registers a paren. To remedy this, add a hold timeout: if the key
is held longer than TAPPING_TERM, it will not register the parens.
Fixes #884, with the side-effect of not being able to have parens
trigger the OS-side repeat anymore.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Diffstat (limited to 'quantum/quantum.c')
-rw-r--r-- | quantum/quantum.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/quantum/quantum.c b/quantum/quantum.c index 098312e6ef..2addcb670c 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -75,6 +75,7 @@ void reset_keyboard(void) { #endif static bool shift_interrupted[2] = {0, 0}; +static uint16_t scs_timer = 0; bool process_record_quantum(keyrecord_t *record) { @@ -283,6 +284,7 @@ bool process_record_quantum(keyrecord_t *record) { case KC_LSPO: { if (record->event.pressed) { shift_interrupted[0] = false; + scs_timer = timer_read (); register_mods(MOD_BIT(KC_LSFT)); } else { @@ -292,7 +294,7 @@ bool process_record_quantum(keyrecord_t *record) { shift_interrupted[1] = true; } #endif - if (!shift_interrupted[0]) { + if (!shift_interrupted[0] && timer_elapsed(scs_timer) < TAPPING_TERM) { register_code(LSPO_KEY); unregister_code(LSPO_KEY); } @@ -305,6 +307,7 @@ bool process_record_quantum(keyrecord_t *record) { case KC_RSPC: { if (record->event.pressed) { shift_interrupted[1] = false; + scs_timer = timer_read (); register_mods(MOD_BIT(KC_RSFT)); } else { @@ -314,7 +317,7 @@ bool process_record_quantum(keyrecord_t *record) { shift_interrupted[1] = true; } #endif - if (!shift_interrupted[1]) { + if (!shift_interrupted[1] && timer_elapsed(scs_timer) < TAPPING_TERM) { register_code(RSPC_KEY); unregister_code(RSPC_KEY); } |