From 7bd501af672941533a9ddbadf14a0591d9245d71 Mon Sep 17 00:00:00 2001 From: Gregor Best Date: Tue, 21 May 2013 19:12:55 +0200 Subject: [PATCH] Add client_seturgent and a bit more ICCCM compatibility Stolen straight from 3.4 Signed-off-by: Gregor Best Signed-off-by: Julien Danjou --- client.c | 18 ++++++++++++++++++ client.h | 1 + 2 files changed, 19 insertions(+) diff --git a/client.c b/client.c index 527466b1d..67fcece73 100644 --- a/client.c +++ b/client.c @@ -177,6 +177,22 @@ client_ban(Client *c) XUnmapWindow(globalconf.display, c->titlebar.sw->window); } +void +client_seturgent(Client *c, Bool set) { + XWMHints *wmh = XGetWMHints(globalconf.display, c->win); + if (!wmh) + return; + if (set) + wmh->flags |= XUrgencyHint; + else + wmh->flags &= ~(XUrgencyHint); + + XSetWMHints(globalconf.display, c->win, wmh); + XFree(wmh); + c->isurgent = set; + client_updatewmhints(c); +} + /** Give focus to client, or to first client if c is NULL * \param c client * \param screen Screen ID @@ -222,6 +238,8 @@ client_focus(Client *c, int screen, Bool raise) * will appear under the mouse, grabbuttons */ window_grabbuttons(c->win, c->phys_screen); phys_screen = c->phys_screen; + /* ICCCM requires us to unset the urgent hint on focus */ + client_seturgent(c, 0); } else { diff --git a/client.h b/client.h index fea076bad..9922dd0fc 100644 --- a/client.h +++ b/client.h @@ -40,6 +40,7 @@ void client_updatetitle(Client *); void client_saveprops(Client *); void client_kill(Client *); void client_setfloating(Client *, Bool); +void client_seturgent(Client *, Bool); Uicb uicb_client_kill; Uicb uicb_client_moveresize;