From 6fed8db854888381a1d436b76fb9ec3df95763a0 Mon Sep 17 00:00:00 2001 From: Bert Date: Sun, 23 Jan 2011 12:36:27 +0100 Subject: Added [,] mappings for go 10 images back/forward --- main.c | 17 +++++++++++++++-- options.h | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index c7b102e..a73fbf2 100644 --- a/main.c +++ b/main.c @@ -43,8 +43,7 @@ img_t img; win_t win; const char **filenames; -unsigned int filecnt; -unsigned int fileidx; +int filecnt, fileidx; unsigned char timeout; @@ -168,6 +167,20 @@ void on_keypress(XEvent *ev) { changed = 1; } break; + case '[': + if (fileidx != 0) { + fileidx = MAX(0, fileidx - 10); + img_load(&img, filenames[fileidx]); + changed = 1; + } + break; + case ']': + if (fileidx != filecnt - 1) { + fileidx = MIN(fileidx + 10, filecnt - 1); + img_load(&img, filenames[fileidx]); + changed = 1; + } + break; case 'g': if (fileidx != 0) { fileidx = 0; diff --git a/options.h b/options.h index f6dc974..d74cb3f 100644 --- a/options.h +++ b/options.h @@ -21,7 +21,7 @@ typedef struct options_s { const char **filenames; - unsigned int filecnt; + int filecnt; } options_t; extern const options_t *options; -- cgit v1.2.3-54-g00ecf