From 2fcc0fd9e7b92dbb440fd67e34fdbab05be7d98d Mon Sep 17 00:00:00 2001 From: Henrik Kinnunen <fluxgen@fluxbox.org> Date: Sun, 28 Sep 2008 16:00:48 +0200 Subject: Changed workspace area signal to use the new signal system --- ChangeLog | 4 +++- src/Screen.cc | 5 ++--- src/Screen.hh | 4 ++-- src/Window.cc | 11 +++++++---- src/Window.hh | 3 +++ src/fluxbox.cc | 22 +++++++++++----------- src/fluxbox.hh | 3 +++ 7 files changed, 31 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 588033c..dc582ff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,9 @@ (Format: Year/Month/Day) Changes for 1.1.2 *08/09/28: - * Change focused window signal to use the new signal system (Henrik) + * Changed workspace area signal to use the new signal system (Henrik) + Window.hh/cc, Screen.hh/cc, fluxbox.hh/cc + * Changed focused window signal to use the new signal system (Henrik) FbTk/Signal.hh, FocusControl.cc, FocusableList.hh/cc, Screen.hh/cc Window.hh/cc, fluxbox.hh/cc *08/09/25: diff --git a/src/Screen.cc b/src/Screen.cc index fe5ee31..66ab0fd 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -339,7 +339,6 @@ BScreen::BScreen(FbTk::ResourceManager &rm, const string &screenname, const string &altscreenname, int scrn, int num_layers) : - m_workspace_area_sig(*this), // workspace area signal m_reconfigure_sig(*this), // reconfigure signal m_resize_sig(*this), m_layermanager(num_layers), @@ -1453,7 +1452,7 @@ void BScreen::updateAvailableWorkspaceArea() { } if (updated) - m_workspace_area_sig.notify(); + m_workspace_area_sig.emit(*this); } void BScreen::addWorkspaceName(const char *name) { @@ -1933,7 +1932,7 @@ void BScreen::updateSize() { // send resize notify m_resize_sig.notify(); - m_workspace_area_sig.notify(); + m_workspace_area_sig.emit(*this); // move windows out of inactive heads clearHeads(); diff --git a/src/Screen.hh b/src/Screen.hh index 269cf25..d25364a 100644 --- a/src/Screen.hh +++ b/src/Screen.hh @@ -219,7 +219,7 @@ public: /// workspace names signal ScreenSignal &workspaceNamesSig() { return m_workspacenames_sig; } /// workspace area signal - FbTk::Subject &workspaceAreaSig() { return m_workspace_area_sig; } + ScreenSignal &workspaceAreaSig() { return m_workspace_area_sig; } /// current workspace signal ScreenSignal ¤tWorkspaceSig() { return m_currentworkspace_sig; } /// focused window signal @@ -494,11 +494,11 @@ private: const Strut* availableWorkspaceArea(int head) const; ScreenSubject - m_workspace_area_sig, ///< workspace area changed signal m_reconfigure_sig, ///< reconfigure signal m_resize_sig; ///< resize signal FbTk::Signal<void, BScreen&, FluxboxWindow*, WinClient*> m_focusedwindow_sig; ///< focused window signal + ScreenSignal m_workspace_area_sig; ///< workspace area changed signal ScreenSignal m_iconlist_sig; ///< notify if a window gets iconified/deiconified ScreenSignal m_clientlist_sig; ///< client signal ScreenSignal m_bg_change_sig; ///< background change signal diff --git a/src/Window.cc b/src/Window.cc index 7e5a273..cd0e708 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -1488,9 +1488,10 @@ void FluxboxWindow::attachWorkAreaSig() { // notify when struts change, so we can resize accordingly // Subject checks for duplicates for us if (m_state.maximized || m_state.fullscreen) - screen().workspaceAreaSig().attach(this); + join(screen().workspaceAreaSig(), + FbTk::MemFun(*this, &FluxboxWindow::workspaceAreaChanged)); else - screen().workspaceAreaSig().detach(this); + leave(screen().workspaceAreaSig()); } /** @@ -2729,14 +2730,16 @@ void FluxboxWindow::update(FbTk::Subject *subj) { } else if (subj == &m_theme.reconfigSig()) { frame().applyDecorations(); sendConfigureNotify(); - } else if (subj == &screen().workspaceAreaSig()) { - frame().applyState(); } else if (m_initialized && subj == &m_frame.frameExtentSig()) { Fluxbox::instance()->updateFrameExtents(*this); sendConfigureNotify(); } } +void FluxboxWindow::workspaceAreaChanged(BScreen &screen) { + frame().applyState(); +} + // commit current decoration values to actual displayed things void FluxboxWindow::applyDecorations() { frame().setDecorationMask(decorationMask()); diff --git a/src/Window.hh b/src/Window.hh index e5e5c1f..27901d2 100644 --- a/src/Window.hh +++ b/src/Window.hh @@ -526,6 +526,9 @@ private: void associateClient(WinClient &client); /// Called when focused changed, and is attached when it is not in fullscreen mode void focusedWindowChanged(BScreen &screen, FluxboxWindow *focused_win, WinClient* client); + /// Called when workspace area on screen changed. + void workspaceAreaChanged(BScreen &screen); + // state and hint signals WinSubject m_hintsig, diff --git a/src/fluxbox.cc b/src/fluxbox.cc index 4041444..b83fa9c 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc @@ -453,7 +453,9 @@ void Fluxbox::initScreen(BScreen *screen) { screen->initWindows(); // attach screen signals to this - screen->workspaceAreaSig().attach(this); + + join(screen->workspaceAreaSig(), + FbTk::MemFun(*this, &Fluxbox::workspaceAreaChanged)); join(screen->focusedWindowSig(), FbTk::MemFun(*this, &Fluxbox::focusedWindowChanged)); @@ -1104,16 +1106,6 @@ void Fluxbox::update(FbTk::Subject *changedsub) { } screen.removeClient(*client); - } else if (typeid(*changedsub) == typeid(BScreen::ScreenSubject)) { - BScreen::ScreenSubject *subj = dynamic_cast<BScreen::ScreenSubject *>(changedsub); - BScreen &screen = subj->screen(); - if ((&(screen.workspaceAreaSig())) == changedsub) { - for (AtomHandlerContainerIt it= m_atomhandler.begin(); - it != m_atomhandler.end(); ++it) { - if ((*it).first->update()) - (*it).first->updateWorkarea(screen); - } - } } } @@ -1540,3 +1532,11 @@ void Fluxbox::focusedWindowChanged(BScreen &screen, (*it).first->updateFocusedWindow(screen, client ? client->window() : 0 ); } } + +void Fluxbox::workspaceAreaChanged(BScreen &screen) { + for (AtomHandlerContainerIt it= m_atomhandler.begin(); + it != m_atomhandler.end(); ++it) { + if ((*it).first->update()) + (*it).first->updateWorkarea(screen); + } +} diff --git a/src/fluxbox.hh b/src/fluxbox.hh index 4cf0555..6082b25 100644 --- a/src/fluxbox.hh +++ b/src/fluxbox.hh @@ -214,6 +214,9 @@ private: FluxboxWindow* win, WinClient* client); + /// Called when the workspace area changed. + void workspaceAreaChanged(BScreen &screen); + std::auto_ptr<FbAtoms> m_fbatoms; FbTk::ResourceManager m_resourcemanager, &m_screen_rm; -- cgit v0.11.2