aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorBert <ber.t@gmx.com>2011-01-31 15:51:26 +0100
committerBert <ber.t@gmx.com>2011-01-31 15:51:26 +0100
commit802c3448793fdfd8255931235c40084558f7f515 (patch)
tree107e1a1013a14c4ba6c21a77670fbb118e32b6aa /main.c
parent16cc96eff5d858fe99b561459b7bce90fb64eeed (diff)
Check file timestamps before loading from cache
Diffstat (limited to 'main.c')
-rw-r--r--main.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/main.c b/main.c
index 1c103ac..4771cd9 100644
--- a/main.c
+++ b/main.c
@@ -102,7 +102,7 @@ int main(int argc, char **argv) {
filecnt = 0;
for (i = 0; i < options->filecnt; ++i) {
- if (!(img_load(&img, options->filenames[i]) < 0))
+ if (img_check(options->filenames[i]))
filenames[filecnt++] = options->filenames[i];
}
@@ -157,43 +157,37 @@ void on_keypress(XEvent *ev) {
case XK_n:
case XK_space:
if (fileidx + 1 < filecnt) {
- img_load(&img, filenames[++fileidx]);
- changed = 1;
+ changed = img_load(&img, filenames[++fileidx]);
}
break;
case XK_p:
case XK_BackSpace:
if (fileidx > 0) {
- img_load(&img, filenames[--fileidx]);
- changed = 1;
+ changed = img_load(&img, filenames[--fileidx]);
}
break;
case XK_bracketleft:
if (fileidx != 0) {
fileidx = MAX(0, fileidx - 10);
- img_load(&img, filenames[fileidx]);
- changed = 1;
+ changed = img_load(&img, filenames[fileidx]);
}
break;
case XK_bracketright:
if (fileidx != filecnt - 1) {
fileidx = MIN(fileidx + 10, filecnt - 1);
- img_load(&img, filenames[fileidx]);
- changed = 1;
+ changed = img_load(&img, filenames[fileidx]);
}
break;
case XK_g:
if (fileidx != 0) {
fileidx = 0;
- img_load(&img, filenames[fileidx]);
- changed = 1;
+ changed = img_load(&img, filenames[fileidx]);
}
break;
case XK_G:
if (fileidx != filecnt - 1) {
fileidx = filecnt - 1;
- img_load(&img, filenames[fileidx]);
- changed = 1;
+ changed = img_load(&img, filenames[fileidx]);
}
break;