summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client.c5
-rw-r--r--dwm.h2
-rw-r--r--event.c13
-rw-r--r--main.c1
4 files changed, 20 insertions, 1 deletions
diff --git a/client.c b/client.c
index f92df83..9b91ab6 100644
--- a/client.c
+++ b/client.c
@@ -58,6 +58,8 @@ focus(Client *c)
58 drawtitle(c); 58 drawtitle(c);
59 XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); 59 XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
60 XSync(dpy, False); 60 XSync(dpy, False);
61 XChangeProperty(dpy, root, netatom[NetActiveWindow], XA_WINDOW, 32,
62 PropModeReplace, (unsigned char *)&c->win, 1);
61 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); 63 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
62} 64}
63 65
@@ -459,6 +461,9 @@ unmanage(Client *c)
459 arrange(NULL); 461 arrange(NULL);
460 if(sel) 462 if(sel)
461 focus(sel); 463 focus(sel);
464 else
465 XChangeProperty(dpy, root, netatom[NetActiveWindow], XA_WINDOW, 32,
466 PropModeReplace, (unsigned char *)NULL, 1);
462} 467}
463 468
464void 469void
diff --git a/dwm.h b/dwm.h
index 57d628a..efef213 100644
--- a/dwm.h
+++ b/dwm.h
@@ -22,7 +22,7 @@ union Arg {
22}; 22};
23 23
24/* atoms */ 24/* atoms */
25enum { NetSupported, NetWMName, NetLast }; 25enum { NetSupported, NetWMName, NetActiveWindow, NetLast };
26enum { WMProtocols, WMDelete, WMLast }; 26enum { WMProtocols, WMDelete, WMLast };
27 27
28/* cursor */ 28/* cursor */
diff --git a/event.c b/event.c
index 2e4f62e..c3169aa 100644
--- a/event.c
+++ b/event.c
@@ -146,6 +146,18 @@ buttonpress(XEvent *e)
146} 146}
147 147
148static void 148static void
149clientmessage(XEvent *e)
150{
151 Client *c;
152 XClientMessageEvent *ev = &e->xclient;
153
154 if(ev->message_type == netatom[NetActiveWindow]) {
155 if((c = getclient(ev->window)) && c->tags[tsel])
156 focus(c);
157 }
158}
159
160static void
149configurerequest(XEvent *e) 161configurerequest(XEvent *e)
150{ 162{
151 Client *c; 163 Client *c;
@@ -339,6 +351,7 @@ unmapnotify(XEvent *e)
339 351
340void (*handler[LASTEvent]) (XEvent *) = { 352void (*handler[LASTEvent]) (XEvent *) = {
341 [ButtonPress] = buttonpress, 353 [ButtonPress] = buttonpress,
354 [ClientMessage] = clientmessage,
342 [ConfigureRequest] = configurerequest, 355 [ConfigureRequest] = configurerequest,
343 [DestroyNotify] = destroynotify, 356 [DestroyNotify] = destroynotify,
344 [EnterNotify] = enternotify, 357 [EnterNotify] = enternotify,
diff --git a/main.c b/main.c
index 5efe599..ded4761 100644
--- a/main.c
+++ b/main.c
@@ -201,6 +201,7 @@ main(int argc, char *argv[])
201 wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False); 201 wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
202 netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); 202 netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
203 netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); 203 netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
204 netatom[NetActiveWindow] = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False);
204 XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32, 205 XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32,
205 PropModeReplace, (unsigned char *) netatom, NetLast); 206 PropModeReplace, (unsigned char *) netatom, NetLast);
206 207