| @@ -241,7 +241,7 @@ int main(int argc, char **argv) { |
| 241 | 241 | | } |
| 242 | 242 | | |
| 243 | 243 | | filecnt = fileidx; |
| 244 | | − | fileidx = options->startnum < filecnt ? options->startnum : filecnt - 1; |
| 244 | + | fileidx = options->startnum < filecnt ? options->startnum : 0; |
| 245 | 245 | | |
| 246 | 246 | | win_init(&win); |
| 247 | 247 | | img_init(&img, &win); |
| @@ -327,10 +327,11 @@ int run_command(const char *cline, Bool reload) { |
| 327 | 327 | | |
| 328 | 328 | | /* event handling */ |
| 329 | 329 | | |
| 330 | | − | #define TO_WIN_RESIZE 75000 |
| 331 | | − | #define TO_IMAGE_DRAG 1000 |
| 332 | | − | #define TO_CURSOR_HIDE 1500000 |
| 333 | | − | #define TO_THUMBS_LOAD 75000 |
| 330 | + | /* timeouts in milliseconds: */ |
| 331 | + | #define TO_WIN_RESIZE 75 |
| 332 | + | #define TO_IMAGE_DRAG 1 |
| 333 | + | #define TO_CURSOR_HIDE 1500 |
| 334 | + | #define TO_THUMBS_LOAD 200 |
| 334 | 335 | | |
| 335 | 336 | | int timo_cursor; |
| 336 | 337 | | int timo_redraw; |
| @@ -723,7 +724,7 @@ void run() { |
| 723 | 724 | | else |
| 724 | 725 | | remove_file(tns.cnt, 0); |
| 725 | 726 | | gettimeofday(&t1, 0); |
| 726 | | − | if (TV_TO_DOUBLE(t1) - TV_TO_DOUBLE(t0) >= 0.25) |
| 727 | + | if (TIMEDIFF(&t1, &t0) >= TO_THUMBS_LOAD) |
| 727 | 728 | | break; |
| 728 | 729 | | } |
| 729 | 730 | | if (tns.cnt == filecnt) |
| @@ -742,8 +743,7 @@ void run() { |
| 742 | 743 | | timeout = timo_cursor; |
| 743 | 744 | | else |
| 744 | 745 | | timeout = timo_redraw; |
| 745 | | − | tt.tv_sec = timeout / 1000000; |
| 746 | | − | tt.tv_usec = timeout % 1000000; |
| 746 | + | MSEC_TO_TIMEVAL(timeout, &tt); |
| 747 | 747 | | xfd = ConnectionNumber(win.env.dpy); |
| 748 | 748 | | FD_ZERO(&fds); |
| 749 | 749 | | FD_SET(xfd, &fds); |
| @@ -751,7 +751,7 @@ void run() { |
| 751 | 751 | | if (!XPending(win.env.dpy)) |
| 752 | 752 | | select(xfd + 1, &fds, 0, 0, &tt); |
| 753 | 753 | | gettimeofday(&t1, 0); |
| 754 | | − | timeout = MIN((TV_TO_DOUBLE(t1) - TV_TO_DOUBLE(t0)) * 1000000, timeout); |
| 754 | + | timeout = MIN(TIMEDIFF(&t1, &t0), timeout); |
| 755 | 755 | | |
| 756 | 756 | | /* timeouts fired? */ |
| 757 | 757 | | if (timo_cursor) { |