From 1d87fab6ac58869ac10c75c6011f697c48c596e5 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Sat, 24 Aug 2002 19:31:24 +0000 Subject: timeout once per second --- src/Toolbar.cc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Toolbar.cc b/src/Toolbar.cc index d973a64..1786891 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Toolbar.cc,v 1.28 2002/08/17 22:22:57 fluxgen Exp $ +// $Id: Toolbar.cc,v 1.29 2002/08/24 19:31:24 fluxgen Exp $ #include "Toolbar.hh" @@ -81,9 +81,10 @@ iconbar(0) { fluxbox = Fluxbox::instance(); - timeval now; - gettimeofday(&now, 0); - clock_timer.setTimeout((60 - (now.tv_sec % 60)) * 1000); + timeval delay; + delay.tv_sec = 1; + delay.tv_usec = 0; + clock_timer.setTimeout(delay); clock_timer.start(); hide_handler.toolbar = this; @@ -584,6 +585,7 @@ void Toolbar::checkClock(bool redraw, bool date) { if (redraw) { + XClearWindow(display, frame.clock); #ifdef HAVE_STRFTIME char t[1024]; if (! strftime(t, 1024, screen->getStrftimeFormat(), tt)) @@ -1221,9 +1223,10 @@ void Toolbar::keyPressEvent(XKeyEvent *ke) { void Toolbar::timeout() { checkClock(true); - timeval now; - gettimeofday(&now, 0); - clock_timer.setTimeout((60 - (now.tv_sec % 60)) * 1000); + timeval delay; + delay.tv_sec = 1; + delay.tv_usec = 0; + clock_timer.setTimeout(delay); } -- cgit v0.11.2