about summary refs log tree commit diff
path: root/keyboard.h
diff options
context:
space:
mode:
authorMaarten van Gompel <proycon@anaproy.nl>2021-08-23 18:58:29 +0200
committerJohn Sullivan <jsullivan@csumb.edu>2021-10-19 23:12:01 -0700
commitc1636c927529140beb889a17f9c467be3b007be9 (patch)
tree3bc96f6e9a5731638f33d5e8eeb63380fc779575 /keyboard.h
parent71b812cb31720816bd73093c02e7dc17a0c49daf (diff)
downloadsuggpicker-c1636c927529140beb889a17f9c467be3b007be9.tar.gz
When code_mod is used, allow for resetting modifiers or not (default is not to reset them)
Diffstat (limited to 'keyboard.h')
-rw-r--r--keyboard.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/keyboard.h b/keyboard.h
index 10038cf..f5fd555 100644
--- 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);
 		}