make a new autoRaiseDelay value take effect without having to restart
This commit is contained in:
parent
a4c9553c64
commit
ae093dba2f
6 changed files with 34 additions and 11 deletions
|
@ -1,7 +1,12 @@
|
|||
Changelog for Openbox:
|
||||
|
||||
1.3.0:
|
||||
* fix for loading autoRaiseDelay value. (Ben Jansens)
|
||||
* make reconfigure reset the timeout values for
|
||||
windows, the slit, and the toolbar, so that a new
|
||||
autoRaiseDelay value will take effect without having
|
||||
to restart. (Ben Jansens)
|
||||
|
||||
* fix for loading the autoRaiseDelay value. (Ben Jansens)
|
||||
|
||||
1.2.0:
|
||||
* fix off-by-one window resizing bug. (Ben Jansens)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
10
src/Timer.cc
10
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) {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue