diff options
| author | Anselm R Garbe <anselm@garbe.us> | 2011-04-14 13:46:25 +0000 |
|---|---|---|
| committer | Anselm R Garbe <anselm@garbe.us> | 2011-04-14 13:46:25 +0000 |
| commit | 3c2d303c0e8efc9a08f2e70867794b003b886810 (patch) | |
| tree | ef033ea4737dcf645e50bd010d70bfbab7b3314c /dwm.c | |
| parent | applied Brendan MacDonell's WM_TAKE_FOCUS patch, thanks Brendan! (diff) | |
| download | dwm-3c2d303c0e8efc9a08f2e70867794b003b886810.tar.gz dwm-3c2d303c0e8efc9a08f2e70867794b003b886810.zip | |
applied Peter/Andreas NetActiveWindow patch in a slightly modified version
Diffstat (limited to '')
| -rw-r--r-- | dwm.c | 31 |
1 files changed, 22 insertions, 9 deletions
| @@ -58,7 +58,7 @@ | |||
| 58 | enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ | 58 | enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ |
| 59 | enum { ColBorder, ColFG, ColBG, ColLast }; /* color */ | 59 | enum { ColBorder, ColFG, ColBG, ColLast }; /* color */ |
| 60 | enum { NetSupported, NetWMName, NetWMState, | 60 | enum { NetSupported, NetWMName, NetWMState, |
| 61 | NetWMFullscreen, NetLast }; /* EWMH atoms */ | 61 | NetWMFullscreen, NetActiveWindow, NetLast }; /* EWMH atoms */ |
| 62 | enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */ | 62 | enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */ |
| 63 | enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, | 63 | enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, |
| 64 | ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ | 64 | ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ |
| @@ -1259,11 +1259,11 @@ propertynotify(XEvent *e) { | |||
| 1259 | void | 1259 | void |
| 1260 | clientmessage(XEvent *e) { | 1260 | clientmessage(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 | ||
| 1292 | void | 1302 | void |
| @@ -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 | ||
| 1475 | void | 1485 | void |
| 1476 | setfocus(Client *c) { | 1486 | setfocus(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 | } |
