diff options
author | Pavel Labath <pavelo@centrum.sk> | 2011-07-30 10:21:53 (GMT) |
---|---|---|
committer | Pavel Labath <pavelo@centrum.sk> | 2011-07-30 10:21:53 (GMT) |
commit | 13c3958d67b85b86350492b89f93b63d388abcbd (patch) | |
tree | 78823fd18bb4fbf995e2735f662f05fc95acf648 /src/fluxbox.cc | |
parent | 39ffee57bb5e53174d9ef1f709f89da286d0a6c8 (diff) | |
download | fluxbox_pavel-13c3958d67b85b86350492b89f93b63d388abcbd.zip fluxbox_pavel-13c3958d67b85b86350492b89f93b63d388abcbd.tar.bz2 |
Create a completely new lua state upon USR2 reconfigure
This way, global variables set by the scripts don't persist between hard reconfigures.
I also cleaned up the reconfig-handling code in fluxbox.cc. Instead of three reconfig functions
(real_reconfig, timed_reconfig, reconfig) we have just one.
Diffstat (limited to 'src/fluxbox.cc')
-rw-r--r-- | src/fluxbox.cc | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/src/fluxbox.cc b/src/fluxbox.cc index b49e61f..4fba8d1 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc | |||
@@ -305,7 +305,7 @@ Fluxbox::Fluxbox(int argc, char **argv, | |||
305 | // Because when the command is executed we shouldn't do reconfig directly | 305 | // Because when the command is executed we shouldn't do reconfig directly |
306 | // because it could affect ongoing menu stuff so we need to reconfig in | 306 | // because it could affect ongoing menu stuff so we need to reconfig in |
307 | // the next event "round". | 307 | // the next event "round". |
308 | FbTk::RefCount<FbTk::Command<void> > reconfig_cmd(new FbTk::SimpleCommand<Fluxbox>(*this, &Fluxbox::timed_reconfigure)); | 308 | FbTk::RefCount<FbTk::Command<void> > reconfig_cmd(new FbTk::SimpleCommand<Fluxbox>(*this, &Fluxbox::reconfigure)); |
309 | m_reconfig_timer.setTimeout(0, 1); | 309 | m_reconfig_timer.setTimeout(0, 1); |
310 | m_reconfig_timer.setCommand(reconfig_cmd); | 310 | m_reconfig_timer.setCommand(reconfig_cmd); |
311 | m_reconfig_timer.fireOnce(true); | 311 | m_reconfig_timer.fireOnce(true); |
@@ -440,8 +440,6 @@ Fluxbox::Fluxbox(int argc, char **argv, | |||
440 | //XSynchronize(disp, False); | 440 | //XSynchronize(disp, False); |
441 | sync(false); | 441 | sync(false); |
442 | 442 | ||
443 | m_reconfigure_wait = false; | ||
444 | |||
445 | ungrab(); | 443 | ungrab(); |
446 | 444 | ||
447 | m_starting = false; | 445 | m_starting = false; |
@@ -900,7 +898,7 @@ void Fluxbox::handleSignal(int signum) { | |||
900 | load_rc(); | 898 | load_rc(); |
901 | break; | 899 | break; |
902 | case SIGUSR2: | 900 | case SIGUSR2: |
903 | reconfigure(); | 901 | m_reconfig_timer.start(); |
904 | break; | 902 | break; |
905 | case SIGSEGV: | 903 | case SIGSEGV: |
906 | abort(); | 904 | abort(); |
@@ -1182,17 +1180,6 @@ void Fluxbox::load_rc() { | |||
1182 | *m_rc_stylefile = DEFAULTSTYLE; | 1180 | *m_rc_stylefile = DEFAULTSTYLE; |
1183 | } | 1181 | } |
1184 | 1182 | ||
1185 | void Fluxbox::reconfigure() { | ||
1186 | load_rc(); | ||
1187 | m_reconfigure_wait = true; | ||
1188 | m_reconfig_timer.start(); | ||
1189 | } | ||
1190 | |||
1191 | |||
1192 | void Fluxbox::real_reconfigure() { | ||
1193 | STLUtil::forAll(m_screen_list, mem_fun(&BScreen::reconfigure)); | ||
1194 | } | ||
1195 | |||
1196 | BScreen *Fluxbox::findScreen(int id) { | 1183 | BScreen *Fluxbox::findScreen(int id) { |
1197 | 1184 | ||
1198 | BScreen* result = 0; | 1185 | BScreen* result = 0; |
@@ -1205,11 +1192,12 @@ BScreen *Fluxbox::findScreen(int id) { | |||
1205 | return result; | 1192 | return result; |
1206 | } | 1193 | } |
1207 | 1194 | ||
1208 | void Fluxbox::timed_reconfigure() { | 1195 | void Fluxbox::reconfigure() { |
1209 | if (m_reconfigure_wait) | 1196 | std::auto_ptr<FbTk::Lua> t = m_l; |
1210 | real_reconfigure(); | 1197 | m_l.reset(new Lua); |
1211 | 1198 | m_resourcemanager.setLua(*m_l); | |
1212 | m_reconfigure_wait = false; | 1199 | load_rc(); |
1200 | STLUtil::forAll(m_screen_list, mem_fun(&BScreen::reconfigure)); | ||
1213 | } | 1201 | } |
1214 | 1202 | ||
1215 | void Fluxbox::revertFocus() { | 1203 | void Fluxbox::revertFocus() { |