Convert FbTk::Theme::reconfigSig and friends to the new Signal system

I removed the const versions of reconfigSig() in the process since FbTk::Signal has no const
methods anyway.
This commit is contained in:
Pavel Labath 2011-04-29 10:52:28 +02:00
parent 54230c9a44
commit f7d7dfd2a8
34 changed files with 92 additions and 115 deletions

View file

@ -43,8 +43,7 @@ public:
int scale() const { return *m_scale; } // scale factor for inside objects int scale() const { return *m_scale; } // scale factor for inside objects
const std::string &name() { return m_name; } const std::string &name() { return m_name; }
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); } virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); }
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
virtual ButtonTheme &operator *() { return *this; } virtual ButtonTheme &operator *() { return *this; }
virtual const ButtonTheme &operator *() const { return *this; } virtual const ButtonTheme &operator *() const { return *this; }

View file

@ -25,6 +25,7 @@
#include "FbMenu.hh" #include "FbMenu.hh"
#include "FbTk/Signal.hh" #include "FbTk/Signal.hh"
#include "FbTk/Subject.hh"
class BScreen; class BScreen;
class FluxboxWindow; class FluxboxWindow;

View file

@ -28,6 +28,7 @@
#include "CommandDialog.hh" #include "CommandDialog.hh"
#include "fluxbox.hh" #include "fluxbox.hh"
#include "FbTk/MemFun.hh"
#include "FbTk/SimpleCommand.hh" #include "FbTk/SimpleCommand.hh"
#include "FbTk/ImageControl.hh" #include "FbTk/ImageControl.hh"
#include "FbTk/TextUtils.hh" #include "FbTk/TextUtils.hh"
@ -168,7 +169,7 @@ ClockTool::ClockTool(const FbTk::FbWindow &parent,
screen.name() + ".strftimeFormat", screen.altName() + ".StrftimeFormat"), screen.name() + ".strftimeFormat", screen.altName() + ".StrftimeFormat"),
m_stringconvertor(FbTk::StringConvertor::ToFbString) { m_stringconvertor(FbTk::StringConvertor::ToFbString) {
// attach signals // attach signals
theme.reconfigSig().attach(this); m_tracker.join(theme.reconfigSig(), FbTk::MemFun(*this, &ClockTool::themeReconfigured));
std::string time_locale = setlocale(LC_TIME, NULL); std::string time_locale = setlocale(LC_TIME, NULL);
size_t pos = time_locale.find('.'); size_t pos = time_locale.find('.');
@ -197,7 +198,7 @@ ClockTool::ClockTool(const FbTk::FbWindow &parent,
menu.insert(_FB_XTEXT(Toolbar, ClockEditFormat, "Edit Clock Format", "edit Clock Format") , editformat_cmd); menu.insert(_FB_XTEXT(Toolbar, ClockEditFormat, "Edit Clock Format", "edit Clock Format") , editformat_cmd);
update(0); themeReconfigured();
} }
ClockTool::~ClockTool() { ClockTool::~ClockTool() {
@ -233,10 +234,10 @@ void ClockTool::hide() {
void ClockTool::setTimeFormat(const std::string &format) { void ClockTool::setTimeFormat(const std::string &format) {
*m_timeformat = format; *m_timeformat = format;
update(0); themeReconfigured();
} }
void ClockTool::update(FbTk::Subject *subj) { void ClockTool::themeReconfigured() {
updateTime(); updateTime();
// + 2 to make the entire text fit inside // + 2 to make the entire text fit inside
@ -316,7 +317,7 @@ void ClockTool::updateTime() {
void ClockTool::updateSizing() { void ClockTool::updateSizing() {
m_button.setBorderWidth(m_theme->border().width()); m_button.setBorderWidth(m_theme->border().width());
// resizes if new timeformat // resizes if new timeformat
update(0); themeReconfigured();
} }
void ClockTool::reRender() { void ClockTool::reRender() {

View file

@ -26,8 +26,8 @@
#include "ToolbarItem.hh" #include "ToolbarItem.hh"
#include "FbTk/Signal.hh"
#include "FbTk/TextButton.hh" #include "FbTk/TextButton.hh"
#include "FbTk/Observer.hh"
#include "FbTk/Resource.hh" #include "FbTk/Resource.hh"
#include "FbTk/Timer.hh" #include "FbTk/Timer.hh"
#include "FbTk/FbString.hh" #include "FbTk/FbString.hh"
@ -37,12 +37,11 @@ class BScreen;
namespace FbTk { namespace FbTk {
class ImageControl; class ImageControl;
class Subject;
class Menu; class Menu;
template <class T> class ThemeProxy; template <class T> class ThemeProxy;
} }
class ClockTool:public ToolbarItem, public FbTk::Observer { class ClockTool:public ToolbarItem {
public: public:
ClockTool(const FbTk::FbWindow &parent, FbTk::ThemeProxy<ToolTheme> &theme, ClockTool(const FbTk::FbWindow &parent, FbTk::ThemeProxy<ToolTheme> &theme,
BScreen &screen, FbTk::Menu &menu); BScreen &screen, FbTk::Menu &menu);
@ -68,7 +67,7 @@ public:
private: private:
void updateTime(); void updateTime();
void update(FbTk::Subject *subj); void themeReconfigured();
void renderTheme(int alpha); void renderTheme(int alpha);
void reRender(); void reRender();
void updateSizing(); void updateSizing();
@ -83,6 +82,8 @@ private:
FbTk::Resource<std::string> m_timeformat; FbTk::Resource<std::string> m_timeformat;
FbTk::StringConvertor m_stringconvertor; FbTk::StringConvertor m_stringconvertor;
FbTk::SignalTracker m_tracker;
}; };
#endif // CLOCKTOOL_HH #endif // CLOCKTOOL_HH

View file

@ -36,6 +36,7 @@
#include "MenuItem.hh" #include "MenuItem.hh"
#include "MenuSeparator.hh" #include "MenuSeparator.hh"
#include "ImageControl.hh" #include "ImageControl.hh"
#include "MemFun.hh"
#include "MenuTheme.hh" #include "MenuTheme.hh"
#include "App.hh" #include "App.hh"
#include "EventManager.hh" #include "EventManager.hh"
@ -121,7 +122,7 @@ Menu::Menu(FbTk::ThemeProxy<MenuTheme> &tm, ImageControl &imgctrl):
m_hide_timer.fireOnce(true); m_hide_timer.fireOnce(true);
// make sure we get updated when the theme is reloaded // make sure we get updated when the theme is reloaded
tm.reconfigSig().attach(this); m_tracker.join(tm.reconfigSig(), MemFun(*this, &Menu::themeReconfigured));
m_title_vis = true; m_title_vis = true;
@ -1244,7 +1245,6 @@ void Menu::update(FbTk::Subject *subj) {
reconfigure(); reconfigure();
} }
void Menu::setScreen(int x, int y, int w, int h) { void Menu::setScreen(int x, int y, int w, int h) {
m_screen_x = x; m_screen_x = x;
m_screen_y = y; m_screen_y = y;

View file

@ -195,6 +195,7 @@ private:
void closeMenu(); void closeMenu();
void startHide(); void startHide();
void stopHide(); void stopHide();
void themeReconfigured() { update(NULL); }
FbTk::ThemeProxy<MenuTheme> &m_theme; FbTk::ThemeProxy<MenuTheme> &m_theme;
Menu *m_parent; Menu *m_parent;
@ -261,6 +262,8 @@ private:
bool m_need_update; bool m_need_update;
Timer m_submenu_timer; Timer m_submenu_timer;
Timer m_hide_timer; Timer m_hide_timer;
SignalTracker m_tracker;
}; };
} // end namespace FbTk } // end namespace FbTk

View file

@ -130,8 +130,7 @@ public:
m_hl_selected_pixmap->pixmap().dontFree(); m_hl_selected_pixmap->pixmap().dontFree();
} }
virtual Subject &reconfigSig() { return Theme::reconfigSig(); } virtual Signal<void> &reconfigSig() { return Theme::reconfigSig(); }
virtual const Subject &reconfigSig() const { return Theme::reconfigSig(); }
virtual MenuTheme &operator *() { return *this; } virtual MenuTheme &operator *() { return *this; }
virtual const MenuTheme &operator *() const { return *this; } virtual const MenuTheme &operator *() const { return *this; }

View file

@ -56,7 +56,7 @@ struct LoadThemeHelper {
ThemeManager::ThemeList::iterator it = tmlist.begin(); ThemeManager::ThemeList::iterator it = tmlist.begin();
ThemeManager::ThemeList::iterator it_end = tmlist.end(); ThemeManager::ThemeList::iterator it_end = tmlist.end();
for (; it != it_end; ++it) { for (; it != it_end; ++it) {
(*it)->reconfigSig().notify(); (*it)->reconfigSig().emit();
} }
} }

View file

@ -26,8 +26,8 @@
#ifndef FBTK_THEME_HH #ifndef FBTK_THEME_HH
#define FBTK_THEME_HH #define FBTK_THEME_HH
#include "Signal.hh"
#include "XrmDatabaseHelper.hh" #include "XrmDatabaseHelper.hh"
#include "Subject.hh"
#include <string> #include <string>
#include <list> #include <list>
@ -107,15 +107,13 @@ public:
template <typename T> template <typename T>
void remove(ThemeItem<T> &item); void remove(ThemeItem<T> &item);
virtual bool fallback(ThemeItem_base &) { return false; } virtual bool fallback(ThemeItem_base &) { return false; }
FbTk::Subject &reconfigSig() { return m_reconfig_sig; } Signal<void> &reconfigSig() { return m_reconfig_sig; }
const FbTk::Subject &reconfigSig() const { return m_reconfig_sig; }
private: private:
const int m_screen_num; const int m_screen_num;
ItemList m_themeitems; ItemList m_themeitems;
FbTk::Subject m_reconfig_sig; Signal<void> m_reconfig_sig;
}; };
/// Proxy interface for themes, so they can be substituted dynamically /// Proxy interface for themes, so they can be substituted dynamically
@ -124,8 +122,7 @@ class ThemeProxy {
public: public:
virtual ~ThemeProxy() { } virtual ~ThemeProxy() { }
virtual Subject &reconfigSig() = 0; virtual Signal<void> &reconfigSig() = 0;
virtual const Subject &reconfigSig() const = 0;
virtual BaseTheme &operator *() = 0; virtual BaseTheme &operator *() = 0;
virtual const BaseTheme &operator *() const = 0; virtual const BaseTheme &operator *() const = 0;

View file

@ -79,8 +79,7 @@ public:
IconbarTheme &iconbarTheme() { return m_iconbar_theme; } IconbarTheme &iconbarTheme() { return m_iconbar_theme; }
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); } virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); }
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
virtual FbWinFrameTheme &operator *() { return *this; } virtual FbWinFrameTheme &operator *() { return *this; }
virtual const FbWinFrameTheme &operator *() const { return *this; } virtual const FbWinFrameTheme &operator *() const { return *this; }

