At Wed, 11 Feb 2009 16:38:32 +0100 Gregor Best wrote: > At Wed, 11 Feb 2009 16:18:10 +0100 > Julien Danjou wrote: > > > At 1234365239 time_t, Gregor Best wrote: > > > Yeah, that would make sense. How is that hook defined? Does it only > > > trigger if focus is set to true or does it trigger either way? > > > > Just each time you change urgent flag value. > > > > Okay, then I'll add that to the patch >
Here comes an update, now it updates the EWMH hints, the ICCCM hints and calls
the urgent hook for the client. I'm not sure whether XORing the ICCCM hints'
flags field with 0x100 is the right way to do it, but here it hasn't shown any
problems with URxvt.
--
Gregor Best
From 524b909bfb6890021a41fdac1c9839cade6edd48 Mon Sep 17 00:00:00 2001 From: Gregor Best <[email protected]> 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 | 26 ++++++++++++++++++++++++++ client.h | 1 + ewmh.c | 6 +++--- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/client.c b/client.c index ea107f6..090e797 100644 --- a/client.c +++ b/client.c @@ -110,6 +110,29 @@ 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); + /* update ICCCM hints */ + xcb_wm_hints_t wmh; + xcb_get_wm_hints_reply(globalconf.connection, + xcb_get_wm_hints_unchecked(globalconf.connection, c->win), + &wmh, NULL); + wmh.flags ^= 0x100; + xcb_set_wm_hints(globalconf.connection, c->win, &wmh); + + hooks_property(c, "urgent"); + } +} + /** Returns true if a client is tagged * with one of the tags of the specified screen. * \param c The client to check. @@ -274,6 +297,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
