At Wed, 11 Feb 2009 15:58:59 +0100 Maarten Maathuis wrote: > property_update_wm_hints is not a set function, but a get function, my bad. > > You can probably leave out that call. > > Strange thing is that property_update_wm_hints() is only called upon > manage, which suggests it doesn't even work atm for windows that > enable this hint. But that should be fixed (if needed) in a seperate > patch. > > Maarten.
Okay, great. I added a client_seturgent(client_t *, bool) function which checks if the flag actually needs to be changed before doing so, as you suggested. I also modified the 3 places in ewmh.c which change the urgency flag to call this function instead, but I'm not sure whether that is neccessary / right. -- Gregor Best
From 42fd75ffed93ecacc11752e13f6dd8765b9ee5e9 Mon Sep 17 00:00:00 2001 From: Gregor Best <farha...@googlemail.com> Date: Wed, 11 Feb 2009 15:18:02 +0100 Subject: [PATCH] client.c: add client_seturgent() and remove urgent hint on focus According to EWMH, the window manager is responsible for removing the urgent state of a client. Also, this commit adds a new client_seturgent(client_t *, bool) function to set the urgent state if needed. --- client.c | 17 +++++++++++++++++ client.h | 1 + ewmh.c | 6 +++--- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/client.c b/client.c index ea107f6..d2fa7e6 100644 --- a/client.c +++ b/client.c @@ -110,6 +110,20 @@ window_hasproto(xcb_window_t win, xcb_atom_t atom) return ret; } +/** Change the clients urgency flag. + * \param c The client + * \param urgent The new flag state + */ +void +client_seturgent(client_t *c, bool urgent) +{ + if(c->isurgent != urgent) + { + c->isurgent = urgent; + ewmh_client_update_hints(c); + } +} + /** Returns true if a client is tagged * with one of the tags of the specified screen. * \param c The client to check. @@ -274,6 +288,9 @@ client_focus(client_t *c) luaA_dofunction(globalconf.L, globalconf.hooks.focus, 1, 0); } + /* according to EWMH, we have to remove the urgent state from a client */ + client_seturgent(c, false); + ewmh_update_net_active_window(c->phys_screen); } diff --git a/client.h b/client.h index 657c4e1..780bff2 100644 --- a/client.h +++ b/client.h @@ -66,6 +66,7 @@ void client_setmaxhoriz(client_t *, bool); void client_setmaxvert(client_t *, bool); void client_setminimized(client_t *, bool); void client_setborder(client_t *, int); +void client_seturgent(client_t *, bool); void client_focus(client_t *); int luaA_client_newindex(lua_State *); diff --git a/ewmh.c b/ewmh.c index e00c46c..b40782e 100644 --- a/ewmh.c +++ b/ewmh.c @@ -347,11 +347,11 @@ ewmh_process_state_atom(client_t *c, xcb_atom_t state, int set) else if(state == _NET_WM_STATE_DEMANDS_ATTENTION) { if(set == _NET_WM_STATE_REMOVE) - c->isurgent = false; + client_seturgent(c, false); else if(set == _NET_WM_STATE_ADD) - c->isurgent = true; + client_seturgent(c, true); else if(set == _NET_WM_STATE_TOGGLE) - c->isurgent = !c->isurgent; + client_seturgent(c, !c->isurgent); /* execute hook */ hooks_property(c, "urgent"); -- 1.6.1.2
signature.asc
Description: PGP signature