Mercurial > sdl-ios-xcode
comparison src/SDL_compat.c @ 3025:54fac87e1f34
Added an API to enable/disable the screen saver.
The screensaver is disabled by default when using SDL 1.2 compatibility.
Use the new XScreenSaver extension, removed unused DPMS extension.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 12 Jan 2009 06:19:05 +0000 |
parents | e4a469d6ddab |
children | 1c4a059966bd |
comparison
equal
deleted
inserted
replaced
3024:1a08749aebce | 3025:54fac87e1f34 |
---|---|
374 black = SDL_MapRGB(SDL_PublicSurface->format, 0, 0, 0); | 374 black = SDL_MapRGB(SDL_PublicSurface->format, 0, 0, 0); |
375 SDL_FillRect(SDL_PublicSurface, NULL, black); | 375 SDL_FillRect(SDL_PublicSurface, NULL, black); |
376 SDL_UpdateRect(SDL_PublicSurface, 0, 0, 0, 0); | 376 SDL_UpdateRect(SDL_PublicSurface, 0, 0, 0, 0); |
377 } | 377 } |
378 | 378 |
379 static void | |
380 SetupScreenSaver() | |
381 { | |
382 const char *env; | |
383 SDL_bool allow_screensaver; | |
384 | |
385 /* Allow environment override of screensaver disable */ | |
386 env = SDL_getenv("SDL_VIDEO_ALLOW_SCREENSAVER"); | |
387 if (env) { | |
388 allow_screensaver = SDL_atoi(env) ? SDL_TRUE : SDL_FALSE; | |
389 } else { | |
390 allow_screensaver = SDL_FALSE; | |
391 } | |
392 if (allow_screensaver) { | |
393 SDL_EnableScreenSaver(); | |
394 } else { | |
395 SDL_DisableScreenSaver(); | |
396 } | |
397 } | |
398 | |
379 int | 399 int |
380 SDL_ResizeVideoMode(int width, int height, int bpp, Uint32 flags) | 400 SDL_ResizeVideoMode(int width, int height, int bpp, Uint32 flags) |
381 { | 401 { |
382 int w, h; | 402 int w, h; |
383 Uint32 format; | 403 Uint32 format; |
454 SDL_Surface * | 474 SDL_Surface * |
455 SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags) | 475 SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags) |
456 { | 476 { |
457 SDL_DisplayMode desktop_mode; | 477 SDL_DisplayMode desktop_mode; |
458 SDL_DisplayMode mode; | 478 SDL_DisplayMode mode; |
479 const char *env; | |
459 int window_x = SDL_WINDOWPOS_UNDEFINED; | 480 int window_x = SDL_WINDOWPOS_UNDEFINED; |
460 int window_y = SDL_WINDOWPOS_UNDEFINED; | 481 int window_y = SDL_WINDOWPOS_UNDEFINED; |
461 Uint32 window_flags; | 482 Uint32 window_flags; |
462 Uint32 desktop_format; | 483 Uint32 desktop_format; |
463 Uint32 desired_format; | 484 Uint32 desired_format; |
677 | 698 |
678 SDL_VideoFlags = flags; | 699 SDL_VideoFlags = flags; |
679 | 700 |
680 ClearVideoSurface(); | 701 ClearVideoSurface(); |
681 | 702 |
703 SetupScreenSaver(); | |
704 | |
682 /* We're finally done! */ | 705 /* We're finally done! */ |
683 return SDL_PublicSurface; | 706 return SDL_PublicSurface; |
684 } | 707 } |
685 | 708 |
686 SDL_Surface * | 709 SDL_Surface * |