Krolyxon
Commit 6fed8db

Branches

Refs →

nsxiv6fed8db

Added [,] mappings for go 10 images back/forward

Author
Bert
Date
2011-01-23 12:36 +0100
Parent
2f7bd16
Commit
6fed8db854888381a1d436b76fb9ec3df95763a0

+16 −3

2 files changed

  1. M main.c +15 −2
  2. M options.h +1 −1
M main.c View
@@ -43,8 +43,7 @@ img_t img;
4343 win_t win;
4444
4545 const char **filenames;
46−unsigned int filecnt;
47−unsigned int fileidx;
46+int filecnt, fileidx;
4847
4948 unsigned char timeout;
5049
@@ -168,6 +167,20 @@ void on_keypress(XEvent *ev) {
168167 changed = 1;
169168 }
170169 break;
170+ case '[':
171+ if (fileidx != 0) {
172+ fileidx = MAX(0, fileidx - 10);
173+ img_load(&img, filenames[fileidx]);
174+ changed = 1;
175+ }
176+ break;
177+ case ']':
178+ if (fileidx != filecnt - 1) {
179+ fileidx = MIN(fileidx + 10, filecnt - 1);
180+ img_load(&img, filenames[fileidx]);
181+ changed = 1;
182+ }
183+ break;
171184 case 'g':
172185 if (fileidx != 0) {
173186 fileidx = 0;
M options.h View
@@ -21,7 +21,7 @@
2121
2222 typedef struct options_s {
2323 const char **filenames;
24− unsigned int filecnt;
24+ int filecnt;
2525 } options_t;
2626
2727 extern const options_t *options;