diff --git a/programs/dtwm/WmMcdeDesktop.c b/programs/dtwm/WmMcdeDesktop.c index ec4a6ae8..da61b701 100644 --- a/programs/dtwm/WmMcdeDesktop.c +++ b/programs/dtwm/WmMcdeDesktop.c @@ -112,7 +112,7 @@ static int deskCount; static Display *deskDpy; static Window deskRoot; static GC deskGC; -static Pixel deskBg, deskFg, deskMid; +static Pixel deskBg, deskFg, deskMid, deskShadow; static XFontStruct *deskFont; static int deskSel = -1; static Time deskLast; @@ -365,9 +365,6 @@ DeskDraw(int i) int gy = 6; int lw; - XSetForeground(deskDpy, deskGC, deskBg); - XFillRectangle(deskDpy, it->win, deskGC, 0, 0, DESK_CELL_W, - DESK_CELL_H); if (it->glyph != None) { if (it->mask != None) { XSetClipMask(deskDpy, deskGC, it->mask); @@ -380,12 +377,35 @@ DeskDraw(int i) DeskLabel(it, label, sizeof label); lw = deskFont != NULL ? XTextWidth(deskFont, label, (int) strlen(label)) : (int) strlen(label) * 6; - XSetForeground(deskDpy, deskGC, deskBg); - XFillRectangle(deskDpy, it->win, deskGC, (DESK_CELL_W - lw) / 2 - 3, - gy + gh + 6, (unsigned) (lw + 6), DESK_LABEL_H); + /* 4Dwm sets the label on the backdrop, with a shadow, not into a + * tile: the window is shaped to the picture and the text (below) and + * the text gets one pixel of black under it. */ + XSetForeground(deskDpy, deskGC, deskShadow); + XDrawString(deskDpy, it->win, deskGC, (DESK_CELL_W - lw) / 2 + 1, + gy + gh + 6 + DESK_LABEL_H - 3, label, (int) strlen(label)); XSetForeground(deskDpy, deskGC, deskFg); XDrawString(deskDpy, it->win, deskGC, (DESK_CELL_W - lw) / 2, gy + gh + 6 + DESK_LABEL_H - 4, label, (int) strlen(label)); + { + Pixmap shape = XCreatePixmap(deskDpy, it->win, DESK_CELL_W, + DESK_CELL_H, 1); + GC sg = XCreateGC(deskDpy, shape, 0, NULL); + + XSetForeground(deskDpy, sg, 0); + XFillRectangle(deskDpy, shape, sg, 0, 0, DESK_CELL_W, + DESK_CELL_H); + XSetForeground(deskDpy, sg, 1); + if (it->glyph != None) + XFillRectangle(deskDpy, shape, sg, gx, gy, + (unsigned) gw, (unsigned) gh); + XFillRectangle(deskDpy, shape, sg, (DESK_CELL_W - lw) / 2, + gy + gh + 6, (unsigned) lw, + (unsigned) DESK_LABEL_H); + XShapeCombineMask(deskDpy, it->win, ShapeBounding, 0, 0, + shape, ShapeSet); + XFreeGC(deskDpy, sg); + XFreePixmap(deskDpy, shape); + } if (i == deskSel) XDrawRectangle(deskDpy, it->win, deskGC, 0, 0, DESK_CELL_W - 1, DESK_CELL_H - 1); @@ -415,7 +435,13 @@ DeskMap(int i) } if (it->workspace == 0 || it->workspace == active + 1) { XMoveWindow(deskDpy, it->win, it->x, it->y); - XMapRaised(deskDpy, it->win); + /* The desktop is the bottom of the stack: a window that is + * raised (a full screen program) covers the icons, as 4Dwm's + * does. XMapRaised put them above every client, because an + * override-redirect window is not restacked by the window + * manager. */ + XMapWindow(deskDpy, it->win); + XLowerWindow(deskDpy, it->win); } else XUnmapWindow(deskDpy, it->win); } @@ -1956,6 +1982,7 @@ McdeDesktopInit(void) cmap = DefaultColormap(deskDpy, pSD->screen); deskBg = WhitePixel(deskDpy, pSD->screen); deskFg = BlackPixel(deskDpy, pSD->screen); + deskShadow = BlackPixel(deskDpy, pSD->screen); deskMid = WhitePixel(deskDpy, pSD->screen); if (XParseColor(deskDpy, cmap, "#C6C6B2B2A8A8", &c) && XAllocColor(deskDpy, cmap, &c))