aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBert <ber.t@gmx.com>2011-09-02 15:56:03 +0200
committerBert <ber.t@gmx.com>2011-09-02 15:56:03 +0200
commitdcd04e526d8d4382f6a26534897901d882d43526 (patch)
treea111b37a4839f2899dff253de386032e9a643638
parent1e84773276ede56309a145dc08a4f3d47ad3a29f (diff)
Corrected thumbnail loading and timeout handling
-rw-r--r--main.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/main.c b/main.c
index 5866823..13cab4c 100644
--- a/main.c
+++ b/main.c
@@ -357,31 +357,31 @@ void run() {
redraw();
while (1) {
- if (!XPending(win.env.dpy)) {
+ while (mode == MODE_THUMB && tns.cnt < filecnt &&
+ !XPending(win.env.dpy))
+ {
/* load thumbnails */
- while (mode == MODE_THUMB && tns.cnt < filecnt) {
- win_set_cursor(&win, CURSOR_WATCH);
- if (tns_load(&tns, tns.cnt, &files[tns.cnt], False, False))
- tns.cnt++;
- else
- remove_file(tns.cnt, 0);
- if (tns.cnt == filecnt) {
- redraw();
- win_set_cursor(&win, CURSOR_ARROW);
- } else {
- set_timeout(redraw, TO_REDRAW_THUMBS, 0);
- check_timeouts(NULL);
- }
+ win_set_cursor(&win, CURSOR_WATCH);
+ set_timeout(redraw, TO_REDRAW_THUMBS, 0);
+ if (tns_load(&tns, tns.cnt, &files[tns.cnt], False, False))
+ tns.cnt++;
+ else
+ remove_file(tns.cnt, 0);
+ if (tns.cnt == filecnt) {
+ redraw();
+ win_set_cursor(&win, CURSOR_ARROW);
+ } else {
+ check_timeouts(NULL);
}
+ }
+ if (!XPending(win.env.dpy) && check_timeouts(&timeout)) {
/* handle timeouts */
- if (check_timeouts(&timeout)) {
- xfd = ConnectionNumber(win.env.dpy);
- FD_ZERO(&fds);
- FD_SET(xfd, &fds);
- if (!select(xfd + 1, &fds, 0, 0, &timeout))
- check_timeouts(NULL);
- }
+ xfd = ConnectionNumber(win.env.dpy);
+ FD_ZERO(&fds);
+ FD_SET(xfd, &fds);
+ if (!select(xfd + 1, &fds, 0, 0, &timeout))
+ check_timeouts(NULL);
}
if (!XNextEvent(win.env.dpy, &ev)) {