The GR_EVENT_SCREENSAVER structure is used to facilitate activation and deactivation of a screen saver. The event is sent to activate a screen saver when the screen saver timer expires with no user input. The event is also sent to deactivate a screen saver if the screen saver is active and some user input is detected.
![]() | 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. |
| Type | Name | Description |
|---|---|---|
| GR_EVENT_TYPE | type | The event type will be a GR_EVENT_TYPE_SCREENSAVER. |
| GR_BOOL | activate | This field indicates whether the screen saver is being activated or deactivated. If the value is GR_TRUE then the screen saver should be started. If the value is GR_FALSE then the screen saver should be turned off (screen restored). |
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 3-1. Using GR_EVENT_SCREENSAVER
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();
}
} |