aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.def.h3
-rw-r--r--image.c4
-rw-r--r--nsxiv.h1
-rw-r--r--thumbs.c3
-rw-r--r--window.c5
5 files changed, 11 insertions, 5 deletions
diff --git a/config.def.h b/config.def.h
index 49ca504..65837bf 100644
--- a/config.def.h
+++ b/config.def.h
@@ -16,6 +16,9 @@ static const char *DEFAULT_BAR_FG = NULL; /* NULL means it will default to
static const char *DEFAULT_FONT = "monospace-8";
#endif
+/* if true, statusbar appears on top of the window */
+static const bool TOP_STATUSBAR = false;
+
#endif
#ifdef _IMAGE_CONFIG
diff --git a/image.c b/image.c
index ade9494..1c57d27 100644
--- a/image.c
+++ b/image.c
@@ -589,12 +589,12 @@ void img_render(img_t *img)
if (img->y <= 0) {
sy = -img->y / img->zoom + 0.5;
sh = win->h / img->zoom;
- dy = 0;
+ dy = win->bar.top ? win->bar.h : 0;
dh = win->h;
} else {
sy = 0;
sh = img->h;
- dy = img->y;
+ dy = img->y + (win->bar.top ? win->bar.h : 0);
dh = MAX(img->h * img->zoom, 1);
}
diff --git a/nsxiv.h b/nsxiv.h
index 1b0bc6f..afa657f 100644
--- a/nsxiv.h
+++ b/nsxiv.h
@@ -424,6 +424,7 @@ struct win {
struct {
unsigned int h;
+ bool top;
win_bar_t l;
win_bar_t r;
} bar;
diff --git a/thumbs.c b/thumbs.c
index 04ef77f..b4c2de3 100644
--- a/thumbs.c
+++ b/thumbs.c
@@ -428,7 +428,8 @@ void tns_render(tns_t *tns)
}
r = cnt % tns->cols ? 1 : 0;
tns->x = x = (win->w - MIN(cnt, tns->cols) * tns->dim) / 2 + tns->bw + 3;
- tns->y = y = (win->h - (cnt / tns->cols + r) * tns->dim) / 2 + tns->bw + 3;
+ tns->y = y = (win->h - (cnt / tns->cols + r) * tns->dim) / 2 + tns->bw + 3 +
+ (win->bar.top ? win->bar.h : 0);
tns->loadnext = *tns->cnt;
tns->end = tns->first + cnt;
diff --git a/window.c b/window.c
index a305353..7d82975 100644
--- a/window.c
+++ b/window.c
@@ -159,6 +159,7 @@ void win_init(win_t *win)
win->bar.r.buf = emalloc(win->bar.r.size + 3);
win->bar.r.buf[0] = '\0';
win->bar.h = options->hide_bar ? 0 : barheight;
+ win->bar.top = TOP_STATUSBAR;
#endif /* HAVE_LIBFONTS */
XrmDestroyDatabase(db);
@@ -445,12 +446,12 @@ static void win_draw_bar(win_t *win)
return;
e = &win->env;
- y = win->h + font->ascent + V_TEXT_PAD;
+ y = (win->bar.top ? 0 : win->h) + font->ascent + V_TEXT_PAD;
w = win->w - 2*H_TEXT_PAD;
d = XftDrawCreate(e->dpy, win->buf.pm, e->vis, e->cmap);
XSetForeground(e->dpy, gc, win->bar_bg.pixel);
- XFillRectangle(e->dpy, win->buf.pm, gc, 0, win->h, win->w, win->bar.h);
+ XFillRectangle(e->dpy, win->buf.pm, gc, 0, win->bar.top ? 0 : win->h, win->w, win->bar.h);
XSetForeground(e->dpy, gc, win->win_bg.pixel);
XSetBackground(e->dpy, gc, win->bar_bg.pixel);