aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/FocusableList.cc36
-rw-r--r--src/FocusableList.hh1
-rw-r--r--src/Window.cc11
-rw-r--r--src/Window.hh7
-rw-r--r--src/fluxbox.cc10
-rw-r--r--src/fluxbox.hh2
6 files changed, 40 insertions, 27 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
diff --git a/src/FocusableList.hh b/src/FocusableList.hh
index 29d536f..af73e3e 100644
--- a/src/FocusableList.hh
+++ b/src/FocusableList.hh
@@ -105,6 +105,7 @@ private:
105 void parentOrderChanged(Focusable* win); 105 void parentOrderChanged(Focusable* win);
106 void parentWindowAdded(Focusable* win); 106 void parentWindowAdded(Focusable* win);
107 void parentWindowRemoved(Focusable* win); 107 void parentWindowRemoved(Focusable* win);
108 void windowUpdated(FluxboxWindow &fbwin);
108 109
109 110
110 std::auto_ptr<ClientPattern> m_pat; 111 std::auto_ptr<ClientPattern> m_pat;
diff --git a/src/Window.cc b/src/Window.cc
index ca63178..f91f741 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -262,7 +262,6 @@ FluxboxWindow::FluxboxWindow(WinClient &client):
262 m_hintsig(*this), 262 m_hintsig(*this),
263 m_statesig(*this), 263 m_statesig(*this),
264 m_layersig(*this), 264 m_layersig(*this),
265 m_workspacesig(*this),
266 m_creation_time(0), 265 m_creation_time(0),
267 moving(false), resizing(false), 266 moving(false), resizing(false),
268 m_initialized(false), 267 m_initialized(false),
@@ -536,7 +535,7 @@ void FluxboxWindow::init() {
536 setMaximizedState(tmp); 535 setMaximizedState(tmp);
537 } 536 }
538 537
539 m_workspacesig.notify(); 538 m_workspacesig.emit(*this);
540 539
541 struct timeval now; 540 struct timeval now;
542 gettimeofday(&now, NULL); 541 gettimeofday(&now, NULL);
@@ -627,7 +626,7 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) {
627 // TODO: one day these should probably be neatened to only act on the 626 // TODO: one day these should probably be neatened to only act on the
628 // affected clients if possible 627 // affected clients if possible
629 m_statesig.notify(); 628 m_statesig.notify();
630 m_workspacesig.notify(); 629 m_workspacesig.emit(*this);
631 m_layersig.notify(); 630 m_layersig.notify();
632 631
633 if (was_focused) { 632 if (was_focused) {
@@ -1537,8 +1536,8 @@ void FluxboxWindow::setWorkspace(int n) {
1537 1536
1538 // notify workspace change 1537 // notify workspace change
1539 if (m_initialized && old_wkspc != m_workspace_number) { 1538 if (m_initialized && old_wkspc != m_workspace_number) {
1540 fbdbg<<this<<" notify workspace signal"<<endl; 1539 fbdbg<<this<<" emit workspace signal"<<endl;
1541 m_workspacesig.notify(); 1540 m_workspacesig.emit(*this);
1542 } 1541 }
1543} 1542}
1544 1543
@@ -1587,7 +1586,7 @@ void FluxboxWindow::stick() {
1587 if (m_initialized) { 1586 if (m_initialized) {
1588 stateSig().notify(); 1587 stateSig().notify();
1589 // notify since some things consider "stuck" to be a pseudo-workspace 1588 // notify since some things consider "stuck" to be a pseudo-workspace
1590 m_workspacesig.notify(); 1589 m_workspacesig.emit(*this);
1591 } 1590 }
1592 1591
1593 ClientList::iterator client_it = clientList().begin(); 1592 ClientList::iterator client_it = clientList().begin();
diff --git a/src/Window.hh b/src/Window.hh
index cbbb817..a394401 100644
--- a/src/Window.hh
+++ b/src/Window.hh
@@ -464,8 +464,7 @@ public:
464 const FbTk::Subject &layerSig() const { return m_layersig; } 464 const FbTk::Subject &layerSig() const { return m_layersig; }
465 FbTk::Subject &hintSig() { return m_hintsig; } 465 FbTk::Subject &hintSig() { return m_hintsig; }
466 const FbTk::Subject &hintSig() const { return m_hintsig; } 466 const FbTk::Subject &hintSig() const { return m_hintsig; }
467 FbTk::Subject &workspaceSig() { return m_workspacesig; } 467 FbTk::Signal<FluxboxWindow &> &workspaceSig() { return m_workspacesig; }
468 const FbTk::Subject &workspaceSig() const { return m_workspacesig; }
469 /** @} */ // end group signals 468 /** @} */ // end group signals
470 469
471 //@} 470 //@}
@@ -543,8 +542,8 @@ private:
543 // state and hint signals 542 // state and hint signals
544 WinSubject m_hintsig, 543 WinSubject m_hintsig,
545 m_statesig, 544 m_statesig,
546 m_layersig, 545 m_layersig;
547 m_workspacesig; 546 FbTk::Signal<FluxboxWindow &> m_workspacesig;
548 547
549 time_t m_creation_time; 548 time_t m_creation_time;
550 549
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index 0263de7..e319a2f 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -978,9 +978,6 @@ void Fluxbox::update(FbTk::Subject *changedsub) {
978 } else if (fbwin && &fbwin->layerSig() == changedsub) { // layer signal 978 } else if (fbwin && &fbwin->layerSig() == changedsub) { // layer signal
979 STLUtil::forAllIf(m_atomhandler, mem_fun(&AtomHandler::update), 979 STLUtil::forAllIf(m_atomhandler, mem_fun(&AtomHandler::update),
980 CallMemFunWithRefArg<AtomHandler, FluxboxWindow&, void>(&AtomHandler::updateLayer, *fbwin)); 980 CallMemFunWithRefArg<AtomHandler, FluxboxWindow&, void>(&AtomHandler::updateLayer, *fbwin));
981 } else if (fbwin && &fbwin->workspaceSig() == changedsub) { // workspace signal
982 STLUtil::forAllIf(m_atomhandler, mem_fun(&AtomHandler::update),
983 CallMemFunWithRefArg<AtomHandler, FluxboxWindow&, void>(&AtomHandler::updateWorkspace, *fbwin));
984 } 981 }
985} 982}
986 983
@@ -1023,10 +1020,15 @@ void Fluxbox::clientDied(Focusable &focusable) {
1023 screen.removeClient(client); 1020 screen.removeClient(client);
1024} 1021}
1025 1022
1023void Fluxbox::windowWorkspaceChanged(FluxboxWindow &win) {
1024 STLUtil::forAllIf(m_atomhandler, mem_fun(&AtomHandler::update),
1025 CallMemFunWithRefArg<AtomHandler, FluxboxWindow&, void>(&AtomHandler::updateWorkspace, win));
1026}
1027
1026void Fluxbox::attachSignals(FluxboxWindow &win) { 1028void Fluxbox::attachSignals(FluxboxWindow &win) {
1027 win.hintSig().attach(this); 1029 win.hintSig().attach(this);
1028 win.stateSig().attach(this); 1030 win.stateSig().attach(this);
1029 win.workspaceSig().attach(this); 1031 join(win.workspaceSig(), FbTk::MemFun(*this, &Fluxbox::windowWorkspaceChanged));
1030 win.layerSig().attach(this); 1032 win.layerSig().attach(this);
1031 join(win.dieSig(), FbTk::MemFun(*this, &Fluxbox::windowDied)); 1033 join(win.dieSig(), FbTk::MemFun(*this, &Fluxbox::windowDied));
1032 STLUtil::forAll(m_atomhandler, 1034 STLUtil::forAll(m_atomhandler,
diff --git a/src/fluxbox.hh b/src/fluxbox.hh
index 082297f..4c8fcdf 100644
--- a/src/fluxbox.hh
+++ b/src/fluxbox.hh
@@ -221,6 +221,8 @@ private:
221 void windowDied(Focusable &focusable); 221 void windowDied(Focusable &focusable);
222 /// Called when a client (WinClient) dies 222 /// Called when a client (WinClient) dies
223 void clientDied(Focusable &focusable); 223 void clientDied(Focusable &focusable);
224 /// Called when a window changes workspace
225 void windowWorkspaceChanged(FluxboxWindow &win);
224 226
225 std::auto_ptr<FbAtoms> m_fbatoms; 227 std::auto_ptr<FbAtoms> m_fbatoms;
226 228