From c66c6dff847d57978383701cda4b57d21baa82c0 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Thu, 27 Dec 2007 16:19:05 +0100 Subject: [PATCH] add support for _NET_CLIENT_LIST --- awesome.c | 3 ++- client.c | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/awesome.c b/awesome.c index d4df36364..3e4d57910 100644 --- a/awesome.c +++ b/awesome.c @@ -289,7 +289,7 @@ main(int argc, char *argv[]) Display * dpy; int shape_event, randr_event_base; int screen; - enum { NetSupported, NetWMName, NetWMIcon, NetLast }; /* EWMH atoms */ + enum { NetSupported, NetWMName, NetWMIcon, NetClientList, NetLast }; /* EWMH atoms */ Atom netatom[NetLast]; event_handler **handler; struct sockaddr_un *addr; @@ -348,6 +348,7 @@ main(int argc, char *argv[]) netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); netatom[NetWMIcon] = XInternAtom(dpy, "_NET_WM_ICON", False); + netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False); /* do this only for real screen */ for(screen = 0; screen < ScreenCount(dpy); screen++) diff --git a/client.c b/client.c index f7f27dec1..057898603 100644 --- a/client.c +++ b/client.c @@ -257,6 +257,31 @@ focus(Client *c, Bool selscreen, int screen) RevertToPointerRoot, CurrentTime); } +static void +ewmh_update_net_client_list(int phys_screen) +{ + Window *wins; + Client *c; + int n = 0; + + for(c = globalconf.clients; c; c = c->next) + if(c->phys_screen == phys_screen) + n++; + + wins = p_new(Window, n + 1); + + for(n = 0, c = globalconf.clients; c; c = c->next, n++) + if(c->phys_screen == phys_screen) + wins[n] = c->win; + + XChangeProperty(globalconf.display, RootWindow(globalconf.display, phys_screen), + XInternAtom(globalconf.display, "_NET_CLIENT_LIST", False), XA_WINDOW, 32, + PropModeReplace, (unsigned char*)wins, n); + + p_delete(&wins); + XFlush(globalconf.display); +} + /** Manage a new client * \param w The window * \param wa Window attributes @@ -366,6 +391,8 @@ client_manage(Window w, XWindowAttributes *wa, int screen) focus(c, True, screen); + ewmh_update_net_client_list(c->phys_screen); + /* rearrange to display new window */ arrange(screen); }