aboutsummaryrefslogtreecommitdiff
path: root/src/AttentionNoticeHandler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/AttentionNoticeHandler.cc')
-rw-r--r--src/AttentionNoticeHandler.cc31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/AttentionNoticeHandler.cc b/src/AttentionNoticeHandler.cc
index 10a087c..3f28695 100644
--- a/src/AttentionNoticeHandler.cc
+++ b/src/AttentionNoticeHandler.cc
@@ -23,7 +23,7 @@
23 23
24#include "AttentionNoticeHandler.hh" 24#include "AttentionNoticeHandler.hh"
25 25
26#include "WinClient.hh" 26#include "Window.hh"
27#include "Screen.hh" 27#include "Screen.hh"
28#include "STLUtil.hh" 28#include "STLUtil.hh"
29 29
@@ -34,16 +34,15 @@
34namespace { 34namespace {
35class ToggleFrameFocusCmd: public FbTk::Command { 35class ToggleFrameFocusCmd: public FbTk::Command {
36public: 36public:
37 ToggleFrameFocusCmd(WinClient &client): 37 ToggleFrameFocusCmd(Focusable &client):
38 m_client(client), 38 m_client(client),
39 m_state(false) {} 39 m_state(false) {}
40 void execute() { 40 void execute() {
41 m_state ^= true; 41 m_state ^= true;
42 m_client.fbwindow()->setLabelButtonFocus(m_client, m_state); 42 m_client.setAttentionState(m_state);
43 m_client.fbwindow()->setAttentionState(m_state);
44 } 43 }
45private: 44private:
46 WinClient& m_client; 45 Focusable &m_client;
47 bool m_state; 46 bool m_state;
48}; 47};
49 48
@@ -54,9 +53,9 @@ AttentionNoticeHandler::~AttentionNoticeHandler() {
54 STLUtil::destroyAndClearSecond(m_attentions); 53 STLUtil::destroyAndClearSecond(m_attentions);
55} 54}
56 55
57void AttentionNoticeHandler::addAttention(WinClient &client) { 56void AttentionNoticeHandler::addAttention(Focusable &client) {
58 // no need to add already active client 57 // no need to add already active client
59 if (client.fbwindow()->isFocused() && &client.fbwindow()->winClient() == &client) 58 if (client.isFocused())
60 return; 59 return;
61 60
62 // Already have a notice for it? 61 // Already have a notice for it?
@@ -104,22 +103,24 @@ void AttentionNoticeHandler::addAttention(WinClient &client) {
104void AttentionNoticeHandler::update(FbTk::Subject *subj) { 103void AttentionNoticeHandler::update(FbTk::Subject *subj) {
105 104
106 // we need to be able to get the window 105 // we need to be able to get the window
107 if (typeid(*subj) != typeid(WinClient::WinClientSubj)) 106 if (!subj || typeid(*subj) != typeid(Focusable::FocusSubject))
108 return; 107 return;
109 108
110 // all signals results in destruction of the notice 109 // all signals results in destruction of the notice
111 110
112 WinClient::WinClientSubj *winsubj = 111 Focusable::FocusSubject *winsubj =
113 static_cast<WinClient::WinClientSubj *>(subj); 112 static_cast<Focusable::FocusSubject *>(subj);
114 delete m_attentions[&winsubj->winClient()]; 113 delete m_attentions[&winsubj->win()];
115 m_attentions.erase(&winsubj->winClient()); 114 m_attentions.erase(&winsubj->win());
115 winsubj->win().setAttentionState(false);
116 116
117 // update _NET_WM_STATE atom 117 // update _NET_WM_STATE atom
118 FluxboxWindow *fbwin = winsubj->winClient().fbwindow(); 118 FluxboxWindow *fbwin = winsubj->win().fbwindow();
119 if (fbwin && winsubj != &winsubj->winClient().dieSig()) 119 if (fbwin && winsubj != &winsubj->win().dieSig())
120 fbwin->stateSig().notify(); 120 fbwin->stateSig().notify();
121
121} 122}
122 123
123bool AttentionNoticeHandler::isDemandingAttention(WinClient &client) { 124bool AttentionNoticeHandler::isDemandingAttention(Focusable &client) {
124 return m_attentions.find(&client) != m_attentions.end(); 125 return m_attentions.find(&client) != m_attentions.end();
125} 126}