aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorBert <ber.t@gmx.com>2011-02-17 16:57:55 +0100
committerBert <ber.t@gmx.com>2011-02-17 16:57:55 +0100
commitf08c24bbb31ae0e3f7001d5d4d0e8f31b0c817f8 (patch)
treef04ddf698c7171b4ece3cca004ea45a6e8837c21 /main.c
parentef24ded6afeb185192e815868c28a31c4c2e6d97 (diff)
Select and open thumbnails
Diffstat (limited to 'main.c')
-rw-r--r--main.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/main.c b/main.c
index bc6d9a3..79b562f 100644
--- a/main.c
+++ b/main.c
@@ -268,7 +268,7 @@ void redraw() {
}
void on_keypress(XKeyEvent *kev) {
- int x, y;
+ int sel, x, y;
unsigned int w, h;
char key;
KeySym ksym;
@@ -388,6 +388,36 @@ void on_keypress(XKeyEvent *kev) {
break;
}
} else {
+ /* thumbnail mode */
+ sel = tns.sel;
+
+ switch (ksym) {
+ /* open selected image */
+ case XK_Return:
+ fileidx = sel;
+ load_image();
+ mode = MODE_NORMAL;
+ changed = 1;
+ break;
+
+ /* move selection */
+ case XK_h:
+ case XK_Left:
+ tns_move_selection(&tns, &win, MOVE_LEFT);
+ break;
+ case XK_j:
+ case XK_Down:
+ tns_move_selection(&tns, &win, MOVE_DOWN);
+ break;
+ case XK_k:
+ case XK_Up:
+ tns_move_selection(&tns, &win, MOVE_UP);
+ break;
+ case XK_l:
+ case XK_Right:
+ tns_move_selection(&tns, &win, MOVE_RIGHT);
+ break;
+ }
}
/* common key mappings */