comparison src/video/x11/SDL_x11modes.c @ 1545:8d9bb0cf2c2a

Added current_w and current_h to the SDL_VideoInfo structure, which is set to the desktop resolution during video intialization, and then set to the current resolution when a video mode is set. SDL_SetVideoMode() now accepts 0 for width or height and will use the current video mode (or the desktop mode if no mode has been set.)
author Sam Lantinga <slouken@libsdl.org>
date Wed, 15 Mar 2006 17:46:41 +0000
parents d910939febfa
children 3ba88cb7eb1b
comparison
equal deleted inserted replaced
1544:ab1e4c41ab71 1545:8d9bb0cf2c2a
650 x = xinerama_x; 650 x = xinerama_x;
651 y = xinerama_y; 651 y = xinerama_y;
652 if ( currently_fullscreen ) { 652 if ( currently_fullscreen ) {
653 /* Switch resolution and cover it with the FSwindow */ 653 /* Switch resolution and cover it with the FSwindow */
654 move_cursor_to(this, x, y); 654 move_cursor_to(this, x, y);
655 set_best_resolution(this, current_w, current_h); 655 set_best_resolution(this, window_w, window_h);
656 move_cursor_to(this, x, y); 656 move_cursor_to(this, x, y);
657 get_real_resolution(this, &real_w, &real_h); 657 get_real_resolution(this, &real_w, &real_h);
658 if ( current_w > real_w ) { 658 if ( window_w > real_w ) {
659 real_w = MAX(real_w, screen_w); 659 real_w = MAX(real_w, screen_w);
660 } 660 }
661 if ( current_h > real_h ) { 661 if ( window_h > real_h ) {
662 real_h = MAX(real_h, screen_h); 662 real_h = MAX(real_h, screen_h);
663 } 663 }
664 pXMoveResizeWindow(SDL_Display, FSwindow, x, y, real_w, real_h); 664 pXMoveResizeWindow(SDL_Display, FSwindow, x, y, real_w, real_h);
665 move_cursor_to(this, real_w/2, real_h/2); 665 move_cursor_to(this, real_w/2, real_h/2);
666 666
667 /* Center and reparent the drawing window */ 667 /* Center and reparent the drawing window */
668 x = (real_w - current_w)/2; 668 x = (real_w - window_w)/2;
669 y = (real_h - current_h)/2; 669 y = (real_h - window_h)/2;
670 pXReparentWindow(SDL_Display, SDL_Window, FSwindow, x, y); 670 pXReparentWindow(SDL_Display, SDL_Window, FSwindow, x, y);
671 /* FIXME: move the mouse to the old relative location */ 671 /* FIXME: move the mouse to the old relative location */
672 pXSync(SDL_Display, True); /* Flush spurious mode change events */ 672 pXSync(SDL_Display, True); /* Flush spurious mode change events */
673 } 673 }
674 return(1); 674 return(1);
704 704
705 /* Map the fullscreen window to blank the screen */ 705 /* Map the fullscreen window to blank the screen */
706 screen_w = DisplayWidth(SDL_Display, SDL_Screen); 706 screen_w = DisplayWidth(SDL_Display, SDL_Screen);
707 screen_h = DisplayHeight(SDL_Display, SDL_Screen); 707 screen_h = DisplayHeight(SDL_Display, SDL_Screen);
708 get_real_resolution(this, &real_w, &real_h); 708 get_real_resolution(this, &real_w, &real_h);
709 if ( current_w > real_w ) { 709 if ( window_w > real_w ) {
710 real_w = MAX(real_w, screen_w); 710 real_w = MAX(real_w, screen_w);
711 } 711 }
712 if ( current_h > real_h ) { 712 if ( window_h > real_h ) {
713 real_h = MAX(real_h, screen_h); 713 real_h = MAX(real_h, screen_h);
714 } 714 }
715 pXMoveResizeWindow(SDL_Display, FSwindow, 715 pXMoveResizeWindow(SDL_Display, FSwindow,
716 xinerama_x, xinerama_y, real_w, real_h); 716 xinerama_x, xinerama_y, real_w, real_h);
717 pXMapRaised(SDL_Display, FSwindow); 717 pXMapRaised(SDL_Display, FSwindow);