shithub: riow

Download patch

ref: 29bc6afda314f82046952f3008ecb2db2f0a7ca5
parent: 99a6924ce4253c02ff0fffc67146da36efdde912
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Mon Sep 12 12:37:57 EDT 2022

don't send over any keys if Kmod4 was used

--- a/riow.c
+++ b/riow.c
@@ -320,8 +320,8 @@
 static void
 process(char *s)
 {
+	int n, o, oldmod;
 	char b[128], *p;
-	int n, o;
 	Rune r;
 
 	if(*s == 'K' && s[1] == 0)
@@ -339,6 +339,8 @@
 			break;
 		}
 
+		oldmod = mod;
+
 		if(*s == 'c' && (mod & Mmod4) != 0){
 			keyevent(r);
 			continue;
@@ -351,10 +353,8 @@
 				mod |= Mctl;
 			else if(r == Kshift)
 				mod |= Mshift;
-			else if(r >= '0' && r <= '9' && (mod & (Mshift|Mmod4)) == (Mshift|Mmod4)){
+			else if(r >= '0' && r <= '9' && (mod & (Mshift|Mmod4)) == (Mshift|Mmod4))
 				keyevent(r);
-				continue;
-			}
 		}else if(*s == 'K'){
 			if(r == Kmod4)
 				mod &= ~Mmod4;
@@ -363,6 +363,9 @@
 			else if(r == Kshift)
 				mod &= ~Mshift;
 		}
+
+		if((oldmod | mod) & Mmod4)
+			continue;
 
 		memmove(b+o, p, n);
 		o += n;