changeset: 1535:75f547f2b774
tag: tip
user: Anselm R Garbe <anselm_AT_garbe.us>
date: Thu Apr 14 13:46:25 2011 +0000
files: dwm.c
description:
applied Peter/Andreas NetActiveWindow patch in a slightly modified version
diff -r 7e2a8fec8d6c -r 75f547f2b774 dwm.c
--- a/dwm.c Tue Apr 12 20:19:32 2011 +0000
+++ b/dwm.c Thu Apr 14 13:46:25 2011 +0000
@@ -58,7 +58,7 @@
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
enum { ColBorder, ColFG, ColBG, ColLast }; /* color */
enum { NetSupported, NetWMName, NetWMState,
- NetWMFullscreen, NetLast }; /* EWMH atoms */
+ NetWMFullscreen, NetActiveWindow, NetLast }; /* EWMH atoms */
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
@@ -1259,11 +1259,11 @@
void
clientmessage(XEvent *e) {
XClientMessageEvent *cme = &e->xclient;
- Client *c;
+ Client *c = wintoclient(cme->window);
- if((c = wintoclient(cme->window))
- && (cme->message_type == netatom[NetWMState] && cme->data.l[1] == netatom[NetWMFullscreen]))
- {
+ if(!c)
+ return;
+ if(cme->message_type == netatom[NetWMState] && cme->data.l[1] == netatom[NetWMFullscreen]) {
if(cme->data.l[0]) {
XChangeProperty(dpy, cme->window, netatom[NetWMState], XA_ATOM, 32,
PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1);
@@ -1287,6 +1287,16 @@
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
@@ -1460,7 +1470,7 @@
exists = protocols[n] == proto;
XFree(protocols);
}
- if (exists) {
+ if(exists) {
ev.type = ClientMessage;
ev.xclient.window = c->win;
ev.xclient.message_type = wmatom[WMProtocols];
@@ -1474,7 +1484,7 @@
void
setfocus(Client *c) {
- if (!c->neverfocus)
+ if(!c->neverfocus)
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
sendevent(c, wmatom[WMTakeFocus]);
}
@@ -1525,6 +1535,7 @@
wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False);
+ netatom[NetActiveWindow] = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False);
wmatom[WMTakeFocus] = XInternAtom(dpy, "WM_TAKE_FOCUS", False);
netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
@@ -1942,8 +1953,10 @@
}
else
c->isurgent = (wmh->flags & XUrgencyHint) ? True : False;
- if (wmh->flags & InputHint) c->neverfocus = !wmh->input;
- else c->neverfocus = False;
+ if(wmh->flags & InputHint)
+ c->neverfocus = !wmh->input;
+ else
+ c->neverfocus = False;
XFree(wmh);
}
}
Received on Thu Apr 14 2011 - 19:20:22 CEST
This archive was generated by hypermail 2.2.0 : Thu Apr 14 2011 - 19:24:05 CEST