add support for _NET_CLIENT_LIST

This commit is contained in:
Julien Danjou 2007-12-27 16:19:05 +01:00
parent 0f4a9df88c
commit c66c6dff84
2 changed files with 29 additions and 1 deletions

View File

@ -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++)

View File

@ -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);
}