diff options
author | Pavel Labath <pavelo@centrum.sk> | 2011-05-06 20:26:20 (GMT) |
---|---|---|
committer | Pavel Labath <pavelo@centrum.sk> | 2011-05-10 11:00:46 (GMT) |
commit | 6a0280aa4d8b468617a7dd5f7a6523d0422364e8 (patch) | |
tree | e85f742583d112f8d970c0523537aacdb1926726 /src/FocusableList.cc | |
parent | e53d14e9102270a1682a88c29161580ccbf0c20a (diff) | |
download | fluxbox_pavel-6a0280aa4d8b468617a7dd5f7a6523d0422364e8.zip fluxbox_pavel-6a0280aa4d8b468617a7dd5f7a6523d0422364e8.tar.bz2 |
Convert FluxboxWindow::layerSig to FbTk::Signal
Diffstat (limited to 'src/FocusableList.cc')
-rw-r--r-- | src/FocusableList.cc | 71 |
1 files changed, 20 insertions, 51 deletions
diff --git a/src/FocusableList.cc b/src/FocusableList.cc index 0368442..77ff247 100644 --- a/src/FocusableList.cc +++ b/src/FocusableList.cc | |||
@@ -107,17 +107,6 @@ void FocusableList::init() { | |||
107 | } | 107 | } |
108 | } | 108 | } |
109 | 109 | ||
110 | void FocusableList::update(FbTk::Subject *subj) { | ||
111 | if (subj == 0 || m_screen.isShuttingdown()) | ||
112 | return; | ||
113 | |||
114 | if (typeid(*subj) == typeid(FluxboxWindow::WinSubject)) { | ||
115 | FluxboxWindow::WinSubject *fsubj = | ||
116 | static_cast<FluxboxWindow::WinSubject *>(subj); | ||
117 | windowUpdated(fsubj->win()); | ||
118 | } | ||
119 | } | ||
120 | |||
121 | void FocusableList::windowUpdated(FluxboxWindow &fbwin) { | 110 | void FocusableList::windowUpdated(FluxboxWindow &fbwin) { |
122 | if (m_screen.isShuttingdown()) | 111 | if (m_screen.isShuttingdown()) |
123 | return; | 112 | return; |
@@ -243,7 +232,7 @@ void FocusableList::remove(Focusable &win) { | |||
243 | // if the window isn't already in this list, we could send a bad signal | 232 | // if the window isn't already in this list, we could send a bad signal |
244 | bool contained = contains(win); | 233 | bool contained = contains(win); |
245 | 234 | ||
246 | detachSignals(win); | 235 | m_signal_map.erase(&win); |
247 | if (!contained) { | 236 | if (!contained) { |
248 | return; | 237 | return; |
249 | } | 238 | } |
@@ -257,50 +246,30 @@ void FocusableList::updateTitle(Focusable& win) { | |||
257 | #include "Debug.hh" | 246 | #include "Debug.hh" |
258 | 247 | ||
259 | void FocusableList::attachSignals(Focusable &win) { | 248 | void FocusableList::attachSignals(Focusable &win) { |
260 | if (m_parent) { | 249 | if (m_parent == NULL) |
261 | FluxboxWindow *fbwin = win.fbwindow(); | 250 | return; |
262 | |||
263 | // attach various signals for matching | ||
264 | FbTk::RefCount<FbTk::SignalTracker> &tracker = m_signal_map[&win]; | ||
265 | if (! tracker) { | ||
266 | // we have not attached to this window yet | ||
267 | tracker = new SignalTracker; | ||
268 | tracker->join(win.titleSig(), MemFunSelectArg1(*this, &FocusableList::updateTitle)); | ||
269 | tracker->join(win.dieSig(), MemFun(*this, &FocusableList::remove)); | ||
270 | if(fbwin) { | ||
271 | tracker->join(fbwin->workspaceSig(), | ||
272 | MemFun(*this, &FocusableList::windowUpdated) | ||
273 | ); | ||
274 | tracker->join(fbwin->stateSig(), | ||
275 | MemFun(*this, &FocusableList::windowUpdated) | ||
276 | ); | ||
277 | } | ||
278 | } | ||
279 | |||
280 | if (!fbwin) | ||
281 | return; | ||
282 | fbwin->layerSig().attach(this); | ||
283 | // TODO: can't watch (head=...) yet | ||
284 | } | ||
285 | } | ||
286 | 251 | ||
287 | void FocusableList::detachSignals(Focusable &win) { | 252 | FluxboxWindow *fbwin = win.fbwindow(); |
288 | m_signal_map.erase(&win); | 253 | |
289 | if (m_parent) { | 254 | // attach various signals for matching |
290 | // detach various signals for matching | 255 | FbTk::RefCount<FbTk::SignalTracker> &tracker = m_signal_map[&win]; |
291 | FluxboxWindow *fbwin = win.fbwindow(); | 256 | if (! tracker) { |
292 | if (!fbwin) | 257 | // we have not attached to this window yet |
293 | return; | 258 | tracker = new SignalTracker; |
294 | fbwin->layerSig().detach(this); | 259 | tracker->join(win.titleSig(), MemFunSelectArg1(*this, &FocusableList::updateTitle)); |
295 | // TODO: can't watch (head=...) yet | 260 | tracker->join(win.dieSig(), MemFun(*this, &FocusableList::remove)); |
261 | if(fbwin) { | ||
262 | tracker->join(fbwin->workspaceSig(), MemFun(*this, &FocusableList::windowUpdated)); | ||
263 | tracker->join(fbwin->stateSig(), MemFun(*this, &FocusableList::windowUpdated)); | ||
264 | tracker->join(fbwin->layerSig(), MemFun(*this, &FocusableList::windowUpdated)); | ||
265 | // TODO: can't watch (head=...) yet | ||
266 | } | ||
296 | } | 267 | } |
297 | } | 268 | } |
298 | 269 | ||
299 | void FocusableList::reset() { | 270 | void FocusableList::reset() { |
300 | while (!m_list.empty()) { | 271 | m_signal_map.clear(); |
301 | detachSignals(*m_list.back()); | 272 | m_list.clear(); |
302 | m_list.pop_back(); | ||
303 | } | ||
304 | m_pat->resetMatches(); | 273 | m_pat->resetMatches(); |
305 | if (m_parent) | 274 | if (m_parent) |
306 | addMatching(); | 275 | addMatching(); |