]> git.lizzy.rs Git - plan9front.git/commitdiff
rio: avoid re-triggering clicks on resize/hide/unhide and send wctl when focus is...
authorcinap_lenrek <cinap_lenrek@felloff.net>
Sun, 25 Apr 2021 10:41:20 +0000 (12:41 +0200)
committercinap_lenrek <cinap_lenrek@felloff.net>
Sun, 25 Apr 2021 10:41:20 +0000 (12:41 +0200)
sys/src/cmd/rio/wind.c

index 6869cb8af218c6da24846a529b5f5711fda2fbb5..b74f8b8b244afb37990653428aac5c6eef53f7f7 100644 (file)
@@ -378,6 +378,7 @@ wresize(Window *w, Image *i)
        w->topped = ++topped;
        w->resized = TRUE;
        w->winnameread = FALSE;
+       w->mc.buttons = 0;      /* avoid re-triggering clicks on resize */
        w->mouse.counter++;
        w->wctlready = 1;
 }
@@ -1379,6 +1380,14 @@ wctlmesg(Window *w, int m, Rectangle r, void *p)
                        /* sync with input change from wcurrent()/wuncurrent() */
                        Channel *c = p;
                        input = recvp(c);
+
+                       /* when we lost input, release mouse buttons */
+                       if(w->mc.buttons){
+                               w->mc.buttons = 0;
+                               w->mouse.counter++;
+                       }
+                       w->wctlready = 1;
+
                        sendp(c, w);
                }
                if(w->i==nil || Dx(w->screenr)<=0)