Convert FluxboxWindow::workspaceSig to FbTk::Signal
This commit is contained in:
parent
ae68b7f7cd
commit
4f89009c9e
6 changed files with 40 additions and 27 deletions
|
@ -114,16 +114,22 @@ void FocusableList::update(FbTk::Subject *subj) {
|
||||||
if (typeid(*subj) == typeid(FluxboxWindow::WinSubject)) {
|
if (typeid(*subj) == typeid(FluxboxWindow::WinSubject)) {
|
||||||
FluxboxWindow::WinSubject *fsubj =
|
FluxboxWindow::WinSubject *fsubj =
|
||||||
static_cast<FluxboxWindow::WinSubject *>(subj);
|
static_cast<FluxboxWindow::WinSubject *>(subj);
|
||||||
// we only bind these for matching patterns, so skip finding out signal
|
windowUpdated(fsubj->win());
|
||||||
FluxboxWindow &fbwin = fsubj->win();
|
}
|
||||||
if (m_parent->contains(fbwin))
|
}
|
||||||
checkUpdate(fbwin);
|
|
||||||
std::list<WinClient *> list = fbwin.clientList();
|
void FocusableList::windowUpdated(FluxboxWindow &fbwin) {
|
||||||
std::list<WinClient *>::iterator it = list.begin(), it_end = list.end();
|
if (m_screen.isShuttingdown())
|
||||||
for (; it != it_end; ++it) {
|
return;
|
||||||
if (m_parent->contains(**it))
|
|
||||||
checkUpdate(**it);
|
// we only bind these for matching patterns, so skip finding out signal
|
||||||
}
|
if (m_parent->contains(fbwin))
|
||||||
|
checkUpdate(fbwin);
|
||||||
|
const std::list<WinClient *> &list = fbwin.clientList();
|
||||||
|
std::list<WinClient *>::const_iterator it = list.begin(), it_end = list.end();
|
||||||
|
for (; it != it_end; ++it) {
|
||||||
|
if (m_parent->contains(**it))
|
||||||
|
checkUpdate(**it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,6 +258,8 @@ void FocusableList::updateTitle(Focusable& win) {
|
||||||
|
|
||||||
void FocusableList::attachSignals(Focusable &win) {
|
void FocusableList::attachSignals(Focusable &win) {
|
||||||
if (m_parent) {
|
if (m_parent) {
|
||||||
|
FluxboxWindow *fbwin = win.fbwindow();
|
||||||
|
|
||||||
// attach various signals for matching
|
// attach various signals for matching
|
||||||
FbTk::RefCount<FbTk::SignalTracker> &tracker = m_signal_map[&win];
|
FbTk::RefCount<FbTk::SignalTracker> &tracker = m_signal_map[&win];
|
||||||
if (! tracker) {
|
if (! tracker) {
|
||||||
|
@ -259,12 +267,15 @@ void FocusableList::attachSignals(Focusable &win) {
|
||||||
tracker = new SignalTracker;
|
tracker = new SignalTracker;
|
||||||
tracker->join(win.titleSig(), MemFunSelectArg1(*this, &FocusableList::updateTitle));
|
tracker->join(win.titleSig(), MemFunSelectArg1(*this, &FocusableList::updateTitle));
|
||||||
tracker->join(win.dieSig(), MemFun(*this, &FocusableList::remove));
|
tracker->join(win.dieSig(), MemFun(*this, &FocusableList::remove));
|
||||||
|
if(fbwin) {
|
||||||
|
tracker->join(fbwin->workspaceSig(),
|
||||||
|
MemFun(*this, &FocusableList::windowUpdated)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluxboxWindow *fbwin = win.fbwindow();
|
|
||||||
if (!fbwin)
|
if (!fbwin)
|
||||||
return;
|
return;
|
||||||
fbwin->workspaceSig().attach(this);
|
|
||||||
fbwin->stateSig().attach(this);
|
fbwin->stateSig().attach(this);
|
||||||
fbwin->layerSig().attach(this);
|
fbwin->layerSig().attach(this);
|
||||||
// TODO: can't watch (head=...) yet
|
// TODO: can't watch (head=...) yet
|
||||||
|
@ -278,7 +289,6 @@ void FocusableList::detachSignals(Focusable &win) {
|
||||||
FluxboxWindow *fbwin = win.fbwindow();
|
FluxboxWindow *fbwin = win.fbwindow();
|
||||||
if (!fbwin)
|
if (!fbwin)
|
||||||
return;
|
return;
|
||||||
fbwin->workspaceSig().detach(this);
|
|
||||||
fbwin->stateSig().detach(this);
|
fbwin->stateSig().detach(this);
|
||||||
fbwin->layerSig().detach(this);
|
fbwin->layerSig().detach(this);
|
||||||
// TODO: can't watch (head=...) yet
|
// TODO: can't watch (head=...) yet
|
||||||
|
|
|
@ -105,6 +105,7 @@ private:
|
||||||
void parentOrderChanged(Focusable* win);
|
void parentOrderChanged(Focusable* win);
|
||||||
void parentWindowAdded(Focusable* win);
|
void parentWindowAdded(Focusable* win);
|
||||||
void parentWindowRemoved(Focusable* win);
|
void parentWindowRemoved(Focusable* win);
|
||||||
|
void windowUpdated(FluxboxWindow &fbwin);
|
||||||
|
|
||||||
|
|
||||||
std::auto_ptr<ClientPattern> m_pat;
|
std::auto_ptr<ClientPattern> m_pat;
|
||||||
|
|
|
@ -262,7 +262,6 @@ FluxboxWindow::FluxboxWindow(WinClient &client):
|
||||||
m_hintsig(*this),
|
m_hintsig(*this),
|
||||||
m_statesig(*this),
|
m_statesig(*this),
|
||||||
m_layersig(*this),
|
m_layersig(*this),
|
||||||
m_workspacesig(*this),
|
|
||||||
m_creation_time(0),
|
m_creation_time(0),
|
||||||
moving(false), resizing(false),
|
moving(false), resizing(false),
|
||||||
m_initialized(false),
|
m_initialized(false),
|
||||||
|
@ -536,7 +535,7 @@ void FluxboxWindow::init() {
|
||||||
setMaximizedState(tmp);
|
setMaximizedState(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_workspacesig.notify();
|
m_workspacesig.emit(*this);
|
||||||
|
|
||||||
struct timeval now;
|
struct timeval now;
|
||||||
gettimeofday(&now, NULL);
|
gettimeofday(&now, NULL);
|
||||||
|
@ -627,7 +626,7 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) {
|
||||||
// TODO: one day these should probably be neatened to only act on the
|
// TODO: one day these should probably be neatened to only act on the
|
||||||
// affected clients if possible
|
// affected clients if possible
|
||||||
m_statesig.notify();
|
m_statesig.notify();
|
||||||
m_workspacesig.notify();
|
m_workspacesig.emit(*this);
|
||||||
m_layersig.notify();
|
m_layersig.notify();
|
||||||
|
|
||||||
if (was_focused) {
|
if (was_focused) {
|
||||||
|
@ -1537,8 +1536,8 @@ void FluxboxWindow::setWorkspace(int n) {
|
||||||
|
|
||||||
// notify workspace change
|
// notify workspace change
|
||||||
if (m_initialized && old_wkspc != m_workspace_number) {
|
if (m_initialized && old_wkspc != m_workspace_number) {
|
||||||
fbdbg<<this<<" notify workspace signal"<<endl;
|
fbdbg<<this<<" emit workspace signal"<<endl;
|
||||||
m_workspacesig.notify();
|
m_workspacesig.emit(*this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1587,7 +1586,7 @@ void FluxboxWindow::stick() {
|
||||||
if (m_initialized) {
|
if (m_initialized) {
|
||||||
stateSig().notify();
|
stateSig().notify();
|
||||||
// notify since some things consider "stuck" to be a pseudo-workspace
|
// notify since some things consider "stuck" to be a pseudo-workspace
|
||||||
m_workspacesig.notify();
|
m_workspacesig.emit(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
ClientList::iterator client_it = clientList().begin();
|
ClientList::iterator client_it = clientList().begin();
|
||||||
|
|
|
@ -464,8 +464,7 @@ public:
|
||||||
const FbTk::Subject &layerSig() const { return m_layersig; }
|
const FbTk::Subject &layerSig() const { return m_layersig; }
|
||||||
FbTk::Subject &hintSig() { return m_hintsig; }
|
FbTk::Subject &hintSig() { return m_hintsig; }
|
||||||
const FbTk::Subject &hintSig() const { return m_hintsig; }
|
const FbTk::Subject &hintSig() const { return m_hintsig; }
|
||||||
FbTk::Subject &workspaceSig() { return m_workspacesig; }
|
FbTk::Signal<FluxboxWindow &> &workspaceSig() { return m_workspacesig; }
|
||||||
const FbTk::Subject &workspaceSig() const { return m_workspacesig; }
|
|
||||||
/** @} */ // end group signals
|
/** @} */ // end group signals
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
@ -543,8 +542,8 @@ private:
|
||||||
// state and hint signals
|
// state and hint signals
|
||||||
WinSubject m_hintsig,
|
WinSubject m_hintsig,
|
||||||
m_statesig,
|
m_statesig,
|
||||||
m_layersig,
|
m_layersig;
|
||||||
m_workspacesig;
|
FbTk::Signal<FluxboxWindow &> m_workspacesig;
|
||||||
|
|
||||||
time_t m_creation_time;
|
time_t m_creation_time;
|
||||||
|
|
||||||
|
|
|
@ -978,9 +978,6 @@ void Fluxbox::update(FbTk::Subject *changedsub) {
|
||||||
} else if (fbwin && &fbwin->layerSig() == changedsub) { // layer signal
|
} else if (fbwin && &fbwin->layerSig() == changedsub) { // layer signal
|
||||||
STLUtil::forAllIf(m_atomhandler, mem_fun(&AtomHandler::update),
|
STLUtil::forAllIf(m_atomhandler, mem_fun(&AtomHandler::update),
|
||||||
CallMemFunWithRefArg<AtomHandler, FluxboxWindow&, void>(&AtomHandler::updateLayer, *fbwin));
|
CallMemFunWithRefArg<AtomHandler, FluxboxWindow&, void>(&AtomHandler::updateLayer, *fbwin));
|
||||||
} else if (fbwin && &fbwin->workspaceSig() == changedsub) { // workspace signal
|
|
||||||
STLUtil::forAllIf(m_atomhandler, mem_fun(&AtomHandler::update),
|
|
||||||
CallMemFunWithRefArg<AtomHandler, FluxboxWindow&, void>(&AtomHandler::updateWorkspace, *fbwin));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1023,10 +1020,15 @@ void Fluxbox::clientDied(Focusable &focusable) {
|
||||||
screen.removeClient(client);
|
screen.removeClient(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Fluxbox::windowWorkspaceChanged(FluxboxWindow &win) {
|
||||||
|
STLUtil::forAllIf(m_atomhandler, mem_fun(&AtomHandler::update),
|
||||||
|
CallMemFunWithRefArg<AtomHandler, FluxboxWindow&, void>(&AtomHandler::updateWorkspace, win));
|
||||||
|
}
|
||||||
|
|
||||||
void Fluxbox::attachSignals(FluxboxWindow &win) {
|
void Fluxbox::attachSignals(FluxboxWindow &win) {
|
||||||
win.hintSig().attach(this);
|
win.hintSig().attach(this);
|
||||||
win.stateSig().attach(this);
|
win.stateSig().attach(this);
|
||||||
win.workspaceSig().attach(this);
|
join(win.workspaceSig(), FbTk::MemFun(*this, &Fluxbox::windowWorkspaceChanged));
|
||||||
win.layerSig().attach(this);
|
win.layerSig().attach(this);
|
||||||
join(win.dieSig(), FbTk::MemFun(*this, &Fluxbox::windowDied));
|
join(win.dieSig(), FbTk::MemFun(*this, &Fluxbox::windowDied));
|
||||||
STLUtil::forAll(m_atomhandler,
|
STLUtil::forAll(m_atomhandler,
|
||||||
|
|
|
@ -221,6 +221,8 @@ private:
|
||||||
void windowDied(Focusable &focusable);
|
void windowDied(Focusable &focusable);
|
||||||
/// Called when a client (WinClient) dies
|
/// Called when a client (WinClient) dies
|
||||||
void clientDied(Focusable &focusable);
|
void clientDied(Focusable &focusable);
|
||||||
|
/// Called when a window changes workspace
|
||||||
|
void windowWorkspaceChanged(FluxboxWindow &win);
|
||||||
|
|
||||||
std::auto_ptr<FbAtoms> m_fbatoms;
|
std::auto_ptr<FbAtoms> m_fbatoms;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue