shithub: riscv

Download patch

ref: 4d59f9bd1a0051feaf9e52a2c10d6b05807c59f4
parent: c2c9562e3c2994d87f65ab09779190d1e7e09517
author: cinap_lenrek <[email protected]>
date: Sat Mar 17 17:27:07 EDT 2018

camv: fix display locking issues

--- a/sys/src/cmd/camv.c
+++ b/sys/src/cmd/camv.c
@@ -203,8 +203,8 @@
 		r = (Rectangle){subpt(p, q), addpt(p, q)};
 		lockdisplay(display);
 		draw(disp, r, i, nil, i->r.min);
-		flushimage(display, 1);
 		freeimage(i);
+		flushimage(display, 1);
 		unlockdisplay(display);
 	}
 	fprint(2, "readimage: %r\n");
@@ -233,11 +233,17 @@
 	threadcreate(resizethread, nil, mainstacksize);
 	proccreate(videoproc, nil, mainstacksize);
 	display->locking = 1;
+	flushimage(display, 1);
 	unlockdisplay(display);
-	while(readmouse(mc) >= 0){
+	while(recv(mc->c, &mc->Mouse) >= 0){
+		if(mc->buttons == 0)
+			continue;
+		lockdisplay(display);
 		if((mc->buttons & 4) != 0)
 			rmb();
 		else if((mc->buttons & 2) != 0)
 			mmb();
+		flushimage(display, 1);
+		unlockdisplay(display);
 	}
 }