shithub: pplay

Download patch

ref: 81e01f77365442ee2434e6d9a0d8af88b83bdfe7
parent: 5e16a3c98400a0f72a541d9a0cad446449ff3e3b
author: qwx <qwx@sciops.net>
date: Thu Apr 15 12:51:29 EDT 2021

properly initialize mouse state

--- a/pplay.c
+++ b/pplay.c
@@ -146,6 +146,7 @@
 		sysfatal("initkeyboard: %r");
 	if((mc = initmouse(nil, screen)) == nil)
 		sysfatal("initmouse: %r");
+	mo.xy = ZP;
 	Alt a[] = {
 		{mc->resizec, nil, CHANRCV},
 		{mc->c, &mc->Mouse, CHANRCV},
@@ -163,6 +164,8 @@
 			redraw(1);
 			break;
 		case 1:
+			if(eqpt(mo.xy, ZP))
+				mo = mc->Mouse;
 			switch(mc->buttons){
 			case 1: setofs(mc->xy.x - screen->r.min.x); break;
 			case 2: setloop(mc->xy.x - screen->r.min.x); break;