This is an automated email generated because a ref change occurred in the
git repository for project wmaker-crm.git.
The branch, master has been updated
via 67e2f5e1ca9847e2093e5122363b5bbcf91c3e59 (commit)
from 3579c85af1a44458081867957091db8d685199b8 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 67e2f5e1ca9847e2093e5122363b5bbcf91c3e59
Author: David Maciejak <
david.m...@gmail.com>
Date: Thu, 25 Dec 2025 16:19:05 -0500
URL: <
https://repo.or.cz/wmaker-crm.git/67e2f5e1ca9847e2>
Prevent XAllocColor() call on TrueColor display
As reported in bug
https://github.com/window-maker/wmaker/issues/50
X11 XAllocColor() call from wGetColorForColormap() in src/resources.c is returning some errors
especially seen when running GZDoom.
TrueColor display has been the dominant standard for well over a decade, meaning almost all modern X servers default to a TrueColor visual.
The default colormap is predefined and read-only, making allocation with XAllocColor() unnecessary (and meaning no need to free it too).
The patch is checking the display visual, and in case the display is truecolor, it does not allocate or free the color, just looking up for it.
Once the patch applied, GZDoom is not reporting warnings anymore.
---
src/framewin.c | 12 ++++++------
src/resources.c | 15 +++++++++++++--
src/resources.h | 2 +-
3 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/src/framewin.c b/src/framewin.c
index 3f03aa5948ae..b11f414ebc86 100644
--- a/src/framewin.c
+++ b/src/framewin.c
@@ -58,14 +58,14 @@ static void paintButton(WCoreWindow * button, WTexture * texture,
static void updateTitlebar(WFrameWindow * fwin);
-static void allocFrameBorderPixel(Colormap colormap, const char *color_name, unsigned long **pixel);
+static void allocFrameBorderPixel(WFrameWindow *fwin, const char *color_name, unsigned long **pixel);
-static void allocFrameBorderPixel(Colormap colormap, const char *color_name, unsigned long **pixel) {
+static void allocFrameBorderPixel(WFrameWindow *fwin, const char *color_name, unsigned long **pixel) {
XColor xcol;
*pixel = NULL;
- if (! wGetColorForColormap(colormap, color_name, &xcol))
+ if (! wGetColorForColormap(fwin->screen_ptr, fwin->colormap, color_name, &xcol))
return;
*pixel = wmalloc(sizeof(unsigned long));
@@ -412,9 +412,9 @@ void wFrameWindowUpdateBorders(WFrameWindow * fwin, int flags)
checkTitleSize(fwin);
- allocFrameBorderPixel(fwin->colormap, WMGetColorRGBDescription(scr->frame_border_color), &fwin->border_pixel);
- allocFrameBorderPixel(fwin->colormap, WMGetColorRGBDescription(scr->frame_focused_border_color), &fwin->focused_border_pixel);
- allocFrameBorderPixel(fwin->colormap, WMGetColorRGBDescription(scr->frame_selected_border_color), &fwin->selected_border_pixel);
+ allocFrameBorderPixel(fwin, WMGetColorRGBDescription(scr->frame_border_color), &fwin->border_pixel);
+ allocFrameBorderPixel(fwin, WMGetColorRGBDescription(scr->frame_focused_border_color), &fwin->focused_border_pixel);
+ allocFrameBorderPixel(fwin, WMGetColorRGBDescription(scr->frame_selected_border_color), &fwin->selected_border_pixel);
if (flags & WFF_SELECTED) {
if (fwin->selected_border_pixel)
diff --git a/src/resources.c b/src/resources.c
index 8a336008fa54..ee427915fa5c 100644
--- a/src/resources.c
+++ b/src/resources.c
@@ -35,8 +35,16 @@
#include "resources.h"
#include "screen.h"
-int wGetColorForColormap(Colormap colormap, const char *color_name, XColor *color)
+int wGetColorForColormap(WScreen *scr, Colormap colormap, const char *color_name, XColor *color)
{
+ if (scr->w_visual->class == TrueColor) {
+ XColor dummy_exact;
+ if (!XLookupColor(dpy, colormap, color_name, &dummy_exact, color)) {
+ wwarning(_("could not lookup color \"%s\""), color_name);
+ return False;
+ }
+ return True;
+ }
if (!XParseColor(dpy, colormap, color_name, color)) {
wwarning(_("could not parse color \"%s\""), color_name);
return False;
@@ -50,11 +58,14 @@ int wGetColorForColormap(Colormap colormap, const char *color_name, XColor *colo
int wGetColor(WScreen *scr, const char *color_name, XColor *color)
{
- return wGetColorForColormap(scr->w_colormap, color_name, color);
+ return wGetColorForColormap(scr, scr->w_colormap, color_name, color);
}
void wFreeColor(WScreen * scr, unsigned long pixel)
{
+ if (scr->w_visual->class == TrueColor)
+ return;
+
if (pixel != scr->white_pixel && pixel != scr->black_pixel) {
unsigned long colors[1];
diff --git a/src/resources.h b/src/resources.h
index a310c60b2b04..7fe589f01db6 100644
--- a/src/resources.h
+++ b/src/resources.h
@@ -21,7 +21,7 @@
#ifndef WMRESOURCES_H_
#define WMRESOURCES_H_
-int wGetColorForColormap(Colormap colormap, const char *color_name, XColor *color);
+int wGetColorForColormap(WScreen *scr, Colormap colormap, const char *color_name, XColor *color);
int wGetColor(WScreen *scr, const char *color_name, XColor *color);
void wFreeColor(WScreen *scr, unsigned long pixel);
-----------------------------------------------------------------------
Summary of changes:
src/framewin.c | 12 ++++++------
src/resources.c | 15 +++++++++++++--
src/resources.h | 2 +-
3 files changed, 20 insertions(+), 9 deletions(-)
repo.or.cz automatic notification. Contact project admin
crm...@gmail.com
if you want to unsubscribe, or site admin
ad...@repo.or.cz if you receive
no reply.
--
wmaker-crm.git ("The Window Maker window manager")