From e9be87766bd5e3353217d49037f971d43e548d3a Mon Sep 17 00:00:00 2001 From: fluxgen Date: Sun, 7 Dec 2003 17:49:07 +0000 Subject: observe title signal --- src/Workspace.cc | 30 +++++++----------------------- src/Workspace.hh | 12 ++++++------ 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 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Workspace.cc,v 1.84 2003/12/03 23:05:29 fluxgen Exp $ +// $Id: Workspace.cc,v 1.85 2003/12/07 17:49:07 fluxgen Exp $ #include "Workspace.hh" @@ -157,6 +157,8 @@ void Workspace::addWindow(FluxboxWindow &w, bool place) { return; w.setWorkspace(m_id); + // attach signals + w.titleSig().attach(this); if (place) placeWindow(w); @@ -181,6 +183,9 @@ int Workspace::removeWindow(FluxboxWindow *w) { if (w == 0) return -1; + // detach from signals + w->titleSig().detach(this); + if (m_lastfocus == w) { m_lastfocus = 0; } @@ -231,20 +236,6 @@ int Workspace::removeWindow(FluxboxWindow *w) { return m_windowlist.size(); } -void Workspace::removeWindow(WinClient &client) { - if (client.m_win == 0) - return; - - if (client.m_win->numClients() == 0) { - Windows::iterator erase_it = remove(m_windowlist.begin(), - m_windowlist.end(), client.m_win); - if (erase_it != m_windowlist.end()) - m_windowlist.erase(erase_it); - } - - updateClientmenu(); -} - void Workspace::showAll() { Windows::iterator it = m_windowlist.begin(); Windows::iterator it_end = m_windowlist.end(); @@ -378,7 +369,7 @@ bool Workspace::loadGroups(const std::string &filename) { return true; } -void Workspace::update() { +void Workspace::update(FbTk::Subject *subj) { m_clientmenu.update(); } @@ -407,13 +398,6 @@ void Workspace::setName(const std::string &name) { clears the m_windowlist */ void Workspace::shutdown() { -#ifdef DEBUG - cerr<<__FILE__<<"("<<__FUNCTION__<<"): scr "<(cerr, " \n")); - cerr< +#include "FbTk/MultLayers.hh" +#include "FbTk/Observer.hh" +#include "FbTk/NotCopyable.hh" #include #include @@ -43,7 +44,7 @@ class WinClient; /** Handles a single workspace */ -class Workspace:private FbTk::NotCopyable { +class Workspace:private FbTk::NotCopyable, private FbTk::Observer { public: typedef std::vector Windows; @@ -59,11 +60,9 @@ public: void hideAll(); void removeAll(); void reconfigure(); - void update(); void shutdown(); void addWindow(FluxboxWindow &win, bool place = false); int removeWindow(FluxboxWindow *win); - void removeWindow(WinClient &client); void updateClientmenu(); BScreen &screen() { return m_screen; } @@ -90,6 +89,7 @@ public: static bool loadGroups(const std::string &filename); private: + void update(FbTk::Subject *subj); void placeWindow(FluxboxWindow &win); BScreen &m_screen; -- cgit v0.11.2