summaryrefslogtreecommitdiffstats
path: root/thumbs.c
diff options
context:
space:
mode:
authorBert Münnich <ber.t@gmx.com>2011-09-17 17:23:51 +0200
committerBert Münnich <ber.t@gmx.com>2011-09-17 17:23:51 +0200
commit515e41045198074cc1b015c6296f536edbfedff5 (patch)
tree01e37683299d7f614ff9680dbcb24722bbd8a096 /thumbs.c
parent82df0b34e96f2b9eec87a4c8e7a47ff86aedc580 (diff)
downloadnsxiv-515e41045198074cc1b015c6296f536edbfedff5.tar.zst
Use win_t member in img_t & tns_t instead of parameters
Diffstat (limited to 'thumbs.c')
-rw-r--r--thumbs.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/thumbs.c b/thumbs.c
index 85dd34f..11c580f 100644
--- a/thumbs.c
+++ b/thumbs.c
@@ -156,7 +156,7 @@ void tns_clean_cache(tns_t *tns) {
}
-void tns_init(tns_t *tns, int cnt) {
+void tns_init(tns_t *tns, int cnt, win_t *win) {
int len;
char *homedir;
@@ -170,8 +170,9 @@ void tns_init(tns_t *tns, int cnt) {
tns->thumbs = NULL;
}
- tns->cnt = tns->first = tns->sel = 0;
tns->cap = cnt;
+ tns->cnt = tns->first = tns->sel = 0;
+ tns->win = win;
tns->alpha = true;
tns->dirty = false;
@@ -305,16 +306,17 @@ void tns_check_view(tns_t *tns, bool scrolled) {
}
}
-void tns_render(tns_t *tns, win_t *win) {
- int i, cnt, r, x, y;
+void tns_render(tns_t *tns) {
thumb_t *t;
+ win_t *win;
+ int i, cnt, r, x, y;
- if (!tns || !tns->thumbs || !win)
+ if (!tns || !tns->thumbs || !tns->win)
return;
-
if (!tns->dirty)
return;
+ win = tns->win;
win_clear(win);
imlib_context_set_drawable(win->pm);
@@ -357,17 +359,20 @@ void tns_render(tns_t *tns, win_t *win) {
}
tns->dirty = false;
- tns_highlight(tns, win, tns->sel, true);
+ tns_highlight(tns, tns->sel, true);
}
-void tns_highlight(tns_t *tns, win_t *win, int n, bool hl) {
+void tns_highlight(tns_t *tns, int n, bool hl) {
thumb_t *t;
+ win_t *win;
int x, y;
unsigned long col;
- if (!tns || !tns->thumbs || !win)
+ if (!tns || !tns->thumbs || !tns->win)
return;
+ win = tns->win;
+
if (n >= 0 && n < tns->cnt) {
t = &tns->thumbs[n];
@@ -387,10 +392,10 @@ void tns_highlight(tns_t *tns, win_t *win, int n, bool hl) {
win_draw(win);
}
-bool tns_move_selection(tns_t *tns, win_t *win, direction_t dir) {
+bool tns_move_selection(tns_t *tns, direction_t dir) {
int old;
- if (!tns || !tns->thumbs || !win)
+ if (!tns || !tns->thumbs)
return false;
old = tns->sel;
@@ -415,10 +420,10 @@ bool tns_move_selection(tns_t *tns, win_t *win, direction_t dir) {
}
if (tns->sel != old) {
- tns_highlight(tns, win, old, false);
+ tns_highlight(tns, old, false);
tns_check_view(tns, false);
if (!tns->dirty)
- tns_highlight(tns, win, tns->sel, true);
+ tns_highlight(tns, tns->sel, true);
}
return tns->sel != old;