View file

@ -34,12 +34,15 @@ public:
FocusableTheme(Focusable &win, FbTk::ThemeProxy<BaseTheme> &focused, FocusableTheme(Focusable &win, FbTk::ThemeProxy<BaseTheme> &focused,
FbTk::ThemeProxy<BaseTheme> &unfocused): FbTk::ThemeProxy<BaseTheme> &unfocused):
m_win(win), m_focused_theme(focused), m_unfocused_theme(unfocused) { m_win(win), m_focused_theme(focused), m_unfocused_theme(unfocused) {
// relay focus signal to reconfig signal
FbTk::relaySignal(m_signals, m_win.focusSig(), m_reconfig_sig); m_signals.join(m_win.focusSig(),
FbTk::MemFunIgnoreArgs(m_reconfig_sig, &FbTk::Signal<void>::emit));
m_win.attentionSig().attach(this); m_win.attentionSig().attach(this);
m_focused_theme.reconfigSig().attach(this); m_signals.join(m_focused_theme.reconfigSig(),
m_unfocused_theme.reconfigSig().attach(this); FbTk::MemFun(m_reconfig_sig, &FbTk::Signal<void>::emit));
m_signals.join(m_unfocused_theme.reconfigSig(),
FbTk::MemFun(m_reconfig_sig, &FbTk::Signal<void>::emit));
} }
Focusable &win() { return m_win; } Focusable &win() { return m_win; }
@ -51,8 +54,7 @@ public:
FbTk::ThemeProxy<BaseTheme> &unfocusedTheme() { return m_unfocused_theme; } FbTk::ThemeProxy<BaseTheme> &unfocusedTheme() { return m_unfocused_theme; }
const FbTk::ThemeProxy<BaseTheme> &unfocusedTheme() const { return m_unfocused_theme; } const FbTk::ThemeProxy<BaseTheme> &unfocusedTheme() const { return m_unfocused_theme; }
FbTk::Subject &reconfigSig() { return m_reconfig_sig; } FbTk::Signal<void> &reconfigSig() { return m_reconfig_sig; }
const FbTk::Subject &reconfigSig() const { return m_reconfig_sig; }
virtual BaseTheme &operator *() { virtual BaseTheme &operator *() {
return (m_win.isFocused() || m_win.getAttentionState()) ? return (m_win.isFocused() || m_win.getAttentionState()) ?
@ -64,11 +66,11 @@ public:
} }
private: private:
void update(FbTk::Subject *subj) { m_reconfig_sig.notify(); } void update(FbTk::Subject *subj) { m_reconfig_sig.emit(); }
Focusable &m_win; Focusable &m_win;
FbTk::ThemeProxy<BaseTheme> &m_focused_theme, &m_unfocused_theme; FbTk::ThemeProxy<BaseTheme> &m_focused_theme, &m_unfocused_theme;
FbTk::Subject m_reconfig_sig; FbTk::Signal<void> m_reconfig_sig;
FbTk::SignalTracker m_signals; FbTk::SignalTracker m_signals;
}; };

