[repo.or.cz] wmaker-crm.git branch master updated: wmaker-0.96.0-68-g75a8299d1806

1 view
Skip to first unread message

crmafra

unread,
Feb 20, 2026, 3:48:29 AM (5 days ago) Feb 20
to wmake...@googlegroups.com
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 75a8299d18064b1601107698e7ea867885ff1a4f (commit)
from cc0a652ea87f24fea82875ea46270713ff70501c (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 75a8299d18064b1601107698e7ea867885ff1a4f
Author: David Maciejak <david.m...@gmail.com>
Date: Wed, 18 Feb 2026 21:26:56 -0500
URL: <https://repo.or.cz/wmaker-crm.git/75a8299d18064b16>

wmaker: set the color pixel for TrueColor display

As mentioned in commit 67e2f5e1ca9847e2093e5122363b5bbcf91c3e59,
for TrueColor display it's not necessary to allocate a color but
it is required to set the pixel property of the XColor.
---
src/resources.c | 37 +++++++++++++++++++++++++++++--------
1 file changed, 29 insertions(+), 8 deletions(-)

diff --git a/src/resources.c b/src/resources.c
index ee427915fa5c..61ed48a63333 100644
--- a/src/resources.c
+++ b/src/resources.c
@@ -35,20 +35,41 @@
#include "resources.h"
#include "screen.h"

-int wGetColorForColormap(WScreen *scr, Colormap colormap, const char *color_name, XColor *color)
+static unsigned long scale_color_component(unsigned short value, unsigned long mask)
{
- 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;
+ unsigned long m = mask;
+ int shift = 0, bits = 0;
+
+ if (!m)
+ return 0;
+
+ while (!(m & 1)) {
+ shift++;
+ m >>= 1;
+ }
+ while (m) {
+ bits++;
+ m >>= 1;
}
+
+ return ((unsigned long)(value >> (16 - bits)) & ((1UL << bits) - 1)) << shift;
+}
+
+int wGetColorForColormap(WScreen *scr, Colormap colormap, const char *color_name, XColor *color)
+{
if (!XParseColor(dpy, colormap, color_name, color)) {
wwarning(_("could not parse color \"%s\""), color_name);
return False;
}
+
+ if (scr->w_visual->class == TrueColor) {
+ /* Compute pixel directly from RGB components using the visual's channel masks */
+ color->pixel = scale_color_component(color->red, scr->w_visual->red_mask)
+ | scale_color_component(color->green, scr->w_visual->green_mask)
+ | scale_color_component(color->blue, scr->w_visual->blue_mask);
+ return True;
+ }
+
if (!XAllocColor(dpy, colormap, color)) {
wwarning(_("could not allocate color \"%s\""), color_name);
return False;

-----------------------------------------------------------------------

Summary of changes:
src/resources.c | 37 +++++++++++++++++++++++++++++--------
1 file changed, 29 insertions(+), 8 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")
Reply all
Reply to author
Forward
0 new messages