summaryrefslogtreecommitdiffstats
path: root/window.c
diff options
context:
space:
mode:
authorBert Münnich <ber.t@posteo.de>2019-07-16 19:18:13 +0200
committerBert Münnich <ber.t@posteo.de>2019-07-16 19:18:13 +0200
commit28868767e6ea74f1e758686e6ae5d58918bd1627 (patch)
treea4b23a809509e2bc674a37b01f47c78dbcc05cc2 /window.c
parent6511d681ac5e5306d9afc0e7b3a60d21a9614664 (diff)
downloadnsxiv-28868767e6ea74f1e758686e6ae5d58918bd1627.tar.zst
Use normal win colors in fullscreen mode
Fixes issues #361 and #367
Diffstat (limited to 'window.c')
-rw-r--r--window.c27
1 files changed, 7 insertions, 20 deletions
diff --git a/window.c b/window.c
index b41d6c1..d336d06 100644
--- a/window.c
+++ b/window.c
@@ -123,11 +123,6 @@ const char* win_res(Display *dpy, const char *name, const char *def)
}
}
-unsigned int win_luminance(const XftColor *col)
-{
- return (col->color.red + col->color.green + col->color.blue) / 3;
-}
-
#define INIT_ATOM_(atom) \
atoms[ATOM_##atom] = XInternAtom(e->dpy, #atom, False);
@@ -159,8 +154,6 @@ void win_init(win_t *win)
fg = win_res(e->dpy, RES_CLASS ".foreground", "black");
win_alloc_color(e, bg, &win->bg);
win_alloc_color(e, fg, &win->fg);
- win_alloc_color(e, "black", &win->black);
- win->light = win_luminance(&win->bg) > win_luminance(&win->fg);
win->bar.l.size = BAR_L_LEN;
win->bar.r.size = BAR_R_LEN;
@@ -300,7 +293,7 @@ void win_open(win_t *win)
win->buf.h = e->scrh;
win->buf.pm = XCreatePixmap(e->dpy, win->xwin,
win->buf.w, win->buf.h, e->depth);
- XSetForeground(e->dpy, gc, fullscreen ? win->black.pixel : win->bg.pixel);
+ XSetForeground(e->dpy, gc, win->bg.pixel);
XFillRectangle(e->dpy, win->buf.pm, gc, 0, 0, win->buf.w, win->buf.h);
XSetWindowBackgroundPixmap(e->dpy, win->xwin, win->buf.pm);
@@ -392,7 +385,7 @@ void win_clear(win_t *win)
win->buf.pm = XCreatePixmap(e->dpy, win->xwin,
win->buf.w, win->buf.h, e->depth);
}
- XSetForeground(e->dpy, gc, win->fullscreen ? win->black.pixel : win->bg.pixel);
+ XSetForeground(e->dpy, gc, win->bg.pixel);
XFillRectangle(e->dpy, win->buf.pm, gc, 0, 0, win->buf.w, win->buf.h);
}
@@ -439,7 +432,6 @@ void win_draw_bar(win_t *win)
win_env_t *e;
win_bar_t *l, *r;
XftDraw *d;
- const XftColor *bg, *fg;
if ((l = &win->bar.l)->buf == NULL || (r = &win->bar.r)->buf == NULL)
return;
@@ -450,28 +442,23 @@ void win_draw_bar(win_t *win)
d = XftDrawCreate(e->dpy, win->buf.pm, DefaultVisual(e->dpy, e->scr),
DefaultColormap(e->dpy, e->scr));
- if (win->fullscreen && !win->light)
- bg = &win->bg, fg = &win->fg;
- else
- bg = &win->fg, fg = &win->bg;
-
- XSetForeground(e->dpy, gc, bg->pixel);
+ XSetForeground(e->dpy, gc, win->fg.pixel);
XFillRectangle(e->dpy, win->buf.pm, gc, 0, win->h, win->w, win->bar.h);
- XSetForeground(e->dpy, gc, fg->pixel);
- XSetBackground(e->dpy, gc, bg->pixel);
+ XSetForeground(e->dpy, gc, win->bg.pixel);
+ XSetBackground(e->dpy, gc, win->fg.pixel);
if ((len = strlen(r->buf)) > 0) {
if ((tw = TEXTWIDTH(win, r->buf, len)) > w)
return;
x = win->w - tw - H_TEXT_PAD;
w -= tw;
- win_draw_text(win, d, fg, x, y, r->buf, len, tw);
+ win_draw_text(win, d, &win->bg, x, y, r->buf, len, tw);
}
if ((len = strlen(l->buf)) > 0) {
x = H_TEXT_PAD;
w -= 2 * H_TEXT_PAD; /* gap between left and right parts */
- win_draw_text(win, d, fg, x, y, l->buf, len, w);
+ win_draw_text(win, d, &win->bg, x, y, l->buf, len, w);
}
XftDrawDestroy(d);
}