View file

@ -21,6 +21,7 @@
#include "GenericTool.hh" #include "GenericTool.hh"
#include "FbTk/FbWindow.hh" #include "FbTk/FbWindow.hh"
#include "FbTk/MemFun.hh"
#include "ToolTheme.hh" #include "ToolTheme.hh"
#include <string> #include <string>
@ -31,7 +32,7 @@ GenericTool::GenericTool(FbTk::FbWindow *new_window, ToolbarItem::Type type,
m_window(new_window), m_window(new_window),
m_theme(theme) { m_theme(theme) {
theme.reconfigSig().attach(this); m_tracker.join(theme.reconfigSig(), FbTk::MemFun(*this, &GenericTool::themeReconfigured));
if (new_window == 0) if (new_window == 0)
throw std::string("GenericTool: Error! Tried to create a tool with window = 0"); throw std::string("GenericTool: Error! Tried to create a tool with window = 0");
@ -80,7 +81,7 @@ void GenericTool::renderTheme(int alpha) {
m_window->clear(); m_window->clear();
} }
void GenericTool::update(FbTk::Subject *subj) { void GenericTool::themeReconfigured() {
m_window->clear(); m_window->clear();
} }

View file

@ -25,7 +25,7 @@
#include "ToolbarItem.hh" #include "ToolbarItem.hh"
#include "FbTk/NotCopyable.hh" #include "FbTk/NotCopyable.hh"
#include "FbTk/Observer.hh" #include "FbTk/Signal.hh"
#include <memory> #include <memory>
@ -37,7 +37,7 @@ template <class T> class ThemeProxy;
} }
/// helper class for simple tools, i.e buttons etc /// helper class for simple tools, i.e buttons etc
class GenericTool: public ToolbarItem, public FbTk::Observer, private FbTk::NotCopyable { class GenericTool: public ToolbarItem, private FbTk::NotCopyable {
public: public:
GenericTool(FbTk::FbWindow *new_window, ToolbarItem::Type type, GenericTool(FbTk::FbWindow *new_window, ToolbarItem::Type type,
FbTk::ThemeProxy<ToolTheme> &theme); FbTk::ThemeProxy<ToolTheme> &theme);
@ -63,10 +63,11 @@ protected:
virtual void renderTheme(int alpha); virtual void renderTheme(int alpha);
private: private:
void update(FbTk::Subject *subj); void themeReconfigured();
std::auto_ptr<FbTk::FbWindow> m_window; std::auto_ptr<FbTk::FbWindow> m_window;
FbTk::ThemeProxy<ToolTheme> &m_theme; FbTk::ThemeProxy<ToolTheme> &m_theme;
FbTk::SignalTracker m_tracker;
}; };
#endif // GENERICTOOL_HH #endif // GENERICTOOL_HH

