implemented NET_ACTIVE_WINDOW support
92e55c7c
4 file(s) · +20 −1
| 58 | 58 | drawtitle(c); |
|
| 59 | 59 | XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); |
|
| 60 | 60 | XSync(dpy, False); |
|
| 61 | + | XChangeProperty(dpy, root, netatom[NetActiveWindow], XA_WINDOW, 32, |
|
| 62 | + | PropModeReplace, (unsigned char *)&c->win, 1); |
|
| 61 | 63 | while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); |
|
| 62 | 64 | } |
|
| 63 | 65 | ||
| 459 | 461 | arrange(NULL); |
|
| 460 | 462 | if(sel) |
|
| 461 | 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 | 469 | void |
|
| 22 | 22 | }; |
|
| 23 | 23 | ||
| 24 | 24 | /* atoms */ |
|
| 25 | - | enum { NetSupported, NetWMName, NetLast }; |
|
| 25 | + | enum { NetSupported, NetWMName, NetActiveWindow, NetLast }; |
|
| 26 | 26 | enum { WMProtocols, WMDelete, WMLast }; |
|
| 27 | 27 | ||
| 28 | 28 | /* cursor */ |
| 146 | 146 | } |
|
| 147 | 147 | ||
| 148 | 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 | 161 | configurerequest(XEvent *e) |
|
| 150 | 162 | { |
|
| 151 | 163 | Client *c; |
|
| 339 | 351 | ||
| 340 | 352 | void (*handler[LASTEvent]) (XEvent *) = { |
|
| 341 | 353 | [ButtonPress] = buttonpress, |
|
| 354 | + | [ClientMessage] = clientmessage, |
|
| 342 | 355 | [ConfigureRequest] = configurerequest, |
|
| 343 | 356 | [DestroyNotify] = destroynotify, |
|
| 344 | 357 | [EnterNotify] = enternotify, |
|
| 201 | 201 | wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False); |
|
| 202 | 202 | netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); |
|
| 203 | 203 | netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); |
|
| 204 | + | netatom[NetActiveWindow] = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False); |
|
| 204 | 205 | XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32, |
|
| 205 | 206 | PropModeReplace, (unsigned char *) netatom, NetLast); |
|
| 206 | 207 |