Changed background changed signal in BScreen to use the new signal system
Henrik Kinnunen fluxgen@fluxbox.org
7 files changed,
43 insertions(+),
17 deletions(-)
M
ChangeLog
→
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
M
src/Screen.cc
→
src/Screen.cc
@@ -345,7 +345,6 @@ m_workspace_area_sig(*this), // workspace area signal
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 @@
} // 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) {
M
src/Screen.hh
→
src/Screen.hh
@@ -209,24 +209,25 @@ /**
@name Screen signals */ //@{ + typedef FbTk::Signal<void, BScreen&> 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<void, BScreen&> &workspaceCountSig() { return m_workspacecount_sig; } + ScreenSignal &workspaceCountSig() { return m_workspacecount_sig; } /// workspace names signal - FbTk::Signal<void, BScreen&> &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<void, BScreen&> ¤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 @@
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<void, BScreen&> m_workspacecount_sig; ///< workspace count signal - FbTk::Signal<void, BScreen&> m_currentworkspace_sig; ///< current workspace signal - FbTk::Signal<void, BScreen&> 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;
M
src/Slit.cc
→
src/Slit.cc
@@ -41,6 +41,8 @@ #include "FbTk/SimpleCommand.hh"
#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 @@
// 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);@@ -1046,6 +1051,10 @@ void Slit::exposeEvent(XExposeEvent &ev) {
// we don't need to clear the entire window // just the are that gets exposed frame.window.clearArea(ev.x, ev.y, ev.width, ev.height); +} + +void Slit::updateForScreen(BScreen &screen) { + reconfigure(); } void Slit::update(FbTk::Subject *subj) {
M
src/Slit.hh
→
src/Slit.hh
@@ -38,6 +38,7 @@ #include "FbTk/FbWindow.hh"
#include "FbTk/Timer.hh" #include "FbTk/Resource.hh" #include "FbTk/XLayerItem.hh" +#include "FbTk/Signal.hh" #include <X11/Xutil.h>@@ -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<SlitClient *> SlitClients; /**@@ -129,6 +132,9 @@ unsigned int height() const { return frame.height; }
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();
M
src/SystemTray.cc
→
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 @@ FbTk::EventManager::instance()->add(*this, m_selection_owner);
// 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();
M
src/SystemTray.hh
→
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 T> 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 @@
static Atom getXEmbedInfoAtom(); private: - + /// Called when an update for a screen is needed. + void updateForScreen(BScreen &screen) { + update(); + } void update(); typedef std::list<TrayWindow *> ClientList;