mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
support _NET_CLIENT_LIST.
the x property api doesn't let you remove one entry from an X property array, so client_remove is kinda expensive, but there's no real way around that.. ok okan@
This commit is contained in:
parent
3c60d854db
commit
728d2a40dd
3
calmwm.h
3
calmwm.h
@ -527,7 +527,8 @@ extern struct conf Conf;
|
||||
#define _NET_SUPPORTING_WM_CHECK cwm_atoms[8]
|
||||
#define _NET_WM_NAME cwm_atoms[9]
|
||||
#define _NET_ACTIVE_WINDOW cwm_atoms[10]
|
||||
#define CWM_NO_ATOMS 11
|
||||
#define _NET_CLIENT_LIST cwm_atoms[11]
|
||||
#define CWM_NO_ATOMS 12
|
||||
#define CWM_NETWM_START 7
|
||||
|
||||
extern Atom cwm_atoms[CWM_NO_ATOMS];
|
||||
|
23
client.c
23
client.c
@ -114,6 +114,9 @@ client_new(Window win, struct screen_ctx *sc, int mapped)
|
||||
|
||||
TAILQ_INSERT_TAIL(&sc->mruq, cc, mru_entry);
|
||||
TAILQ_INSERT_TAIL(&Clientq, cc, entry);
|
||||
/* append to the client list */
|
||||
XChangeProperty(X_Dpy, sc->rootwin, _NET_CLIENT_LIST, XA_WINDOW, 32,
|
||||
PropModeAppend, (unsigned char *)&cc->win, 1);
|
||||
|
||||
client_gethints(cc);
|
||||
client_update(cc);
|
||||
@ -128,7 +131,10 @@ int
|
||||
client_delete(struct client_ctx *cc)
|
||||
{
|
||||
struct screen_ctx *sc = cc->sc;
|
||||
struct client_ctx *tcc;
|
||||
struct winname *wn;
|
||||
Window *winlist;
|
||||
int i, j;
|
||||
|
||||
group_client_delete(cc);
|
||||
|
||||
@ -141,6 +147,23 @@ client_delete(struct client_ctx *cc)
|
||||
|
||||
TAILQ_REMOVE(&sc->mruq, cc, mru_entry);
|
||||
TAILQ_REMOVE(&Clientq, cc, entry);
|
||||
/*
|
||||
* Sadly we can't remove just one entry from a property, so we must
|
||||
* redo the whole thing from scratch. this is the stupid way, the other
|
||||
* way incurs many roundtrips to the server.
|
||||
*/
|
||||
i = j = 0;
|
||||
TAILQ_FOREACH(tcc, &Clientq, entry)
|
||||
i++;
|
||||
if (i > 0) {
|
||||
winlist = xmalloc(i * sizeof(*winlist));
|
||||
TAILQ_FOREACH(tcc, &Clientq, entry)
|
||||
winlist[j++] = tcc->win;
|
||||
XChangeProperty(X_Dpy, sc->rootwin, _NET_CLIENT_LIST,
|
||||
XA_WINDOW, 32, PropModeReplace,
|
||||
(unsigned char *)winlist, i);
|
||||
xfree(winlist);
|
||||
}
|
||||
|
||||
if (_curcc == cc)
|
||||
client_none(sc);
|
||||
|
Loading…
Reference in New Issue
Block a user