aboutsummaryrefslogtreecommitdiff
path: root/src/FocusableList.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FocusableList.cc')
-rw-r--r--src/FocusableList.cc27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/FocusableList.cc b/src/FocusableList.cc
index b2b0320..77e0a76 100644
--- a/src/FocusableList.cc
+++ b/src/FocusableList.cc
@@ -113,10 +113,9 @@ void FocusableList::update(FbTk::Subject *subj) {
113 if (typeid(*subj) == typeid(Focusable::FocusSubject)) { 113 if (typeid(*subj) == typeid(Focusable::FocusSubject)) {
114 Focusable::FocusSubject *fsubj = 114 Focusable::FocusSubject *fsubj =
115 static_cast<Focusable::FocusSubject *>(subj); 115 static_cast<Focusable::FocusSubject *>(subj);
116 if (fsubj == &fsubj->win().dieSig()) 116 if (fsubj == &fsubj->win().dieSig()) {
117 remove(fsubj->win()); 117 remove(fsubj->win());
118 else if (fsubj == &fsubj->win().titleSig()) 118 }
119 checkUpdate(fsubj->win());
120 } 119 }
121 if (typeid(*subj) == typeid(FluxboxWindow::WinSubject)) { 120 if (typeid(*subj) == typeid(FluxboxWindow::WinSubject)) {
122 FluxboxWindow::WinSubject *fsubj = 121 FluxboxWindow::WinSubject *fsubj =
@@ -244,17 +243,27 @@ void FocusableList::remove(Focusable &win) {
244 bool contained = contains(win); 243 bool contained = contains(win);
245 244
246 detachSignals(win); 245 detachSignals(win);
247 if (!contained) 246 if (!contained) {
248 return; 247 return;
248 }
249 m_list.remove(&win); 249 m_list.remove(&win);
250 m_removesig.notify(&win); 250 m_removesig.notify(&win);
251} 251}
252 252
253void FocusableList::updateTitle(Focusable& win) {
254 checkUpdate(win);
255}
256
253void FocusableList::attachSignals(Focusable &win) { 257void FocusableList::attachSignals(Focusable &win) {
254 win.dieSig().attach(this); 258 win.dieSig().attach(this);
255 if (m_parent) { 259 if (m_parent) {
256 // attach various signals for matching 260 // attach various signals for matching
257 win.titleSig().attach(this); 261 if (m_signal_map.find(&win) == m_signal_map.end()) {
262 m_signal_map[&win] = join(win.titleSig(),
263 MemFunSelectArg1(*this,
264 &FocusableList::updateTitle));
265 }
266
258 FluxboxWindow *fbwin = win.fbwindow(); 267 FluxboxWindow *fbwin = win.fbwindow();
259 if (!fbwin) 268 if (!fbwin)
260 return; 269 return;
@@ -268,8 +277,14 @@ void FocusableList::attachSignals(Focusable &win) {
268void FocusableList::detachSignals(Focusable &win) { 277void FocusableList::detachSignals(Focusable &win) {
269 win.dieSig().detach(this); 278 win.dieSig().detach(this);
270 if (m_parent) { 279 if (m_parent) {
280 // disconnect client
281 SignalMap::iterator sigIt = m_signal_map.find(&win);
282 if (sigIt != m_signal_map.end()) {
283 leave(sigIt->second);
284 m_signal_map.erase(sigIt);
285 }
286
271 // detach various signals for matching 287 // detach various signals for matching
272 win.titleSig().detach(this);
273 FluxboxWindow *fbwin = win.fbwindow(); 288 FluxboxWindow *fbwin = win.fbwindow();
274 if (!fbwin) 289 if (!fbwin)
275 return; 290 return;