View file

@ -41,8 +41,7 @@ public:
const FbTk::Texture &texture() const { return *m_texture; } const FbTk::Texture &texture() const { return *m_texture; }
const FbTk::Texture &emptyTexture() const { return *m_empty_texture; } const FbTk::Texture &emptyTexture() const { return *m_empty_texture; }
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); } virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); }
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
virtual IconbarTheme &operator *() { return *this; } virtual IconbarTheme &operator *() { return *this; }
virtual const IconbarTheme &operator *() const { return *this; } virtual const IconbarTheme &operator *() const { return *this; }

View file

@ -291,10 +291,12 @@ IconbarTool::IconbarTool(const FbTk::FbWindow &parent, IconbarTheme &theme,
menu.insert(m_menu.label().logical(), &m_menu); menu.insert(m_menu.label().logical(), &m_menu);
// setup signals // setup signals
theme.reconfigSig().attach(this); m_tracker.join(theme.reconfigSig(), FbTk::MemFun(*this, &IconbarTool::themeReconfigured));
focused_theme.reconfigSig().attach(this); m_tracker.join(focused_theme.reconfigSig(),
unfocused_theme.reconfigSig().attach(this); FbTk::MemFun(*this, &IconbarTool::themeReconfigured));
setMode(*m_rc_mode); m_tracker.join(unfocused_theme.reconfigSig(),
FbTk::MemFun(*this, &IconbarTool::themeReconfigured));
themeReconfigured();
} }
IconbarTool::~IconbarTool() { IconbarTool::~IconbarTool() {
@ -383,6 +385,10 @@ unsigned int IconbarTool::borderWidth() const {
return m_icon_container.borderWidth(); return m_icon_container.borderWidth();
} }
void IconbarTool::themeReconfigured() {
setMode(*m_rc_mode);
}
void IconbarTool::update(FbTk::Subject *subj) { void IconbarTool::update(FbTk::Subject *subj) {
// ignore updates if we're shutting down // ignore updates if we're shutting down
if (m_screen.isShuttingdown()) { if (m_screen.isShuttingdown()) {
@ -396,13 +402,6 @@ void IconbarTool::update(FbTk::Subject *subj) {
*m_rc_client_width = FbTk::Util::clamp(*m_rc_client_width, 10, 400); *m_rc_client_width = FbTk::Util::clamp(*m_rc_client_width, 10, 400);
m_icon_container.setMaxSizePerClient(*m_rc_client_width); m_icon_container.setMaxSizePerClient(*m_rc_client_width);
if (subj == &m_focused_theme.reconfigSig() ||
subj == &m_unfocused_theme.reconfigSig() ||
subj == &m_theme.reconfigSig()) {
setMode(*m_rc_mode);
return;
}
// lock graphic update // lock graphic update
m_icon_container.setUpdateLock(true); m_icon_container.setUpdateLock(true);

View file

@ -95,12 +95,15 @@ private:
/// add icons to the list /// add icons to the list
void updateList(); void updateList();
void themeReconfigured();
BScreen &m_screen; BScreen &m_screen;
FbTk::Container m_icon_container; FbTk::Container m_icon_container;
IconbarTheme &m_theme; IconbarTheme &m_theme;
FbTk::ThemeProxy<IconbarTheme> &m_focused_theme, &m_unfocused_theme; FbTk::ThemeProxy<IconbarTheme> &m_focused_theme, &m_unfocused_theme;
FbTk::CachedPixmap m_empty_pm; ///< pixmap for empty container FbTk::CachedPixmap m_empty_pm; ///< pixmap for empty container
FbTk::SignalTracker m_tracker;
std::auto_ptr<FocusableList> m_winlist; std::auto_ptr<FocusableList> m_winlist;
IconMap m_icons; IconMap m_icons;

View file

@ -48,8 +48,7 @@ public:
GC opGC() const { return m_opgc.gc(); } GC opGC() const { return m_opgc.gc(); }
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); } virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); }
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
virtual RootTheme &operator *() { return *this; } virtual RootTheme &operator *() { return *this; }
virtual const RootTheme &operator *() const { return *this; } virtual const RootTheme &operator *() const { return *this; }

View file

@ -435,7 +435,8 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
m_menutheme->setDelay(*resource.menu_delay); m_menutheme->setDelay(*resource.menu_delay);
focusedWinFrameTheme()->reconfigSig().attach(this);// for geom window m_tracker.join(focusedWinFrameTheme()->reconfigSig(),
FbTk::MemFun(*this, &BScreen::focusedWinFrameThemeReconfigured));
renderGeomWindow(); renderGeomWindow();
@ -749,10 +750,7 @@ unsigned int BScreen::maxBottom(int head) const {
return doFullMax() ? height() : height() - availableWorkspaceArea(head)->bottom(); return doFullMax() ? height() : height() - availableWorkspaceArea(head)->bottom();
} }
void BScreen::update(FbTk::Subject *subj) { void BScreen::focusedWinFrameThemeReconfigured() {
// for now we're only listening to the theme sig, so no object check
// if another signal is added later, will need to differentiate here
renderGeomWindow(); renderGeomWindow();
renderPosWindow(); renderPosWindow();

View file

@ -75,7 +75,6 @@ class Menu;
class ImageControl; class ImageControl;
class LayerItem; class LayerItem;
class FbWindow; class FbWindow;
class Subject;
} }
@ -83,8 +82,7 @@ class Subject;
/** /**
Create workspaces, handles switching between workspaces and windows Create workspaces, handles switching between workspaces and windows
*/ */
class BScreen: public FbTk::EventHandler, public FbTk::Observer, class BScreen: public FbTk::EventHandler, private FbTk::NotCopyable {
private FbTk::NotCopyable {
public: public:
typedef std::list<FluxboxWindow *> Icons; typedef std::list<FluxboxWindow *> Icons;
@ -220,9 +218,6 @@ public:
ScreenSignal &bgChangeSig() { return m_bg_change_sig; } ScreenSignal &bgChangeSig() { return m_bg_change_sig; }
//@} //@}
/// called when the screen receives a signal from a subject
void update(FbTk::Subject *subj);
void propertyNotify(Atom atom); void propertyNotify(Atom atom);
void keyPressEvent(XKeyEvent &ke); void keyPressEvent(XKeyEvent &ke);
void keyReleaseEvent(XKeyEvent &ke); void keyReleaseEvent(XKeyEvent &ke);
@ -476,9 +471,11 @@ private:
void setupConfigmenu(FbTk::Menu &menu); void setupConfigmenu(FbTk::Menu &menu);
void renderGeomWindow(); void renderGeomWindow();
void renderPosWindow(); void renderPosWindow();
void focusedWinFrameThemeReconfigured();
const Strut* availableWorkspaceArea(int head) const; const Strut* availableWorkspaceArea(int head) const;
FbTk::SignalTracker m_tracker;
ScreenSubject m_reconfigure_sig; ///< reconfigure signal ScreenSubject m_reconfigure_sig; ///< reconfigure signal

View file

@ -263,13 +263,13 @@ Slit::Slit(BScreen &scr, FbTk::Layer &layer, const char *filename)
_FB_USES_NLS; _FB_USES_NLS;
// attach to theme and root window change signal // attach to theme and root window change signal
theme().reconfigSig().attach(this); join(theme().reconfigSig(), FbTk::MemFun(*this, &Slit::reconfigure));
join(scr.resizeSig(), join(scr.resizeSig(),
FbTk::MemFun(*this, &Slit::screenSizeChanged)); FbTk::MemFun(*this, &Slit::screenSizeChanged));
join(scr.bgChangeSig(), join(scr.bgChangeSig(),
FbTk::MemFun(*this, &Slit::updateForScreen)); FbTk::MemFunIgnoreArgs(*this, &Slit::reconfigure));
scr.reconfigureSig().attach(this); // if alpha changed (we disablethis signal when we get theme change sig) scr.reconfigureSig().attach(this); // if alpha changed (we disablethis signal when we get theme change sig)
@ -1042,12 +1042,8 @@ void Slit::screenSizeChanged(BScreen &screen) {
#endif // XINERAMA #endif // XINERAMA
} }
void Slit::updateForScreen(BScreen &screen) {
reconfigure();
}
void Slit::update(FbTk::Subject*) { void Slit::update(FbTk::Subject*) {
updateForScreen(screen()); reconfigure();
} }
void Slit::clearWindow() { void Slit::clearWindow() {

View file

@ -134,7 +134,6 @@ public:
private: private:
/// Called when screen has changed /// Called when screen has changed
void screenSizeChanged(BScreen &screen); void screenSizeChanged(BScreen &screen);
void updateForScreen(BScreen &screen);
void updateAlpha(); void updateAlpha();
void clearWindow(); void clearWindow();

View file

@ -38,8 +38,7 @@ public:
int borderWidth() const { return *m_border_width; } int borderWidth() const { return *m_border_width; }
int bevelWidth() const { return *m_bevel_width; } int bevelWidth() const { return *m_bevel_width; }
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); } virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); }
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
virtual SlitTheme &operator *() { return *this; } virtual SlitTheme &operator *() { return *this; }
virtual const SlitTheme &operator *() const { return *this; } virtual const SlitTheme &operator *() const { return *this; }

