diff --git a/src/framewin.c b/src/framewin.c index 3f03aa59..b11f414e 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 8a336008..ee427915 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 a310c60b..7fe589f0 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);