libdraw: enter/eenter, set and restore clip rect

front
cinap_lenrek 2012-07-22 16:32:59 +02:00
parent aae765a161
commit f3b08dd655
2 changed files with 12 additions and 2 deletions

View File

@ -10,7 +10,7 @@ eenter(char *ask, char *buf, int len, Mouse *m)
int done, down, tick, n, h, w, l, i; int done, down, tick, n, h, w, l, i;
Image *b, *save, *backcol, *bordcol; Image *b, *save, *backcol, *bordcol;
Point p, o, t; Point p, o, t;
Rectangle r; Rectangle r, sc;
Event ev; Event ev;
Rune k; Rune k;
@ -23,6 +23,9 @@ eenter(char *ask, char *buf, int len, Mouse *m)
while(ecankbd()) while(ecankbd())
ekbd(); ekbd();
sc = screen->clipr;
replclipr(screen, 0, screen->r);
if(m) o = m->xy; if(m) o = m->xy;
if(buf && len > 0) if(buf && len > 0)
@ -186,6 +189,8 @@ eenter(char *ask, char *buf, int len, Mouse *m)
save = nil; save = nil;
} }
replclipr(screen, 0, sc);
freeimage(backcol); freeimage(backcol);
freeimage(bordcol); freeimage(bordcol);
flushimage(display, 1); flushimage(display, 1);

View File

@ -11,7 +11,7 @@ enter(char *ask, char *buf, int len, Mousectl *mc, Keyboardctl *kc, Screen *scr)
int done, down, tick, n, h, w, l, i; int done, down, tick, n, h, w, l, i;
Image *b, *save, *backcol, *bordcol; Image *b, *save, *backcol, *bordcol;
Point p, o, t; Point p, o, t;
Rectangle r; Rectangle r, sc;
Alt a[3]; Alt a[3];
Mouse m; Mouse m;
Rune k; Rune k;
@ -22,6 +22,9 @@ enter(char *ask, char *buf, int len, Mousectl *mc, Keyboardctl *kc, Screen *scr)
if(backcol == nil || bordcol == nil) if(backcol == nil || bordcol == nil)
return -1; return -1;
sc = screen->clipr;
replclipr(screen, 0, screen->r);
n = 0; n = 0;
if(kc){ if(kc){
while(nbrecv(kc->c, nil) == 1) while(nbrecv(kc->c, nil) == 1)
@ -211,6 +214,8 @@ enter(char *ask, char *buf, int len, Mousectl *mc, Keyboardctl *kc, Screen *scr)
} }
} }
replclipr(screen, 0, sc);
freeimage(backcol); freeimage(backcol);
freeimage(bordcol); freeimage(bordcol);
flushimage(display, 1); flushimage(display, 1);