comparison src/video/x11/SDL_x11video.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 b46bb79cc197
comparison
equal deleted inserted replaced
1544:ab1e4c41ab71 1545:8d9bb0cf2c2a
506 506
507 /* Get the available video modes */ 507 /* Get the available video modes */
508 if(X11_GetVideoModes(this) < 0) 508 if(X11_GetVideoModes(this) < 0)
509 return -1; 509 return -1;
510 510
511 /* Determine the current screen size */
512 this->info.current_w = DisplayWidth(SDL_Display, SDL_Screen);
513 this->info.current_h = DisplayHeight(SDL_Display, SDL_Screen);
514
511 /* Determine the default screen depth: 515 /* Determine the default screen depth:
512 Use the default visual (or at least one with the same depth) */ 516 Use the default visual (or at least one with the same depth) */
513 SDL_DisplayColormap = DefaultColormap(SDL_Display, SDL_Screen); 517 SDL_DisplayColormap = DefaultColormap(SDL_Display, SDL_Screen);
514 for(i = 0; i < this->hidden->nvisuals; i++) 518 for(i = 0; i < this->hidden->nvisuals; i++)
515 if(this->hidden->visuals[i].depth == DefaultDepth(SDL_Display, 519 if(this->hidden->visuals[i].depth == DefaultDepth(SDL_Display,
861 } 865 }
862 866
863 /* resize the (possibly new) window manager window */ 867 /* resize the (possibly new) window manager window */
864 if( !SDL_windowid ) { 868 if( !SDL_windowid ) {
865 X11_SetSizeHints(this, w, h, flags); 869 X11_SetSizeHints(this, w, h, flags);
866 current_w = w; 870 window_w = w;
867 current_h = h; 871 window_h = h;
868 pXResizeWindow(SDL_Display, WMwindow, w, h); 872 pXResizeWindow(SDL_Display, WMwindow, w, h);
869 } 873 }
870 874
871 /* Create (or use) the X11 display window */ 875 /* Create (or use) the X11 display window */
872 if ( !SDL_windowid ) { 876 if ( !SDL_windowid ) {
983 SDL_Surface *screen, int w, int h, Uint32 flags) 987 SDL_Surface *screen, int w, int h, Uint32 flags)
984 { 988 {
985 if ( ! SDL_windowid ) { 989 if ( ! SDL_windowid ) {
986 /* Resize the window manager window */ 990 /* Resize the window manager window */
987 X11_SetSizeHints(this, w, h, flags); 991 X11_SetSizeHints(this, w, h, flags);
988 current_w = w; 992 window_w = w;
989 current_h = h; 993 window_h = h;
990 pXResizeWindow(SDL_Display, WMwindow, w, h); 994 pXResizeWindow(SDL_Display, WMwindow, w, h);
991 995
992 /* Resize the fullscreen and display windows */ 996 /* Resize the fullscreen and display windows */
993 if ( flags & SDL_FULLSCREEN ) { 997 if ( flags & SDL_FULLSCREEN ) {
994 if ( screen->flags & SDL_FULLSCREEN ) { 998 if ( screen->flags & SDL_FULLSCREEN ) {