From 734e67d8b6f32be6c40ea9b78404e9795d1b2605 Mon Sep 17 00:00:00 2001 From: Ianos Gnatiuc Date: Sun, 9 Jul 2006 10:27:53 +0000 Subject: [PATCH] Fix idle time counting (2-nd try) --- golded3/geutil.cpp | 11 ++++------- golded3/geutil2.cpp | 8 ++++++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/golded3/geutil.cpp b/golded3/geutil.cpp index 67de64f..47616d2 100644 --- a/golded3/geutil.cpp +++ b/golded3/geutil.cpp @@ -656,12 +656,10 @@ void call_help() { void CheckTick(gkey quitkey) { - Clock idle_secs = gkbd.tickvalue - gkbd.tickpress; - if (gkbd.tickvalue < gkbd.tickpress) - idle_secs = gkbd.tickpress - gkbd.tickvalue; + gkbd.tickpress = gkbd.tickvalue; - idle_secs /= 10; + Clock idle_secs = (gkbd.tickvalue - gkbd.tickpress)/10; if (CFG->timeout) { @@ -704,12 +702,11 @@ void IdleCheckSemaphores() { // I don't like this solution either... :( static Clock last_secs = 0; - Clock idle_secs = gkbd.tickvalue - gkbd.tickpress; if (gkbd.tickvalue < gkbd.tickpress) - idle_secs = gkbd.tickpress - gkbd.tickvalue; + gkbd.tickpress = gkbd.tickvalue; - idle_secs /= 10; + Clock idle_secs = (gkbd.tickvalue - gkbd.tickpress)/10; // Make sure the stuff below is only run once in a second if(not idle_secs or (idle_secs - last_secs == 0)) diff --git a/golded3/geutil2.cpp b/golded3/geutil2.cpp index 0c87b56..cd06cf9 100644 --- a/golded3/geutil2.cpp +++ b/golded3/geutil2.cpp @@ -327,9 +327,13 @@ void ScreenBlankIdle() { } // If timed out, exit screenblanker - if(CFG->timeout) - if(gkbd.tickvalue >= (gkbd.tickpress+(CFG->timeout*10L))) + if (CFG->timeout) + { + if (gkbd.tickvalue < gkbd.tickpress) + gkbd.tickpress = gkbd.tickvalue; + if (gkbd.tickvalue >= (gkbd.tickpress+(CFG->timeout*10L))) kbput(Key_Tick); + } }