Corrected thumbnail loading and timeout handling
This commit is contained in:
parent
1e84773276
commit
dcd04e526d
10
main.c
10
main.c
|
@ -357,10 +357,12 @@ void run() {
|
||||||
redraw();
|
redraw();
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if (!XPending(win.env.dpy)) {
|
while (mode == MODE_THUMB && tns.cnt < filecnt &&
|
||||||
|
!XPending(win.env.dpy))
|
||||||
|
{
|
||||||
/* load thumbnails */
|
/* load thumbnails */
|
||||||
while (mode == MODE_THUMB && tns.cnt < filecnt) {
|
|
||||||
win_set_cursor(&win, CURSOR_WATCH);
|
win_set_cursor(&win, CURSOR_WATCH);
|
||||||
|
set_timeout(redraw, TO_REDRAW_THUMBS, 0);
|
||||||
if (tns_load(&tns, tns.cnt, &files[tns.cnt], False, False))
|
if (tns_load(&tns, tns.cnt, &files[tns.cnt], False, False))
|
||||||
tns.cnt++;
|
tns.cnt++;
|
||||||
else
|
else
|
||||||
|
@ -369,20 +371,18 @@ void run() {
|
||||||
redraw();
|
redraw();
|
||||||
win_set_cursor(&win, CURSOR_ARROW);
|
win_set_cursor(&win, CURSOR_ARROW);
|
||||||
} else {
|
} else {
|
||||||
set_timeout(redraw, TO_REDRAW_THUMBS, 0);
|
|
||||||
check_timeouts(NULL);
|
check_timeouts(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!XPending(win.env.dpy) && check_timeouts(&timeout)) {
|
||||||
/* handle timeouts */
|
/* handle timeouts */
|
||||||
if (check_timeouts(&timeout)) {
|
|
||||||
xfd = ConnectionNumber(win.env.dpy);
|
xfd = ConnectionNumber(win.env.dpy);
|
||||||
FD_ZERO(&fds);
|
FD_ZERO(&fds);
|
||||||
FD_SET(xfd, &fds);
|
FD_SET(xfd, &fds);
|
||||||
if (!select(xfd + 1, &fds, 0, 0, &timeout))
|
if (!select(xfd + 1, &fds, 0, 0, &timeout))
|
||||||
check_timeouts(NULL);
|
check_timeouts(NULL);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!XNextEvent(win.env.dpy, &ev)) {
|
if (!XNextEvent(win.env.dpy, &ev)) {
|
||||||
/* handle events */
|
/* handle events */
|
||||||
|
|
Loading…
Reference in New Issue