shithub: riscv

Download patch

ref: 0fcab2a6e8896ba99c935a9feee798d06ed8fc3b
parent: d11ca3b545a69c957f8ab7f019d7f373afe19e57
author: phil9 <telephil9@gmail.com>
date: Tue May 7 06:43:36 EDT 2024

vcrop: fix image panning

--- a/sys/src/cmd/vcrop.c
+++ b/sys/src/cmd/vcrop.c
@@ -172,6 +172,8 @@
 	a[Eresize].c = mctl->resizec;
 	a[Ekeyboard].c = kctl->c;
 	bg = allocimage(display, Rect(0,0,1,1), screen->chan, 1, 0xCCCCCCFF);
+	if(bg==nil)
+		sysfatal("allocimage: %r");
 	n = readimage(display, fd, 0);
 	if(n==nil)
 		sysfatal("readimage: %r");
@@ -185,9 +187,8 @@
 		case Emouse:
 			if(m.buttons==1){
 				for(;;) {
-					o = m.xy;
-					if(!readmouse(mctl))
-						break;
+					o = mctl->xy;
+					readmouse(mctl);
 					if((mctl->buttons & 1) == 0)
 						break;
 					translate(subpt(mctl->xy, o));