diff options
author | fluxgen <fluxgen> | 2003-08-18 11:13:32 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-08-18 11:13:32 (GMT) |
commit | f1f5472711fe4e8514697b4ccb8681a7f1771902 (patch) | |
tree | 2b6af8451e98bbd7923298d1e816e8874d9abc74 | |
parent | cc01c64c5c9af6a162fe88d6e649853fa942b6f4 (diff) | |
download | fluxbox-f1f5472711fe4e8514697b4ccb8681a7f1771902.zip fluxbox-f1f5472711fe4e8514697b4ccb8681a7f1771902.tar.bz2 |
added removeWindow and fixed workspace sig
-rw-r--r-- | src/IconbarTool.cc | 49 | ||||
-rw-r--r-- | 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 @@ | |||
20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
21 | // DEALINGS IN THE SOFTWARE. | 21 | // DEALINGS IN THE SOFTWARE. |
22 | 22 | ||
23 | // $Id: IconbarTool.cc,v 1.8 2003/08/16 11:47:26 fluxgen Exp $ | 23 | // $Id: IconbarTool.cc,v 1.9 2003/08/18 11:13:32 fluxgen Exp $ |
24 | 24 | ||
25 | #include "IconbarTool.hh" | 25 | #include "IconbarTool.hh" |
26 | 26 | ||
@@ -109,26 +109,16 @@ void IconbarTool::update(FbTk::Subject *subj) { | |||
109 | if (subj != 0 && typeid(*subj) == typeid(FluxboxWindow::WinSubject)) { | 109 | if (subj != 0 && typeid(*subj) == typeid(FluxboxWindow::WinSubject)) { |
110 | // we handle everything except die signal here | 110 | // we handle everything except die signal here |
111 | FluxboxWindow::WinSubject *winsubj = static_cast<FluxboxWindow::WinSubject *>(subj); | 111 | FluxboxWindow::WinSubject *winsubj = static_cast<FluxboxWindow::WinSubject *>(subj); |
112 | if (subj != &(winsubj->win().dieSig())) { | 112 | if (subj == &(winsubj->win().focusSig())) { |
113 | renderWindow(winsubj->win()); | 113 | renderWindow(winsubj->win()); |
114 | return; | 114 | return; |
115 | } else { | 115 | } else if (subj == &(winsubj->win().workspaceSig())) { |
116 | // got window die signal, lets find and remove the window | 116 | // workspace changed for this window, and if it's not on current workspace we remove it |
117 | IconList::iterator it = m_icon_list.begin(); | 117 | if (m_screen.currentWorkspaceID() != winsubj->win().workspaceNumber()) |
118 | IconList::iterator it_end = m_icon_list.end(); | 118 | removeWindow(winsubj->win()); |
119 | for (; it != it_end; ++it) { | 119 | return; |
120 | if (&(*it)->win() == &winsubj->win()) | 120 | } else { // die sig |
121 | break; | 121 | removeWindow(winsubj->win()); |
122 | } | ||
123 | // did we find it? | ||
124 | if (it == m_icon_list.end()) | ||
125 | return; | ||
126 | |||
127 | // remove from list and render theme again | ||
128 | delete *it; | ||
129 | m_icon_list.erase(it); | ||
130 | m_icon_container.removeItem(m_icon_container.find(*it)); | ||
131 | renderTheme(); | ||
132 | return; // we don't need to update the entire list | 122 | return; // we don't need to update the entire list |
133 | } | 123 | } |
134 | } | 124 | } |
@@ -195,6 +185,7 @@ void IconbarTool::update(FbTk::Subject *subj) { | |||
195 | 185 | ||
196 | (*it)->focusSig().attach(this); | 186 | (*it)->focusSig().attach(this); |
197 | (*it)->dieSig().attach(this); | 187 | (*it)->dieSig().attach(this); |
188 | (*it)->workspaceSig().attach(this); | ||
198 | } | 189 | } |
199 | 190 | ||
200 | m_icon_container.showSubwindows(); | 191 | m_icon_container.showSubwindows(); |
@@ -307,3 +298,23 @@ void IconbarTool::deleteIcons() { | |||
307 | m_icon_list.pop_back(); | 298 | m_icon_list.pop_back(); |
308 | } | 299 | } |
309 | } | 300 | } |
301 | |||
302 | void IconbarTool::removeWindow(FluxboxWindow &win) { | ||
303 | |||
304 | // got window die signal, lets find and remove the window | ||
305 | IconList::iterator it = m_icon_list.begin(); | ||
306 | IconList::iterator it_end = m_icon_list.end(); | ||
307 | for (; it != it_end; ++it) { | ||
308 | if (&(*it)->win() == &win) | ||
309 | break; | ||
310 | } | ||
311 | // did we find it? | ||
312 | if (it == m_icon_list.end()) | ||
313 | return; | ||
314 | |||
315 | // remove from list and render theme again | ||
316 | delete *it; | ||
317 | m_icon_list.erase(it); | ||
318 | m_icon_container.removeItem(m_icon_container.find(*it)); | ||
319 | renderTheme(); | ||
320 | } | ||
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 @@ | |||
20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
21 | // DEALINGS IN THE SOFTWARE. | 21 | // DEALINGS IN THE SOFTWARE. |
22 | 22 | ||
23 | // $Id: IconbarTool.hh,v 1.5 2003/08/16 11:47:26 fluxgen Exp $ | 23 | // $Id: IconbarTool.hh,v 1.6 2003/08/18 11:13:32 fluxgen Exp $ |
24 | 24 | ||
25 | #ifndef ICONBARTOOL_HH | 25 | #ifndef ICONBARTOOL_HH |
26 | #define ICONBARTOOL_HH | 26 | #define ICONBARTOOL_HH |
@@ -65,6 +65,8 @@ private: | |||
65 | void renderTheme(); | 65 | void renderTheme(); |
66 | /// destroy all icons | 66 | /// destroy all icons |
67 | void deleteIcons(); | 67 | void deleteIcons(); |
68 | /// remove a single window an render theme again | ||
69 | void removeWindow(FluxboxWindow &win); | ||
68 | 70 | ||
69 | BScreen &m_screen; | 71 | BScreen &m_screen; |
70 | Container m_icon_container; | 72 | Container m_icon_container; |