comparison src/video/x11/SDL_x11video.c @ 3936:c5c3c772f5aa SDL-1.2

Let app set SDL_VIDEO_ALLOW_SCREENSAVER environment variable to override SDL's attempt to disable screen savers. Works for Quartz (Mac OS X) and X11. Need a formal API for this in 1.3, still. Fixes Bugzilla #415.
author Ryan C. Gordon <icculus@icculus.org>
date Fri, 06 Apr 2007 20:30:41 +0000
parents a10bddfdc40f
children 3dc92ff218dd
comparison
equal deleted inserted replaced
3935:00959c391aa6 3936:c5c3c772f5aa
439 XSetWMProtocols(SDL_Display, WMwindow, &WM_DELETE_WINDOW, 1); 439 XSetWMProtocols(SDL_Display, WMwindow, &WM_DELETE_WINDOW, 1);
440 } 440 }
441 441
442 static int X11_VideoInit(_THIS, SDL_PixelFormat *vformat) 442 static int X11_VideoInit(_THIS, SDL_PixelFormat *vformat)
443 { 443 {
444 const char *env = NULL;
444 char *display; 445 char *display;
445 int i; 446 int i;
446 447
447 /* Open the X11 display */ 448 /* Open the X11 display */
448 display = NULL; /* Get it from DISPLAY environment variable */ 449 display = NULL; /* Get it from DISPLAY environment variable */
544 } 545 }
545 X11_SaveVidModeGamma(this); 546 X11_SaveVidModeGamma(this);
546 547
547 /* Save DPMS and screensaver settings */ 548 /* Save DPMS and screensaver settings */
548 X11_SaveScreenSaver(SDL_Display, &screensaver_timeout, &dpms_enabled); 549 X11_SaveScreenSaver(SDL_Display, &screensaver_timeout, &dpms_enabled);
549 X11_DisableScreenSaver(SDL_Display); 550 X11_DisableScreenSaver(this, SDL_Display);
550 551
551 /* See if we have been passed a window to use */ 552 /* See if we have been passed a window to use */
552 SDL_windowid = SDL_getenv("SDL_WINDOWID"); 553 SDL_windowid = SDL_getenv("SDL_WINDOWID");
553 554
554 /* Create the fullscreen and managed windows */ 555 /* Create the fullscreen and managed windows */
559 BLANK_CWIDTH, BLANK_CHEIGHT, 560 BLANK_CWIDTH, BLANK_CHEIGHT,
560 BLANK_CHOTX, BLANK_CHOTY); 561 BLANK_CHOTX, BLANK_CHOTY);
561 562
562 /* Fill in some window manager capabilities */ 563 /* Fill in some window manager capabilities */
563 this->info.wm_available = 1; 564 this->info.wm_available = 1;
565
566 /* Allow environment override of screensaver disable. */
567 env = SDL_getenv("SDL_VIDEO_ALLOW_SCREENSAVER");
568 this->hidden->allow_screensaver = ( (env && SDL_atoi(env)) ? 1 : 0 );
564 569
565 /* We're done! */ 570 /* We're done! */
566 XFlush(SDL_Display); 571 XFlush(SDL_Display);
567 return(0); 572 return(0);
568 } 573 }
1373 if ( SDL_GetAppState() & SDL_APPACTIVE ) { 1378 if ( SDL_GetAppState() & SDL_APPACTIVE ) {
1374 X11_SwapVidModeGamma(this); 1379 X11_SwapVidModeGamma(this);
1375 } 1380 }
1376 1381
1377 /* Restore DPMS and screensaver settings */ 1382 /* Restore DPMS and screensaver settings */
1378 X11_RestoreScreenSaver(SDL_Display, screensaver_timeout, dpms_enabled); 1383 X11_RestoreScreenSaver(this, SDL_Display, screensaver_timeout, dpms_enabled);
1379 1384
1380 /* Free that blank cursor */ 1385 /* Free that blank cursor */
1381 if ( SDL_BlankCursor != NULL ) { 1386 if ( SDL_BlankCursor != NULL ) {
1382 this->FreeWMCursor(this, SDL_BlankCursor); 1387 this->FreeWMCursor(this, SDL_BlankCursor);
1383 SDL_BlankCursor = NULL; 1388 SDL_BlankCursor = NULL;