diff options
author | fluxgen <fluxgen> | 2002-08-24 19:31:24 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2002-08-24 19:31:24 (GMT) |
commit | 1d87fab6ac58869ac10c75c6011f697c48c596e5 (patch) | |
tree | 1817421b2bb42640a1cb93b99172755208c64830 | |
parent | 5ac4d4bcff5fdaabdfe29135c93016c8067dc5b2 (diff) | |
download | fluxbox-1d87fab6ac58869ac10c75c6011f697c48c596e5.zip fluxbox-1d87fab6ac58869ac10c75c6011f697c48c596e5.tar.bz2 |
timeout once per second
-rw-r--r-- | src/Toolbar.cc | 17 |
1 files 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 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Toolbar.cc,v 1.28 2002/08/17 22:22:57 fluxgen Exp $ | 25 | // $Id: Toolbar.cc,v 1.29 2002/08/24 19:31:24 fluxgen Exp $ |
26 | 26 | ||
27 | #include "Toolbar.hh" | 27 | #include "Toolbar.hh" |
28 | 28 | ||
@@ -81,9 +81,10 @@ iconbar(0) { | |||
81 | 81 | ||
82 | fluxbox = Fluxbox::instance(); | 82 | fluxbox = Fluxbox::instance(); |
83 | 83 | ||
84 | timeval now; | 84 | timeval delay; |
85 | gettimeofday(&now, 0); | 85 | delay.tv_sec = 1; |
86 | clock_timer.setTimeout((60 - (now.tv_sec % 60)) * 1000); | 86 | delay.tv_usec = 0; |
87 | clock_timer.setTimeout(delay); | ||
87 | clock_timer.start(); | 88 | clock_timer.start(); |
88 | 89 | ||
89 | hide_handler.toolbar = this; | 90 | hide_handler.toolbar = this; |
@@ -584,6 +585,7 @@ void Toolbar::checkClock(bool redraw, bool date) { | |||
584 | 585 | ||
585 | 586 | ||
586 | if (redraw) { | 587 | if (redraw) { |
588 | XClearWindow(display, frame.clock); | ||
587 | #ifdef HAVE_STRFTIME | 589 | #ifdef HAVE_STRFTIME |
588 | char t[1024]; | 590 | char t[1024]; |
589 | if (! strftime(t, 1024, screen->getStrftimeFormat(), tt)) | 591 | if (! strftime(t, 1024, screen->getStrftimeFormat(), tt)) |
@@ -1221,9 +1223,10 @@ void Toolbar::keyPressEvent(XKeyEvent *ke) { | |||
1221 | void Toolbar::timeout() { | 1223 | void Toolbar::timeout() { |
1222 | checkClock(true); | 1224 | checkClock(true); |
1223 | 1225 | ||
1224 | timeval now; | 1226 | timeval delay; |
1225 | gettimeofday(&now, 0); | 1227 | delay.tv_sec = 1; |
1226 | clock_timer.setTimeout((60 - (now.tv_sec % 60)) * 1000); | 1228 | delay.tv_usec = 0; |
1229 | clock_timer.setTimeout(delay); | ||
1227 | } | 1230 | } |
1228 | 1231 | ||
1229 | 1232 | ||