summaryrefslogtreecommitdiff
path: root/sys/src
diff options
context:
space:
mode:
authorJacob Moody <moody@posixcafe.org>2023-01-28 10:30:00 +0000
committerJacob Moody <moody@posixcafe.org>2023-01-28 10:30:00 +0000
commit8188b4f4f0e07b6669e6ae3c6c1099af917eaab4 (patch)
tree01b9ba0ae1df1441ac5870d42e6810ad20d1b72c /sys/src
parentbd3c854f6022c48418ecd918fe921a9140d28f30 (diff)
rio: sync keyboard state with active window on switch
this addresses issues with stuck modifier keys when clicking off and on from vncv with a modifier held.
Diffstat (limited to 'sys/src')
-rw-r--r--sys/src/cmd/rio/rio.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/sys/src/cmd/rio/rio.c b/sys/src/cmd/rio/rio.c
index 322076f8c..9ed6a0a3d 100644
--- a/sys/src/cmd/rio/rio.c
+++ b/sys/src/cmd/rio/rio.c
@@ -392,6 +392,7 @@ keyboardtap(void*)
char *e;
char *watched;
Window *w, *cur;
+ static char keys[64];
threadsetname("keyboardtap");
enum { Awin, Actl, Afrom, Adev, Ato, Ainp, Awatch, NALT };
@@ -408,22 +409,28 @@ keyboardtap(void*)
cur = nil;
watched = nil;
+ keys[0] = 0;
for(;;)
switch(alt(alts)){
case Awin:
cur = w;
if(cur != nil){
alts[Ainp].c = cur->ck;
- if(tapseats[OREAD] == Tapoff)
- goto Reset;
- if(alts[Awatch].op == CHANSND)
- free(watched);
- watched = smprint("%c%d", Tapfocus, cur->id);
- alts[Awatch].op = CHANSND;
+ if(tapseats[OREAD] != Tapoff){
+ if(alts[Awatch].op == CHANSND)
+ free(watched);
+ watched = smprint("%c%d", Tapfocus, cur->id);
+ alts[Awatch].op = CHANSND;
+ }
}
if(alts[Ainp].op != CHANNOP || alts[Ato].op != CHANNOP)
free(s);
- goto Reset;
+ if(cur == nil)
+ goto Reset;
+ s = smprint("K%s", keys);
+ alts[Ainp].op = CHANSND;
+ alts[Ato].op = CHANNOP;
+ break;
case Actl:
e = tapctlmsg(ctl);
sendp(resptap, e);
@@ -444,6 +451,8 @@ keyboardtap(void*)
alts[Ainp].op = CHANSND;
break;
case Adev:
+ if(*s == 'k' || *s == 'K')
+ strcpy(keys, s+1);
if(tapseats[OWRITE] == Tapoff && cur == nil){
free(s);
break;