wvkbd

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

commit 00f288b6098d350f2f9f2d6622265ed74672d713
parent 9eee270dfd861af9b2f22c6525130cde0dd36f9d
Author: Maarten van Gompel <proycon@anaproy.nl>
Date:   Mon, 23 Aug 2021 18:58:29 +0200

When code_mod is used, allow for resetting modifiers or not (default is not to reset them)

Diffstat:
Mkeyboard.h | 7++++++-
Mlayout.mobile.h | 4++--
2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/keyboard.h b/keyboard.h @@ -48,6 +48,7 @@ struct key { * XKB keycodes are +8 */ struct layout *layout; //pointer back to the parent layout that holds this key const uint32_t code_mod; /* modifier to force when this key is pressed */ + bool reset_mod; /* reset modifiers when clicked */ //actual coordinates on the surface (pixels), will be computed automatically for all keys uint32_t x, y, w, h; @@ -170,7 +171,11 @@ kbd_press_key(struct kbd *kb, struct key *k, uint32_t time) { switch (k->type) { case Code: if (k->code_mod) { - zwp_virtual_keyboard_v1_modifiers(kb->vkbd, k->code_mod, 0, 0, 0); + if (k->reset_mod) { + zwp_virtual_keyboard_v1_modifiers(kb->vkbd, k->code_mod, 0, 0, 0); + } else { + zwp_virtual_keyboard_v1_modifiers(kb->vkbd, kb->mods ^ k->code_mod, 0, 0, 0); + } } else { zwp_virtual_keyboard_v1_modifiers(kb->vkbd, kb->mods, 0, 0, 0); } diff --git a/layout.mobile.h b/layout.mobile.h @@ -274,8 +274,8 @@ static struct key keys_special[] = { {"⇧", "⇧", 2.0, Mod, Shift}, {";", ":", 1.0, Code, KEY_SEMICOLON}, {"/", "?", 1.0, Code, KEY_SLASH}, - {"<", "«", 1.0, CodeMod, KEY_COMMA, 0, AltGr}, - {">", "»", 1.0, CodeMod, KEY_DOT, 0, AltGr}, + {"<", "«", 1.0, Code, KEY_COMMA, 0, AltGr}, + {">", "»", 1.0, Code, KEY_DOT, 0, AltGr}, {"¡", "¿", 1.0, Code, KEY_MENU}, {"", "", 1.0, Pad}, {"AGr", "AGr", 1.0, Mod, AltGr},