-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Am 20.06.2010 00:19, Kris Maglione wrote: > On Sat, Jun 19, 2010 at 11:42:15PM +0200, Uli Schlachter wrote: >> a friend made me write the attached patch. It adds support for EWMH's >> _NET_WM_DEMANDS_ATTENTION status by transfering it into ICCCM's urgency hint. >> >> I hope this is useful for others and perhaps this might even get included in >> the >> main repository. I know this is not perfect, but the code for >> _NET_WM_FULLSCREEN >> wasn't much worse than this. ;) > > Why not just set c->isurgent rather than actually changing the > wmhints? Apart from being needlessly complicated and probably > pointless, it's directly contrary to ICCCM ยง4.1.2. The window > manager isn't allowed to change client properties.
I went for the easy route with this one. I knew that changing the hints will be handled properly and thus it looked like the easier thing to do. If I just set c->isurgent here, the next call to updatewmhints() might clear that flag again (which btw also calls XSetWMHints(). Isn't that wrong, too?). Anyway, attached is a new version of the patch. This one is now untested, sorry. Technically, it would also have to set NetWMState, but then the state of NetWMFullscreen would have to be remembered, so that that one can be set, too. Cheers, Uli - -- - - Buck, when, exactly, did you lose your mind? - - Three months ago. I woke up one morning married to a pineapple. An ugly pineapple... But I loved her! -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iQEcBAEBCAAGBQJMHb/3AAoJECLkKOvLj8sGgK0IAJABHfVdRKvIJbow0kZ07f+r g8WXSN1DiS1jKw/pXGu7cE8cPbQB+SP9cHhigV2QqiA4MoDlq1IfPaqbrkv+L2cY Mo6vN7o4oQj4TVMJmzou7f5CHnQ2BmUQH3JRk/cp27IDq+qxwJEgJeyvVsjJ6DGw myvNNyFZepqV/1BLkf0eOfyeI9KSHjlSQFaGHLzAAsqouH8yvITXXJ70V7wGjqd5 ATInc0ejPrgRp/ldQdRUm5r7UWcM8Xhr4Agd+4pTtrXE1qipTYjPqRc1gHx+qi+L ulCa0NXz28+CWx5Zho8wFas3shc85dXEpzjvfgIz2u1OtoMKOjRtNpHAQl/6wz4= =Yehk -----END PGP SIGNATURE-----
--- dwm.c.orig 2010-06-19 13:39:11.764762684 +0200 +++ dwm.c 2010-06-20 09:11:44.512261070 +0200 @@ -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, NetWMDemandsAttention, NetLast }; /* EWMH atoms */ enum { WMProtocols, WMDelete, WMState, WMLast }; /* default atoms */ enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ @@ -1302,13 +1302,24 @@ void clientmessage(XEvent *e) { XClientMessageEvent *cme = &e->xclient; - 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, + if(cme->message_type == netatom[NetWMState]) { + Bool set = (cme->data.l[0] != 0) ? True : False; + if (cme->data.l[1] == netatom[NetWMFullscreen]) { + if (set) + XChangeProperty(dpy, cme->window, netatom[NetWMState], XA_ATOM, 32, PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1); - else - XChangeProperty(dpy, cme->window, netatom[NetWMState], XA_ATOM, 32, + else + XChangeProperty(dpy, cme->window, netatom[NetWMState], XA_ATOM, 32, PropModeReplace, (unsigned char*)0, 0); + } + if (cme->data.l[1] == netatom[NetWMDemandsAttention]) { + Client *c = wintoclient(cme->window); + if (!c) + return; + + c->isurgent = set; + drawbars(); + } } } @@ -1517,6 +1528,7 @@ setup(void) { netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False); netatom[NetWMFullscreen] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False); + netatom[NetWMDemandsAttention] = XInternAtom(dpy, "_NET_WM_STATE_DEMANDS_ATTENTION", False); /* init cursors */ cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr); cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing);
dwm-demands_attention2.patch.sig
Description: Binary data