shithub: asif

Download patch

ref: a0974e00aa0a8bc99bfdf8355fb6277987ed5ae2
parent: 067c3d093f3c6b6292e5eeeb0fe6e6ff75c5950c
author: qwx <qwx@sciops.net>
date: Thu Mar 17 03:03:44 EDT 2022

client: don't continually flip the same node while holding the mouse

--- a/path/client.c
+++ b/path/client.c
@@ -23,7 +23,7 @@
 {
 	Rune r;
 	Mouse m;
-	Node *n;
+	Node *n, *p;
 
 	enum{
 		Aresize,
@@ -37,6 +37,7 @@
 		[Akbd] {kc->c, &r, CHANRCV},
 		[Aend] {nil, nil, CHANEND},
 	};
+	p = nil;
 	for(;;){
 		switch(alt(a)){
 		case Aresize:
@@ -45,14 +46,12 @@
 			resetdrw();
 			break;
 		case Amouse:
-			m = mc->Mouse;
-			if(m.buttons == 0)
+			if(mc->buttons == 0)
 				break;
-			if((n = scrselect(m.xy)) != nil){
-				if(m.buttons & 4)
-					n->blocked ^= 1;
-				mouseinput(n, m);
-			}
+			if((n = scrselect(m.xy)) != nil
+			&& mc->buttons != m.buttons && p != n)
+				mouseinput(n, mc->Mouse);
+			p = n;
 			updatedrw();
 			break;
 		case Akbd:
@@ -62,6 +61,7 @@
 			keyinput(r);
 			break;
 		}
+		m = mc->Mouse;
 	}
 }
 
@@ -99,7 +99,6 @@
 	fmtinstall('R', Rfmt);
 	initfs();
 	initmap();
-	initgrid();
 	initdrw();
 	if((kc = initkeyboard(nil)) == nil)
 		sysfatal("initkeyboard: %r");