added removeWindow and fixed workspace sig
This commit is contained in:
parent
cc01c64c5c
commit
f1f5472711
2 changed files with 33 additions and 20 deletions
|
@ -20,7 +20,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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"
|
#include "IconbarTool.hh"
|
||||||
|
|
||||||
|
@ -109,26 +109,16 @@ void IconbarTool::update(FbTk::Subject *subj) {
|
||||||
if (subj != 0 && typeid(*subj) == typeid(FluxboxWindow::WinSubject)) {
|
if (subj != 0 && typeid(*subj) == typeid(FluxboxWindow::WinSubject)) {
|
||||||
// we handle everything except die signal here
|
// we handle everything except die signal here
|
||||||
FluxboxWindow::WinSubject *winsubj = static_cast<FluxboxWindow::WinSubject *>(subj);
|
FluxboxWindow::WinSubject *winsubj = static_cast<FluxboxWindow::WinSubject *>(subj);
|
||||||
if (subj != &(winsubj->win().dieSig())) {
|
if (subj == &(winsubj->win().focusSig())) {
|
||||||
renderWindow(winsubj->win());
|
renderWindow(winsubj->win());
|
||||||
return;
|
return;
|
||||||
} else {
|
} else if (subj == &(winsubj->win().workspaceSig())) {
|
||||||
// got window die signal, lets find and remove the window
|
// workspace changed for this window, and if it's not on current workspace we remove it
|
||||||
IconList::iterator it = m_icon_list.begin();
|
if (m_screen.currentWorkspaceID() != winsubj->win().workspaceNumber())
|
||||||
IconList::iterator it_end = m_icon_list.end();
|
removeWindow(winsubj->win());
|
||||||
for (; it != it_end; ++it) {
|
return;
|
||||||
if (&(*it)->win() == &winsubj->win())
|
} else { // die sig
|
||||||
break;
|
removeWindow(winsubj->win());
|
||||||
}
|
|
||||||
// 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();
|
|
||||||
return; // we don't need to update the entire list
|
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)->focusSig().attach(this);
|
||||||
(*it)->dieSig().attach(this);
|
(*it)->dieSig().attach(this);
|
||||||
|
(*it)->workspaceSig().attach(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_icon_container.showSubwindows();
|
m_icon_container.showSubwindows();
|
||||||
|
@ -307,3 +298,23 @@ void IconbarTool::deleteIcons() {
|
||||||
m_icon_list.pop_back();
|
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();
|
||||||
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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
|
#ifndef ICONBARTOOL_HH
|
||||||
#define ICONBARTOOL_HH
|
#define ICONBARTOOL_HH
|
||||||
|
@ -65,6 +65,8 @@ private:
|
||||||
void renderTheme();
|
void renderTheme();
|
||||||
/// destroy all icons
|
/// destroy all icons
|
||||||
void deleteIcons();
|
void deleteIcons();
|
||||||
|
/// remove a single window an render theme again
|
||||||
|
void removeWindow(FluxboxWindow &win);
|
||||||
|
|
||||||
BScreen &m_screen;
|
BScreen &m_screen;
|
||||||
Container m_icon_container;
|
Container m_icon_container;
|
||||||
|
|
Loading…
Reference in a new issue