View file

@ -25,7 +25,6 @@
#include "FbTk/ImageControl.hh" #include "FbTk/ImageControl.hh"
#include "FbTk/TextUtils.hh" #include "FbTk/TextUtils.hh"
#include "FbTk/MemFun.hh" #include "FbTk/MemFun.hh"
#include "FbTk/SimpleObserver.hh"
#include "AtomHandler.hh" #include "AtomHandler.hh"
#include "fluxbox.hh" #include "fluxbox.hh"
@ -167,11 +166,10 @@ SystemTray::SystemTray(const FbTk::FbWindow& parent,
FbTk::EventManager::instance()->add(*this, m_window); FbTk::EventManager::instance()->add(*this, m_window);
FbTk::EventManager::instance()->add(*this, m_selection_owner); FbTk::EventManager::instance()->add(*this, m_selection_owner);
// setup signals // setup signals
m_observer.reset(makeObserver(*this, &SystemTray::update)); join(m_theme->reconfigSig(), FbTk::MemFun(*this, &SystemTray::update));
m_theme->reconfigSig().attach(m_observer.get());
join(screen.bgChangeSig(), join(screen.bgChangeSig(),
FbTk::MemFun(*this, &SystemTray::updateForScreen)); FbTk::MemFunIgnoreArgs(*this, &SystemTray::update));
Fluxbox* fluxbox = Fluxbox::instance(); Fluxbox* fluxbox = Fluxbox::instance();

View file

@ -40,7 +40,6 @@ class AtomHandler;
namespace FbTk { namespace FbTk {
template <class T> class ThemeProxy; template <class T> class ThemeProxy;
class Observer;
} }
class SystemTray: public ToolbarItem, public FbTk::EventHandler, class SystemTray: public ToolbarItem, public FbTk::EventHandler,
@ -89,10 +88,6 @@ public:
static Atom getXEmbedInfoAtom(); static Atom getXEmbedInfoAtom();
private: private:
/// Called when an update for a screen is needed.
void updateForScreen(BScreen &screen) {
update();
}
void update(); void update();
typedef std::list<TrayWindow *> ClientList; typedef std::list<TrayWindow *> ClientList;
@ -116,7 +111,6 @@ private:
// gaim/pidgin seems to barf if the selection is not an independent window. // gaim/pidgin seems to barf if the selection is not an independent window.
// I suspect it's an interacton with parent relationship and gdk window caching. // I suspect it's an interacton with parent relationship and gdk window caching.
FbTk::FbWindow m_selection_owner; FbTk::FbWindow m_selection_owner;
std::auto_ptr<FbTk::Observer> m_observer;
}; };
#endif // SYSTEMTRAY_HH #endif // SYSTEMTRAY_HH

View file

@ -23,7 +23,6 @@
#ifndef TOOLTHEME_HH #ifndef TOOLTHEME_HH
#define TOOLTHEME_HH #define TOOLTHEME_HH
#include "FbTk/TextTheme.hh" #include "FbTk/TextTheme.hh"
#include "FbTk/BorderTheme.hh" #include "FbTk/BorderTheme.hh"
#include "FbTk/Texture.hh" #include "FbTk/Texture.hh"
@ -44,8 +43,7 @@ public:
int alpha() const { return m_alpha; } int alpha() const { return m_alpha; }
void setAlpha(int alpha) { m_alpha = alpha; } void setAlpha(int alpha) { m_alpha = alpha; }
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); } virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); }
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
virtual ToolTheme &operator *() { return *this; } virtual ToolTheme &operator *() { return *this; }
virtual const ToolTheme &operator *() const { return *this; } virtual const ToolTheme &operator *() const { return *this; }

View file

@ -231,8 +231,8 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::Layer &layer, size_t width):
m_observers.push_back(makeObserver(*this, &Toolbar::rearrangeItems)); m_observers.push_back(makeObserver(*this, &Toolbar::rearrangeItems));
// we need to get notified when the theme is reloaded // we need to get notified when the theme is reloaded
m_observers.push_back(makeObserver(*this, &Toolbar::reconfigure)); 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 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 // listen to screen size changes
m_signal_tracker.join(screen().resizeSig(), m_signal_tracker.join(screen().resizeSig(),

View file

@ -44,8 +44,7 @@ public:
int height() const { return *m_height; } int height() const { return *m_height; }
int buttonSize() const { return *m_button_size; } int buttonSize() const { return *m_button_size; }
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); } virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); }
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
virtual ToolbarTheme &operator *() { return *this; } virtual ToolbarTheme &operator *() { return *this; }
virtual const ToolbarTheme &operator *() const { return *this; } virtual const ToolbarTheme &operator *() const { return *this; }

