summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBert Münnich <ber.t@posteo.de>2014-08-18 15:42:10 +0200
committerBert Münnich <ber.t@posteo.de>2014-08-18 15:42:10 +0200
commit056624548ae1baa4eec3ce634469349de18b0705 (patch)
tree3c87df9e2de368adccd112fcc7004bbd28eeb04a
parentfe3a1e326fed155239f125c1322c0b9c4e7b56d0 (diff)
downloadnsxiv-056624548ae1baa4eec3ce634469349de18b0705.tar.zst
Beautified thumbnail marks and selection border
-rw-r--r--thumbs.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/thumbs.c b/thumbs.c
index 908c3a2..ea91292 100644
--- a/thumbs.c
+++ b/thumbs.c
@@ -419,19 +419,19 @@ void tns_mark(tns_t *tns, int n, bool mark)
return;
if (n >= 0 && n < tns->cnt) {
- unsigned long col;
- thumb_t *t = &tns->thumbs[n];
win_t *win = tns->win;
+ thumb_t *t = &tns->thumbs[n];
+ unsigned long col = win->fullscreen ? win->fscol : win->bgcol;
+ int x = t->x + t->w, y = t->y + t->h;
+
+ win_draw_rect(win, x - 2, y + 1, 1, 2, true, 1, col);
+ win_draw_rect(win, x + 1, y - 2, 2, 1, true, 1, col);
if (mark)
col = win->selcol;
- else if (win->fullscreen)
- col = win->fscol;
- else
- col = win->bgcol;
- win_draw_rect(win, t->x + t->w - 1, t->y + t->h + 1, 6, 2, true, 1, col);
- win_draw_rect(win, t->x + t->w + 1, t->y + t->h - 1, 2, 6, true, 1, col);
+ win_draw_rect(win, x - 1, y + 1, 6, 2, true, 1, col);
+ win_draw_rect(win, x + 1, y - 1, 2, 6, true, 1, col);
if (!mark && n == *tns->sel)
tns_highlight(tns, n, true);
@@ -444,20 +444,18 @@ void tns_highlight(tns_t *tns, int n, bool hl)
return;
if (n >= 0 && n < tns->cnt) {
- unsigned long col;
- thumb_t *t = &tns->thumbs[n];
win_t *win = tns->win;
+ thumb_t *t = &tns->thumbs[n];
+ unsigned long col;
if (hl)
col = win->selcol;
- else if (win->fullscreen)
- col = win->fscol;
else
- col = win->bgcol;
+ col = win->fullscreen ? win->fscol : win->bgcol;
win_draw_rect(win, t->x - 2, t->y - 2, t->w + 4, t->h + 4, false, 2, col);
- if (!hl && tns->files[n].marked)
+ if (tns->files[n].marked)
tns_mark(tns, n, true);
}
}