Fix idle time counting (2-nd try)

This commit is contained in:
Ianos Gnatiuc 2006-07-09 10:27:53 +00:00
parent bceb23563b
commit 734e67d8b6
2 changed files with 10 additions and 9 deletions

View File

@ -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))

View File

@ -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);
}
}