From af66b61b81a0098e9d1379155539e5f7f0d3352f Mon Sep 17 00:00:00 2001 From: "\"John Hawthorn ext:(%22)" Date: Wed, 31 Dec 2008 17:10:04 -0800 Subject: select() waits properly, cleanup in main.c --- src/main.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/main.c b/src/main.c index 7734b66..2437ac0 100644 --- a/src/main.c +++ b/src/main.c @@ -183,7 +183,7 @@ int doredraw(struct image **i){ return 0; if(!(*i = imageopen2(images[0]))){ images[0] = NULL; - return; + return 0; } }else{ int firstimg = imageidx; @@ -255,23 +255,20 @@ void run(){ images[0][read-1] = '\0'; } if(XPending(display)){ + tv = &tv0; + XEvent event; do{ - tv = &tv0; - XEvent event; XNextEvent(display, &event); handleevent(&event); }while(XPending(display)); - }else if(ret == 0 && (mode != MODE_CTL || images[0] != NULL)){ - if(!img || img->state != BILINEARDRAWN){ - doredraw(&img); + }else if(ret == 0){ + if(mode == MODE_CTL && images[0] == NULL){ + tv = NULL; + }else if(!img || img->state != BILINEARDRAWN){ + if(!doredraw(&img)){ + tv = NULL; + } } - /*else if(!nextimg || !nextimg->ximg || !nextimg->redraw){ - doredraw(&nextimg); - }else if(!previmg || !previmg->ximg || !previmg->redraw){ - doredraw(&previmg); - }else{ - tv = &tv0; - }*/ } } } -- cgit v1.2.3