shithub: plan9front

Download patch

ref: 6b4b8e405ae17d5004085df03d166cddcc99c11b
parent: e0cf0261d0f81eb1c54c4d4a7636c27de4b00d36
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Apr 25 06:41:20 EDT 2021

rio: avoid re-triggering clicks on resize/hide/unhide and send wctl when focus is lost

--- a/sys/src/cmd/rio/wind.c	Sun Apr 25 06:16:40 2021
+++ b/sys/src/cmd/rio/wind.c	Sun Apr 25 06:41:20 2021
@@ -378,6 +378,7 @@
 	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 @@
 			/* 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)