shithub: riscv

Download patch

ref: f3b08dd655446276be6426506a1fd84d13defbad
parent: aae765a161228a70ffe60fb9f62b17c44a66f14b
author: cinap_lenrek <[email protected]>
date: Sun Jul 22 12:32:59 EDT 2012

libdraw: enter/eenter, set and restore clip rect

--- a/sys/src/libdraw/eenter.c
+++ b/sys/src/libdraw/eenter.c
@@ -10,7 +10,7 @@
 	int done, down, tick, n, h, w, l, i;
 	Image *b, *save, *backcol, *bordcol;
 	Point p, o, t;
-	Rectangle r;
+	Rectangle r, sc;
 	Event ev;
 	Rune k;
 
@@ -23,6 +23,9 @@
 	while(ecankbd())
 		ekbd();
 
+	sc = screen->clipr;
+	replclipr(screen, 0, screen->r);
+
 	if(m) o = m->xy;
 
 	if(buf && len > 0)
@@ -185,6 +188,8 @@
 		freeimage(save);
 		save = nil;
 	}
+
+	replclipr(screen, 0, sc);
 
 	freeimage(backcol);
 	freeimage(bordcol);
--- a/sys/src/libdraw/enter.c
+++ b/sys/src/libdraw/enter.c
@@ -11,7 +11,7 @@
 	int done, down, tick, n, h, w, l, i;
 	Image *b, *save, *backcol, *bordcol;
 	Point p, o, t;
-	Rectangle r;
+	Rectangle r, sc;
 	Alt a[3];
 	Mouse m;
 	Rune k;
@@ -22,6 +22,9 @@
 	if(backcol == nil || bordcol == nil)
 		return -1;
 
+	sc = screen->clipr;
+	replclipr(screen, 0, screen->r);
+
 	n = 0;
 	if(kc){
 		while(nbrecv(kc->c, nil) == 1)
@@ -210,6 +213,8 @@
 			save = nil;
 		}
 	}
+
+	replclipr(screen, 0, sc);
 
 	freeimage(backcol);
 	freeimage(bordcol);