applied Peter/Andreas NetActiveWindow patch in a slightly modified version

pull/1/head
Anselm R Garbe 14 years ago
parent 1e20a0f78a
commit 3c2d303c0e
  1. 27
      dwm.c

27
dwm.c

@ -58,7 +58,7 @@
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
enum { ColBorder, ColFG, ColBG, ColLast }; /* color */ enum { ColBorder, ColFG, ColBG, ColLast }; /* color */
enum { NetSupported, NetWMName, NetWMState, enum { NetSupported, NetWMName, NetWMState,
NetWMFullscreen, NetLast }; /* EWMH atoms */ NetWMFullscreen, NetActiveWindow, NetLast }; /* EWMH atoms */
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */ enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
@ -1259,11 +1259,11 @@ propertynotify(XEvent *e) {
void void
clientmessage(XEvent *e) { clientmessage(XEvent *e) {
XClientMessageEvent *cme = &e->xclient; XClientMessageEvent *cme = &e->xclient;
Client *c; Client *c = wintoclient(cme->window);
if((c = wintoclient(cme->window)) if(!c)
&& (cme->message_type == netatom[NetWMState] && cme->data.l[1] == netatom[NetWMFullscreen])) return;
{ if(cme->message_type == netatom[NetWMState] && cme->data.l[1] == netatom[NetWMFullscreen]) {
if(cme->data.l[0]) { if(cme->data.l[0]) {
XChangeProperty(dpy, cme->window, netatom[NetWMState], XA_ATOM, 32, XChangeProperty(dpy, cme->window, netatom[NetWMState], XA_ATOM, 32,
PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1); PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1);
@ -1287,6 +1287,16 @@ clientmessage(XEvent *e) {
arrange(c->mon); arrange(c->mon);
} }
} }
else if(cme->message_type == netatom[NetActiveWindow]) {
if(!ISVISIBLE(c)) {
Arg a = { .ui = c->tags };
view(&a);
}
detach(c);
attach(c);
focus(c);
arrange(c->mon);
}
} }
void void
@ -1525,6 +1535,7 @@ setup(void) {
wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False); wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False); wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False); wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False);
netatom[NetActiveWindow] = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False);
wmatom[WMTakeFocus] = XInternAtom(dpy, "WM_TAKE_FOCUS", False); wmatom[WMTakeFocus] = XInternAtom(dpy, "WM_TAKE_FOCUS", False);
netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
@ -1942,8 +1953,10 @@ updatewmhints(Client *c) {
} }
else else
c->isurgent = (wmh->flags & XUrgencyHint) ? True : False; c->isurgent = (wmh->flags & XUrgencyHint) ? True : False;
if (wmh->flags & InputHint) c->neverfocus = !wmh->input; if(wmh->flags & InputHint)
else c->neverfocus = False; c->neverfocus = !wmh->input;
else
c->neverfocus = False;
XFree(wmh); XFree(wmh);
} }
} }

Loading…
Cancel
Save