all repos — fluxbox @ 4f89009c9e6521910442eabc36d572367398c0bf

custom fork of the fluxbox windowmanager

Convert FluxboxWindow::workspaceSig to FbTk::Signal
Pavel Labath pavelo@centrum.sk
commit

4f89009c9e6521910442eabc36d572367398c0bf

parent

ae68b7f7cd47c91e776fadee7aecb93d5b3ee3df

6 files changed, 40 insertions(+), 27 deletions(-)

jump to
M src/FocusableList.ccsrc/FocusableList.cc

@@ -114,16 +114,22 @@

if (typeid(*subj) == typeid(FluxboxWindow::WinSubject)) { FluxboxWindow::WinSubject *fsubj = static_cast<FluxboxWindow::WinSubject *>(subj); - // we only bind these for matching patterns, so skip finding out signal - FluxboxWindow &fbwin = fsubj->win(); - if (m_parent->contains(fbwin)) - checkUpdate(fbwin); - std::list<WinClient *> list = fbwin.clientList(); - std::list<WinClient *>::iterator it = list.begin(), it_end = list.end(); - for (; it != it_end; ++it) { - if (m_parent->contains(**it)) - checkUpdate(**it); - } + windowUpdated(fsubj->win()); + } +} + +void FocusableList::windowUpdated(FluxboxWindow &fbwin) { + if (m_screen.isShuttingdown()) + return; + + // 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 @@ #include "Debug.hh"

void FocusableList::attachSignals(Focusable &win) { if (m_parent) { + FluxboxWindow *fbwin = win.fbwindow(); + // attach various signals for matching FbTk::RefCount<FbTk::SignalTracker> &tracker = m_signal_map[&win]; if (! tracker) {

@@ -259,12 +267,15 @@ // we have not attached to this window yet

tracker = new SignalTracker; tracker->join(win.titleSig(), MemFunSelectArg1(*this, &FocusableList::updateTitle)); tracker->join(win.dieSig(), MemFun(*this, &FocusableList::remove)); + if(fbwin) { + tracker->join(fbwin->workspaceSig(), + MemFun(*this, &FocusableList::windowUpdated) + ); + } } - FluxboxWindow *fbwin = win.fbwindow(); if (!fbwin) return; - fbwin->workspaceSig().attach(this); fbwin->stateSig().attach(this); fbwin->layerSig().attach(this); // TODO: can't watch (head=...) yet

@@ -278,7 +289,6 @@ // detach various signals for matching

FluxboxWindow *fbwin = win.fbwindow(); if (!fbwin) return; - fbwin->workspaceSig().detach(this); fbwin->stateSig().detach(this); fbwin->layerSig().detach(this); // TODO: can't watch (head=...) yet
M src/FocusableList.hhsrc/FocusableList.hh

@@ -105,6 +105,7 @@ void updateTitle(Focusable& win);

void parentOrderChanged(Focusable* win); void parentWindowAdded(Focusable* win); void parentWindowRemoved(Focusable* win); + void windowUpdated(FluxboxWindow &fbwin); std::auto_ptr<ClientPattern> m_pat;
M src/Window.ccsrc/Window.cc

@@ -262,7 +262,6 @@ oplock(false),

m_hintsig(*this), m_statesig(*this), m_layersig(*this), - m_workspacesig(*this), m_creation_time(0), moving(false), resizing(false), m_initialized(false),

@@ -536,7 +535,7 @@ m_state.maximized = WindowState::MAX_NONE;

setMaximizedState(tmp); } - m_workspacesig.notify(); + m_workspacesig.emit(*this); struct timeval now; gettimeofday(&now, NULL);

@@ -627,7 +626,7 @@ // make sure that the state etc etc is updated for the new client

// TODO: one day these should probably be neatened to only act on the // affected clients if possible m_statesig.notify(); - m_workspacesig.notify(); + m_workspacesig.emit(*this); m_layersig.notify(); if (was_focused) {

@@ -1537,8 +1536,8 @@ m_workspace_number = n;

// notify workspace change if (m_initialized && old_wkspc != m_workspace_number) { - fbdbg<<this<<" notify workspace signal"<<endl; - m_workspacesig.notify(); + fbdbg<<this<<" emit workspace signal"<<endl; + m_workspacesig.emit(*this); } }

@@ -1587,7 +1586,7 @@

if (m_initialized) { stateSig().notify(); // notify since some things consider "stuck" to be a pseudo-workspace - m_workspacesig.notify(); + m_workspacesig.emit(*this); } ClientList::iterator client_it = clientList().begin();
M src/Window.hhsrc/Window.hh

@@ -464,8 +464,7 @@ FbTk::Subject &layerSig() { return m_layersig; }

const FbTk::Subject &layerSig() const { return m_layersig; } FbTk::Subject &hintSig() { return m_hintsig; } const FbTk::Subject &hintSig() const { return m_hintsig; } - FbTk::Subject &workspaceSig() { return m_workspacesig; } - const FbTk::Subject &workspaceSig() const { return m_workspacesig; } + FbTk::Signal<FluxboxWindow &> &workspaceSig() { return m_workspacesig; } /** @} */ // end group signals //@}

@@ -543,8 +542,8 @@

// state and hint signals WinSubject m_hintsig, m_statesig, - m_layersig, - m_workspacesig; + m_layersig; + FbTk::Signal<FluxboxWindow &> m_workspacesig; time_t m_creation_time;
M src/fluxbox.ccsrc/fluxbox.cc

@@ -978,9 +978,6 @@ }

} else if (fbwin && &fbwin->layerSig() == changedsub) { // layer signal STLUtil::forAllIf(m_atomhandler, mem_fun(&AtomHandler::update), 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 @@

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) { win.hintSig().attach(this); win.stateSig().attach(this); - win.workspaceSig().attach(this); + join(win.workspaceSig(), FbTk::MemFun(*this, &Fluxbox::windowWorkspaceChanged)); win.layerSig().attach(this); join(win.dieSig(), FbTk::MemFun(*this, &Fluxbox::windowDied)); STLUtil::forAll(m_atomhandler,
M src/fluxbox.hhsrc/fluxbox.hh

@@ -221,6 +221,8 @@ /// Called when a window (FluxboxWindow) dies

void windowDied(Focusable &focusable); /// Called when a client (WinClient) dies void clientDied(Focusable &focusable); + /// Called when a window changes workspace + void windowWorkspaceChanged(FluxboxWindow &win); std::auto_ptr<FbAtoms> m_fbatoms;