mirror of
https://github.com/jjsullivan5196/wvkbd.git
synced 2025-03-13 02:42:47 +01:00
When code_mod is used, allow for resetting modifiers or not (default is not to reset them)
This commit is contained in:
parent
9eee270dfd
commit
00f288b609
@ -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);
|
||||
}
|
||||
|
@ -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},
|
||||
|
Loading…
x
Reference in New Issue
Block a user