mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 04:48:06 +01:00
Draw window borders with correct colormap.
Using window-supplied depth, visual and colormap information has the side effect of causing window borders to be draw using inconsistent colormap entries. Allocate entries from each window's colormap when drawing its border. Force setting the border when the window is first created so it's guaranteed to be drawn in a consistent state.
This commit is contained in:
committed by
Carlos R. Mafra
parent
9ab2b642a6
commit
b796928504
@@ -58,6 +58,27 @@ static void paintButton(WCoreWindow * button, WTexture * texture,
|
||||
|
||||
static void updateTitlebar(WFrameWindow * fwin);
|
||||
|
||||
static void allocFrameBorderPixel(Colormap colormap, char *color_name, unsigned long **pixel);
|
||||
|
||||
static void allocFrameBorderPixel(Colormap colormap, char *color_name, unsigned long **pixel) {
|
||||
XColor xcol;
|
||||
|
||||
*pixel = NULL;
|
||||
|
||||
if (!XParseColor(dpy, colormap, color_name, &xcol)) {
|
||||
wwarning(_("could not parse color \"%s\""), color_name);
|
||||
return;
|
||||
}
|
||||
if (!XAllocColor(dpy, colormap, &xcol)) {
|
||||
wwarning(_("could not allocate color \"%s\""), color_name);
|
||||
return;
|
||||
}
|
||||
|
||||
*pixel = wmalloc(sizeof(unsigned long));
|
||||
if (*pixel)
|
||||
**pixel = xcol.pixel;
|
||||
}
|
||||
|
||||
WFrameWindow *wFrameWindowCreate(WScreen * scr, int wlevel, int x, int y,
|
||||
int width, int height, int *clearance,
|
||||
int *title_min, int *title_max, int flags,
|
||||
@@ -88,6 +109,8 @@ WFrameWindow *wFrameWindowCreate(WScreen * scr, int wlevel, int x, int y,
|
||||
fwin->depth = depth;
|
||||
fwin->visual = visual;
|
||||
fwin->colormap = colormap;
|
||||
allocFrameBorderPixel(fwin->colormap, FRAME_BORDER_COLOR, &fwin->border_pixel);
|
||||
allocFrameBorderPixel(fwin->colormap, FRAME_SELECTED_BORDER_COLOR, &fwin->selected_border_pixel);
|
||||
|
||||
fwin->core = wCoreCreateTopLevel(scr, x, y, width, height, (flags & WFF_BORDER)
|
||||
? FRAME_BORDER_WIDTH : 0, fwin->depth, fwin->visual, fwin->colormap);
|
||||
@@ -413,6 +436,9 @@ void wFrameWindowUpdateBorders(WFrameWindow * fwin, int flags)
|
||||
}
|
||||
|
||||
checkTitleSize(fwin);
|
||||
|
||||
if (fwin->border_pixel)
|
||||
XSetWindowBorder(dpy, fwin->core->window, *fwin->border_pixel);
|
||||
}
|
||||
|
||||
void wFrameWindowDestroy(WFrameWindow * fwin)
|
||||
|
||||
Reference in New Issue
Block a user