shithub: view

Download patch

ref: 5345ff12ba5438c42ec65668310cab94524e48d9
parent: 3f239295d1fec3dbc03ce17acd66de9f0d81479f
author: phil9 <telephil9@gmail.com>
date: Sun Nov 28 01:48:25 EST 2021

change cursor when panning image

--- a/view.c
+++ b/view.c
@@ -4,6 +4,7 @@
 #include <thread.h>
 #include <mouse.h>
 #include <keyboard.h>
+#include <cursor.h>
 #include <plumb.h>
 #include <stb.h>
 #include "a.h"
@@ -16,6 +17,20 @@
 	Eplumb,
 };
 
+Cursor cross = {
+	{-8, -8},
+	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	},
+	{ 0x00, 0x00, 0x01, 0x00, 0x03, 0x80, 0x07, 0xc0,
+	  0x01, 0x00, 0x11, 0x10, 0x31, 0x18, 0x7f, 0xfc,
+	  0x31, 0x18, 0x11, 0x10, 0x01, 0x00, 0x07, 0xc0,
+	  0x03, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
+	},
+};
+
 int mainstacksize=16384;
 
 Mousectl *mctl;
@@ -404,6 +419,7 @@
 	Point o;
 
 	if(m.buttons == 1){
+		setcursor(mctl, &cross);
 		for(;;){
 			o = mctl->xy;
 			if(readmouse(mctl) < 0)
@@ -412,6 +428,7 @@
 				break;
 			pan(subpt(mctl->xy, o));
 		}
+		setcursor(mctl, nil);
 	}else if(m.buttons == 2){
 		menu2hit();
 	}else if(m.buttons == 4){