shithub: riscv

Download patch

ref: b795a6d9dc155c726ec492eabbe927fdd79a3621
parent: 759651e8a941378d89589d1084913c69bd5aeac4
author: aiju <devnull@localhost>
date: Wed Apr 19 06:13:36 EDT 2017

blit: always show top-left corner; add tony kaku's -m flag

--- a/.hgignore
+++ b/.hgignore
@@ -16,3 +16,4 @@
 ^sys/man/(searchindex|[1-8]/INDEX.*)$
 ^sys/src/.*\.(bits|debug|output|tab\.[hc])$
 ^sys/src/pkg(/|$)
+^home
--- a/sys/src/games/blit/blit.c
+++ b/sys/src/games/blit/blit.c
@@ -30,6 +30,14 @@
 
 	p = divpt(addpt(screen->r.min, screen->r.max), 2);
 	picr = (Rectangle){subpt(p, Pt(scale * SX/2, scale * SY/2)), addpt(p, Pt(scale * SX/2, scale * SY/2))};
+	if(picr.min.x < screen->r.min.x){
+		picr.max.x += screen->r.min.x - picr.min.x;
+		picr.min.x = screen->r.min.x;
+	}
+	if(picr.min.y < screen->r.min.y){
+		picr.max.y += screen->r.min.y - picr.min.y;
+		picr.min.y = screen->r.min.y;
+	}
 	if(tmp != nil) freeimage(tmp);
 	tmp = allocimage(display, Rect(0, 0, scale * SX, scale > 1 ? 1 : scale * SY), CHAN1(CMap, 1), scale > 1, 0);
 	if(bg != nil) freeimage(bg);
@@ -157,12 +165,13 @@
 void
 threadmain(int argc, char **argv)
 {
-	int n;
+	int n, ms;
 	static Cursor blank;
 	char *telnet;
 	char *p;
 	extern int diag;
 	
+	ms = 0;
 	telnet = nil;
 	ARGBEGIN{
 	case 'b':
@@ -184,6 +193,9 @@
 	case 'd':
 		diag++;
 		break;
+	case 'm':
+		ms++;
+		break;
 	default: usage();
 	}ARGEND;
 	if(argc != 0) usage();
@@ -201,7 +213,8 @@
 	mc = initmouse(nil, screen);
 	if(mc == nil)
 		sysfatal("initmouse: %r");
-	setcursor(mc, &blank);
+	if(ms == 0)
+		setcursor(mc, &blank);
 
 	cpureset();
 	for(;;){