wvkbd

git clone https://git.tarina.org/wvkbd
Log | Files | Refs | README | LICENSE

commit e58e63f2da4c4b91da52c1eb9402e7fca3799f48
parent 9e4cf691377930e230c11ab4824165d86bf148cd
Author: Stacy Harper <contact@stacyharper.net>
Date:   Mon, 23 Aug 2021 15:55:15 +0200

Remove dedicated CodeMod

Diffstat:
Mkeyboard.h | 23+++++++++--------------
1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/keyboard.h b/keyboard.h @@ -13,7 +13,6 @@ enum key_type { EndRow, Last, Compose, - CodeMod, Copy, }; @@ -170,20 +169,12 @@ void kbd_press_key(struct kbd *kb, struct key *k, uint32_t time) { uint8_t mods_before; switch (k->type) { - case CodeMod: - mods_before = kb->mods; - - kb->mods ^= k->code_mod; - kb->last_press = k; - kbd_draw_key(kb, k, true); - zwp_virtual_keyboard_v1_modifiers(kb->vkbd, kb->mods, 0, 0, 0); - zwp_virtual_keyboard_v1_key(kb->vkbd, time, kb->last_press->code, - WL_KEYBOARD_KEY_STATE_PRESSED); - - kb->mods = mods_before; - zwp_virtual_keyboard_v1_modifiers(kb->vkbd, kb->mods, 0, 0, 0); - break; case Code: + if (k->code_mod) { + mods_before = kb->mods; + kb->mods = k->code_mod; + zwp_virtual_keyboard_v1_modifiers(kb->vkbd, kb->mods, 0, 0, 0); + } if (compose == 1) { if (k->layout) { compose++; @@ -204,6 +195,10 @@ kbd_press_key(struct kbd *kb, struct key *k, uint32_t time) { compose++; } } + if (k->code_mod) { + kb->mods = mods_before; + zwp_virtual_keyboard_v1_modifiers(kb->vkbd, kb->mods, 0, 0, 0); + } break; case Mod: kb->mods ^= k->code;