From 4a67d023ef204d0c237841610e943cc247447be0 Mon Sep 17 00:00:00 2001 From: Martin Tournoij Date: Mon, 8 Apr 2024 17:43:36 +0100 Subject: [PATCH] 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 --- find-cursor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/find-cursor.c b/find-cursor.c index 3d2dd7f..91a6ebf 100644 --- a/find-cursor.c +++ b/find-cursor.c @@ -259,10 +259,12 @@ void draw(char *name, Display *display, int screen, XSetWindowAttributes window_attr; window_attr.override_redirect = 1; + Colormap colormap = DefaultColormap(display, screen); if (transparent) { XVisualInfo vinfo; XMatchVisualInfo(display, screen, 32, TrueColor, &vinfo); window_attr.colormap = XCreateColormap(display, DefaultRootWindow(display), vinfo.visual, AllocNone); + colormap = window_attr.colormap; window_attr.background_pixel = 0; window = XCreateWindow(display, XRootWindow(display, screen), center_x, // x position @@ -349,7 +351,6 @@ void draw(char *name, Display *display, int screen, GC gc = XCreateGC(display, window, valuemask, &values); // Get colours. - Colormap colormap = DefaultColormap(display, screen); XColor color; int err = XAllocNamedColor(display, colormap, color_name, &color, &color); if (err == 0) {