Fix in tabbed with alpha patch (#3)

* Fix in tabbed with alpha patch

Co-authored-by: Jared Forrest <jared_forrest@mailbox.org>
This commit is contained in:
Berke Kocaoğlu 2021-09-11 08:46:33 +03:00
parent ba0d87fadf
commit c7ca547b55
2 changed files with 23 additions and 9 deletions

View File

@ -482,7 +482,7 @@ void img_render(img_t *img)
if ((bg = imlib_create_image(dw, dh)) == NULL)
error(EXIT_FAILURE, ENOMEM, NULL);
imlib_context_set_image(bg);
imlib_image_set_has_alpha(0);
imlib_image_set_has_alpha(1);
if (img->alpha) {
int i, c, r;
@ -510,6 +510,7 @@ void img_render(img_t *img)
imlib_free_image();
imlib_context_set_color_modifier(img->cmod);
} else {
imlib_image_set_has_alpha(1);
imlib_render_image_part_on_drawable_at_size(sx, sy, sw, sh, dx, dy, dw, dh);
}
img->dirty = false;

View File

@ -64,8 +64,8 @@ void win_init_font(const win_env_t *e, const char *fontstr)
void win_alloc_color(const win_env_t *e, const char *name, XftColor *col)
{
if (!XftColorAllocName(e->dpy, DefaultVisual(e->dpy, e->scr),
DefaultColormap(e->dpy, e->scr), name, col))
if (!XftColorAllocName(e->dpy, e->vis,
e->cmap, name, col))
{
error(EXIT_FAILURE, 0, "Error allocating color '%s'", name);
}
@ -95,6 +95,9 @@ void win_init(win_t *win)
const char *bg, *fg, *f;
char *res_man;
XrmDatabase db;
XVisualInfo vis;
XWindowAttributes attr;
Window parent;
memset(win, 0, sizeof(win_t));
@ -105,9 +108,19 @@ void win_init(win_t *win)
e->scr = DefaultScreen(e->dpy);
e->scrw = DisplayWidth(e->dpy, e->scr);
e->scrh = DisplayHeight(e->dpy, e->scr);
e->vis = DefaultVisual(e->dpy, e->scr);
e->cmap = DefaultColormap(e->dpy, e->scr);
parent = options->embed != 0 ? options->embed : RootWindow(e->dpy, e->scr);
if (options->embed == 0) {
e->depth = DefaultDepth(e->dpy, e->scr);
} else {
XGetWindowAttributes(e->dpy, parent, &attr);
e->depth = attr.depth;
}
XMatchVisualInfo(e->dpy, e->scr, e->depth, TrueColor, &vis);
e->vis = vis.visual;
e->cmap = XCreateColormap(e->dpy, parent, e->vis, None);
if (setlocale(LC_CTYPE, "") == NULL || XSupportsLocale() == 0)
error(0, 0, "No locale support");
@ -210,7 +223,7 @@ void win_open(win_t *win)
if (i != CURSOR_NONE)
cursors[i].icon = XCreateFontCursor(e->dpy, cursors[i].name);
}
if (XAllocNamedColor(e->dpy, DefaultColormap(e->dpy, e->scr), "black",
if (XAllocNamedColor(e->dpy, e->cmap, "black",
&col, &col) == 0)
{
error(EXIT_FAILURE, 0, "Error allocating color 'black'");
@ -400,8 +413,8 @@ void win_draw_bar(win_t *win)
e = &win->env;
y = win->h + font->ascent + V_TEXT_PAD;
w = win->w - 2*H_TEXT_PAD;
d = XftDrawCreate(e->dpy, win->buf.pm, DefaultVisual(e->dpy, e->scr),
DefaultColormap(e->dpy, e->scr));
d = XftDrawCreate(e->dpy, win->buf.pm, e->vis,
e->cmap);
XSetForeground(e->dpy, gc, win->fg.pixel);
XFillRectangle(e->dpy, win->buf.pm, gc, 0, win->h, win->w, win->bar.h);