GrSetScreenSaverTimeout()

Name

GrSetScreenSaverTimeout() -- Set screen saver timeout

Synopsis

void GrSetScreenSaverTimeout ( GR_TIMEOUT timeout );

Description

This function sets the timeout period of the system's screen saver event.

Note

A bug in version 0.89-pre7 of Microwindows causes the timeout to be multiplied internally by 1000. Therefore when building with 0.89-pre7 you must set the timeout in seconds rather than milli-seconds.

Parameters

TypeNameDescription
GR_TIMEOUTtimeoutThe screen saver timeout period in milliseconds. If no pointer or keyboard input occurs for the duration of this timeout period, a GR_EVENT_SCREENSAVER event is sent to each window that has selected the event.

Example

The following example will turn an LCD backlight off when a 60 second screen saver timer expires, and restore the backlight when user input is resumed.

Example 2-1. Using GrSetScreenSaverTimeout()

 
void setup_screensaver (void)
{
    /* Set a one minute timeout for the LCD backlight */
    /* nano-X BUG: use seconds rather than mS for 0.89-pre7 */
    GrSetScreenSaverTimeout (60 * 1000);
}

void process_screensaver_event (GR_EVENT_SCREENSAVER *event)
{
    if (event->activate)
    {
        /* Turn the LCD backlight off */
        your_platforms_backlight_off();
    }
    else
    {
        /* Turn the LCD backlight on */
        your_platforms_backlight_on();
    }
}

See Also

GR_EVENT_SCREENSAVER.