View file

@ -44,7 +44,8 @@ WinButton::WinButton(FluxboxWindow &listen_to,
m_theme(theme), m_pressed_theme(pressed), m_theme(theme), m_pressed_theme(pressed),
m_icon_pixmap(0), m_icon_mask(0), m_icon_pixmap(0), m_icon_mask(0),
overrode_bg(false), overrode_pressed(false) { overrode_bg(false), overrode_pressed(false) {
theme.reconfigSig().attach(this);
join(theme.reconfigSig(), FbTk::MemFun(*this, &WinButton::updateAll));
if (buttontype == MENUICON) if (buttontype == MENUICON)
update(0); update(0);

View file

@ -65,8 +65,7 @@ public:
FbTk::PixmapWithMask &titlePixmap() { return *m_title_pm; } FbTk::PixmapWithMask &titlePixmap() { return *m_title_pm; }
const FbTk::PixmapWithMask &titlePixmap() const { return *m_title_pm; } const FbTk::PixmapWithMask &titlePixmap() const { return *m_title_pm; }
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); } virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); }
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
virtual WinButtonTheme &operator *() { return *this; } virtual WinButtonTheme &operator *() { return *this; }
virtual const WinButtonTheme &operator *() const { return *this; } virtual const WinButtonTheme &operator *() const { return *this; }

View file

