From f1f5472711fe4e8514697b4ccb8681a7f1771902 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Mon, 18 Aug 2003 11:13:32 +0000 Subject: added removeWindow and fixed workspace sig --- src/IconbarTool.cc | 49 ++++++++++++++++++++++++++++++------------------- src/IconbarTool.hh | 4 +++- 2 files changed, 33 insertions(+), 20 deletions(-) diff --git a/src/IconbarTool.cc b/src/IconbarTool.cc index 2e72d12..f7f9954 100644 --- a/src/IconbarTool.cc +++ b/src/IconbarTool.cc @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: IconbarTool.cc,v 1.8 2003/08/16 11:47:26 fluxgen Exp $ +// $Id: IconbarTool.cc,v 1.9 2003/08/18 11:13:32 fluxgen Exp $ #include "IconbarTool.hh" @@ -109,26 +109,16 @@ void IconbarTool::update(FbTk::Subject *subj) { if (subj != 0 && typeid(*subj) == typeid(FluxboxWindow::WinSubject)) { // we handle everything except die signal here FluxboxWindow::WinSubject *winsubj = static_cast(subj); - if (subj != &(winsubj->win().dieSig())) { + if (subj == &(winsubj->win().focusSig())) { renderWindow(winsubj->win()); return; - } else { - // got window die signal, lets find and remove the window - IconList::iterator it = m_icon_list.begin(); - IconList::iterator it_end = m_icon_list.end(); - for (; it != it_end; ++it) { - if (&(*it)->win() == &winsubj->win()) - break; - } - // did we find it? - if (it == m_icon_list.end()) - return; - - // remove from list and render theme again - delete *it; - m_icon_list.erase(it); - m_icon_container.removeItem(m_icon_container.find(*it)); - renderTheme(); + } else if (subj == &(winsubj->win().workspaceSig())) { + // workspace changed for this window, and if it's not on current workspace we remove it + if (m_screen.currentWorkspaceID() != winsubj->win().workspaceNumber()) + removeWindow(winsubj->win()); + return; + } else { // die sig + removeWindow(winsubj->win()); return; // we don't need to update the entire list } } @@ -195,6 +185,7 @@ void IconbarTool::update(FbTk::Subject *subj) { (*it)->focusSig().attach(this); (*it)->dieSig().attach(this); + (*it)->workspaceSig().attach(this); } m_icon_container.showSubwindows(); @@ -307,3 +298,23 @@ void IconbarTool::deleteIcons() { m_icon_list.pop_back(); } } + +void IconbarTool::removeWindow(FluxboxWindow &win) { + + // got window die signal, lets find and remove the window + IconList::iterator it = m_icon_list.begin(); + IconList::iterator it_end = m_icon_list.end(); + for (; it != it_end; ++it) { + if (&(*it)->win() == &win) + break; + } + // did we find it? + if (it == m_icon_list.end()) + return; + + // remove from list and render theme again + delete *it; + m_icon_list.erase(it); + m_icon_container.removeItem(m_icon_container.find(*it)); + renderTheme(); +} diff --git a/src/IconbarTool.hh b/src/IconbarTool.hh index db50cd7..6dc7bfa 100644 --- a/src/IconbarTool.hh +++ b/src/IconbarTool.hh @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: IconbarTool.hh,v 1.5 2003/08/16 11:47:26 fluxgen Exp $ +// $Id: IconbarTool.hh,v 1.6 2003/08/18 11:13:32 fluxgen Exp $ #ifndef ICONBARTOOL_HH #define ICONBARTOOL_HH @@ -65,6 +65,8 @@ private: void renderTheme(); /// destroy all icons void deleteIcons(); + /// remove a single window an render theme again + void removeWindow(FluxboxWindow &win); BScreen &m_screen; Container m_icon_container; -- cgit v0.11.2