From 753c0f836ed0b4f986b55dd70cd151a3ff344a9b Mon Sep 17 00:00:00 2001 From: lotherk Date: Sun, 22 Nov 2026 13:51:31 +0100 Subject: [PATCH] dtwm: the desktop icons stay above the wallpaper The wallpaper is a window of its own (WmBackdrop.c), and the icons are override-redirect windows. XLowerWindow on an icon put it *below* that window: the icon was mapped and invisible (measured 2026-11-22 on the MacBook, the icon windows were IsViewable at 1174,10 and 96x96, and the screen showed only the wallpaper). DeskMap lowers the backdrops after the icon now, so the order is root < wallpaper < icons < clients, as 4Dwm has it. Measured: make -C programs/dtwm rc=0, 0 errors (the MacBook build of this file, /tmp/dtwm-build7.log); the screenshot shows Computer, CD/DVD drive and Trash at 1174,10 / 1174,98 / 1174,186. --- programs/dtwm/WmMcdeDesktop.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/programs/dtwm/WmMcdeDesktop.c b/programs/dtwm/WmMcdeDesktop.c index 43d840a2..a1bf1835 100644 --- a/programs/dtwm/WmMcdeDesktop.c +++ b/programs/dtwm/WmMcdeDesktop.c @@ -429,6 +429,23 @@ DeskWorkspaceIndex(WmScreenData *pSD) return (int) (pSD->pActiveWS - pSD->pWS); } +/* The wallpaper is a window of its own (WmBackdrop.c) and the icons are + * override-redirect windows, so XLowerWindow on an icon puts it *below* the + * wallpaper: the icon is there and invisible (measured 2026-11-22). Lower + * the backdrop first, then the icon sits above the wallpaper and below the + * clients -- the order 4Dwm has. */ +static void +DeskLowerBackdrops(void) +{ + int i; + + if (pSD == NULL) + return; + for (i = 0; i < pSD->numWorkspaces; i++) + if (pSD->pWS[i].backdrop.window != None) + XLowerWindow(deskDpy, pSD->pWS[i].backdrop.window); +} + static void DeskMap(int i) { @@ -450,6 +467,7 @@ DeskMap(int i) * manager. */ XMapWindow(deskDpy, it->win); XLowerWindow(deskDpy, it->win); + DeskLowerBackdrops(); } else XUnmapWindow(deskDpy, it->win); }