dwm-meillo
changeset 229:f4f5d000ce7a
implemented NET_ACTIVE_WINDOW support
author | Anselm R.Garbe <arg@10ksloc.org> |
---|---|
date | Tue, 08 Aug 2006 17:08:45 +0200 |
parents | ebb1fd90f633 |
children | b92bbc2487c9 |
files | client.c dwm.h event.c main.c |
diffstat | 4 files changed, 20 insertions(+), 1 deletions(-) [+] |
line diff
1.1 --- a/client.c Tue Aug 08 12:58:05 2006 +0200 1.2 +++ b/client.c Tue Aug 08 17:08:45 2006 +0200 1.3 @@ -58,6 +58,8 @@ 1.4 drawtitle(c); 1.5 XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); 1.6 XSync(dpy, False); 1.7 + XChangeProperty(dpy, root, netatom[NetActiveWindow], XA_WINDOW, 32, 1.8 + PropModeReplace, (unsigned char *)&c->win, 1); 1.9 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); 1.10 } 1.11 1.12 @@ -459,6 +461,9 @@ 1.13 arrange(NULL); 1.14 if(sel) 1.15 focus(sel); 1.16 + else 1.17 + XChangeProperty(dpy, root, netatom[NetActiveWindow], XA_WINDOW, 32, 1.18 + PropModeReplace, (unsigned char *)NULL, 1); 1.19 } 1.20 1.21 void
2.1 --- a/dwm.h Tue Aug 08 12:58:05 2006 +0200 2.2 +++ b/dwm.h Tue Aug 08 17:08:45 2006 +0200 2.3 @@ -22,7 +22,7 @@ 2.4 }; 2.5 2.6 /* atoms */ 2.7 -enum { NetSupported, NetWMName, NetLast }; 2.8 +enum { NetSupported, NetWMName, NetActiveWindow, NetLast }; 2.9 enum { WMProtocols, WMDelete, WMLast }; 2.10 2.11 /* cursor */
3.1 --- a/event.c Tue Aug 08 12:58:05 2006 +0200 3.2 +++ b/event.c Tue Aug 08 17:08:45 2006 +0200 3.3 @@ -146,6 +146,18 @@ 3.4 } 3.5 3.6 static void 3.7 +clientmessage(XEvent *e) 3.8 +{ 3.9 + Client *c; 3.10 + XClientMessageEvent *ev = &e->xclient; 3.11 + 3.12 + if(ev->message_type == netatom[NetActiveWindow]) { 3.13 + if((c = getclient(ev->window)) && c->tags[tsel]) 3.14 + focus(c); 3.15 + } 3.16 +} 3.17 + 3.18 +static void 3.19 configurerequest(XEvent *e) 3.20 { 3.21 Client *c; 3.22 @@ -339,6 +351,7 @@ 3.23 3.24 void (*handler[LASTEvent]) (XEvent *) = { 3.25 [ButtonPress] = buttonpress, 3.26 + [ClientMessage] = clientmessage, 3.27 [ConfigureRequest] = configurerequest, 3.28 [DestroyNotify] = destroynotify, 3.29 [EnterNotify] = enternotify,
4.1 --- a/main.c Tue Aug 08 12:58:05 2006 +0200 4.2 +++ b/main.c Tue Aug 08 17:08:45 2006 +0200 4.3 @@ -201,6 +201,7 @@ 4.4 wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False); 4.5 netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); 4.6 netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); 4.7 + netatom[NetActiveWindow] = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False); 4.8 XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32, 4.9 PropModeReplace, (unsigned char *) netatom, NetLast); 4.10