/** * ?? Internal function. * * @return ?? */ MWBOOL GdTimeout(void) { MWTIMER *n, *t = timerlist; gettimeofday(¤t_time, NULL); while(t) { n = t->next; if(time_to_expiry(&t->timeout) <= 0) { t->callback(t->arg); if (t->type == MWTIMER_ONESHOT) { /* One shot timer, is finished delete it now */ GdDestroyTimer(t); } else { /* Periodic timer needs to be reset */ calculate_timeval (&t->timeout, t->period); } } t = n; } if(mainloop_timeout.tv_sec > 0 || mainloop_timeout.tv_usec > 0) if(time_to_expiry(&mainloop_timeout) <= 0) return TRUE; return FALSE; }
/* * Deactivate screen saver and reset timer if active. */ void GsResetScreenSaver(void) { MWTIMER *timer; if(screensaver_active == GR_TRUE) { screensaver_active = GR_FALSE; GsDeliverScreenSaverEvent(GR_FALSE); } if(screensaver_delay) { if((timer = GdFindTimer(GsActivateScreenSaver))) GdDestroyTimer(timer); GdAddTimer(screensaver_delay, GsActivateScreenSaver, GsActivateScreenSaver); } }
/* * Deactivate screen saver and reset timer if active. */ void GsResetScreenSaver(void) { #if MW_FEATURE_TIMERS MWTIMER *timer; #endif /* MW_FEATURE_TIMERS */ if(screensaver_active == GR_TRUE) { screensaver_active = GR_FALSE; GsDeliverScreenSaverEvent(GR_FALSE); } #if MW_FEATURE_TIMERS if(screensaver_delay) { if((timer = GdFindTimer(GsActivateScreenSaver))) GdDestroyTimer(timer); GdAddTimer(screensaver_delay, GsActivateScreenSaver, GsActivateScreenSaver); } #endif /* MW_FEATURE_TIMERS */ }