From 998b23acf220f7bfa2117f8446a4f3a179b32d0a Mon Sep 17 00:00:00 2001 From: markt Date: Sat, 30 Jun 2007 01:40:35 +0000 Subject: hack for making _NET_WM_STATE_DEMANDS_ATTENTION work with tabs --- src/AttentionNoticeHandler.cc | 4 ++++ src/Ewmh.cc | 21 ++++++++++++++------- src/Ewmh.hh | 2 ++ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/AttentionNoticeHandler.cc b/src/AttentionNoticeHandler.cc index c2599c9..fec3933 100644 --- a/src/AttentionNoticeHandler.cc +++ b/src/AttentionNoticeHandler.cc @@ -98,6 +98,10 @@ void AttentionNoticeHandler::addAttention(Focusable &client) { void AttentionNoticeHandler::update(FbTk::Subject *subj) { + // we need to be able to get the window + if (typeid(*subj) != typeid(Focusable::FocusSubject)) + return; + // all signals results in destruction of the notice Focusable::FocusSubject *winsubj = diff --git a/src/Ewmh.cc b/src/Ewmh.cc index f8d3598..99a8759 100644 --- a/src/Ewmh.cc +++ b/src/Ewmh.cc @@ -722,11 +722,11 @@ bool Ewmh::checkClientMessage(const XClientMessageEvent &ce, // ce.data.l[1] = the first property to alter // ce.data.l[2] = second property to alter (can be zero) if (ce.data.l[0] == STATE_REMOVE) { - setState(win, ce.data.l[1], false); - setState(win, ce.data.l[2], false); + setState(win, ce.data.l[1], false, *winclient); + setState(win, ce.data.l[2], false, *winclient); } else if (ce.data.l[0] == STATE_ADD) { - setState(win, ce.data.l[1], true); - setState(win, ce.data.l[2], true); + setState(win, ce.data.l[1], true, *winclient); + setState(win, ce.data.l[2], true, *winclient); } else if (ce.data.l[0] == STATE_TOGGLE) { toggleState(win, ce.data.l[1]); toggleState(win, ce.data.l[2]); @@ -1004,8 +1004,15 @@ void Ewmh::createAtoms() { utf8_string = XInternAtom(disp, "UTF8_STRING", False); } -// set window state +// wrapper for avoiding changing every AtomHandler to include an unnecessary +// parameter, although we need it for _NET_WM_STATE_DEMANDS_ATTENTION void Ewmh::setState(FluxboxWindow &win, Atom state, bool value) { + setState(win, state, value, win.winClient()); +} + +// set window state +void Ewmh::setState(FluxboxWindow &win, Atom state, bool value, + WinClient &client) { if (state == m_net_wm_state_sticky) { // STICKY if (value && !win.isStuck() || (!value && win.isStuck())) @@ -1045,10 +1052,10 @@ void Ewmh::setState(FluxboxWindow &win, Atom state, bool value) { win.moveToLayer(Layer::NORMAL); } else if (state == m_net_wm_state_demands_attention) { if (value) { // if add attention - Fluxbox::instance()->attentionHandler().addAttention(win.winClient()); + Fluxbox::instance()->attentionHandler().addAttention(client); } else { // erase it Fluxbox::instance()->attentionHandler(). - update(&win.winClient().focusSig()); + update(&client.focusSig()); } } diff --git a/src/Ewmh.hh b/src/Ewmh.hh index 3df66d3..8d5d986 100644 --- a/src/Ewmh.hh +++ b/src/Ewmh.hh @@ -66,6 +66,8 @@ private: enum { STATE_REMOVE = 0, STATE_ADD = 1, STATE_TOGGLE = 2}; void setState(FluxboxWindow &win, Atom state, bool value); + void setState(FluxboxWindow &win, Atom state, bool value, + WinClient &client); void toggleState(FluxboxWindow &win, Atom state); void createAtoms(); void updateStrut(WinClient &winclient); -- cgit v0.11.2