aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Labath <pavelo@centrum.sk>2011-07-13 13:05:42 (GMT)
committerPavel Labath <pavelo@centrum.sk>2013-02-17 09:55:05 (GMT)
commit199123d5fd668b5adcfef29ffaa172d322f65368 (patch)
tree655eb3c620f342e3901a25cc5ae547d565c211a2
parent9ccff50963217f90a93fa857a908a12a4d27588e (diff)
downloadfluxbox_pavel-199123d5fd668b5adcfef29ffaa172d322f65368.zip
fluxbox_pavel-199123d5fd668b5adcfef29ffaa172d322f65368.tar.bz2
Attach a modifiedSig handler to the session.styleFile resource
-rw-r--r--src/FbCommands.cc10
-rw-r--r--src/RootCmdMenuItem.cc3
-rw-r--r--src/Screen.cc5
-rw-r--r--src/StyleMenuItem.cc2
-rw-r--r--src/fluxbox.cc8
-rw-r--r--src/fluxbox.hh5
6 files changed, 14 insertions, 19 deletions
diff --git a/src/FbCommands.cc b/src/FbCommands.cc
index 119f378..683c3b9 100644
--- a/src/FbCommands.cc
+++ b/src/FbCommands.cc
@@ -246,8 +246,8 @@ void ReconfigureFluxboxCmd::execute() {
246REGISTER_COMMAND(reloadstyle, FbCommands::ReloadStyleCmd, void); 246REGISTER_COMMAND(reloadstyle, FbCommands::ReloadStyleCmd, void);
247 247
248void ReloadStyleCmd::execute() { 248void ReloadStyleCmd::execute() {
249 SetStyleCmd cmd(Fluxbox::instance()->getStyleFilename()); 249 // setting the value will trigger a reload
250 cmd.execute(); 250 *Fluxbox::instance()->getStyleResource() = *Fluxbox::instance()->getStyleResource();
251} 251}
252 252
253REGISTER_COMMAND_WITH_ARGS(setstyle, FbCommands::SetStyleCmd, void); 253REGISTER_COMMAND_WITH_ARGS(setstyle, FbCommands::SetStyleCmd, void);
@@ -257,11 +257,7 @@ SetStyleCmd::SetStyleCmd(const string &filename):m_filename(filename) {
257} 257}
258 258
259void SetStyleCmd::execute() { 259void SetStyleCmd::execute() {
260 if (FbTk::ThemeManager::instance().load(m_filename, 260 *Fluxbox::instance()->getStyleResource() = m_filename;
261 Fluxbox::instance()->getStyleOverlayFilename())) {
262 Fluxbox::instance()->saveStyleFilename(m_filename.c_str());
263 Fluxbox::instance()->save_rc();
264 }
265} 261}
266 262
267REGISTER_COMMAND_WITH_ARGS(keymode, FbCommands::KeyModeCmd, void); 263REGISTER_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
45bool RootCmdMenuItem::isSelected() const { 45bool 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 ff7b1b3..97ebffa 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -865,11 +865,6 @@ void BScreen::reconfigure() {
865 // notify objects that the screen is reconfigured 865 // notify objects that the screen is reconfigured
866 m_reconfigure_sig.emit(*this); 866 m_reconfigure_sig.emit(*this);
867 867
868 // Reload style
869 FbTk::ThemeManager::instance().load(fluxbox->getStyleFilename(),
870 fluxbox->getStyleOverlayFilename(),
871 m_root_theme->screenNum());
872
873 reconfigureTabs(); 868 reconfigureTabs();
874} 869}
875 870
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
44bool StyleMenuItem::isSelected() const { 44bool 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 37eb0e1..22dfbe3 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -331,6 +331,7 @@ Fluxbox::Fluxbox(int argc, char **argv,
331#endif // HAVE_RANDR 331#endif // HAVE_RANDR
332 332
333 join(m_rc_pseudotrans.modifiedSig(), &FbTk::Transparent::usePseudoTransparent); 333 join(m_rc_pseudotrans.modifiedSig(), &FbTk::Transparent::usePseudoTransparent);
334 join(m_rc_stylefile.modifiedSig(), MemFunIgnoreArgs(*this, &Fluxbox::styleChanged));
334 335
335 load_rc(); 336 load_rc();
336 grab(); 337 grab();
@@ -351,9 +352,6 @@ Fluxbox::Fluxbox(int argc, char **argv,
351#endif // HAVE_GETPID 352#endif // HAVE_GETPID
352 353
353 354
354 // setup theme manager to have our style file ready to be scanned
355 FbTk::ThemeManager::instance().load(getStyleFilename(), getStyleOverlayFilename());
356
357 // Create keybindings handler and load keys file 355 // Create keybindings handler and load keys file
358 // Note: this needs to be done before creating screens 356 // Note: this needs to be done before creating screens
359 m_key.reset(new Keys); 357 m_key.reset(new Keys);
@@ -1010,6 +1008,10 @@ void Fluxbox::windowLayerChanged(FluxboxWindow &win) {
1010 CallMemFunWithRefArg<AtomHandler, FluxboxWindow&, void>(&AtomHandler::updateLayer, win)); 1008 CallMemFunWithRefArg<AtomHandler, FluxboxWindow&, void>(&AtomHandler::updateLayer, win));
1011} 1009}
1012 1010
1011void Fluxbox::styleChanged() {
1012 FbTk::ThemeManager::instance().load(*getStyleResource(), getStyleOverlayFilename());
1013}
1014
1013void Fluxbox::attachSignals(FluxboxWindow &win) { 1015void Fluxbox::attachSignals(FluxboxWindow &win) {
1014 join(win.stateSig(), FbTk::MemFun(*this, &Fluxbox::windowStateChanged)); 1016 join(win.stateSig(), FbTk::MemFun(*this, &Fluxbox::windowStateChanged));
1015 join(win.workspaceSig(), FbTk::MemFun(*this, &Fluxbox::windowWorkspaceChanged)); 1017 join(win.workspaceSig(), FbTk::MemFun(*this, &Fluxbox::windowWorkspaceChanged));
diff --git a/src/fluxbox.hh b/src/fluxbox.hh
index 47ab834..78ce093 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;