From 9aee5b80cb32119a633151a489a2bd85b63e3b28 Mon Sep 17 00:00:00 2001 From: Henrik Kinnunen Date: Sun, 28 Sep 2008 18:13:30 +0200 Subject: Changed resize signal in BScreen to use the new signal system --- ChangeLog | 3 +++ src/Screen.cc | 3 +-- src/Screen.hh | 8 ++++---- src/Slit.cc | 20 +++++++++++++------- src/Slit.hh | 1 + src/Toolbar.cc | 9 ++++++++- src/Toolbar.hh | 5 +++++ 7 files changed, 35 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index dc582ff..5a2772e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ (Format: Year/Month/Day) Changes for 1.1.2 *08/09/28: + * Changed resize signal, in screen, to use the new signal system + (Henrik) + Toolbar.hh/cc, Slit.hh/cc, Screen.hh/cc * 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) diff --git a/src/Screen.cc b/src/Screen.cc index 66ab0fd..a4778be 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -340,7 +340,6 @@ BScreen::BScreen(FbTk::ResourceManager &rm, const string &altscreenname, int scrn, int num_layers) : m_reconfigure_sig(*this), // reconfigure signal - m_resize_sig(*this), m_layermanager(num_layers), m_focused_windowtheme(new FbWinFrameTheme(scrn, ".focus", ".Focus")), m_unfocused_windowtheme(new FbWinFrameTheme(scrn, ".unfocus", ".Unfocus")), @@ -1931,7 +1930,7 @@ void BScreen::updateSize() { m_root_theme->reconfigTheme(); // send resize notify - m_resize_sig.notify(); + m_resize_sig.emit(*this); m_workspace_area_sig.emit(*this); // move windows out of inactive heads diff --git a/src/Screen.hh b/src/Screen.hh index d25364a..eb86b03 100644 --- a/src/Screen.hh +++ b/src/Screen.hh @@ -226,7 +226,7 @@ public: FbTk::Signal &focusedWindowSig() { return m_focusedwindow_sig; } /// reconfigure signal FbTk::Subject &reconfigureSig() { return m_reconfigure_sig; } - FbTk::Subject &resizeSig() { return m_resize_sig; } + ScreenSignal &resizeSig() { return m_resize_sig; } ScreenSignal &bgChangeSig() { return m_bg_change_sig; } //@} @@ -493,11 +493,11 @@ private: const Strut* availableWorkspaceArea(int head) const; - ScreenSubject - m_reconfigure_sig, ///< reconfigure signal - m_resize_sig; ///< resize signal + ScreenSubject m_reconfigure_sig; ///< reconfigure signal + FbTk::Signal m_focusedwindow_sig; ///< focused window signal + ScreenSignal m_resize_sig; ///< resize 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 diff --git a/src/Slit.cc b/src/Slit.cc index 6824bde..5bb96c4 100644 --- a/src/Slit.cc +++ b/src/Slit.cc @@ -265,7 +265,9 @@ Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename) // attach to theme and root window change signal theme().reconfigSig().attach(this); - scr.resizeSig().attach(this); + + join(scr.resizeSig(), + FbTk::MemFun(*this, &Slit::screenSizeChanged)); join(scr.bgChangeSig(), FbTk::MemFun(*this, &Slit::updateForScreen)); @@ -1053,18 +1055,22 @@ void Slit::exposeEvent(XExposeEvent &ev) { frame.window.clearArea(ev.x, ev.y, ev.width, ev.height); } -void Slit::updateForScreen(BScreen &screen) { - reconfigure(); -} - -void Slit::update(FbTk::Subject *subj) { +void Slit::screenSizeChanged(BScreen &screen) { reconfigure(); #ifdef XINERAMA - if (subj == &m_screen.resizeSig() && m_xineramaheadmenu) + if (m_xineramaheadmenu) m_xineramaheadmenu->reloadHeads(); #endif // XINERAMA } +void Slit::updateForScreen(BScreen &screen) { + reconfigure(); +} + +void Slit::update(FbTk::Subject*) { + updateForScreen(screen()); +} + void Slit::clearWindow() { frame.window.clear(); } diff --git a/src/Slit.hh b/src/Slit.hh index e1bcc5e..5514b42 100644 --- a/src/Slit.hh +++ b/src/Slit.hh @@ -133,6 +133,7 @@ public: SlitClients &clients() { return m_client_list; } private: /// Called when screen has changed + void screenSizeChanged(BScreen &screen); void updateForScreen(BScreen &screen); void updateAlpha(); diff --git a/src/Toolbar.cc b/src/Toolbar.cc index 0292b87..f23e124 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc @@ -51,6 +51,7 @@ #include "FbTk/IntMenuItem.hh" #include "FbTk/Shape.hh" #include "FbTk/SimpleObserver.hh" +#include "FbTk/MemFun.hh" // use GNU extensions #ifndef _GNU_SOURCE @@ -253,8 +254,10 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, size_t width): m_observers.push_back(makeObserver(*this, &Toolbar::reconfigure)); m_theme.reconfigSig().attach(m_observers.back()); screen().reconfigureSig().attach(m_observers.back()); // get this on antialias change + // listen to screen size changes - screen().resizeSig().attach(m_observers.back()); + m_signal_tracker.join(screen().resizeSig(), + FbTk::MemFun(*this, &Toolbar::screenChanged)); moveToLayer((*m_rc_layernum).getNum()); @@ -380,6 +383,10 @@ void Toolbar::lower() { m_layeritem.lower(); } +void Toolbar::screenChanged(BScreen &screen) { + reconfigure(); +} + void Toolbar::reconfigure() { updateVisibleState(); diff --git a/src/Toolbar.hh b/src/Toolbar.hh index 100b38b..f631c41 100644 --- a/src/Toolbar.hh +++ b/src/Toolbar.hh @@ -41,6 +41,7 @@ #include "FbTk/XLayerItem.hh" #include "FbTk/EventHandler.hh" #include "FbTk/FbWindow.hh" +#include "FbTk/Signal.hh" #include @@ -139,6 +140,9 @@ private: void updateStrut(); void updateAlpha(); + /// Called when the screen changed property. + void screenChanged(BScreen &screen); + bool m_hidden; ///< hidden state /// Toolbar frame @@ -193,6 +197,7 @@ private: bool m_resize_lock; ///< to lock rearrangeItems or not /// observers for various signals std::vector m_observers; + FbTk::SignalTracker m_signal_tracker; }; -- cgit v0.11.2