diff --git a/src/framewin.c b/src/framewin.c index b7a6e971..67cda92e 100644 --- a/src/framewin.c +++ b/src/framewin.c @@ -113,15 +113,7 @@ WFrameWindow *wFrameWindowCreate(WScreen * scr, int wlevel, int x, int y, 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); - if (wPreferences.use_saveunders) { - unsigned long vmask; - XSetWindowAttributes attribs; - - vmask = CWSaveUnder; - attribs.save_under = True; - XChangeWindowAttributes(dpy, fwin->core->window, vmask, &attribs); - } + ? FRAME_BORDER_WIDTH : 0, fwin->depth, fwin->visual, fwin->colormap, scr->frame_border_pixel); /* setup stacking information */ fwin->core->stacking = wmalloc(sizeof(WStacking)); diff --git a/src/icon.c b/src/icon.c index e88ec30d..62f618a5 100644 --- a/src/icon.c +++ b/src/icon.c @@ -168,8 +168,6 @@ WIcon *icon_create_for_dock(WScreen *scr, char *command, char *wm_instance, char static WIcon *icon_create_core(WScreen *scr, int coord_x, int coord_y) { WIcon *icon; - unsigned long vmask = 0; - XSetWindowAttributes attribs; icon = wmalloc(sizeof(WIcon)); icon->core = wCoreCreateTopLevel(scr, @@ -177,18 +175,8 @@ static WIcon *icon_create_core(WScreen *scr, int coord_x, int coord_y) coord_y, wPreferences.icon_size, wPreferences.icon_size, - 0, scr->w_depth, scr->w_visual, scr->w_colormap); - - if (wPreferences.use_saveunders) { - vmask = CWSaveUnder; - attribs.save_under = True; - } - - /* a white border for selecting it */ - vmask |= CWBorderPixel; - attribs.border_pixel = scr->white_pixel; - - XChangeWindowAttributes(dpy, icon->core->window, vmask, &attribs); + 0, scr->w_depth, scr->w_visual, scr->w_colormap, + scr->white_pixel); /* will be overriden if this is a application icon */ icon->core->descriptor.handle_mousedown = miniwindowMouseDown; diff --git a/src/wcore.c b/src/wcore.c index 1abe8425..a2aff96a 100644 --- a/src/wcore.c +++ b/src/wcore.c @@ -43,7 +43,7 @@ extern XContext wWinContext; * Returns: * The created window. *--------------------------------------------------------------------- */ -WCoreWindow *wCoreCreateTopLevel(WScreen *screen, int x, int y, int width, int height, int bwidth, int depth, Visual *visual, Colormap colormap) +WCoreWindow *wCoreCreateTopLevel(WScreen *screen, int x, int y, int width, int height, int bwidth, int depth, Visual *visual, Colormap colormap, WMPixel border_pixel) { WCoreWindow *core; int vmask; @@ -56,13 +56,18 @@ WCoreWindow *wCoreCreateTopLevel(WScreen *screen, int x, int y, int width, int h attribs.cursor = wCursor[WCUR_DEFAULT]; attribs.background_pixmap = None; attribs.background_pixel = screen->black_pixel; - attribs.border_pixel = screen->frame_border_pixel; + attribs.border_pixel = border_pixel; attribs.event_mask = SubstructureRedirectMask | ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | ExposureMask | EnterWindowMask | LeaveWindowMask; attribs.colormap = colormap; + if (wPreferences.use_saveunders) { + vmask |= CWSaveUnder; + attribs.save_under = True; + } + core->window = XCreateWindow(dpy, screen->root_win, x, y, width, height, bwidth, depth, CopyFromParent, visual, vmask, &attribs); core->width = width; diff --git a/src/wcore.h b/src/wcore.h index 4e626ccd..6065c5fe 100644 --- a/src/wcore.h +++ b/src/wcore.h @@ -43,7 +43,8 @@ typedef struct _WCoreWindow { WCoreWindow *wCoreCreateTopLevel(WScreen *screen, int x, int y, int width, int height, int bwidth, - int depth, Visual *visual, Colormap colormap); + int depth, Visual *visual, Colormap colormap, + WMPixel border_pixel); WCoreWindow *wCoreCreate(WCoreWindow *parent, int x, int y, int width, int height);