From d05804e6661d4976ba52ef8727ec8387e2e3bba1 Mon Sep 17 00:00:00 2001 From: Henrik Kinnunen Date: Sun, 21 Sep 2008 16:12:36 +0200 Subject: Changed background changed signal in BScreen to use the new signal system --- ChangeLog | 3 +++ src/Screen.cc | 3 +-- src/Screen.hh | 20 ++++++++++---------- src/Slit.cc | 11 ++++++++++- src/Slit.hh | 8 +++++++- src/SystemTray.cc | 6 +++++- src/SystemTray.hh | 9 +++++++-- 7 files changed, 43 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 37fc0c3..5104aff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ (Format: Year/Month/Day) Changes for 1.1.2 *08/09/21: + * Changed background changed signal in Bscreen to use the new signal + system (Henrik) + Screen.hh/cc,SystemTray.hh/cc,Slit.hh/cc * Changed workspace names signal in BScreen to use the new signal system (Henrik) Screen.hh/cc, SendToMenu.hh/cc, WorkspaceMenu.hh/cc, WorkspaceNameTool.hh/cc diff --git a/src/Screen.cc b/src/Screen.cc index 7c372bc..8809609 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -345,7 +345,6 @@ BScreen::BScreen(FbTk::ResourceManager &rm, m_focusedwindow_sig(*this), // focused window signal m_reconfigure_sig(*this), // reconfigure signal m_resize_sig(*this), - m_bg_change_sig(*this), m_layermanager(num_layers), m_focused_windowtheme(new FbWinFrameTheme(scrn, ".focus", ".Focus")), m_unfocused_windowtheme(new FbWinFrameTheme(scrn, ".unfocus", ".Unfocus")), @@ -855,7 +854,7 @@ void BScreen::propertyNotify(Atom atom) { } // TODO: this doesn't belong in FbPixmap } else if (FbTk::FbPixmap::rootwinPropertyNotify(screenNumber(), atom)) - m_bg_change_sig.notify(); + m_bg_change_sig.emit(*this); } void BScreen::keyPressEvent(XKeyEvent &ke) { diff --git a/src/Screen.hh b/src/Screen.hh index 7bafead..00ab2e5 100644 --- a/src/Screen.hh +++ b/src/Screen.hh @@ -209,24 +209,25 @@ public: @name Screen signals */ //@{ + typedef FbTk::Signal ScreenSignal; /// client list signal FbTk::Subject &clientListSig() { return m_clientlist_sig; } /// icon list sig FbTk::Subject &iconListSig() { return m_iconlist_sig; } /// workspace count signal - FbTk::Signal &workspaceCountSig() { return m_workspacecount_sig; } + ScreenSignal &workspaceCountSig() { return m_workspacecount_sig; } /// workspace names signal - FbTk::Signal &workspaceNamesSig() { return m_workspacenames_sig; } + ScreenSignal &workspaceNamesSig() { return m_workspacenames_sig; } /// workspace area signal FbTk::Subject &workspaceAreaSig() { return m_workspace_area_sig; } /// current workspace signal - FbTk::Signal ¤tWorkspaceSig() { return m_currentworkspace_sig; } + ScreenSignal ¤tWorkspaceSig() { return m_currentworkspace_sig; } /// focused window signal FbTk::Subject &focusedWindowSig() { return m_focusedwindow_sig; } /// reconfigure signal FbTk::Subject &reconfigureSig() { return m_reconfigure_sig; } FbTk::Subject &resizeSig() { return m_resize_sig; } - FbTk::Subject &bgChangeSig() { return m_bg_change_sig; } + ScreenSignal &bgChangeSig() { return m_bg_change_sig; } //@} /// called when the screen receives a signal from a subject @@ -494,16 +495,15 @@ private: ScreenSubject m_clientlist_sig, ///< client signal m_iconlist_sig, ///< notify if a window gets iconified/deiconified - m_workspace_area_sig, ///< workspace area changed signal m_focusedwindow_sig, ///< focused window signal m_reconfigure_sig, ///< reconfigure signal - m_resize_sig, ///< resize signal - m_bg_change_sig; ///< background change signal + m_resize_sig; ///< resize signal - FbTk::Signal m_workspacecount_sig; ///< workspace count signal - FbTk::Signal m_currentworkspace_sig; ///< current workspace signal - FbTk::Signal m_workspacenames_sig; ///< workspace names signal + ScreenSignal m_bg_change_sig; ///< background change signal + ScreenSignal m_workspacecount_sig; ///< workspace count signal + ScreenSignal m_currentworkspace_sig; ///< current workspace signal + ScreenSignal m_workspacenames_sig; ///< workspace names signal FbTk::MultLayers m_layermanager; diff --git a/src/Slit.cc b/src/Slit.cc index 56e591e..6824bde 100644 --- a/src/Slit.cc +++ b/src/Slit.cc @@ -41,6 +41,8 @@ #include "FbTk/Theme.hh" #include "FbTk/Transparent.hh" #include "FbTk/MacroCommand.hh" +#include "FbTk/MemFun.hh" + #include "FbCommands.hh" #include "Layer.hh" #include "LayerMenu.hh" @@ -264,7 +266,10 @@ 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); - scr.bgChangeSig().attach(this); + + join(scr.bgChangeSig(), + FbTk::MemFun(*this, &Slit::updateForScreen)); + scr.reconfigureSig().attach(this); // if alpha changed (we disablethis signal when we get theme change sig) scr.addConfigMenu(_FB_XTEXT(Slit, Slit, "Slit", "The Slit"), m_slitmenu); @@ -1048,6 +1053,10 @@ 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) { reconfigure(); #ifdef XINERAMA diff --git a/src/Slit.hh b/src/Slit.hh index 19e4698..e1bcc5e 100644 --- a/src/Slit.hh +++ b/src/Slit.hh @@ -38,6 +38,7 @@ #include "FbTk/Timer.hh" #include "FbTk/Resource.hh" #include "FbTk/XLayerItem.hh" +#include "FbTk/Signal.hh" #include @@ -51,7 +52,9 @@ class Strut; class Layer; /// Handles dock apps -class Slit: public FbTk::EventHandler, public FbTk::Observer, public LayerObject { +class Slit: public FbTk::EventHandler, public FbTk::Observer, + public LayerObject, private FbTk::SignalTracker +{ public: typedef std::list SlitClients; /** @@ -129,6 +132,9 @@ public: const SlitClients &clients() const { return m_client_list; } SlitClients &clients() { return m_client_list; } private: + /// Called when screen has changed + void updateForScreen(BScreen &screen); + void updateAlpha(); void clearWindow(); void setupMenu(); diff --git a/src/SystemTray.cc b/src/SystemTray.cc index 699ca47..0c3e550 100644 --- a/src/SystemTray.cc +++ b/src/SystemTray.cc @@ -24,6 +24,7 @@ #include "FbTk/EventManager.hh" #include "FbTk/ImageControl.hh" #include "FbTk/TextUtils.hh" +#include "FbTk/MemFun.hh" #include "AtomHandler.hh" #include "fluxbox.hh" @@ -170,7 +171,10 @@ SystemTray::SystemTray(const FbTk::FbWindow& parent, // setup signals m_observer.reset(makeObserver(*this, &SystemTray::update)); m_theme->reconfigSig().attach(m_observer.get()); - screen.bgChangeSig().attach(m_observer.get()); + + join(screen.bgChangeSig(), + FbTk::MemFun(*this, &SystemTray::updateForScreen)); + Fluxbox* fluxbox = Fluxbox::instance(); Display *disp = fluxbox->display(); diff --git a/src/SystemTray.hh b/src/SystemTray.hh index 132069a..c67e08a 100644 --- a/src/SystemTray.hh +++ b/src/SystemTray.hh @@ -25,6 +25,7 @@ #include "FbTk/FbWindow.hh" #include "FbTk/EventHandler.hh" +#include "FbTk/Signal.hh" #include "ToolTheme.hh" #include "ToolbarItem.hh" @@ -42,7 +43,8 @@ template class ThemeProxy; class Observer; } -class SystemTray: public ToolbarItem, public FbTk::EventHandler { +class SystemTray: public ToolbarItem, public FbTk::EventHandler, + private FbTk::SignalTracker { public: explicit SystemTray(const FbTk::FbWindow &parent, @@ -85,7 +87,10 @@ public: static Atom getXEmbedInfoAtom(); private: - + /// Called when an update for a screen is needed. + void updateForScreen(BScreen &screen) { + update(); + } void update(); typedef std::list ClientList; -- cgit v0.11.2