aboutsummaryrefslogtreecommitdiff
path: root/src/FocusableList.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FocusableList.cc')
-rw-r--r--src/FocusableList.cc63
1 files changed, 32 insertions, 31 deletions
diff --git a/src/FocusableList.cc b/src/FocusableList.cc
index a130ec0..73d865e 100644
--- a/src/FocusableList.cc
+++ b/src/FocusableList.cc
@@ -125,40 +125,41 @@ void FocusableList::update(FbTk::Subject *subj) {
125 checkUpdate(**it); 125 checkUpdate(**it);
126 } 126 }
127 } 127 }
128 if (typeid(*subj) == typeid(FocusableListSubject)) { 128}
129 FocusableListSubject *fsubj = 129
130 static_cast<FocusableListSubject *>(subj); 130void FocusableList::parentOrderChanged(Focusable *win) {
131 if (subj == &m_parent->addSig()) { 131 if(!m_screen.isShuttingdown() && contains(*win)) {
132 attachSignals(*fsubj->win()); 132 if(insertFromParent(*win))
133 if (m_pat->match(*fsubj->win())) { 133 m_ordersig.emit(win);
134 insertFromParent(*fsubj->win()); 134 }
135 m_addsig.notify(fsubj->win()); 135}
136 } 136
137 } else if (subj == &m_parent->removeSig()) 137void FocusableList::parentWindowAdded(Focusable *win) {
138 remove(*fsubj->win()); 138 if(!m_screen.isShuttingdown()) {
139 else if (subj == &m_parent->resetSig()) 139 attachSignals(*win);
140 reset(); 140 if (m_pat->match(*win)) {
141 else if (subj == &m_parent->orderSig()) { 141 insertFromParent(*win);
142 Focusable *win = fsubj->win(); 142 m_addsig.emit(win);
143 if (!win || !contains(*win))
144 return;
145 if (insertFromParent(*win))
146 m_ordersig.notify(win);
147 } 143 }
148 } 144 }
149} 145}
150 146
147void FocusableList::parentWindowRemoved(Focusable *win) {
148 if(!m_screen.isShuttingdown())
149 remove(*win);
150}
151
151void FocusableList::checkUpdate(Focusable &win) { 152void FocusableList::checkUpdate(Focusable &win) {
152 if (contains(win)) { 153 if (contains(win)) {
153 if (!m_pat->match(win)) { 154 if (!m_pat->match(win)) {
154 m_list.remove(&win); 155 m_list.remove(&win);
155 m_pat->removeMatch(); 156 m_pat->removeMatch();
156 m_removesig.notify(&win); 157 m_removesig.emit(&win);
157 } 158 }
158 } else if (m_pat->match(win)) { 159 } else if (m_pat->match(win)) {
159 insertFromParent(win); 160 insertFromParent(win);
160 m_pat->addMatch(); 161 m_pat->addMatch();
161 m_addsig.notify(&win); 162 m_addsig.emit(&win);
162 } 163 }
163} 164}
164 165
@@ -203,13 +204,13 @@ void FocusableList::addMatching() {
203void FocusableList::pushFront(Focusable &win) { 204void FocusableList::pushFront(Focusable &win) {
204 m_list.push_front(&win); 205 m_list.push_front(&win);
205 attachSignals(win); 206 attachSignals(win);
206 m_addsig.notify(&win); 207 m_addsig.emit(&win);
207} 208}
208 209
209void FocusableList::pushBack(Focusable &win) { 210void FocusableList::pushBack(Focusable &win) {
210 m_list.push_back(&win); 211 m_list.push_back(&win);
211 attachSignals(win); 212 attachSignals(win);
212 m_addsig.notify(&win); 213 m_addsig.emit(&win);
213} 214}
214 215
215void FocusableList::moveToFront(Focusable &win) { 216void FocusableList::moveToFront(Focusable &win) {
@@ -219,7 +220,7 @@ void FocusableList::moveToFront(Focusable &win) {
219 220
220 m_list.remove(&win); 221 m_list.remove(&win);
221 m_list.push_front(&win); 222 m_list.push_front(&win);
222 m_ordersig.notify(&win); 223 m_ordersig.emit(&win);
223} 224}
224 225
225void FocusableList::moveToBack(Focusable &win) { 226void FocusableList::moveToBack(Focusable &win) {
@@ -229,7 +230,7 @@ void FocusableList::moveToBack(Focusable &win) {
229 230
230 m_list.remove(&win); 231 m_list.remove(&win);
231 m_list.push_back(&win); 232 m_list.push_back(&win);
232 m_ordersig.notify(&win); 233 m_ordersig.emit(&win);
233} 234}
234 235
235void FocusableList::remove(Focusable &win) { 236void FocusableList::remove(Focusable &win) {
@@ -241,7 +242,7 @@ void FocusableList::remove(Focusable &win) {
241 return; 242 return;
242 } 243 }
243 m_list.remove(&win); 244 m_list.remove(&win);
244 m_removesig.notify(&win); 245 m_removesig.emit(&win);
245} 246}
246 247
247void FocusableList::updateTitle(Focusable& win) { 248void FocusableList::updateTitle(Focusable& win) {
@@ -292,7 +293,7 @@ void FocusableList::reset() {
292 m_pat->resetMatches(); 293 m_pat->resetMatches();
293 if (m_parent) 294 if (m_parent)
294 addMatching(); 295 addMatching();
295 m_resetsig.notify(0); 296 m_resetsig.emit();
296} 297}
297 298
298bool FocusableList::contains(const Focusable &win) const { 299bool FocusableList::contains(const Focusable &win) const {
@@ -311,10 +312,10 @@ Focusable *FocusableList::find(const ClientPattern &pat) const {
311} 312}
312 313
313void FocusableList::attachChild(FocusableList &child) const { 314void FocusableList::attachChild(FocusableList &child) const {
314 m_addsig.attach(&child); 315 m_addsig.connect(FbTk::MemFun(child, &FocusableList::parentWindowAdded));
315 m_removesig.attach(&child); 316 m_ordersig.connect(FbTk::MemFun(child, &FocusableList::parentOrderChanged));
316 m_resetsig.attach(&child); 317 m_removesig.connect(FbTk::MemFun(child, &FocusableList::parentWindowRemoved));
317 m_ordersig.attach(&child); 318 m_resetsig.connect(FbTk::MemFun(child, &FocusableList::reset));
318} 319}
319 320
320void FocusableList::workspaceChanged(BScreen &screen) { 321void FocusableList::workspaceChanged(BScreen &screen) {