From 9b88b1f2c7e2da1ec6a47518ded37c0eab36e738 Mon Sep 17 00:00:00 2001 From: fluxgen <fluxgen> Date: Fri, 19 Dec 2003 13:37:28 +0000 Subject: reconfig timer back, needs to have a timer so we can reconfig fluxbox save in the next event round, see comments... --- src/fluxbox.cc | 28 +++++++++++++++++++--------- src/fluxbox.hh | 4 +++- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/fluxbox.cc b/src/fluxbox.cc index c831713..4210f47 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: fluxbox.cc,v 1.209 2003/12/19 03:58:36 fluxgen Exp $ +// $Id: fluxbox.cc,v 1.210 2003/12/19 13:37:28 fluxgen Exp $ #include "fluxbox.hh" @@ -409,7 +409,7 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile m_focus_revert_screen(0) { - + if (s_singleton != 0) throw string("Fatal! There can only one instance of fluxbox class."); @@ -438,6 +438,19 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile sigh.registerHandler(SIGHUP, this); sigh.registerHandler(SIGUSR1, this); sigh.registerHandler(SIGUSR2, this); + // + // setup timer + // This timer is used to we can issue a safe reconfig command. + // Because when the command is executed we shouldn't do reconfig directly + // because it could affect ongoing menu stuff so we need to reconfig in + // the next event "round". + FbTk::RefCount<FbTk::Command> reconfig_cmd(new FbTk::SimpleCommand<Fluxbox>(*this, &Fluxbox::timed_reconfigure)); + timeval to; + to.tv_sec = 0; + to.tv_usec = 1; + m_reconfig_timer.setTimeout(to); + m_reconfig_timer.setCommand(reconfig_cmd); + m_reconfig_timer.fireOnce(true); Display *disp = FbTk::App::instance()->display(); @@ -931,9 +944,8 @@ void Fluxbox::handleEvent(XEvent * const e) { #ifdef DEBUG cerr<<__FILE__<<"("<<__FUNCTION__<<") Focus out is not a FluxboxWindow !!"<<endl; #endif // DEBUG - } else if (winclient && winclient == m_focused_window) { - setFocusedWindow(0); - } + } else if (winclient && winclient == m_focused_window) + setFocusedWindow(0); } break; case ClientMessage: @@ -1749,8 +1761,7 @@ void Fluxbox::reload_rc() { void Fluxbox::reconfigure() { m_reconfigure_wait = true; - - timed_reconfigure(); + m_reconfig_timer.start(); } @@ -1802,8 +1813,7 @@ void Fluxbox::checkMenu() { void Fluxbox::rereadMenu() { m_reread_menu_wait = true; - - timed_reconfigure(); + m_reconfig_timer.start(); } diff --git a/src/fluxbox.hh b/src/fluxbox.hh index 7f1c43f..054af43 100644 --- a/src/fluxbox.hh +++ b/src/fluxbox.hh @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: fluxbox.hh,v 1.76 2003/12/19 00:35:08 fluxgen Exp $ +// $Id: fluxbox.hh,v 1.77 2003/12/19 13:36:21 fluxgen Exp $ #ifndef FLUXBOX_HH #define FLUXBOX_HH @@ -301,6 +301,8 @@ private: int m_argc; XEvent m_last_event; + FbTk::Timer m_reconfig_timer; ///< when we execute reconfig command we must wait at least to next event round + std::auto_ptr<Keys> m_key; //default arguments for titlebar left and right -- cgit v0.11.2