summaryrefslogtreecommitdiffstats
path: root/thumbs.c
diff options
context:
space:
mode:
authorBert <ber.t@gmx.com>2011-02-17 17:28:13 +0100
committerBert <ber.t@gmx.com>2011-02-17 17:28:13 +0100
commit6adbb3831d889b7a0fa3b69e40843d8b70beaf55 (patch)
treecabceb1b50489cf92e2f550a9a2025430d0bd08a /thumbs.c
parentf08c24bbb31ae0e3f7001d5d4d0e8f31b0c817f8 (diff)
downloadnsxiv-6adbb3831d889b7a0fa3b69e40843d8b70beaf55.tar.zst
Use Button1 to open thumbnail
Diffstat (limited to 'thumbs.c')
-rw-r--r--thumbs.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/thumbs.c b/thumbs.c
index c369395..25a7fc1 100644
--- a/thumbs.c
+++ b/thumbs.c
@@ -170,3 +170,19 @@ void tns_move_selection(tns_t *tns, win_t *win, movedir_t dir) {
break;
}
}
+
+int tns_translate(tns_t *tns, int x, int y) {
+ int n;
+ thumb_t *t;
+
+ if (!tns || x < 5 || y < 5)
+ return -1;
+
+ if ((n = y / thumb_dim * tns-> cols + x / thumb_dim) < tns->cnt) {
+ t = &tns->thumbs[n];
+ if (x > t->x && x < t->x + t->w && y > t->y && y < t->y + t->h)
+ return n;
+ }
+
+ return -1;
+}