From 13377b4e34be6d298eeb41a55df939f39ee7f5a7 Mon Sep 17 00:00:00 2001 From: Wynn Wolf Arbor Date: Wed, 18 Mar 2020 19:47:55 +0100 Subject: Calculate colors using the client's visual and colormap As cwm was using the screen's default visual and colormap to draw all client borders, borders for windows that had a depth of 32 bits were not rendered correctly. The same happened with text in the popup menus which were recently changed to be drawn in the context of the client. This commit introduces a Visual reference for each client, and allocates all potential colors for a client's specific visual and colormap in the client_ctx struct. These colors are then used to draw client borders and popup menus. Additionally, since we touch the drawing code anyway, borders are reintroduced to the popup menus for better contrast. --- calmwm.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'calmwm.h') diff --git a/calmwm.h b/calmwm.h index 17ea203..98dee6e 100644 --- a/calmwm.h +++ b/calmwm.h @@ -138,6 +138,7 @@ struct client_ctx { struct group_ctx *gc; Window win; Colormap colormap; + Visual *visual; int bwidth; /* border width */ int obwidth; /* original border width */ struct geom geom, savegeom, fullgeom; @@ -191,6 +192,7 @@ struct client_ctx { char *res_class; /* class hint */ char *res_name; /* class hint */ int initial_state; /* wm hint */ + XftColor xftcolor[CWM_COLOR_NITEMS]; }; TAILQ_HEAD(client_q, client_ctx); @@ -480,7 +482,7 @@ void screen_assert_clients_within(struct screen_ctx *); struct geom screen_area(struct screen_ctx *, int, int, int); struct screen_ctx *screen_find(Window); void screen_init(int); -void screen_prop_win_create(struct screen_ctx *, Window); +void screen_prop_win_create(struct screen_ctx *, struct client_ctx *); void screen_prop_win_destroy(struct screen_ctx *); void screen_prop_win_draw(struct screen_ctx *, const char *, ...) -- cgit v1.2.3-2-gb3c3