shithub: fplay

Download patch

ref: d4973711223b25f7d2e70d2739c81257e28f3a14
parent: 71b0c44a7b2d2b878ba521bffb2f550c9b4e0550
author: qwx <qwx@sciops.net>
date: Thu Apr 15 13:09:54 EDT 2021

properly initialize mouse state

--- a/fplay.c
+++ b/fplay.c
@@ -464,6 +464,7 @@
 		sysfatal("initkeyboard: %r");
 	if(mc = initmouse(nil, screen), mc == nil)
 		sysfatal("initmouse: %r");
+	mo.xy = ZP;
 	col[Csamp] = eallocimage(Rect(0,0,1,1), 1, 0x440000FF);
 	col[Cft] = eallocimage(Rect(0,0,1,1), 1, 0x660000FF);
 	col[Cline] = eallocimage(Rect(0,0,1,1), 1, 0x884400FF);
@@ -496,6 +497,8 @@
 			mo = mc->Mouse;
 			break;
 		case 1:
+			if(eqpt(mo.xy, ZP))
+				mo = mc->Mouse;
 			switch(mc->buttons){
 			case 0: if(dx != 0 || dy != 0) redrawbg(Rzoom); dx = dy = 0; break;
 			case 1: setpos(); break;