shithub: drawterm

Download patch

ref: 8406d23041c63f3f546fb3aa08ecaf3ece8c7ade
parent: fa7529962867e6d1025e1666fed3afb018bfa2c3
author: aap <aap@papnet.eu>
date: Tue Apr 5 10:58:34 EDT 2016

changed cursor to plan 9 cursor

--- a/kern/devmouse.c
+++ b/kern/devmouse.c
@@ -12,6 +12,20 @@
 
 Mouseinfo	mouse;
 Cursorinfo	cursor;
+Cursorinfo      arrow = {
+	0,
+	{ -1, -1 },
+	{ 0xFF, 0xFF, 0x80, 0x01, 0x80, 0x02, 0x80, 0x0C,
+	  0x80, 0x10, 0x80, 0x10, 0x80, 0x08, 0x80, 0x04,
+	  0x80, 0x02, 0x80, 0x01, 0x80, 0x02, 0x8C, 0x04,
+	  0x92, 0x08, 0x91, 0x10, 0xA0, 0xA0, 0xC0, 0x40,
+	},
+	{ 0x00, 0x00, 0x7F, 0xFE, 0x7F, 0xFC, 0x7F, 0xF0,
+	  0x7F, 0xE0, 0x7F, 0xE0, 0x7F, 0xF0, 0x7F, 0xF8,
+	  0x7F, 0xFC, 0x7F, 0xFE, 0x7F, 0xFC, 0x73, 0xF8,
+	  0x61, 0xF0, 0x60, 0xE0, 0x40, 0x40, 0x00, 0x00,
+	},
+};
 
 static int	mousechanged(void*);
 
@@ -29,6 +43,13 @@
 
 #define	NMOUSE	(sizeof(mousedir)/sizeof(Dirtab))
 
+static void
+mouseinit(void)
+{
+	cursor = arrow;
+	setcursor();
+}
+
 static Chan*
 mouseattach(char *spec)
 {
@@ -82,7 +103,8 @@
 		lock(&mouse.lk);
 		mouse.open = 0;
 		unlock(&mouse.lk);
-		cursorarrow();
+		cursor = arrow;
+		setcursor();
 	}
 }
 
@@ -174,7 +196,8 @@
 
 	case Qcursor:
 		if(n < 2*4+2*2*16){
-			cursorarrow();
+			cursor = arrow;
+			setcursor();
 		}else{
 			n = 2*4+2*2*16;
 			lock(&cursor.lk);
@@ -219,7 +242,7 @@
 	"mouse",
 
 	devreset,
-	devinit,
+	mouseinit,
 	devshutdown,
 	mouseattach,
 	mousewalk,
--- a/kern/screen.h
+++ b/kern/screen.h
@@ -40,6 +40,7 @@
 extern	Memimage *gscreen;
 extern	Mouseinfo mouse;
 extern	Cursorinfo cursor;
+extern	Cursorinfo arrow;
 extern	Screeninfo screen;
 
 void	screeninit(void);
@@ -48,7 +49,6 @@
 void	getcolor(ulong, ulong*, ulong*, ulong*);
 void	setcolor(ulong, ulong, ulong, ulong);
 
-void	cursorarrow(void);
 void	setcursor(void);
 void	mouseset(Point);
 void	flushmemscreen(Rectangle);