timeout once per second
This commit is contained in:
parent
5ac4d4bcff
commit
1d87fab6ac
1 changed files with 10 additions and 7 deletions
|
@ -22,7 +22,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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"
|
#include "Toolbar.hh"
|
||||||
|
|
||||||
|
@ -81,9 +81,10 @@ iconbar(0) {
|
||||||
|
|
||||||
fluxbox = Fluxbox::instance();
|
fluxbox = Fluxbox::instance();
|
||||||
|
|
||||||
timeval now;
|
timeval delay;
|
||||||
gettimeofday(&now, 0);
|
delay.tv_sec = 1;
|
||||||
clock_timer.setTimeout((60 - (now.tv_sec % 60)) * 1000);
|
delay.tv_usec = 0;
|
||||||
|
clock_timer.setTimeout(delay);
|
||||||
clock_timer.start();
|
clock_timer.start();
|
||||||
|
|
||||||
hide_handler.toolbar = this;
|
hide_handler.toolbar = this;
|
||||||
|
@ -584,6 +585,7 @@ void Toolbar::checkClock(bool redraw, bool date) {
|
||||||
|
|
||||||
|
|
||||||
if (redraw) {
|
if (redraw) {
|
||||||
|
XClearWindow(display, frame.clock);
|
||||||
#ifdef HAVE_STRFTIME
|
#ifdef HAVE_STRFTIME
|
||||||
char t[1024];
|
char t[1024];
|
||||||
if (! strftime(t, 1024, screen->getStrftimeFormat(), tt))
|
if (! strftime(t, 1024, screen->getStrftimeFormat(), tt))
|
||||||
|
@ -1221,9 +1223,10 @@ void Toolbar::keyPressEvent(XKeyEvent *ke) {
|
||||||
void Toolbar::timeout() {
|
void Toolbar::timeout() {
|
||||||
checkClock(true);
|
checkClock(true);
|
||||||
|
|
||||||
timeval now;
|
timeval delay;
|
||||||
gettimeofday(&now, 0);
|
delay.tv_sec = 1;
|
||||||
clock_timer.setTimeout((60 - (now.tv_sec % 60)) * 1000);
|
delay.tv_usec = 0;
|
||||||
|
clock_timer.setTimeout(delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue