summaryrefslogtreecommitdiffstats
path: root/dwm.c
diff options
context:
space:
mode:
authorAnselm R Garbe <anselm@garbe.us>2011-04-14 13:46:25 +0000
committerAnselm R Garbe <anselm@garbe.us>2011-04-14 13:46:25 +0000
commit3c2d303c0e8efc9a08f2e70867794b003b886810 (patch)
treeef033ea4737dcf645e50bd010d70bfbab7b3314c /dwm.c
parentapplied Brendan MacDonell's WM_TAKE_FOCUS patch, thanks Brendan! (diff)
downloaddwm-3c2d303c0e8efc9a08f2e70867794b003b886810.tar.gz
dwm-3c2d303c0e8efc9a08f2e70867794b003b886810.zip
applied Peter/Andreas NetActiveWindow patch in a slightly modified version
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/dwm.c b/dwm.c
index 0a1b30e..a3d83fb 100644
--- a/dwm.c
+++ b/dwm.c
@@ -58,7 +58,7 @@
58enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ 58enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
59enum { ColBorder, ColFG, ColBG, ColLast }; /* color */ 59enum { ColBorder, ColFG, ColBG, ColLast }; /* color */
60enum { NetSupported, NetWMName, NetWMState, 60enum { NetSupported, NetWMName, NetWMState,
61 NetWMFullscreen, NetLast }; /* EWMH atoms */ 61 NetWMFullscreen, NetActiveWindow, NetLast }; /* EWMH atoms */
62enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */ 62enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
63enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, 63enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
64 ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ 64 ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
@@ -1259,11 +1259,11 @@ propertynotify(XEvent *e) {
1259void 1259void
1260clientmessage(XEvent *e) { 1260clientmessage(XEvent *e) {
1261 XClientMessageEvent *cme = &e->xclient; 1261 XClientMessageEvent *cme = &e->xclient;
1262 Client *c; 1262 Client *c = wintoclient(cme->window);
1263 1263
1264 if((c = wintoclient(cme->window)) 1264 if(!c)
1265 && (cme->message_type == netatom[NetWMState] && cme->data.l[1] == netatom[NetWMFullscreen])) 1265 return;
1266 { 1266 if(cme->message_type == netatom[NetWMState] && cme->data.l[1] == netatom[NetWMFullscreen]) {
1267 if(cme->data.l[0]) { 1267 if(cme->data.l[0]) {
1268 XChangeProperty(dpy, cme->window, netatom[NetWMState], XA_ATOM, 32, 1268 XChangeProperty(dpy, cme->window, netatom[NetWMState], XA_ATOM, 32,
1269 PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1); 1269 PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1);
@@ -1287,6 +1287,16 @@ clientmessage(XEvent *e) {
1287 arrange(c->mon); 1287 arrange(c->mon);
1288 } 1288 }
1289 } 1289 }
1290 else if(cme->message_type == netatom[NetActiveWindow]) {
1291 if(!ISVISIBLE(c)) {
1292 Arg a = { .ui = c->tags };
1293 view(&a);
1294 }
1295 detach(c);
1296 attach(c);
1297 focus(c);
1298 arrange(c->mon);
1299 }
1290} 1300}
1291 1301
1292void 1302void
@@ -1460,7 +1470,7 @@ sendevent(Client *c, Atom proto) {
1460 exists = protocols[n] == proto; 1470 exists = protocols[n] == proto;
1461 XFree(protocols); 1471 XFree(protocols);
1462 } 1472 }
1463 if (exists) { 1473 if(exists) {
1464 ev.type = ClientMessage; 1474 ev.type = ClientMessage;
1465 ev.xclient.window = c->win; 1475 ev.xclient.window = c->win;
1466 ev.xclient.message_type = wmatom[WMProtocols]; 1476 ev.xclient.message_type = wmatom[WMProtocols];
@@ -1474,7 +1484,7 @@ sendevent(Client *c, Atom proto) {
1474 1484
1475void 1485void
1476setfocus(Client *c) { 1486setfocus(Client *c) {
1477 if (!c->neverfocus) 1487 if(!c->neverfocus)
1478 XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); 1488 XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
1479 sendevent(c, wmatom[WMTakeFocus]); 1489 sendevent(c, wmatom[WMTakeFocus]);
1480} 1490}
@@ -1525,6 +1535,7 @@ setup(void) {
1525 wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False); 1535 wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
1526 wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False); 1536 wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
1527 wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False); 1537 wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False);
1538 netatom[NetActiveWindow] = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False);
1528 wmatom[WMTakeFocus] = XInternAtom(dpy, "WM_TAKE_FOCUS", False); 1539 wmatom[WMTakeFocus] = XInternAtom(dpy, "WM_TAKE_FOCUS", False);
1529 netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); 1540 netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
1530 netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); 1541 netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
@@ -1942,8 +1953,10 @@ updatewmhints(Client *c) {
1942 } 1953 }
1943 else 1954 else
1944 c->isurgent = (wmh->flags & XUrgencyHint) ? True : False; 1955 c->isurgent = (wmh->flags & XUrgencyHint) ? True : False;
1945 if (wmh->flags & InputHint) c->neverfocus = !wmh->input; 1956 if(wmh->flags & InputHint)
1946 else c->neverfocus = False; 1957 c->neverfocus = !wmh->input;
1958 else
1959 c->neverfocus = False;
1947 XFree(wmh); 1960 XFree(wmh);
1948 } 1961 }
1949} 1962}