aboutsummaryrefslogtreecommitdiff
path: root/src/fluxbox.cc
diff options
context:
space:
mode:
authorMathias Gumz <akira at fluxbox dot org>2012-08-28 08:51:55 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2012-08-28 08:51:55 (GMT)
commit541c8c407b7ba8dd10f85bb48bcb5900270b3f84 (patch)
tree71a6abc0f2a43bcfd33f80b3b30b878f234cbf05 /src/fluxbox.cc
parent60a53113e05db443af4d520883ec3145680642a8 (diff)
downloadfluxbox-541c8c407b7ba8dd10f85bb48bcb5900270b3f84.zip
fluxbox-541c8c407b7ba8dd10f85bb48bcb5900270b3f84.tar.bz2
changed timing functions to use a monotonic increasing clock
gettimeofday() is subject to be changed on daylight-saving or to ntp-related (think leap-seconds). even worse, it is subject to be changed BACK in time. this is hard to fix correctly (see commit 45726d3016e and bug #3560509). it is irrelevant for timers to know the nano-seconds since the epoch anyways.
Diffstat (limited to 'src/fluxbox.cc')
-rw-r--r--src/fluxbox.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index 77b9881..129ac80 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -306,7 +306,7 @@ Fluxbox::Fluxbox(int argc, char **argv,
306 // because it could affect ongoing menu stuff so we need to reconfig in 306 // because it could affect ongoing menu stuff so we need to reconfig in
307 // the next event "round". 307 // the next event "round".
308 FbTk::RefCount<FbTk::Command<void> > reconfig_cmd(new FbTk::SimpleCommand<Fluxbox>(*this, &Fluxbox::timed_reconfigure)); 308 FbTk::RefCount<FbTk::Command<void> > reconfig_cmd(new FbTk::SimpleCommand<Fluxbox>(*this, &Fluxbox::timed_reconfigure));
309 m_reconfig_timer.setTimeout(0, 1); 309 m_reconfig_timer.setTimeout(1);
310 m_reconfig_timer.setCommand(reconfig_cmd); 310 m_reconfig_timer.setCommand(reconfig_cmd);
311 m_reconfig_timer.fireOnce(true); 311 m_reconfig_timer.fireOnce(true);
312 312
@@ -363,7 +363,6 @@ Fluxbox::Fluxbox(int argc, char **argv,
363 screens.push_back(i); 363 screens.push_back(i);
364 364
365 // find out, on what "screens" fluxbox should run 365 // find out, on what "screens" fluxbox should run
366 // FIXME(php-coder): maybe it worths moving this code to main.cc, where command line is parsed?
367 for (i = 1; i < m_argc; i++) { 366 for (i = 1; i < m_argc; i++) {
368 if (! strcmp(m_argv[i], "-screen")) { 367 if (! strcmp(m_argv[i], "-screen")) {
369 if ((++i) >= m_argc) { 368 if ((++i) >= m_argc) {
@@ -507,8 +506,11 @@ void Fluxbox::initScreen(BScreen *screen) {
507 506
508 507
509void Fluxbox::eventLoop() { 508void Fluxbox::eventLoop() {
509
510 Display *disp = display(); 510 Display *disp = display();
511
511 while (!m_shutdown) { 512 while (!m_shutdown) {
513
512 if (XPending(disp)) { 514 if (XPending(disp)) {
513 XEvent e; 515 XEvent e;
514 XNextEvent(disp, &e); 516 XNextEvent(disp, &e);
@@ -524,8 +526,9 @@ void Fluxbox::eventLoop() {
524 handleEvent(&e); 526 handleEvent(&e);
525 } 527 }
526 } else { 528 } else {
527 FbTk::Timer::updateTimers(ConnectionNumber(disp)); //handle all timers 529 FbTk::Timer::updateTimers(ConnectionNumber(disp));
528 } 530 }
531
529 } 532 }
530} 533}
531 534
@@ -553,9 +556,11 @@ void Fluxbox::ungrab() {
553} 556}
554 557
555void Fluxbox::handleEvent(XEvent * const e) { 558void Fluxbox::handleEvent(XEvent * const e) {
559
556 _FB_USES_NLS; 560 _FB_USES_NLS;
557 m_last_event = *e; 561 m_last_event = *e;
558 562
563
559 // it is possible (e.g. during moving) for a window 564 // it is possible (e.g. during moving) for a window
560 // to mask all events to go to it 565 // to mask all events to go to it
561 if ((m_masked == e->xany.window) && m_masked_window) { 566 if ((m_masked == e->xany.window) && m_masked_window) {