Fixed idle time counting.
This commit is contained in:
parent
d92c06520e
commit
21d9467607
@ -654,12 +654,19 @@ void call_help() {
|
|||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
|
||||||
void CheckTick(gkey quitkey) {
|
void CheckTick(gkey quitkey)
|
||||||
|
{
|
||||||
|
Clock idle_secs = gkbd.tickvalue - gkbd.tickpress;
|
||||||
|
|
||||||
Clock idle_secs = gkbd.tickvalue > gkbd.tickpress? (gkbd.tickvalue - gkbd.tickpress / 10L) : 0;
|
if (gkbd.tickvalue < gkbd.tickpress)
|
||||||
|
idle_secs = gkbd.tickpress - gkbd.tickvalue;
|
||||||
|
|
||||||
if(CFG->timeout) {
|
idle_secs /= 10;
|
||||||
if(idle_secs >= CFG->timeout) {
|
|
||||||
|
if (CFG->timeout)
|
||||||
|
{
|
||||||
|
if (idle_secs >= CFG->timeout)
|
||||||
|
{
|
||||||
kbput(quitkey);
|
kbput(quitkey);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -693,11 +700,16 @@ void CheckTick(gkey quitkey) {
|
|||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
|
||||||
void IdleCheckSemaphores() {
|
void IdleCheckSemaphores()
|
||||||
|
{
|
||||||
// I don't like this solution either... :(
|
// I don't like this solution either... :(
|
||||||
static Clock last_secs = 0;
|
static Clock last_secs = 0;
|
||||||
Clock idle_secs = (gkbd.tickvalue - gkbd.tickpress) / 10L;
|
Clock idle_secs = gkbd.tickvalue - gkbd.tickpress;
|
||||||
|
|
||||||
|
if (gkbd.tickvalue < gkbd.tickpress)
|
||||||
|
idle_secs = gkbd.tickpress - gkbd.tickvalue;
|
||||||
|
|
||||||
|
idle_secs /= 10;
|
||||||
|
|
||||||
// Make sure the stuff below is only run once in a second
|
// Make sure the stuff below is only run once in a second
|
||||||
if(not idle_secs or (idle_secs - last_secs == 0))
|
if(not idle_secs or (idle_secs - last_secs == 0))
|
||||||
|
Reference in New Issue
Block a user