Clear oneshot after macro execution

master
Raheman Vaiya 4 years ago
parent dc46ddecc2
commit 0dd39a3606
  1. 22
      src/keyboard.c
  2. 22
      t/oneshot10.t
  3. 4
      t/run.sh
  4. 1
      t/test.conf

@ -288,7 +288,6 @@ static void kbd_execute_macro(struct keyboard *kbd,
}
}
kbd_reify_mods(kbd);
}
int kbd_execute_expression(struct keyboard *kbd, const char *exp)
@ -313,7 +312,7 @@ static long get_time_ms()
/*
* Here be tiny dragons.
*
* Code may be 0 in the event of a timeout.
* `code` may be 0 in the event of a timeout.
*
* The return value corresponds to a timeout before which the next invocation
* of kbd_process_key_event must take place. A return value of 0 permits the
@ -382,10 +381,7 @@ long kbd_process_key_event(struct keyboard *kbd,
kbd_process_keyseq(kbd, verbatim, &d.args[0].sequence, pressed);
if (pressed) {
oneshot_latch = 0;
kbd_clear_oneshots(kbd);
} else
if (!pressed)
kbd_reify_mods(kbd);
break;
@ -494,8 +490,10 @@ long kbd_process_key_event(struct keyboard *kbd,
kbd_execute_macro(kbd, macro);
timeout = MACRO_REPEAT_TIMEOUT;
} else
} else {
kbd_reify_mods(kbd);
active_macro = NULL;
}
break;
default:
@ -506,5 +504,15 @@ long kbd_process_key_event(struct keyboard *kbd,
if (pressed)
last_pressed_keycode = code;
if (!d.op ||
(pressed &&
(d.op == OP_KEYSEQ ||
d.op == OP_MACRO ||
d.op == OP_OVERLOAD))) {
oneshot_latch = 0;
kbd_clear_oneshots(kbd);
}
return timeout;
}

@ -1,11 +1,15 @@
l down
2 down
2 up
x down
x up
x down
x up
shift down
shift up
o down
o up
l up
a down
a up
control down
control up
b down
b up
n down
n up
x down
x up

@ -17,9 +17,9 @@ cd "$(dirname $0)"
sudo cp test.conf /etc/keyd
sudo pkill keyd
sleep .5s
sleep 1s
sudo ../bin/keyd -d || exit
sleep 2s
sleep 4s
if [ $# -ne 0 ]; then
test_files="$(echo "$@"|sed -e 's/ /.t /g').t"

@ -96,6 +96,7 @@ a = b
t = toggle(customshift)
b = a
x = macro(o n)
[capslock:C]
alt = layer(target)

Loading…
Cancel
Save