diff options
Diffstat (limited to 'src/AttentionNoticeHandler.cc')
-rw-r--r-- | src/AttentionNoticeHandler.cc | 31 |
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 @@ | |||
34 | namespace { | 34 | namespace { |
35 | class ToggleFrameFocusCmd: public FbTk::Command { | 35 | class ToggleFrameFocusCmd: public FbTk::Command { |
36 | public: | 36 | public: |
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 | } |
45 | private: | 44 | private: |
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 | ||
57 | void AttentionNoticeHandler::addAttention(WinClient &client) { | 56 | void 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) { | |||
104 | void AttentionNoticeHandler::update(FbTk::Subject *subj) { | 103 | void 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 | ||
123 | bool AttentionNoticeHandler::isDemandingAttention(WinClient &client) { | 124 | bool AttentionNoticeHandler::isDemandingAttention(Focusable &client) { |
124 | return m_attentions.find(&client) != m_attentions.end(); | 125 | return m_attentions.find(&client) != m_attentions.end(); |
125 | } | 126 | } |