diff options
Diffstat (limited to '')
| -rw-r--r-- | client.c | 5 | ||||
| -rw-r--r-- | dwm.h | 2 | ||||
| -rw-r--r-- | event.c | 13 | ||||
| -rw-r--r-- | main.c | 1 |
4 files changed, 20 insertions, 1 deletions
| @@ -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 | ||
| 464 | void | 469 | void |
| @@ -22,7 +22,7 @@ union Arg { | |||
| 22 | }; | 22 | }; |
| 23 | 23 | ||
| 24 | /* atoms */ | 24 | /* atoms */ |
| 25 | enum { NetSupported, NetWMName, NetLast }; | 25 | enum { NetSupported, NetWMName, NetActiveWindow, NetLast }; |
| 26 | enum { WMProtocols, WMDelete, WMLast }; | 26 | enum { WMProtocols, WMDelete, WMLast }; |
| 27 | 27 | ||
| 28 | /* cursor */ | 28 | /* cursor */ |
| @@ -146,6 +146,18 @@ buttonpress(XEvent *e) | |||
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | static void | 148 | static void |
| 149 | clientmessage(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 | |||
| 160 | static void | ||
| 149 | configurerequest(XEvent *e) | 161 | configurerequest(XEvent *e) |
| 150 | { | 162 | { |
| 151 | Client *c; | 163 | Client *c; |
| @@ -339,6 +351,7 @@ unmapnotify(XEvent *e) | |||
| 339 | 351 | ||
| 340 | void (*handler[LASTEvent]) (XEvent *) = { | 352 | void (*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, |
| @@ -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 | ||
