aboutsummaryrefslogtreecommitdiff
path: root/src/FocusableList.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FocusableList.cc')
-rw-r--r--src/FocusableList.cc36
1 files changed, 23 insertions, 13 deletions
diff --git a/src/FocusableList.cc b/src/FocusableList.cc
index 73d865e..ca73a22 100644
--- a/src/FocusableList.cc
+++ b/src/FocusableList.cc
@@ -114,16 +114,22 @@ void FocusableList::update(FbTk::Subject *subj) {
114 if (typeid(*subj) == typeid(FluxboxWindow::WinSubject)) { 114 if (typeid(*subj) == typeid(FluxboxWindow::WinSubject)) {
115 FluxboxWindow::WinSubject *fsubj = 115 FluxboxWindow::WinSubject *fsubj =
116 static_cast<FluxboxWindow::WinSubject *>(subj); 116 static_cast<FluxboxWindow::WinSubject *>(subj);
117 // we only bind these for matching patterns, so skip finding out signal 117 windowUpdated(fsubj->win());
118 FluxboxWindow &fbwin = fsubj->win(); 118 }
119 if (m_parent->contains(fbwin)) 119}
120 checkUpdate(fbwin); 120
121 std::list<WinClient *> list = fbwin.clientList(); 121void FocusableList::windowUpdated(FluxboxWindow &fbwin) {
122 std::list<WinClient *>::iterator it = list.begin(), it_end = list.end(); 122 if (m_screen.isShuttingdown())
123 for (; it != it_end; ++it) { 123 return;
124 if (m_parent->contains(**it)) 124
125 checkUpdate(**it); 125 // we only bind these for matching patterns, so skip finding out signal
126 } 126 if (m_parent->contains(fbwin))
127 checkUpdate(fbwin);
128 const std::list<WinClient *> &list = fbwin.clientList();
129 std::list<WinClient *>::const_iterator it = list.begin(), it_end = list.end();
130 for (; it != it_end; ++it) {
131 if (m_parent->contains(**it))
132 checkUpdate(**it);
127 } 133 }
128} 134}
129 135
@@ -252,6 +258,8 @@ void FocusableList::updateTitle(Focusable& win) {
252 258
253void FocusableList::attachSignals(Focusable &win) { 259void FocusableList::attachSignals(Focusable &win) {
254 if (m_parent) { 260 if (m_parent) {
261 FluxboxWindow *fbwin = win.fbwindow();
262
255 // attach various signals for matching 263 // attach various signals for matching
256 FbTk::RefCount<FbTk::SignalTracker> &tracker = m_signal_map[&win]; 264 FbTk::RefCount<FbTk::SignalTracker> &tracker = m_signal_map[&win];
257 if (! tracker) { 265 if (! tracker) {
@@ -259,12 +267,15 @@ void FocusableList::attachSignals(Focusable &win) {
259 tracker = new SignalTracker; 267 tracker = new SignalTracker;
260 tracker->join(win.titleSig(), MemFunSelectArg1(*this, &FocusableList::updateTitle)); 268 tracker->join(win.titleSig(), MemFunSelectArg1(*this, &FocusableList::updateTitle));
261 tracker->join(win.dieSig(), MemFun(*this, &FocusableList::remove)); 269 tracker->join(win.dieSig(), MemFun(*this, &FocusableList::remove));
270 if(fbwin) {
271 tracker->join(fbwin->workspaceSig(),
272 MemFun(*this, &FocusableList::windowUpdated)
273 );
274 }
262 } 275 }
263 276
264 FluxboxWindow *fbwin = win.fbwindow();
265 if (!fbwin) 277 if (!fbwin)
266 return; 278 return;
267 fbwin->workspaceSig().attach(this);
268 fbwin->stateSig().attach(this); 279 fbwin->stateSig().attach(this);
269 fbwin->layerSig().attach(this); 280 fbwin->layerSig().attach(this);
270 // TODO: can't watch (head=...) yet 281 // TODO: can't watch (head=...) yet
@@ -278,7 +289,6 @@ void FocusableList::detachSignals(Focusable &win) {
278 FluxboxWindow *fbwin = win.fbwindow(); 289 FluxboxWindow *fbwin = win.fbwindow();
279 if (!fbwin) 290 if (!fbwin)
280 return; 291 return;
281 fbwin->workspaceSig().detach(this);
282 fbwin->stateSig().detach(this); 292 fbwin->stateSig().detach(this);
283 fbwin->layerSig().detach(this); 293 fbwin->layerSig().detach(this);
284 // TODO: can't watch (head=...) yet 294 // TODO: can't watch (head=...) yet