From 6adbb3831d889b7a0fa3b69e40843d8b70beaf55 Mon Sep 17 00:00:00 2001 From: Bert Date: Thu, 17 Feb 2011 17:28:13 +0100 Subject: Use Button1 to open thumbnail --- thumbs.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'thumbs.c') 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; +} -- cgit v1.2.3