@ -291,7 +291,7 @@ FluxboxWindow::FluxboxWindow(WinClient &client):
m_parent(client.screen().rootWindow()), m_parent(client.screen().rootWindow()),
m_resize_corner(RIGHTBOTTOM) { m_resize_corner(RIGHTBOTTOM) {
m_theme.reconfigSig().attach(this); join(m_theme.reconfigSig(), FbTk::MemFun(*this, &FluxboxWindow::themeReconfigured));
m_frame.frameExtentSig().attach(this); m_frame.frameExtentSig().attach(this);
init(); init();
@ -2682,15 +2682,17 @@ void FluxboxWindow::setTitle(const std::string& title, Focusable &client) {
} }
void FluxboxWindow::update(FbTk::Subject *subj) { void FluxboxWindow::update(FbTk::Subject *subj) {
if (subj == &m_theme.reconfigSig()) { if (m_initialized && subj == &m_frame.frameExtentSig()) {
frame().applyDecorations();
sendConfigureNotify();
} else if (m_initialized && subj == &m_frame.frameExtentSig()) {
Fluxbox::instance()->updateFrameExtents(*this); Fluxbox::instance()->updateFrameExtents(*this);
sendConfigureNotify(); sendConfigureNotify();
} }
} }
void FluxboxWindow::themeReconfigured() {
frame().applyDecorations();
sendConfigureNotify();
}
void FluxboxWindow::workspaceAreaChanged(BScreen &screen) { void FluxboxWindow::workspaceAreaChanged(BScreen &screen) {
frame().applyState(); frame().applyState();
} }

View file

@ -492,6 +492,8 @@ private:
void updateClientLeftWindow(); void updateClientLeftWindow();
void grabButtons(); void grabButtons();
void themeReconfigured();
/** /**
* Calculates insertition position in the list by * Calculates insertition position in the list by
* using pixel position x and y. * using pixel position x and y.

View file

@ -49,8 +49,7 @@ public:
return ToolTheme::fallback(item); return ToolTheme::fallback(item);
} }
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); } virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); }
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
virtual WorkspaceNameTheme &operator *() { return *this; } virtual WorkspaceNameTheme &operator *() { return *this; }
virtual const WorkspaceNameTheme &operator *() const { return *this; } virtual const WorkspaceNameTheme &operator *() const { return *this; }

View file

@ -44,11 +44,11 @@ WorkspaceNameTool::WorkspaceNameTool(const FbTk::FbWindow &parent,
// setup signals // setup signals
join(screen.currentWorkspaceSig(), join(screen.currentWorkspaceSig(),
FbTk::MemFun(*this, &WorkspaceNameTool::updateForScreen)); FbTk::MemFunIgnoreArgs(*this, &WorkspaceNameTool::update));
join(screen.workspaceNamesSig(), join(screen.workspaceNamesSig(),
FbTk::MemFun(*this, &WorkspaceNameTool::updateForScreen)); FbTk::MemFunIgnoreArgs(*this, &WorkspaceNameTool::update));
theme.reconfigSig().attach(this); join(theme.reconfigSig(), FbTk::MemFun(*this, &WorkspaceNameTool::update));
} }
WorkspaceNameTool::~WorkspaceNameTool() { WorkspaceNameTool::~WorkspaceNameTool() {
@ -70,12 +70,8 @@ void WorkspaceNameTool::moveResize(int x, int y,
m_button.moveResize(x, y, width, height); m_button.moveResize(x, y, width, height);
} }
void WorkspaceNameTool::update(FbTk::Subject *subj) { void WorkspaceNameTool::update() {
updateForScreen(m_screen); m_button.setText(m_screen.currentWorkspace()->name());
}
void WorkspaceNameTool::updateForScreen(BScreen &screen) {
m_button.setText(screen.currentWorkspace()->name());
if (m_button.width() != width()) { if (m_button.width() != width()) {
resize(width(), height()); resize(width(), height());
resizeSig().notify(); resizeSig().notify();

View file

@ -26,7 +26,6 @@
#include "ToolbarItem.hh" #include "ToolbarItem.hh"
#include "FbTk/TextButton.hh" #include "FbTk/TextButton.hh"
#include "FbTk/Observer.hh"
#include "FbTk/Signal.hh" #include "FbTk/Signal.hh"
class BScreen; class BScreen;
@ -36,8 +35,7 @@ namespace FbTk {
template <class T> class ThemeProxy; template <class T> class ThemeProxy;
} }
class WorkspaceNameTool: public ToolbarItem, public FbTk::Observer, class WorkspaceNameTool: public ToolbarItem, private FbTk::SignalTracker {
private FbTk::SignalTracker {
public: public:
WorkspaceNameTool(const FbTk::FbWindow &parent, FbTk::ThemeProxy<ToolTheme> &theme, BScreen &screen); WorkspaceNameTool(const FbTk::FbWindow &parent, FbTk::ThemeProxy<ToolTheme> &theme, BScreen &screen);
virtual ~WorkspaceNameTool(); virtual ~WorkspaceNameTool();
@ -53,7 +51,6 @@ public:
unsigned int height() const; unsigned int height() const;
unsigned int borderWidth() const; unsigned int borderWidth() const;
void update(FbTk::Subject *subj);
FbTk::Button &button() { return m_button; } FbTk::Button &button() { return m_button; }
const FbTk::Button &button() const { return m_button; } const FbTk::Button &button() const { return m_button; }
void setOrientation(FbTk::Orientation orient); void setOrientation(FbTk::Orientation orient);
@ -61,8 +58,7 @@ public:
void parentMoved() { m_button.parentMoved(); } void parentMoved() { m_button.parentMoved(); }
private: private:
/// Called when workspace changed on \c screen void update();
void updateForScreen(BScreen &screen);
void renderTheme(int alpha); void renderTheme(int alpha);
void reRender(); void reRender();