applied Andreas Amanns' netwm_client_list patch, but with some indentation fixes 3bfc43c3
anselm@garbe.us · 2012-03-25 17:49 1 file(s) · +20 −1
dwm.c +20 −1
60 60
enum { ColBorder, ColFG, ColBG, ColLast };              /* color */
61 61
enum { NetSupported, NetWMName, NetWMState,
62 62
       NetWMFullscreen, NetActiveWindow, NetWMWindowType,
63 -
       NetWMWindowTypeDialog, NetLast };     /* EWMH atoms */
63 +
       NetWMWindowTypeDialog, NetClientList, NetLast };     /* EWMH atoms */
64 64
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
65 65
enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
66 66
       ClkClientWin, ClkRootWin, ClkLast };             /* clicks */
238 238
static Bool updategeom(void);
239 239
static void updatebarpos(Monitor *m);
240 240
static void updatebars(void);
241 +
static void updateclientlist(void);
241 242
static void updatenumlockmask(void);
242 243
static void updatesizehints(Client *c);
243 244
static void updatestatus(void);
1160 1161
		XRaiseWindow(dpy, c->win);
1161 1162
	attach(c);
1162 1163
	attachstack(c);
1164 +
	XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
1165 +
	                (unsigned char *) &(c->win), 1);
1163 1166
	XMoveResizeWindow(dpy, c->win, c->x + 2 * sw, c->y, c->w, c->h); /* some windows require this */
1164 1167
	setclientstate(c, NormalState);
1165 1168
	if (c->mon == selmon)
1621 1624
	netatom[NetWMFullscreen] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False);
1622 1625
	netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
1623 1626
	netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False);
1627 +
	netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False);
1624 1628
	/* init cursors */
1625 1629
	cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr);
1626 1630
	cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing);
1643 1647
	/* EWMH support per view */
1644 1648
	XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32,
1645 1649
			PropModeReplace, (unsigned char *) netatom, NetLast);
1650 +
	XDeleteProperty(dpy, root, netatom[NetClientList]);
1646 1651
	/* select for events */
1647 1652
	wa.cursor = cursor[CurNormal];
1648 1653
	wa.event_mask = SubstructureRedirectMask|SubstructureNotifyMask|ButtonPressMask|PointerMotionMask
1820 1825
	}
1821 1826
	free(c);
1822 1827
	focus(NULL);
1828 +
	updateclientlist();
1823 1829
	arrange(m);
1824 1830
}
1825 1831
1866 1872
	}
1867 1873
	else
1868 1874
		m->by = -bh;
1875 +
}
1876 +
1877 +
void
1878 +
updateclientlist() {
1879 +
	Client *c;
1880 +
	Monitor *m;
1881 +
1882 +
	XDeleteProperty(dpy, root, netatom[NetClientList]);
1883 +
	for(m = mons; m; m = m->next)
1884 +
		for(c = m->clients; c; c = c->next)
1885 +
			XChangeProperty(dpy, root, netatom[NetClientList],
1886 +
			                XA_WINDOW, 32, PropModeAppend,
1887 +
			                (unsigned char *) &(c->win), 1);
1869 1888
}
1870 1889
1871 1890
Bool