diff options
| author | tmk <nobody@nowhere> | 2013-09-18 15:02:44 +0900 |
|---|---|---|
| committer | tmk <nobody@nowhere> | 2013-09-18 15:02:44 +0900 |
| commit | 4d0b3aace09e26b92ae207f94cf889878e709b35 (patch) | |
| tree | 4eb9c5638a5ee3cb9bde782f7b515c08447832d6 /common/action_tapping.c | |
| parent | c7faa51ee843198c1b6a1dfeb0f1842c4e3ea0e6 (diff) | |
| download | qmk_firmware-4d0b3aace09e26b92ae207f94cf889878e709b35.tar.gz qmk_firmware-4d0b3aace09e26b92ae207f94cf889878e709b35.zip | |
Fix Tapping: release of a key pressed before tap
- immediately process release event of a key pressed before tapping
Diffstat (limited to 'common/action_tapping.c')
| -rw-r--r-- | common/action_tapping.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/common/action_tapping.c b/common/action_tapping.c index a6292535e..542949ddd 100644 --- a/common/action_tapping.c +++ b/common/action_tapping.c | |||
| @@ -27,9 +27,7 @@ static uint8_t waiting_buffer_tail = 0; | |||
| 27 | static bool process_tapping(keyrecord_t *record); | 27 | static bool process_tapping(keyrecord_t *record); |
| 28 | static bool waiting_buffer_enq(keyrecord_t record); | 28 | static bool waiting_buffer_enq(keyrecord_t record); |
| 29 | static void waiting_buffer_clear(void); | 29 | static void waiting_buffer_clear(void); |
| 30 | #if TAPPING_TERM >= 500 | ||
| 31 | static bool waiting_buffer_typed(keyevent_t event); | 30 | static bool waiting_buffer_typed(keyevent_t event); |
| 32 | #endif | ||
| 33 | static bool waiting_buffer_has_anykey_pressed(void); | 31 | static bool waiting_buffer_has_anykey_pressed(void); |
| 34 | static void waiting_buffer_scan_tap(void); | 32 | static void waiting_buffer_scan_tap(void); |
| 35 | static void debug_tapping_key(void); | 33 | static void debug_tapping_key(void); |
| @@ -109,6 +107,13 @@ bool process_tapping(keyrecord_t *keyp) | |||
| 109 | return false; | 107 | return false; |
| 110 | } | 108 | } |
| 111 | #endif | 109 | #endif |
| 110 | /* release a key pressed before tapping */ | ||
| 111 | else if (!event.pressed && !waiting_buffer_typed(event)) { | ||
| 112 | /* Unexpected repeating occurs unless this event is processed immedately. */ | ||
| 113 | debug("Tapping: release a key pressed before tapping\n"); | ||
| 114 | process_action(keyp); | ||
| 115 | return true; | ||
| 116 | } | ||
| 112 | else { | 117 | else { |
| 113 | // set interrupted flag when other key preesed during tapping | 118 | // set interrupted flag when other key preesed during tapping |
| 114 | if (event.pressed) { | 119 | if (event.pressed) { |
| @@ -289,7 +294,6 @@ void waiting_buffer_clear(void) | |||
| 289 | waiting_buffer_tail = 0; | 294 | waiting_buffer_tail = 0; |
| 290 | } | 295 | } |
| 291 | 296 | ||
| 292 | #if TAPPING_TERM >= 500 | ||
| 293 | bool waiting_buffer_typed(keyevent_t event) | 297 | bool waiting_buffer_typed(keyevent_t event) |
| 294 | { | 298 | { |
| 295 | for (uint8_t i = waiting_buffer_tail; i != waiting_buffer_head; i = (i + 1) % WAITING_BUFFER_SIZE) { | 299 | for (uint8_t i = waiting_buffer_tail; i != waiting_buffer_head; i = (i + 1) % WAITING_BUFFER_SIZE) { |
| @@ -299,7 +303,6 @@ bool waiting_buffer_typed(keyevent_t event) | |||
| 299 | } | 303 | } |
| 300 | return false; | 304 | return false; |
| 301 | } | 305 | } |
| 302 | #endif | ||
| 303 | 306 | ||
| 304 | bool waiting_buffer_has_anykey_pressed(void) | 307 | bool waiting_buffer_has_anykey_pressed(void) |
| 305 | { | 308 | { |
