flushdisplay (erik quanstrom)

This commit is contained in:
rsc 2006-03-27 00:50:52 +00:00
parent 94bd4b6c2c
commit 190f5e7cb2

View file

@ -20,12 +20,14 @@ eresized(int new)
draw(screen, screen->r, display->white, nil, ZP);
drawop(screen, screen->r, image, nil, image->r.min, S);
flushimage(display, 1);
}
void
main(int argc, char **argv)
{
int fd;
char *label;
Event e;
ARGBEGIN{
@ -42,16 +44,20 @@ main(int argc, char **argv)
if(argc == 1){
if((fd = open(argv[0], OREAD)) < 0)
sysfatal("open %s: %r");
}else
label = argv[0];
}else{
fd = 0;
label = nil;
}
if(initdraw(0, nil, nil) < 0)
if(initdraw(0, nil, label) < 0)
sysfatal("initdraw: %r");
if((image=readimage(display, fd, 0)) == nil)
sysfatal("readimage: %r");
drawresizewindow(Rect(0,0,Dx(image->r),Dy(image->r)));
if(winsize == nil)
drawresizewindow(Rect(0,0,Dx(image->r),Dy(image->r)));
einit(Emouse|Ekeyboard);
eresized(0);
@ -60,7 +66,6 @@ main(int argc, char **argv)
case Ekeyboard:
if(e.kbdc == 'q' || e.kbdc == 0x7F)
exits(nil);
eresized(0);
break;
case Emouse:
break;