Skip to content

Commit

Permalink
Fix not ignored key repeating when tapping
Browse files Browse the repository at this point in the history
Fixes #3.
  • Loading branch information
zsugabubus committed Dec 11, 2019
1 parent 5ed0069 commit 8ec08ce
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions k2k.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,9 @@ should_check_typing(void) {
static void
write_event(struct input_event const *e) {
if (e->type == EV_KEY) {
#if 0
dbgprintf("< Code: %3d Value: %d", e->code, e->value);
#endif
matrix[e->code] = e->value;
if (should_check_typing()) {
if (!is_typing && e->value == EVENT_VALUE_KEYUP && !key_ismod(e->code)) {
Expand Down Expand Up @@ -319,7 +322,7 @@ main(void) {
}

#if 0
dbgprintf("Code: %3d Value: %d", e.code, e.value);
dbgprintf(" > Code: %3d Value: %d", e.code, e.value);
#endif

for (i = 0; i < ARRAY_LEN(MAP_RULES); ++i) {
Expand Down Expand Up @@ -380,17 +383,17 @@ main(void) {
/* Do nothing. */
break;
case -1:
/* Always ignore if we haven't decided what key it
* should be. */
ignore = 1;

/* Do not repeat this key. */
if (v->repeat_key == KEY_RESERVED) {
ignore = 1;
if (v->repeat_key == KEY_RESERVED)
continue;
}

/* Wait for more key repeats. */
if (v->curr_delay-- > 0) {
ignore = 1;
if (v->curr_delay-- > 0)
continue;
}

/* Timeout reached, act as repeat key. */
dbgprintf("Tap rule #%d: Repeated.", i);
Expand Down

0 comments on commit 8ec08ce

Please sign in to comment.