Use correct colormap with -t

Using the default colormap on a drawable w/ specific (ARGB) colormap for
rendering the arcs will lead to random colors being picked (typically
"white", but it can actually be anything) for the arcs. You have to use
the colormap specific to the drawawble (window)

Patch by luebking

Fixes #26
master
Martin Tournoij 2 months ago
parent 925afa184f
commit 4a67d023ef
No known key found for this signature in database

@ -259,10 +259,12 @@ void draw(char *name, Display *display, int screen,
XSetWindowAttributes window_attr; XSetWindowAttributes window_attr;
window_attr.override_redirect = 1; window_attr.override_redirect = 1;
Colormap colormap = DefaultColormap(display, screen);
if (transparent) { if (transparent) {
XVisualInfo vinfo; XVisualInfo vinfo;
XMatchVisualInfo(display, screen, 32, TrueColor, &vinfo); XMatchVisualInfo(display, screen, 32, TrueColor, &vinfo);
window_attr.colormap = XCreateColormap(display, DefaultRootWindow(display), vinfo.visual, AllocNone); window_attr.colormap = XCreateColormap(display, DefaultRootWindow(display), vinfo.visual, AllocNone);
colormap = window_attr.colormap;
window_attr.background_pixel = 0; window_attr.background_pixel = 0;
window = XCreateWindow(display, XRootWindow(display, screen), window = XCreateWindow(display, XRootWindow(display, screen),
center_x, // x position center_x, // x position
@ -349,7 +351,6 @@ void draw(char *name, Display *display, int screen,
GC gc = XCreateGC(display, window, valuemask, &values); GC gc = XCreateGC(display, window, valuemask, &values);
// Get colours. // Get colours.
Colormap colormap = DefaultColormap(display, screen);
XColor color; XColor color;
int err = XAllocNamedColor(display, colormap, color_name, &color, &color); int err = XAllocNamedColor(display, colormap, color_name, &color, &color);
if (err == 0) { if (err == 0) {

Loading…
Cancel
Save