code: drawterm

Download patch

ref: 1baf2ac12262f875e17a1c4d6786c55cbe6d99a4
parent: e0f03e16cebe2bbbcca5aeb16ddf8e2000ca59d3
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Mon Feb 28 15:11:34 EST 2022

wayland: reset key mod state when leaving the window, do not repeat key mods (fixes Shift+Mouse)

--- a/gui-wl/wl-cb.c
+++ b/gui-wl/wl-cb.c
@@ -170,6 +170,13 @@
 static void
 keyboard_leave (void *data, struct wl_keyboard *keyboard, uint32_t serial, struct wl_surface *surface)
 {
+	kbdkey(Kshift, 0);
+	kbdkey(Kctl, 0);
+	kbdkey(Kalt, 0);
+	qlock(&repeatstate.lk);
+	repeatstate.active = 0;
+	repeatstate.key = 0;
+	qunlock(&repeatstate.lk);
 }
 
 static void
@@ -177,6 +184,7 @@
 {
 	Wlwin *wl;
 	uint32_t utf32;
+	int repeat;
 
 	wl = data;
 	xkb_keysym_t keysym = xkb_state_key_get_one_sym(wl->xkb_state, key+8);
@@ -229,6 +237,7 @@
 	if(utf32 == 0)
 		return;
 
+	repeat = state && utf32 != Kctl && utf32 != Kshift && utf32 != Kalt;
 	if(xkb_state_mod_name_is_active(wl->xkb_state, XKB_MOD_NAME_CTRL, XKB_STATE_MODS_EFFECTIVE) > 0)
 	if(utf32 >= 'a' && utf32 <= 'z')
 		utf32 -= ('a' - 1);
@@ -235,7 +244,7 @@
 
 	kbdkey(utf32, state);
 	qlock(&repeatstate.lk);
-	repeatstate.active = state;
+	repeatstate.active = repeat;
 	repeatstate.keytime = time;
 	repeatstate.key = utf32;
 	qunlock(&repeatstate.lk);