summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2002-05-16 09:24:40 +0000
committerDana Jansens <danakj@orodu.net>2002-05-16 09:24:40 +0000
commitae093dba2fb97124bb4af3eaf4070b46f07dfd74 (patch)
tree4dc63a1f7a5aebe7568e6a95b9d6123cf1539682 /src
parenta4c9553c64fb854aa5fdf79f87d5b4d6a07ca67e (diff)
make a new autoRaiseDelay value take effect without having to restart
Diffstat (limited to 'src')
-rw-r--r--src/BaseDisplay.cc17
-rw-r--r--src/Slit.cc4
-rw-r--r--src/Timer.cc10
-rw-r--r--src/Toolbar.cc4
-rw-r--r--src/Window.cc3
5 files changed, 28 insertions, 10 deletions
diff --git a/src/BaseDisplay.cc b/src/BaseDisplay.cc
index 28742e98..c99b2b16 100644
--- a/src/BaseDisplay.cc
+++ b/src/BaseDisplay.cc
@@ -462,10 +462,10 @@ void BaseDisplay::eventLoop(void) {
gettimeofday(&now, 0);
TimerList::iterator it;
- for (it = timerList.begin(); it != timerList.end(); ) {
+ for (it = timerList.begin(); it != timerList.end(); ++it) {
BTimer *timer = *it;
- ++it; // the timer may be removed from the list, so move ahead now
ASSERT(timer != NULL);
+
tm.tv_sec = timer->getStartTime().tv_sec +
timer->getTimeout().tv_sec;
tm.tv_usec = timer->getStartTime().tv_usec +
@@ -478,12 +478,16 @@ void BaseDisplay::eventLoop(void) {
timer->fireTimeout();
// restart the current timer so that the start time is updated
- if (! timer->doOnce())
+ if (! timer->doOnce()) {
+ // reorder
+ removeTimer(timer);
+ addTimer(timer);
timer->start();
- else {
+ } else
timer->stop();
-// delete timer; // USE THIS?
- }
+ it = timerList.begin(); // we no longer have any idea if the iterator is
+ // valid, but what was at the front() is no
+ // longer.
}
}
}
@@ -531,6 +535,7 @@ void BaseDisplay::addTimer(BTimer *timer) {
void BaseDisplay::removeTimer(BTimer *timer) {
+ ASSERT(timer != (BTimer *) 0);
timerList.remove(timer);
}
diff --git a/src/Slit.cc b/src/Slit.cc
index f6c87aa9..66cdc583 100644
--- a/src/Slit.cc
+++ b/src/Slit.cc
@@ -54,7 +54,7 @@ Slit::Slit(BScreen &scr, Resource &conf) : openbox(scr.getOpenbox()),
frame.window = frame.pixmap = None;
timer = new BTimer(openbox, *this);
- timer->setTimeout(openbox.getAutoRaiseDelay());
+ // the time out is set in ::reconfigure()
timer->fireOnce(True);
slitmenu = new Slitmenu(*this);
@@ -326,6 +326,8 @@ void Slit::load() {
}
void Slit::reconfigure(void) {
+ timer->setTimeout(openbox.getAutoRaiseDelay());
+
frame.area.setSize(0, 0);
slitClientList::const_iterator it;
diff --git a/src/Timer.cc b/src/Timer.cc
index 917bc337..8cd4714e 100644
--- a/src/Timer.cc
+++ b/src/Timer.cc
@@ -46,6 +46,10 @@ void BTimer::setTimeout(long t) {
_timeout.tv_usec = t;
_timeout.tv_usec -= (_timeout.tv_sec * 1000);
_timeout.tv_usec *= 1000;
+ if (timing) {
+ display.removeTimer(this);
+ display.addTimer(this); // reorder the display
+ }
}
void BTimer::setTimeout(timeval t) {
@@ -63,9 +67,11 @@ void BTimer::start(void) {
}
void BTimer::stop(void) {
- timing = False;
+ if (timing) {
+ timing = False;
- display.removeTimer(this);
+ display.removeTimer(this);
+ }
}
void BTimer::fireTimeout(void) {
diff --git a/src/Toolbar.cc b/src/Toolbar.cc
index 8a3ea6b2..8e621bdf 100644
--- a/src/Toolbar.cc
+++ b/src/Toolbar.cc
@@ -80,7 +80,7 @@ Toolbar::Toolbar(BScreen &scrn, Resource &conf) : openbox(scrn.getOpenbox()),
hide_handler.toolbar = this;
hide_timer = new BTimer(openbox, hide_handler);
- hide_timer->setTimeout(openbox.getAutoRaiseDelay());
+ // the time out is set in ::reconfigure()
hide_timer->fireOnce(True);
image_ctrl = screen.getImageControl();
@@ -321,6 +321,8 @@ void Toolbar::load() {
}
void Toolbar::reconfigure() {
+ hide_timer->setTimeout(openbox.getAutoRaiseDelay());
+
frame.bevel_w = screen.getBevelWidth();
frame.width = screen.size().w() * m_width_percent / 100;
diff --git a/src/Window.cc b/src/Window.cc
index 7cf8ec1b..59b64095 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -845,6 +845,9 @@ void OpenboxWindow::reconfigure(void) {
windowmenu->move(windowmenu->getX(), frame.y + frame.title_h);
windowmenu->reconfigure();
}
+
+ // re-get the timeout delay
+ timer->setTimeout(openbox.getAutoRaiseDelay());
}