From 97ec84ee3e5b1c84735bc78ec7bb5805b328019f Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Fri, 15 Jul 2011 20:54:59 +0200 Subject: Attach modifiedSig handlers to the session.autoRaiseDelay resource --- src/Toolbar.cc | 8 +++++++- src/Toolbar.hh | 1 + src/Window.cc | 9 +++++++-- src/Window.hh | 2 +- src/fluxbox.hh | 3 ++- 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/Toolbar.cc b/src/Toolbar.cc index 0899988..d43b0ca 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc @@ -219,7 +219,9 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::Layer &layer, size_t width): frame.grab_x = frame.grab_y = 0; // setup hide timer - m_hide_timer.setTimeout(Fluxbox::instance()->getAutoRaiseDelay() * FbTk::FbTime::IN_MILLISECONDS); + autoRaiseDelayChanged(*Fluxbox::instance()->getAutoRaiseDelayResource()); + m_signal_tracker.join(Fluxbox::instance()->getAutoRaiseDelayResource().modifiedSig(), + FbTk::MemFun(*this, &Toolbar::autoRaiseDelayChanged) ); FbTk::RefCount > toggle_hidden(new FbTk::SimpleCommand(*this, &Toolbar::toggleHidden)); m_hide_timer.setCommand(toggle_hidden); m_hide_timer.fireOnce(true); @@ -326,6 +328,10 @@ void Toolbar::screenChanged(BScreen &screen) { reconfigure(); } +void Toolbar::autoRaiseDelayChanged(time_t delay) { + m_hide_timer.setTimeout(delay * FbTk::FbTime::IN_MILLISECONDS); +} + void Toolbar::reconfigure() { updateVisibleState(); diff --git a/src/Toolbar.hh b/src/Toolbar.hh index b0aeb60..924241b 100644 --- a/src/Toolbar.hh +++ b/src/Toolbar.hh @@ -144,6 +144,7 @@ private: /// Called when the screen changed property. void screenChanged(BScreen &screen); + void autoRaiseDelayChanged(time_t delay); bool m_hidden; ///< hidden state diff --git a/src/Window.cc b/src/Window.cc index 62822ab..2ceb3d9 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -431,7 +431,9 @@ void FluxboxWindow::init() { updateMWMHintsFromClient(*m_client); - m_timer.setTimeout(fluxbox.getAutoRaiseDelay() * FbTk::FbTime::IN_MILLISECONDS); + autoRaiseDelayChanged(*fluxbox.getAutoRaiseDelayResource()); + join(fluxbox.getAutoRaiseDelayResource().modifiedSig(), FbTk::MemFun(*this, + &FluxboxWindow::autoRaiseDelayChanged ) ); FbTk::RefCount > raise_cmd(new FbTk::SimpleCommand(*this, &FluxboxWindow::raise)); m_timer.setCommand(raise_cmd); @@ -1064,7 +1066,6 @@ void FluxboxWindow::reconfigure() { applyDecorations(); setFocusFlag(m_focused); moveResize(frame().x(), frame().y(), frame().width(), frame().height()); - m_timer.setTimeout(Fluxbox::instance()->getAutoRaiseDelay() * FbTk::FbTime::IN_MILLISECONDS); updateButtons(); frame().reconfigure(); menu().reconfigure(); @@ -2650,6 +2651,10 @@ void FluxboxWindow::frameExtentChanged() { } } +void FluxboxWindow::autoRaiseDelayChanged(time_t delay) { + m_timer.setTimeout(delay * FbTk::FbTime::IN_MILLISECONDS); +} + void FluxboxWindow::themeReconfigured() { frame().applyDecorations(); sendConfigureNotify(); diff --git a/src/Window.hh b/src/Window.hh index b7975f5..bdcf4cd 100644 --- a/src/Window.hh +++ b/src/Window.hh @@ -523,7 +523,7 @@ private: /// Called when workspace area on screen changed. void workspaceAreaChanged(BScreen &screen); void frameExtentChanged(); - + void autoRaiseDelayChanged(time_t delay); // state and hint signals FbTk::Signal m_workspacesig, m_statesig, m_layersig, m_hintsig; diff --git a/src/fluxbox.hh b/src/fluxbox.hh index 3e2e756..5564d7f 100644 --- a/src/fluxbox.hh +++ b/src/fluxbox.hh @@ -127,7 +127,8 @@ public: FbTk::IntResource &getTabsPaddingResource() { return m_rc_tabs_padding; } - time_t getAutoRaiseDelay() const { return *m_rc_auto_raise_delay; } + FbTk::Resource > & + getAutoRaiseDelayResource() { return m_rc_auto_raise_delay; } FbTk::UIntResource &getCacheLifeResource() { return m_rc_cache_life; } FbTk::UIntResource &getCacheMaxResource() { return m_rc_cache_max; } -- cgit v0.11.2