summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Workspace.cc30
-rw-r--r--src/Workspace.hh12
2 files changed, 13 insertions, 29 deletions
diff --git a/src/Workspace.cc b/src/Workspace.cc
index 73bd537..3b339a0 100644
--- a/src/Workspace.cc
+++ b/src/Workspace.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Workspace.cc,v 1.84 2003/12/03 23:05:29 fluxgen Exp $ 25// $Id: Workspace.cc,v 1.85 2003/12/07 17:49:07 fluxgen Exp $
26 26
27#include "Workspace.hh" 27#include "Workspace.hh"
28 28
@@ -157,6 +157,8 @@ void Workspace::addWindow(FluxboxWindow &w, bool place) {
157 return; 157 return;
158 158
159 w.setWorkspace(m_id); 159 w.setWorkspace(m_id);
160 // attach signals
161 w.titleSig().attach(this);
160 162
161 if (place) 163 if (place)
162 placeWindow(w); 164 placeWindow(w);
@@ -181,6 +183,9 @@ int Workspace::removeWindow(FluxboxWindow *w) {
181 if (w == 0) 183 if (w == 0)
182 return -1; 184 return -1;
183 185
186 // detach from signals
187 w->titleSig().detach(this);
188
184 if (m_lastfocus == w) { 189 if (m_lastfocus == w) {
185 m_lastfocus = 0; 190 m_lastfocus = 0;
186 } 191 }
@@ -231,20 +236,6 @@ int Workspace::removeWindow(FluxboxWindow *w) {
231 return m_windowlist.size(); 236 return m_windowlist.size();
232} 237}
233 238
234void Workspace::removeWindow(WinClient &client) {
235 if (client.m_win == 0)
236 return;
237
238 if (client.m_win->numClients() == 0) {
239 Windows::iterator erase_it = remove(m_windowlist.begin(),
240 m_windowlist.end(), client.m_win);
241 if (erase_it != m_windowlist.end())
242 m_windowlist.erase(erase_it);
243 }
244
245 updateClientmenu();
246}
247
248void Workspace::showAll() { 239void Workspace::showAll() {
249 Windows::iterator it = m_windowlist.begin(); 240 Windows::iterator it = m_windowlist.begin();
250 Windows::iterator it_end = m_windowlist.end(); 241 Windows::iterator it_end = m_windowlist.end();
@@ -378,7 +369,7 @@ bool Workspace::loadGroups(const std::string &filename) {
378 return true; 369 return true;
379} 370}
380 371
381void Workspace::update() { 372void Workspace::update(FbTk::Subject *subj) {
382 m_clientmenu.update(); 373 m_clientmenu.update();
383} 374}
384 375
@@ -407,13 +398,6 @@ void Workspace::setName(const std::string &name) {
407 clears the m_windowlist 398 clears the m_windowlist
408*/ 399*/
409void Workspace::shutdown() { 400void Workspace::shutdown() {
410#ifdef DEBUG
411 cerr<<__FILE__<<"("<<__FUNCTION__<<"): scr "<<screen().screenNumber()<<", ws "<<
412 m_id<<", windowlist:"<<endl;
413 copy(m_windowlist.begin(), m_windowlist.end(),
414 ostream_iterator<FluxboxWindow *>(cerr, " \n"));
415 cerr<<endl;
416#endif // DEBUG
417 // note: when the window dies it'll remove it self from the list 401 // note: when the window dies it'll remove it self from the list
418 while (!m_windowlist.empty()) { 402 while (!m_windowlist.empty()) {
419 // restore with remap on all clients in that window 403 // restore with remap on all clients in that window
diff --git a/src/Workspace.hh b/src/Workspace.hh
index a385963..d7ea28e 100644
--- a/src/Workspace.hh
+++ b/src/Workspace.hh
@@ -25,12 +25,13 @@
25#ifndef WORKSPACE_HH 25#ifndef WORKSPACE_HH
26#define WORKSPACE_HH 26#define WORKSPACE_HH
27 27
28#include "NotCopyable.hh" 28
29 29
30#include "FbMenu.hh" 30#include "FbMenu.hh"
31#include "MultLayers.hh"
32 31
33#include <X11/Xlib.h> 32#include "FbTk/MultLayers.hh"
33#include "FbTk/Observer.hh"
34#include "FbTk/NotCopyable.hh"
34 35
35#include <string> 36#include <string>
36#include <vector> 37#include <vector>
@@ -43,7 +44,7 @@ class WinClient;
43/** 44/**
44 Handles a single workspace 45 Handles a single workspace
45*/ 46*/
46class Workspace:private FbTk::NotCopyable { 47class Workspace:private FbTk::NotCopyable, private FbTk::Observer {
47public: 48public:
48 typedef std::vector<FluxboxWindow *> Windows; 49 typedef std::vector<FluxboxWindow *> Windows;
49 50
@@ -59,11 +60,9 @@ public:
59 void hideAll(); 60 void hideAll();
60 void removeAll(); 61 void removeAll();
61 void reconfigure(); 62 void reconfigure();
62 void update();
63 void shutdown(); 63 void shutdown();
64 void addWindow(FluxboxWindow &win, bool place = false); 64 void addWindow(FluxboxWindow &win, bool place = false);
65 int removeWindow(FluxboxWindow *win); 65 int removeWindow(FluxboxWindow *win);
66 void removeWindow(WinClient &client);
67 void updateClientmenu(); 66 void updateClientmenu();
68 67
69 BScreen &screen() { return m_screen; } 68 BScreen &screen() { return m_screen; }
@@ -90,6 +89,7 @@ public:
90 static bool loadGroups(const std::string &filename); 89 static bool loadGroups(const std::string &filename);
91 90
92private: 91private:
92 void update(FbTk::Subject *subj);
93 void placeWindow(FluxboxWindow &win); 93 void placeWindow(FluxboxWindow &win);
94 94
95 BScreen &m_screen; 95 BScreen &m_screen;