@ -52,6 +52,7 @@ void writefile(char *filepath, char *str);
// Variables
// Variables
Display * dpy ;
Display * dpy ;
enum State state = StateNoInput ;
enum State state = StateNoInput ;
int suspendtimeouts = 35 ;
int suspendpendingsceenon = 0 ;
int suspendpendingsceenon = 0 ;
int suspendpendingtimeouts = 0 ;
int suspendpendingtimeouts = 0 ;
KeySym lastkeysym = XK_Cancel ;
KeySym lastkeysym = XK_Cancel ;
@ -298,8 +299,8 @@ readinputloop(Display *dpy, int screen) {
}
}
} else if ( state = = StateSuspendPending ) {
} else if ( state = = StateSuspendPending ) {
suspendpendingtimeouts + + ;
suspendpendingtimeouts + + ;
// # E.g. after 4 s kick back into suspend
// # E.g. after suspendtimeouts second s kick back into suspend
if ( suspendpendingtimeouts > 4 ) state = StateSuspend ;
if ( suspendpendingtimeouts > suspendtimeouts ) state = StateSuspend ;
syncstate ( ) ;
syncstate ( ) ;
}
}
@ -439,6 +440,9 @@ main(int argc, char **argv) {
signal ( SIGTERM , sigterm ) ;
signal ( SIGTERM , sigterm ) ;
const char * suspendtimeouts_str = getenv ( " SXMO_SUSPENDTIMEOUTS " ) ;
if ( suspendtimeouts_str ! = NULL ) suspendtimeouts = atoi ( suspendtimeouts_str ) ;
const char * rtcwakeinterval = getenv ( " SXMO_RTCWAKEINTERVAL " ) ;
const char * rtcwakeinterval = getenv ( " SXMO_RTCWAKEINTERVAL " ) ;
if ( rtcwakeinterval ! = NULL ) wakeinterval = atoi ( rtcwakeinterval ) ;
if ( rtcwakeinterval ! = NULL ) wakeinterval = atoi ( rtcwakeinterval ) ;