aboutsummaryrefslogtreecommitdiff
path: root/src/AttentionNoticeHandler.cc
diff options
context:
space:
mode:
authorHenrik Kinnunen <fluxgen@fluxbox.org>2010-03-18 18:41:35 (GMT)
committerHenrik Kinnunen <fluxgen@fluxbox.org>2010-03-18 18:41:35 (GMT)
commit6ed8369d57e8d3144805235fb7aeca63993742af (patch)
tree914bfd1a4fdc341d5c8aa1fc57e6297c7f8887f0 /src/AttentionNoticeHandler.cc
parent02bb93590c69b619150735f026f7719df2e5c271 (diff)
downloadfluxbox-6ed8369d57e8d3144805235fb7aeca63993742af.zip
fluxbox-6ed8369d57e8d3144805235fb7aeca63993742af.tar.bz2
Changed Focusable::focusSig() to new signal system.
The focus signal emits the window that had the focus status changed.
Diffstat (limited to 'src/AttentionNoticeHandler.cc')
-rw-r--r--src/AttentionNoticeHandler.cc32
1 files changed, 22 insertions, 10 deletions
diff --git a/src/AttentionNoticeHandler.cc b/src/AttentionNoticeHandler.cc
index 26dd4b5..393e566 100644
--- a/src/AttentionNoticeHandler.cc
+++ b/src/AttentionNoticeHandler.cc
@@ -28,6 +28,7 @@
28#include "FbTk/Subject.hh" 28#include "FbTk/Subject.hh"
29#include "FbTk/Timer.hh" 29#include "FbTk/Timer.hh"
30#include "FbTk/Resource.hh" 30#include "FbTk/Resource.hh"
31#include "FbTk/MemFun.hh"
31 32
32namespace { 33namespace {
33class ToggleFrameFocusCmd: public FbTk::Command<void> { 34class ToggleFrameFocusCmd: public FbTk::Command<void> {
@@ -91,30 +92,41 @@ void AttentionNoticeHandler::addAttention(Focusable &client) {
91 m_attentions[&client] = timer; 92 m_attentions[&client] = timer;
92 // attach signals that will make notice go away 93 // attach signals that will make notice go away
93 client.dieSig().attach(this); 94 client.dieSig().attach(this);
94 client.focusSig().attach(this); 95
96 client.focusSig().connect(MemFun(*this, &AttentionNoticeHandler::windowFocusChanged));
95 97
96 // update _NET_WM_STATE atom 98 // update _NET_WM_STATE atom
97 if (client.fbwindow()) 99 if (client.fbwindow())
98 client.fbwindow()->stateSig().notify(); 100 client.fbwindow()->stateSig().notify();
99} 101}
100 102
101void AttentionNoticeHandler::update(FbTk::Subject *subj) { 103void AttentionNoticeHandler::windowFocusChanged(Focusable& win) {
104 updateWindow(win, false);
105}
106void AttentionNoticeHandler::removeWindow(Focusable& win) {
107 updateWindow(win, true);
108}
102 109
110void AttentionNoticeHandler::update(FbTk::Subject* subj) {
103 // we need to be able to get the window 111 // we need to be able to get the window
104 if (!subj || typeid(*subj) != typeid(Focusable::FocusSubject)) 112 if (!subj || typeid(*subj) != typeid(Focusable::FocusSubject))
105 return; 113 return;
114 Focusable::FocusSubject *winsubj =
115 static_cast<Focusable::FocusSubject *>(subj);
106 116
117 removeWindow(winsubj->win());
118}
119
120void AttentionNoticeHandler::updateWindow(Focusable& win, bool died) {
107 // all signals results in destruction of the notice 121 // all signals results in destruction of the notice
108 122
109 Focusable::FocusSubject *winsubj = 123 delete m_attentions[&win];
110 static_cast<Focusable::FocusSubject *>(subj); 124 m_attentions.erase(&win);
111 delete m_attentions[&winsubj->win()]; 125 win.setAttentionState(false);
112 m_attentions.erase(&winsubj->win());
113 winsubj->win().setAttentionState(false);
114 126
115 // update _NET_WM_STATE atom 127 // update _NET_WM_STATE atom if the window is not dead
116 FluxboxWindow *fbwin = winsubj->win().fbwindow(); 128 FluxboxWindow *fbwin = win.fbwindow();
117 if (fbwin && winsubj != &winsubj->win().dieSig()) 129 if (fbwin && ! died)
118 fbwin->stateSig().notify(); 130 fbwin->stateSig().notify();
119 131
120} 132}