parent
6511d681ac
commit
28868767e6
2
image.c
2
image.c
|
@ -497,7 +497,7 @@ void img_render(img_t *img)
|
|||
}
|
||||
imlib_image_put_back_data(data);
|
||||
} else {
|
||||
c = win->fullscreen ? win->black.pixel : win->bg.pixel;
|
||||
c = win->bg.pixel;
|
||||
imlib_context_set_color(c >> 16 & 0xFF, c >> 8 & 0xFF, c & 0xFF, 0xFF);
|
||||
imlib_image_fill_rectangle(0, 0, dw, dh);
|
||||
}
|
||||
|
|
2
sxiv.h
2
sxiv.h
|
@ -408,10 +408,8 @@ struct win {
|
|||
Window xwin;
|
||||
win_env_t env;
|
||||
|
||||
bool light; /* bg is lighter than fg */
|
||||
XftColor bg;
|
||||
XftColor fg;
|
||||
XftColor black;
|
||||
|
||||
int x;
|
||||
int y;
|
||||
|
|
11
thumbs.c
11
thumbs.c
|
@ -469,14 +469,14 @@ void tns_mark(tns_t *tns, int n, bool mark)
|
|||
if (n >= 0 && n < *tns->cnt && tns->thumbs[n].im != NULL) {
|
||||
win_t *win = tns->win;
|
||||
thumb_t *t = &tns->thumbs[n];
|
||||
unsigned long col = win->fullscreen ? win->black.pixel : win->bg.pixel;
|
||||
unsigned long col = win->bg.pixel;
|
||||
int x = t->x + t->w, y = t->y + t->h;
|
||||
|
||||
win_draw_rect(win, x - 1, y + 1, 1, tns->bw, true, 1, col);
|
||||
win_draw_rect(win, x + 1, y - 1, tns->bw, 1, true, 1, col);
|
||||
|
||||
if (mark)
|
||||
col = win->fullscreen && win->light ? win->bg.pixel : win->fg.pixel;
|
||||
col = win->fg.pixel;
|
||||
|
||||
win_draw_rect(win, x, y, tns->bw + 2, tns->bw + 2, true, 1, col);
|
||||
|
||||
|
@ -490,14 +490,9 @@ void tns_highlight(tns_t *tns, int n, bool hl)
|
|||
if (n >= 0 && n < *tns->cnt && tns->thumbs[n].im != NULL) {
|
||||
win_t *win = tns->win;
|
||||
thumb_t *t = &tns->thumbs[n];
|
||||
unsigned long col;
|
||||
unsigned long col = hl ? win->fg.pixel : win->bg.pixel;
|
||||
int oxy = (tns->bw + 1) / 2 + 1, owh = tns->bw + 2;
|
||||
|
||||
if (hl)
|
||||
col = win->fullscreen && win->light ? win->bg.pixel : win->fg.pixel;
|
||||
else
|
||||
col = win->fullscreen ? win->black.pixel : win->bg.pixel;
|
||||
|
||||
win_draw_rect(win, t->x - oxy, t->y - oxy, t->w + owh, t->h + owh,
|
||||
false, tns->bw, col);
|
||||
|
||||
|
|
27
window.c
27
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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue