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 | |
| parent | a06115df19a74d39b08758472b221e630c3680d3 (diff) | |
| download | qmk_firmware-ffa5b1e7ea6697acf9ebfcade1149031642f7870.tar.gz qmk_firmware-ffa5b1e7ea6697acf9ebfcade1149031642f7870.zip | |
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')
| -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 098312e6e..2addcb670 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c | |||
| @@ -75,6 +75,7 @@ void reset_keyboard(void) { | |||
| 75 | #endif | 75 | #endif |
| 76 | 76 | ||
| 77 | static bool shift_interrupted[2] = {0, 0}; | 77 | static bool shift_interrupted[2] = {0, 0}; |
| 78 | static uint16_t scs_timer = 0; | ||
| 78 | 79 | ||
| 79 | bool process_record_quantum(keyrecord_t *record) { | 80 | bool process_record_quantum(keyrecord_t *record) { |
| 80 | 81 | ||
| @@ -283,6 +284,7 @@ bool process_record_quantum(keyrecord_t *record) { | |||
| 283 | case KC_LSPO: { | 284 | case KC_LSPO: { |
| 284 | if (record->event.pressed) { | 285 | if (record->event.pressed) { |
| 285 | shift_interrupted[0] = false; | 286 | shift_interrupted[0] = false; |
| 287 | scs_timer = timer_read (); | ||
| 286 | register_mods(MOD_BIT(KC_LSFT)); | 288 | register_mods(MOD_BIT(KC_LSFT)); |
| 287 | } | 289 | } |
| 288 | else { | 290 | else { |
| @@ -292,7 +294,7 @@ bool process_record_quantum(keyrecord_t *record) { | |||
| 292 | shift_interrupted[1] = true; | 294 | shift_interrupted[1] = true; |
| 293 | } | 295 | } |
| 294 | #endif | 296 | #endif |
| 295 | if (!shift_interrupted[0]) { | 297 | if (!shift_interrupted[0] && timer_elapsed(scs_timer) < TAPPING_TERM) { |
| 296 | register_code(LSPO_KEY); | 298 | register_code(LSPO_KEY); |
| 297 | unregister_code(LSPO_KEY); | 299 | unregister_code(LSPO_KEY); |
| 298 | } | 300 | } |
| @@ -305,6 +307,7 @@ bool process_record_quantum(keyrecord_t *record) { | |||
| 305 | case KC_RSPC: { | 307 | case KC_RSPC: { |
| 306 | if (record->event.pressed) { | 308 | if (record->event.pressed) { |
| 307 | shift_interrupted[1] = false; | 309 | shift_interrupted[1] = false; |
| 310 | scs_timer = timer_read (); | ||
| 308 | register_mods(MOD_BIT(KC_RSFT)); | 311 | register_mods(MOD_BIT(KC_RSFT)); |
| 309 | } | 312 | } |
| 310 | else { | 313 | else { |
| @@ -314,7 +317,7 @@ bool process_record_quantum(keyrecord_t *record) { | |||
| 314 | shift_interrupted[1] = true; | 317 | shift_interrupted[1] = true; |
| 315 | } | 318 | } |
| 316 | #endif | 319 | #endif |
| 317 | if (!shift_interrupted[1]) { | 320 | if (!shift_interrupted[1] && timer_elapsed(scs_timer) < TAPPING_TERM) { |
| 318 | register_code(RSPC_KEY); | 321 | register_code(RSPC_KEY); |
| 319 | unregister_code(RSPC_KEY); | 322 | unregister_code(RSPC_KEY); |
| 320 | } | 323 | } |
