diff options
author | Pavel Labath <pavelo@centrum.sk> | 2011-07-13 13:05:42 (GMT) |
---|---|---|
committer | Pavel Labath <pavelo@centrum.sk> | 2011-07-13 13:05:42 (GMT) |
commit | cde85e04178e481e321cd8fe4417b07ba6a2889c (patch) | |
tree | 47de4fb09d116dde2436effe971bc26161337966 /src | |
parent | a13f6ba94c2a52966ea0a37edb5a9fa798568052 (diff) | |
download | fluxbox_pavel-cde85e04178e481e321cd8fe4417b07ba6a2889c.zip fluxbox_pavel-cde85e04178e481e321cd8fe4417b07ba6a2889c.tar.bz2 |
Attach a modifiedSig handler to the session.styleFile resource
Diffstat (limited to 'src')
-rw-r--r-- | src/FbCommands.cc | 10 | ||||
-rw-r--r-- | src/RootCmdMenuItem.cc | 3 | ||||
-rw-r--r-- | src/Screen.cc | 5 | ||||
-rw-r--r-- | src/StyleMenuItem.cc | 2 | ||||
-rw-r--r-- | src/fluxbox.cc | 8 | ||||
-rw-r--r-- | src/fluxbox.hh | 5 |
6 files changed, 14 insertions, 19 deletions
diff --git a/src/FbCommands.cc b/src/FbCommands.cc index 4db6af7..b54afd9 100644 --- a/src/FbCommands.cc +++ b/src/FbCommands.cc | |||
@@ -234,8 +234,8 @@ void ReconfigureFluxboxCmd::execute() { | |||
234 | REGISTER_COMMAND(reloadstyle, FbCommands::ReloadStyleCmd, void); | 234 | REGISTER_COMMAND(reloadstyle, FbCommands::ReloadStyleCmd, void); |
235 | 235 | ||
236 | void ReloadStyleCmd::execute() { | 236 | void ReloadStyleCmd::execute() { |
237 | SetStyleCmd cmd(Fluxbox::instance()->getStyleFilename()); | 237 | // setting the value will trigger a reload |
238 | cmd.execute(); | 238 | *Fluxbox::instance()->getStyleResource() = *Fluxbox::instance()->getStyleResource(); |
239 | } | 239 | } |
240 | 240 | ||
241 | REGISTER_COMMAND_WITH_ARGS(setstyle, FbCommands::SetStyleCmd, void); | 241 | REGISTER_COMMAND_WITH_ARGS(setstyle, FbCommands::SetStyleCmd, void); |
@@ -245,11 +245,7 @@ SetStyleCmd::SetStyleCmd(const string &filename):m_filename(filename) { | |||
245 | } | 245 | } |
246 | 246 | ||
247 | void SetStyleCmd::execute() { | 247 | void SetStyleCmd::execute() { |
248 | if (FbTk::ThemeManager::instance().load(m_filename, | 248 | *Fluxbox::instance()->getStyleResource() = m_filename; |
249 | Fluxbox::instance()->getStyleOverlayFilename())) { | ||
250 | Fluxbox::instance()->saveStyleFilename(m_filename.c_str()); | ||
251 | Fluxbox::instance()->save_rc(); | ||
252 | } | ||
253 | } | 249 | } |
254 | 250 | ||
255 | REGISTER_COMMAND_WITH_ARGS(keymode, FbCommands::KeyModeCmd, void); | 251 | REGISTER_COMMAND_WITH_ARGS(keymode, FbCommands::KeyModeCmd, void); |
diff --git a/src/RootCmdMenuItem.cc b/src/RootCmdMenuItem.cc index c3642ee..ce6d24a 100644 --- a/src/RootCmdMenuItem.cc +++ b/src/RootCmdMenuItem.cc | |||
@@ -43,6 +43,7 @@ RootCmdMenuItem::RootCmdMenuItem(const FbTk::FbString &label, | |||
43 | 43 | ||
44 | 44 | ||
45 | bool RootCmdMenuItem::isSelected() const { | 45 | bool RootCmdMenuItem::isSelected() const { |
46 | return Fluxbox::instance()->getStyleFilename() == m_filename; | 46 | // XXX how do we find out which is the current background? |
47 | return false; | ||
47 | } | 48 | } |
48 | 49 | ||
diff --git a/src/Screen.cc b/src/Screen.cc index 73ec8b2..d0bafba 100644 --- a/src/Screen.cc +++ b/src/Screen.cc | |||
@@ -850,11 +850,6 @@ void BScreen::reconfigure() { | |||
850 | // notify objects that the screen is reconfigured | 850 | // notify objects that the screen is reconfigured |
851 | m_reconfigure_sig.emit(*this); | 851 | m_reconfigure_sig.emit(*this); |
852 | 852 | ||
853 | // Reload style | ||
854 | FbTk::ThemeManager::instance().load(fluxbox->getStyleFilename(), | ||
855 | fluxbox->getStyleOverlayFilename(), | ||
856 | m_root_theme->screenNum()); | ||
857 | |||
858 | reconfigureTabs(); | 853 | reconfigureTabs(); |
859 | } | 854 | } |
860 | 855 | ||
diff --git a/src/StyleMenuItem.cc b/src/StyleMenuItem.cc index 8e557a7..348d3c1 100644 --- a/src/StyleMenuItem.cc +++ b/src/StyleMenuItem.cc | |||
@@ -42,6 +42,6 @@ StyleMenuItem::StyleMenuItem(const FbTk::FbString &label, const std::string &fil | |||
42 | 42 | ||
43 | 43 | ||
44 | bool StyleMenuItem::isSelected() const { | 44 | bool StyleMenuItem::isSelected() const { |
45 | return Fluxbox::instance()->getStyleFilename() == m_filename; | 45 | return Fluxbox::instance()->getStyleResource().get() == m_filename; |
46 | } | 46 | } |
47 | 47 | ||
diff --git a/src/fluxbox.cc b/src/fluxbox.cc index d7907be..16706b7 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc | |||
@@ -328,6 +328,7 @@ Fluxbox::Fluxbox(int argc, char **argv, | |||
328 | #endif // HAVE_RANDR | 328 | #endif // HAVE_RANDR |
329 | 329 | ||
330 | join(m_rc_pseudotrans.modifiedSig(), &FbTk::Transparent::usePseudoTransparent); | 330 | join(m_rc_pseudotrans.modifiedSig(), &FbTk::Transparent::usePseudoTransparent); |
331 | join(m_rc_stylefile.modifiedSig(), MemFunIgnoreArgs(*this, &Fluxbox::styleChanged)); | ||
331 | 332 | ||
332 | load_rc(); | 333 | load_rc(); |
333 | 334 | ||
@@ -349,9 +350,6 @@ Fluxbox::Fluxbox(int argc, char **argv, | |||
349 | #endif // HAVE_GETPID | 350 | #endif // HAVE_GETPID |
350 | 351 | ||
351 | 352 | ||
352 | // setup theme manager to have our style file ready to be scanned | ||
353 | FbTk::ThemeManager::instance().load(getStyleFilename(), getStyleOverlayFilename()); | ||
354 | |||
355 | // Create keybindings handler and load keys file | 353 | // Create keybindings handler and load keys file |
356 | // Note: this needs to be done before creating screens | 354 | // Note: this needs to be done before creating screens |
357 | m_key.reset(new Keys); | 355 | m_key.reset(new Keys); |
@@ -1002,6 +1000,10 @@ void Fluxbox::windowLayerChanged(FluxboxWindow &win) { | |||
1002 | CallMemFunWithRefArg<AtomHandler, FluxboxWindow&, void>(&AtomHandler::updateLayer, win)); | 1000 | CallMemFunWithRefArg<AtomHandler, FluxboxWindow&, void>(&AtomHandler::updateLayer, win)); |
1003 | } | 1001 | } |
1004 | 1002 | ||
1003 | void Fluxbox::styleChanged() { | ||
1004 | FbTk::ThemeManager::instance().load(*getStyleResource(), getStyleOverlayFilename()); | ||
1005 | } | ||
1006 | |||
1005 | void Fluxbox::attachSignals(FluxboxWindow &win) { | 1007 | void Fluxbox::attachSignals(FluxboxWindow &win) { |
1006 | join(win.stateSig(), FbTk::MemFun(*this, &Fluxbox::windowStateChanged)); | 1008 | join(win.stateSig(), FbTk::MemFun(*this, &Fluxbox::windowStateChanged)); |
1007 | join(win.workspaceSig(), FbTk::MemFun(*this, &Fluxbox::windowWorkspaceChanged)); | 1009 | join(win.workspaceSig(), FbTk::MemFun(*this, &Fluxbox::windowWorkspaceChanged)); |
diff --git a/src/fluxbox.hh b/src/fluxbox.hh index 22b34bb..7d479ae 100644 --- a/src/fluxbox.hh +++ b/src/fluxbox.hh | |||
@@ -117,7 +117,7 @@ public: | |||
117 | FbTk::BoolResource &getPseudoTransResource() { return m_rc_pseudotrans; } | 117 | FbTk::BoolResource &getPseudoTransResource() { return m_rc_pseudotrans; } |
118 | 118 | ||
119 | Fluxbox::TabsAttachArea getTabsAttachArea() const { return *m_rc_tabs_attach_area; } | 119 | Fluxbox::TabsAttachArea getTabsAttachArea() const { return *m_rc_tabs_attach_area; } |
120 | const std::string &getStyleFilename() const { return *m_rc_stylefile; } | 120 | FbTk::StringResource &getStyleResource() { return m_rc_stylefile; } |
121 | const std::string &getStyleOverlayFilename() const { return *m_rc_styleoverlayfile; } | 121 | const std::string &getStyleOverlayFilename() const { return *m_rc_styleoverlayfile; } |
122 | 122 | ||
123 | const std::string &getMenuFilename() const { return *m_rc_menufile; } | 123 | const std::string &getMenuFilename() const { return *m_rc_menufile; } |
@@ -138,7 +138,6 @@ public: | |||
138 | 138 | ||
139 | void shutdown(); | 139 | void shutdown(); |
140 | void load_rc(BScreen &scr); | 140 | void load_rc(BScreen &scr); |
141 | void saveStyleFilename(const char *val) { m_rc_stylefile = (val == 0 ? "" : val); } | ||
142 | void saveWindowSearch(Window win, WinClient *winclient); | 141 | void saveWindowSearch(Window win, WinClient *winclient); |
143 | // some windows relate to the group, not the client, so we record separately | 142 | // some windows relate to the group, not the client, so we record separately |
144 | // searchWindow on these windows will give the active client in the group | 143 | // searchWindow on these windows will give the active client in the group |
@@ -225,6 +224,8 @@ private: | |||
225 | void windowStateChanged(FluxboxWindow &win); | 224 | void windowStateChanged(FluxboxWindow &win); |
226 | /// Called when a window layer changes | 225 | /// Called when a window layer changes |
227 | void windowLayerChanged(FluxboxWindow &win); | 226 | void windowLayerChanged(FluxboxWindow &win); |
227 | /// Called when a style (or it's overlay) changes | ||
228 | void styleChanged(); | ||
228 | 229 | ||
229 | std::auto_ptr<FbTk::Lua> m_l; | 230 | std::auto_ptr<FbTk::Lua> m_l; |
230 | std::auto_ptr<FbAtoms> m_fbatoms; | 231 | std::auto_ptr<FbAtoms> m_fbatoms; |