dtwm: the desktop's icons look like 4Dwm's and stay under the windows
- No tile: the icon window is shaped (XShapeCombineMask) to the picture and the label, so the backdrop shows between them; the label is drawn on it with one pixel of black under it instead of a filled box. - Bottom of the stack: the icons were mapped with XMapRaised, and an override-redirect window is not restacked by the window manager, so they stayed above every client. They are mapped and lowered now -- a raised window, a full screen program included, covers them, as 4Dwm's desktop does. Measured: make -C programs/dtwm rc=0, 0 errors (build/logs/dtwm-zorder2.log). Not yet: the 64x64 pictures. The .pm files of programs/icons are 32x32 and scaling them would only blur; the IRIX .fti sources raster at 64 with tools/fti2xpm.py once it takes a size.
This commit is contained in:
1 parent
fed6f4c294
commit
f8183fa7d8
1 file changed
+35
-8
@@ -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))
|
||||
|
||||
Reference in new issue
Block a user