~ruther/dwl

4c78ea915aa1fbf807a554c533f97c28cf26d9b8 — Rutherther 6 days ago 717ee61 v0.10-dev/patched-keycodes
mark keys consumed before running keybinding functions

keybinding() and modekeybinding() ran the bound function before
keypress() set consumed[], so a binding that changed focus (e.g.
focusstack) sent the held key to the newly focused client in the
enter event, while its release was later swallowed as consumed.
The client then kept repeating the key indefinitely.
1 files changed, 2 insertions(+), 0 deletions(-)

M dwl.c
M dwl.c => dwl.c +2 -0
@@ 2433,6 2433,7 @@ keybinding(uint32_t mods, xkb_keycode_t keycode)
	for (k = keys; k < END(keys); k++) {
		if (CLEANMASK(mods) == CLEANMASK(k->mod)
				&& keycode == k->keycode && k->func) {
			consumed[keycode - 8] = 1;
			k->func(&k->arg);
			return 1;
		}


@@ 2455,6 2456,7 @@ modekeybinding(uint32_t mods, xkb_keycode_t keycode)
		k = &mk->key;
		if (CLEANMASK(mods) == CLEANMASK(k->mod) &&
				keycode == k->keycode && k->func) {
			consumed[keycode - 8] = 1;
			k->func(&k->arg);
			handled = 1;
		}