From 79d526b968b0e8cec31a66b0eafa8ddeb32cc16e Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Sat, 7 May 2011 22:32:48 +0200 Subject: Convert Screen::reconfigureSig to FbTk::Signal --- src/Screen.cc | 4 +--- src/Screen.hh | 17 ++--------------- src/Slit.cc | 6 +----- src/Slit.hh | 5 +---- src/Toolbar.cc | 7 +++++-- 5 files changed, 10 insertions(+), 29 deletions(-) diff --git a/src/Screen.cc b/src/Screen.cc index ce1f8ed..bfb6221 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -59,7 +59,6 @@ #include "Debug.hh" #include "FbTk/I18n.hh" -#include "FbTk/Subject.hh" #include "FbTk/FbWindow.hh" #include "FbTk/SimpleCommand.hh" #include "FbTk/MultLayers.hh" @@ -301,7 +300,6 @@ BScreen::BScreen(FbTk::ResourceManager &rm, const string &screenname, const string &altscreenname, int scrn, int num_layers) : - m_reconfigure_sig(*this), // reconfigure signal m_layermanager(num_layers), m_image_control(0), m_focused_windowtheme(new FbWinFrameTheme(scrn, ".focus", ".Focus")), @@ -918,7 +916,7 @@ void BScreen::reconfigure() { imageControl().cleanCache(); // notify objects that the screen is reconfigured - m_reconfigure_sig.notify(); + m_reconfigure_sig.emit(*this); // Reload style FbTk::ThemeManager::instance().load(fluxbox->getStyleFilename(), diff --git a/src/Screen.hh b/src/Screen.hh index 96a4d43..a237b36 100644 --- a/src/Screen.hh +++ b/src/Screen.hh @@ -213,7 +213,7 @@ public: /// focused window signal FbTk::Signal &focusedWindowSig() { return m_focusedwindow_sig; } /// reconfigure signal - FbTk::Subject &reconfigureSig() { return m_reconfigure_sig; } + ScreenSignal &reconfigureSig() { return m_reconfigure_sig; } ScreenSignal &resizeSig() { return m_resize_sig; } ScreenSignal &bgChangeSig() { return m_bg_change_sig; } //@} @@ -455,18 +455,6 @@ public: /// when screen dies void addManagedResource(FbTk::Resource_base *resource); - /** - * Used to emit different signals for the screen - */ - class ScreenSubject:public FbTk::Subject { - public: - ScreenSubject(BScreen &scr):m_scr(scr) { } - const BScreen &screen() const { return m_scr; } - BScreen &screen() { return m_scr; } - private: - BScreen &m_scr; - }; - private: void setupConfigmenu(FbTk::Menu &menu); void renderGeomWindow(); @@ -476,8 +464,7 @@ private: const Strut* availableWorkspaceArea(int head) const; FbTk::SignalTracker m_tracker; - ScreenSubject m_reconfigure_sig; ///< reconfigure signal - + ScreenSignal m_reconfigure_sig; ///< reconfigure signal FbTk::Signal m_focusedwindow_sig; ///< focused window signal ScreenSignal m_resize_sig; ///< resize signal diff --git a/src/Slit.cc b/src/Slit.cc index f3e24a9..ccd60ab 100644 --- a/src/Slit.cc +++ b/src/Slit.cc @@ -271,7 +271,7 @@ Slit::Slit(BScreen &scr, FbTk::Layer &layer, const char *filename) join(scr.bgChangeSig(), FbTk::MemFunIgnoreArgs(*this, &Slit::reconfigure)); - scr.reconfigureSig().attach(this); // if alpha changed (we disablethis signal when we get theme change sig) + join(scr.reconfigureSig(), FbTk::MemFunIgnoreArgs(*this, &Slit::reconfigure)); scr.addConfigMenu(_FB_XTEXT(Slit, Slit, "Slit", "The Slit"), m_slitmenu); @@ -1042,10 +1042,6 @@ void Slit::screenSizeChanged(BScreen &screen) { #endif // XINERAMA } -void Slit::update(FbTk::Subject*) { - reconfigure(); -} - void Slit::clearWindow() { frame.window.clear(); } diff --git a/src/Slit.hh b/src/Slit.hh index 2f2eac8..5753565 100644 --- a/src/Slit.hh +++ b/src/Slit.hh @@ -52,8 +52,7 @@ class Strut; class Layer; /// Handles dock apps -class Slit: public FbTk::EventHandler, public FbTk::Observer, - public LayerObject, private FbTk::SignalTracker +class Slit: public FbTk::EventHandler, public LayerObject, private FbTk::SignalTracker { public: typedef std::list SlitClients; @@ -102,8 +101,6 @@ public: void exposeEvent(XExposeEvent &event); //@} - void update(FbTk::Subject *subj); - void moveToLayer(int layernum); void toggleHidden(); diff --git a/src/Toolbar.cc b/src/Toolbar.cc index 1778a02..9c2d2bf 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc @@ -229,9 +229,12 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::Layer &layer, size_t width): _FB_USES_NLS; // NOTE: first subject is always the rearrangeItem ! m_observers.push_back(makeObserver(*this, &Toolbar::rearrangeItems)); + + // get this on antialias change + m_signal_tracker.join(screen().reconfigureSig(), + FbTk::MemFunIgnoreArgs(*this, &Toolbar::reconfigure)); + // we need to get notified when the theme is reloaded - m_observers.push_back(makeObserver(*this, &Toolbar::reconfigure)); - screen().reconfigureSig().attach(m_observers.back()); // get this on antialias change m_signal_tracker.join(m_theme.reconfigSig(), FbTk::MemFun(*this, &Toolbar::reconfigure)); // listen to screen size changes -- cgit v0.11.2