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.
authorSam Lantinga <slouken@libsdl.org>
Wed, 15 Mar 2006 17:46:41 +0000
changeset 15458d9bb0cf2c2a
parent 1544 ab1e4c41ab71
child 1546 4b835e36633d
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.)
WhatsNew
include/SDL_video.h
src/video/SDL_video.c
src/video/bwindow/SDL_sysvideo.cc
src/video/cybergfx/SDL_cgxvideo.c
src/video/cybergfx/SDL_cgxvideo.h
src/video/dga/SDL_dgavideo.c
src/video/epoc/SDL_epocvideo.cpp
src/video/fbcon/SDL_fbvideo.c
src/video/gapi/SDL_gapivideo.c
src/video/gem/SDL_gemvideo.c
src/video/ggi/SDL_ggivideo.c
src/video/ipod/SDL_ipodvideo.c
src/video/macdsp/SDL_dspvideo.c
src/video/macrom/SDL_romvideo.c
src/video/nanox/SDL_nxvideo.c
src/video/os2fslib/SDL_os2fslib.c
src/video/photon/SDL_ph_video.c
src/video/picogui/SDL_pgvideo.c
src/video/ps2gs/SDL_gsvideo.c
src/video/qtopia/SDL_sysvideo.cc
src/video/quartz/SDL_QuartzVideo.m
src/video/riscos/SDL_riscosvideo.c
src/video/svga/SDL_svgavideo.c
src/video/vgl/SDL_vglvideo.c
src/video/windib/SDL_dibvideo.c
src/video/windx5/SDL_dx5video.c
src/video/wscons/SDL_wsconsvideo.c
src/video/x11/SDL_x11modes.c
src/video/x11/SDL_x11video.c
src/video/x11/SDL_x11video.h
src/video/xbios/SDL_xbios.c
test/testvidinfo.c
     1.1 --- a/WhatsNew	Wed Mar 15 15:47:49 2006 +0000
     1.2 +++ b/WhatsNew	Wed Mar 15 17:46:41 2006 +0000
     1.3 @@ -4,7 +4,15 @@
     1.4  Version 1.0:
     1.5  
     1.6  1.2.10:
     1.7 +	Added current_w and current_h to the SDL_VideoInfo structure,
     1.8 +	which is set to the desktop resolution during video intialization,
     1.9 +	and then set to the current resolution when a video mode is set.
    1.10 +
    1.11 +	SDL_SetVideoMode() now accepts 0 for width or height and will use
    1.12 +	the current video mode (or the desktop mode if no mode has been set.)
    1.13 +
    1.14  	Added SDL_GetKeyRepeat()
    1.15 +
    1.16  	Added SDL_config.h, with defaults for various build environments.
    1.17  
    1.18  1.2.7:
     2.1 --- a/include/SDL_video.h	Wed Mar 15 15:47:49 2006 +0000
     2.2 +++ b/include/SDL_video.h	Wed Mar 15 17:46:41 2006 +0000
     2.3 @@ -161,6 +161,8 @@
     2.4  	Uint32 UnusedBits3  :16;
     2.5  	Uint32 video_mem;	/* The total amount of video memory (in K) */
     2.6  	SDL_PixelFormat *vfmt;	/* Value: The format of the video surface */
     2.7 +	int    current_w;	/* Value: The current video mode width */
     2.8 +	int    current_h;	/* Value: The current video mode height */
     2.9  } SDL_VideoInfo;
    2.10  
    2.11  
     3.1 --- a/src/video/SDL_video.c	Wed Mar 15 15:47:49 2006 +0000
     3.2 +++ b/src/video/SDL_video.c	Wed Mar 15 17:46:41 2006 +0000
     3.3 @@ -587,6 +587,13 @@
     3.4  	}
     3.5  	this = video = current_video;
     3.6  
     3.7 +	/* Default to the current width and height */
     3.8 +	if ( width == 0 ) {
     3.9 +		width = video->info.current_w;
    3.10 +	}
    3.11 +	if ( height == 0 ) {
    3.12 +		height = video->info.current_h;
    3.13 +	}
    3.14  	/* Default to the current video bpp */
    3.15  	if ( bpp == 0 ) {
    3.16  		flags |= SDL_ANYFORMAT;
    3.17 @@ -889,6 +896,8 @@
    3.18  		SDL_PublicSurface = SDL_VideoSurface;
    3.19  	}
    3.20  	video->info.vfmt = SDL_VideoSurface->format;
    3.21 +	video->info.current_w = SDL_VideoSurface->w;
    3.22 +	video->info.current_h = SDL_VideoSurface->h;
    3.23  
    3.24  	/* We're done! */
    3.25  	return(SDL_PublicSurface);
     4.1 --- a/src/video/bwindow/SDL_sysvideo.cc	Wed Mar 15 15:47:49 2006 +0000
     4.2 +++ b/src/video/bwindow/SDL_sysvideo.cc	Wed Mar 15 17:46:41 2006 +0000
     4.3 @@ -275,6 +275,8 @@
     4.4  
     4.5  	/* Save the current display mode */
     4.6  	bscreen.GetMode(&saved_mode);
     4.7 +	_this->info.current_w = saved_mode.virtual_width;
     4.8 +	_this->info.current_h = saved_mode.virtual_height;
     4.9  
    4.10  	/* Determine the screen depth */
    4.11  	vformat->BitsPerPixel = ColorSpaceToBitsPerPixel(bscreen.ColorSpace());
     5.1 --- a/src/video/cybergfx/SDL_cgxvideo.c	Wed Mar 15 15:47:49 2006 +0000
     5.2 +++ b/src/video/cybergfx/SDL_cgxvideo.c	Wed Mar 15 17:46:41 2006 +0000
     5.3 @@ -463,6 +463,8 @@
     5.4  		SDL_SetError("Couldn't lock the display");
     5.5  		return(-1);
     5.6  	}
     5.7 +	this->info.current_w = SDL_Display->Width;
     5.8 +	this->info.current_h = SDL_Display->Height;
     5.9  
    5.10  	D(bug("Checking if we are using a CGX native display...\n"));
    5.11  
    5.12 @@ -834,8 +836,6 @@
    5.13  
    5.14  	if( !SDL_windowid ) {
    5.15  	    CGX_SetSizeHints(this, w, h, flags);
    5.16 -		current_w = w;
    5.17 -		current_h = h;
    5.18  	}
    5.19  
    5.20  	/* Set our colormaps when not setting a GL mode */
    5.21 @@ -885,8 +885,6 @@
    5.22  	if ( ! SDL_windowid ) {
    5.23  		/* Resize the window manager window */
    5.24  		CGX_SetSizeHints(this, w, h, flags);
    5.25 -		current_w = w;
    5.26 -		current_h = h;
    5.27  
    5.28  		ChangeWindowBox(SDL_Window,SDL_Window->LeftEdge,SDL_Window->TopEdge, w+SDL_Window->BorderLeft+SDL_Window->BorderRight,
    5.29  					h+SDL_Window->BorderTop+SDL_Window->BorderBottom);
     6.1 --- a/src/video/cybergfx/SDL_cgxvideo.h	Wed Mar 15 15:47:49 2006 +0000
     6.2 +++ b/src/video/cybergfx/SDL_cgxvideo.h	Wed Mar 15 17:46:41 2006 +0000
     6.3 @@ -67,10 +67,6 @@
     6.4      Uint8 *Ximage;		/* The X image for our window */
     6.5      int swap_pixels;		/* Flag: true if display is swapped endian */
     6.6  
     6.7 -    /* The current width and height of the fullscreen mode */
     6.8 -    int current_w;
     6.9 -    int current_h;
    6.10 -
    6.11      /* Support for internal mouse warping */
    6.12      struct {
    6.13          int x;
    6.14 @@ -132,8 +128,6 @@
    6.15  #define SDL_Ximage		(this->hidden->Ximage)
    6.16  #define SDL_GC			(this->hidden->gc)
    6.17  #define swap_pixels		(this->hidden->swap_pixels)
    6.18 -#define current_w		(this->hidden->current_w)
    6.19 -#define current_h		(this->hidden->current_h)
    6.20  #define mouse_last		(this->hidden->mouse_last)
    6.21  #define mouse_accel		(this->hidden->mouse_accel)
    6.22  #define mouse_relative		(this->hidden->mouse_relative)
     7.1 --- a/src/video/dga/SDL_dgavideo.c	Wed Mar 15 15:47:49 2006 +0000
     7.2 +++ b/src/video/dga/SDL_dgavideo.c	Wed Mar 15 17:46:41 2006 +0000
     7.3 @@ -349,6 +349,10 @@
     7.4  	}
     7.5  	DGA_event_base = event_base;
     7.6  
     7.7 +	/* Determine the current screen size */
     7.8 +	this->info.current_w = DisplayWidth(DGA_Display, DGA_Screen);
     7.9 +	this->info.current_h = DisplayHeight(DGA_Display, DGA_Screen);
    7.10 +
    7.11  	/* Determine the current screen depth */
    7.12  	visual = DefaultVisual(DGA_Display, DGA_Screen);
    7.13  	{
     8.1 --- a/src/video/epoc/SDL_epocvideo.cpp	Wed Mar 15 15:47:49 2006 +0000
     8.2 +++ b/src/video/epoc/SDL_epocvideo.cpp	Wed Mar 15 17:46:41 2006 +0000
     8.3 @@ -291,6 +291,9 @@
     8.4  
     8.5      #endif /* __WINS__ */
     8.6  
     8.7 +    _this->info.current_w = Private->EPOC_ScreenSize.iWidth;
     8.8 +    _this->info.current_h = Private->EPOC_ScreenSize.iHeight;
     8.9 +
    8.10      /* The "best" video format should be returned to caller. */
    8.11  
    8.12      vformat->BitsPerPixel       = /*!!GetBpp(displayMode) */ 8;
     9.1 --- a/src/video/fbcon/SDL_fbvideo.c	Wed Mar 15 15:47:49 2006 +0000
     9.2 +++ b/src/video/fbcon/SDL_fbvideo.c	Wed Mar 15 17:46:41 2006 +0000
     9.3 @@ -636,6 +636,8 @@
     9.4  	}
     9.5  
     9.6  	/* Fill in our hardware acceleration capabilities */
     9.7 +	this->info.current_w = current_w;
     9.8 +	this->info.current_h = current_h;
     9.9  	this->info.wm_available = 0;
    9.10  	this->info.hw_available = 1;
    9.11  	this->info.video_mem = finfo.smem_len/1024;
    10.1 --- a/src/video/gapi/SDL_gapivideo.c	Wed Mar 15 15:47:49 2006 +0000
    10.2 +++ b/src/video/gapi/SDL_gapivideo.c	Wed Mar 15 17:46:41 2006 +0000
    10.3 @@ -529,6 +529,10 @@
    10.4  		GAPI_AddMode(this, bpp, gapi->gxProperties.cxWidth, gapi->gxProperties.cyHeight);	
    10.5  	}
    10.6  
    10.7 +	/* Determine the current screen size */
    10.8 +	this->info.current_w = gapi->gxProperties.cxWidth;
    10.9 +	this->info.current_h = gapi->gxProperties.cyHeight;
   10.10 +
   10.11  	/* Sort the mode lists */
   10.12  	for ( i=0; i<NUM_MODELISTS; ++i ) {
   10.13  		if ( gapi->SDL_nummodes[i] > 0 ) {
    11.1 --- a/src/video/gem/SDL_gemvideo.c	Wed Mar 15 15:47:49 2006 +0000
    11.2 +++ b/src/video/gem/SDL_gemvideo.c	Wed Mar 15 17:46:41 2006 +0000
    11.3 @@ -430,9 +430,9 @@
    11.4  	/* Setup destination mfdb */
    11.5  	VDI_dst_mfdb.fd_addr = NULL;
    11.6  
    11.7 -	/* Update hardware info */
    11.8 -	this->info.hw_available = 0;
    11.9 -	this->info.video_mem = 0;
   11.10 +	/* Determine the current screen size */
   11.11 +	this->info.current_w = VDI_w;
   11.12 +	this->info.current_h = VDI_h;
   11.13  
   11.14  	/* Determine the screen depth */
   11.15  	/* we change this during the SDL_SetVideoMode implementation... */
    12.1 --- a/src/video/ggi/SDL_ggivideo.c	Wed Mar 15 15:47:49 2006 +0000
    12.2 +++ b/src/video/ggi/SDL_ggivideo.c	Wed Mar 15 17:46:41 2006 +0000
    12.3 @@ -197,6 +197,10 @@
    12.4  		GGI_VideoQuit(NULL);
    12.5  	}
    12.6  
    12.7 +	/* Determine the current screen size */
    12.8 +	this->info.current_w = mode.virt.x;
    12.9 +	this->info.current_h = mode.virt.y;
   12.10 +
   12.11  	/* Set a palette for palletized modes */
   12.12  	if (GT_SCHEME(mode.graphtype) == GT_PALETTE)
   12.13  	{
    13.1 --- a/src/video/ipod/SDL_ipodvideo.c	Wed Mar 15 15:47:49 2006 +0000
    13.2 +++ b/src/video/ipod/SDL_ipodvideo.c	Wed Mar 15 17:46:41 2006 +0000
    13.3 @@ -287,6 +287,10 @@
    13.4  
    13.5  	fcntl (kbfd, F_SETFL, O_RDWR | O_NONBLOCK);
    13.6  
    13.7 +	/* Determine the current screen size */
    13.8 +	this->info.current_w = lcd_width;
    13.9 +	this->info.current_h = lcd_height;
   13.10 +
   13.11  	if ((generation >= 60000) && (generation < 70000)) {
   13.12  	    vformat->BitsPerPixel = 16;
   13.13  	    vformat->Rmask = 0xF800;
    14.1 --- a/src/video/macdsp/SDL_dspvideo.c	Wed Mar 15 15:47:49 2006 +0000
    14.2 +++ b/src/video/macdsp/SDL_dspvideo.c	Wed Mar 15 17:46:41 2006 +0000
    14.3 @@ -329,7 +329,7 @@
    14.4  };
    14.5  
    14.6  /* Use DSp/Display Manager to build mode list for given screen */
    14.7 -static SDL_Rect**  DSp_BuildModeList (const GDHandle gDevice)
    14.8 +static SDL_Rect**  DSp_BuildModeList (const GDHandle gDevice, int *displayWidth, int *displayHeight)
    14.9  {
   14.10  	DSpContextAttributes  attributes;
   14.11  	DSpContextReference   context;
   14.12 @@ -355,6 +355,9 @@
   14.13  	
   14.14  	if ( DSpContext_GetAttributes (context, &attributes) != noErr )
   14.15  		return NULL;
   14.16 +
   14.17 +	*displayWidth = attributes.displayWidth;
   14.18 +	*displayHeight = attributes.displayHeight;
   14.19  			
   14.20  	for ( i = 0; i < SDL_arraysize(temp_list); i++ ) {
   14.21  		width  = attributes.displayWidth;
   14.22 @@ -556,14 +559,14 @@
   14.23  			break;
   14.24  	}
   14.25     
   14.26 -   if ( DSp_CreatePalette (this) < 0 ) {
   14.27 -   
   14.28 -      SDL_SetError ("Could not create palette");
   14.29 -      return (-1);
   14.30 -   }
   14.31 +	if ( DSp_CreatePalette (this) < 0 ) {
   14.32 +		SDL_SetError ("Could not create palette");
   14.33 +		return (-1);
   14.34 +	}
   14.35     
   14.36  	/* Get a list of available fullscreen modes */
   14.37 -	SDL_modelist = DSp_BuildModeList (SDL_Display);
   14.38 +	SDL_modelist = DSp_BuildModeList (SDL_Display,
   14.39 +	                                  &this->info.current_w, &this->info.current_h);
   14.40  	if (SDL_modelist == NULL) {
   14.41  		SDL_SetError ("DrawSprocket could not build a mode list");
   14.42  		return (-1);
    15.1 --- a/src/video/macrom/SDL_romvideo.c	Wed Mar 15 15:47:49 2006 +0000
    15.2 +++ b/src/video/macrom/SDL_romvideo.c	Wed Mar 15 17:46:41 2006 +0000
    15.3 @@ -203,6 +203,10 @@
    15.4  	/* Get a handle to the main monitor */
    15.5  	SDL_Display = GetMainDevice();
    15.6  
    15.7 +	/* Determine the current screen size */
    15.8 +	this->info.current_w = (**SDL_Display).gdRect.right;
    15.9 +	this->info.current_h = (**SDL_Display).gdRect.bottom;
   15.10 +
   15.11  	/* Determine pixel format */
   15.12  	vformat->BitsPerPixel = (**(**SDL_Display).gdPMap).pixelSize;
   15.13  	switch (vformat->BitsPerPixel) {
    16.1 --- a/src/video/nanox/SDL_nxvideo.c	Wed Mar 15 15:47:49 2006 +0000
    16.2 +++ b/src/video/nanox/SDL_nxvideo.c	Wed Mar 15 17:46:41 2006 +0000
    16.3 @@ -209,6 +209,10 @@
    16.4      GrGetScreenInfo (& si) ;
    16.5      SDL_Visual.bpp = si.bpp ;
    16.6  
    16.7 +    /* Determine the current screen size */
    16.8 +    this->info.current_w = si.cols ;
    16.9 +    this->info.current_h = si.rows ;
   16.10 +
   16.11      // GetVideoMode
   16.12      SDL_modelist = (SDL_Rect **) SDL_malloc (sizeof (SDL_Rect *) * 2) ;
   16.13      if (SDL_modelist) {
    17.1 --- a/src/video/os2fslib/SDL_os2fslib.c	Wed Mar 15 15:47:49 2006 +0000
    17.2 +++ b/src/video/os2fslib/SDL_os2fslib.c	Wed Mar 15 17:46:41 2006 +0000
    17.3 @@ -2724,6 +2724,10 @@
    17.4      return -1;
    17.5    }
    17.6  
    17.7 +  /* Determine the current screen size */
    17.8 +  _this->info.current_w = 0; // FIXME!
    17.9 +  _this->info.current_h = 0; // FIXME!
   17.10 +
   17.11    /* Determine the screen depth */
   17.12    vformat->BitsPerPixel = pDesktopMode->uiBPP;
   17.13    vformat->BytesPerPixel = (vformat->BitsPerPixel+7)/8;
    18.1 --- a/src/video/photon/SDL_ph_video.c	Wed Mar 15 15:47:49 2006 +0000
    18.2 +++ b/src/video/photon/SDL_ph_video.c	Wed Mar 15 17:46:41 2006 +0000
    18.3 @@ -400,6 +400,10 @@
    18.4          return -1;
    18.5      }
    18.6  
    18.7 +   /* Determine the current screen size */
    18.8 +   this->info.current_w = desktop_mode.width;
    18.9 +   this->info.current_h = desktop_mode.height;
   18.10 +
   18.11      /* We need to return BytesPerPixel as it in used by CreateRGBsurface */
   18.12      vformat->BitsPerPixel = desktop_mode.bits_per_pixel;
   18.13      vformat->BytesPerPixel = desktop_mode.bytes_per_scanline/desktop_mode.width;
    19.1 --- a/src/video/picogui/SDL_pgvideo.c	Wed Mar 15 15:47:49 2006 +0000
    19.2 +++ b/src/video/picogui/SDL_pgvideo.c	Wed Mar 15 17:46:41 2006 +0000
    19.3 @@ -166,6 +166,10 @@
    19.4  
    19.5  	PG_InitEvents(this);
    19.6  
    19.7 +	/* Determine the current screen size */
    19.8 +	this->info.current_w = this->hidden->mi.lxres;
    19.9 +	this->info.current_h = this->hidden->mi.lyres;
   19.10 +
   19.11  	/* Determine the screen depth.
   19.12  	 * We change this during the SDL_SetVideoMode implementation... 
   19.13  	 * Round up to the nearest Bytes per pixel
    20.1 --- a/src/video/ps2gs/SDL_gsvideo.c	Wed Mar 15 15:47:49 2006 +0000
    20.2 +++ b/src/video/ps2gs/SDL_gsvideo.c	Wed Mar 15 17:46:41 2006 +0000
    20.3 @@ -298,7 +298,6 @@
    20.4  		return(-1);
    20.5  	}
    20.6  
    20.7 -	/* Determine the current screen depth */
    20.8  	if ( ioctl(console_fd, PS2IOC_GSCREENINFO, &vinfo) < 0 ) {
    20.9  		close(memory_fd);
   20.10  		close(console_fd);
   20.11 @@ -306,6 +305,12 @@
   20.12  		SDL_SetError("Couldn't get console pixel format");
   20.13  		return(-1);
   20.14  	}
   20.15 +
   20.16 +	/* Determine the current screen size */
   20.17 +	this->info.current_w = vinfo.w;
   20.18 +	this->info.current_h = vinfo.h;
   20.19 +
   20.20 +	/* Determine the current screen depth */
   20.21  	switch (vinfo.psm) {
   20.22  	    /* Supported pixel formats */
   20.23  	    case PS2_GS_PSMCT32:
    21.1 --- a/src/video/qtopia/SDL_sysvideo.cc	Wed Mar 15 15:47:49 2006 +0000
    21.2 +++ b/src/video/qtopia/SDL_sysvideo.cc	Wed Mar 15 17:46:41 2006 +0000
    21.3 @@ -226,6 +226,10 @@
    21.4      QT_AddMode(_this, ((vformat->BitsPerPixel+7)/8)-1,
    21.5  	       desktop_size.height(), desktop_size.width());
    21.6  
    21.7 +    /* Determine the current screen size */
    21.8 +    this->info.current_w = desktop_size.width();
    21.9 +    this->info.current_h = desktop_size.height();
   21.10 +
   21.11      /* Create the window / widget */
   21.12      SDL_Win = new SDL_QWin(QSize(QT_HIDDEN_SIZE, QT_HIDDEN_SIZE));
   21.13      ((QPEApplication*)qApp)->showMainWidget(SDL_Win);
    22.1 --- a/src/video/quartz/SDL_QuartzVideo.m	Wed Mar 15 15:47:49 2006 +0000
    22.2 +++ b/src/video/quartz/SDL_QuartzVideo.m	Wed Mar 15 17:46:41 2006 +0000
    22.3 @@ -200,6 +200,11 @@
    22.4      CFNumberGetValue (CFDictionaryGetValue (save_mode, kCGDisplayHeight),
    22.5                        kCFNumberSInt32Type, &device_height);
    22.6  
    22.7 +    /* Determine the current screen size */
    22.8 +    this->info.current_w = device_width;
    22.9 +    this->info.current_h = device_height;
   22.10 +
   22.11 +    /* Determine the default screen depth */
   22.12      video_format->BitsPerPixel = device_bpp;
   22.13  
   22.14      /* Set misc globals */
    23.1 --- a/src/video/riscos/SDL_riscosvideo.c	Wed Mar 15 15:47:49 2006 +0000
    23.2 +++ b/src/video/riscos/SDL_riscosvideo.c	Wed Mar 15 17:46:41 2006 +0000
    23.3 @@ -175,6 +175,10 @@
    23.4  	_kernel_swi(OS_ReadModeVariable, &regs, &regs);
    23.5  	vformat->BitsPerPixel = (1 << regs.r[2]);
    23.6  
    23.7 +	/* Determine the current screen size */
    23.8 +	this->info.current_w = 0; /* FIXME! */
    23.9 +	this->info.current_h = 0; /* FIXME! */
   23.10 +
   23.11  	/* Minimum bpp for SDL is 8 */
   23.12  	if (vformat->BitsPerPixel < 8) vformat->BitsPerPixel = 8;
   23.13  
    24.1 --- a/src/video/svga/SDL_svgavideo.c	Wed Mar 15 15:47:49 2006 +0000
    24.2 +++ b/src/video/svga/SDL_svgavideo.c	Wed Mar 15 17:46:41 2006 +0000
    24.3 @@ -257,6 +257,10 @@
    24.4  	}
    24.5  	keyboard_seteventhandler(SVGA_keyboardcallback);
    24.6  
    24.7 +	/* Determine the current screen size */
    24.8 +	this->info.current_w = 0;
    24.9 +	this->info.current_h = 0;
   24.10 +
   24.11  	/* Determine the screen depth (use default 8-bit depth) */
   24.12  	vformat->BitsPerPixel = 8;
   24.13  
    25.1 --- a/src/video/vgl/SDL_vglvideo.c	Wed Mar 15 15:47:49 2006 +0000
    25.2 +++ b/src/video/vgl/SDL_vglvideo.c	Wed Mar 15 17:46:41 2006 +0000
    25.3 @@ -257,6 +257,12 @@
    25.4  		return -1;
    25.5  	}
    25.6  
    25.7 +	/* Determine the current screen size */
    25.8 +	if (VGLCurMode != NULL) {
    25.9 +		this->info.current_w = VGLCurMode->ModeInfo.Xsize;
   25.10 +		this->info.current_h = VGLCurMode->ModeInfo.Ysize;
   25.11 +	}
   25.12 +
   25.13  	/* Determine the screen depth */
   25.14  	if (VGLCurMode != NULL)
   25.15  		vformat->BitsPerPixel = VGLCurMode->Depth;
    26.1 --- a/src/video/windib/SDL_dibvideo.c	Wed Mar 15 15:47:49 2006 +0000
    26.2 +++ b/src/video/windib/SDL_dibvideo.c	Wed Mar 15 17:46:41 2006 +0000
    26.3 @@ -334,6 +334,8 @@
    26.4  #endif
    26.5  	/* Query for the desktop resolution */
    26.6  	EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &SDL_desktop_mode);
    26.7 +	this->info.current_w = SDL_desktop_mode.dmPelsWidth;
    26.8 +	this->info.current_h = SDL_desktop_mode.dmPelsHeight;
    26.9  
   26.10  	/* Query for the list of available video modes */
   26.11  	for ( i=0; EnumDisplaySettings(NULL, i, &settings); ++i ) {
    27.1 --- a/src/video/windx5/SDL_dx5video.c	Wed Mar 15 15:47:49 2006 +0000
    27.2 +++ b/src/video/windx5/SDL_dx5video.c	Wed Mar 15 17:46:41 2006 +0000
    27.3 @@ -930,6 +930,8 @@
    27.4  #ifndef NO_CHANGEDISPLAYSETTINGS
    27.5  	/* Query for the desktop resolution */
    27.6  	EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &SDL_desktop_mode);
    27.7 +	this->info.current_w = SDL_desktop_mode.dmPelsWidth;
    27.8 +	this->info.current_h = SDL_desktop_mode.dmPelsHeight;
    27.9  #endif
   27.10  
   27.11  	/* Enumerate the available fullscreen modes */
    28.1 --- a/src/video/wscons/SDL_wsconsvideo.c	Wed Mar 15 15:47:49 2006 +0000
    28.2 +++ b/src/video/wscons/SDL_wsconsvideo.c	Wed Mar 15 17:46:41 2006 +0000
    28.3 @@ -300,6 +300,9 @@
    28.4      height = private->info.height;
    28.5    }
    28.6  
    28.7 +  this->info.current_w = width;
    28.8 +  this->info.current_h = height;
    28.9 +
   28.10    if (private->shadowFB) {
   28.11      private->shadowmem = (Uint8 *)SDL_malloc(len);
   28.12      if (private->shadowmem == NULL) {
    29.1 --- a/src/video/x11/SDL_x11modes.c	Wed Mar 15 15:47:49 2006 +0000
    29.2 +++ b/src/video/x11/SDL_x11modes.c	Wed Mar 15 17:46:41 2006 +0000
    29.3 @@ -652,21 +652,21 @@
    29.4      if ( currently_fullscreen ) {
    29.5          /* Switch resolution and cover it with the FSwindow */
    29.6          move_cursor_to(this, x, y);
    29.7 -        set_best_resolution(this, current_w, current_h);
    29.8 +        set_best_resolution(this, window_w, window_h);
    29.9          move_cursor_to(this, x, y);
   29.10          get_real_resolution(this, &real_w, &real_h);
   29.11 -        if ( current_w > real_w ) {
   29.12 +        if ( window_w > real_w ) {
   29.13              real_w = MAX(real_w, screen_w);
   29.14          }
   29.15 -        if ( current_h > real_h ) {
   29.16 +        if ( window_h > real_h ) {
   29.17              real_h = MAX(real_h, screen_h);
   29.18          }
   29.19          pXMoveResizeWindow(SDL_Display, FSwindow, x, y, real_w, real_h);
   29.20          move_cursor_to(this, real_w/2, real_h/2);
   29.21  
   29.22          /* Center and reparent the drawing window */
   29.23 -        x = (real_w - current_w)/2;
   29.24 -        y = (real_h - current_h)/2;
   29.25 +        x = (real_w - window_w)/2;
   29.26 +        y = (real_h - window_h)/2;
   29.27          pXReparentWindow(SDL_Display, SDL_Window, FSwindow, x, y);
   29.28          /* FIXME: move the mouse to the old relative location */
   29.29          pXSync(SDL_Display, True);   /* Flush spurious mode change events */
   29.30 @@ -706,10 +706,10 @@
   29.31      screen_w = DisplayWidth(SDL_Display, SDL_Screen);
   29.32      screen_h = DisplayHeight(SDL_Display, SDL_Screen);
   29.33      get_real_resolution(this, &real_w, &real_h);
   29.34 -    if ( current_w > real_w ) {
   29.35 +    if ( window_w > real_w ) {
   29.36          real_w = MAX(real_w, screen_w);
   29.37      }
   29.38 -    if ( current_h > real_h ) {
   29.39 +    if ( window_h > real_h ) {
   29.40          real_h = MAX(real_h, screen_h);
   29.41      }
   29.42      pXMoveResizeWindow(SDL_Display, FSwindow,
    30.1 --- a/src/video/x11/SDL_x11video.c	Wed Mar 15 15:47:49 2006 +0000
    30.2 +++ b/src/video/x11/SDL_x11video.c	Wed Mar 15 17:46:41 2006 +0000
    30.3 @@ -508,6 +508,10 @@
    30.4  	if(X11_GetVideoModes(this) < 0)
    30.5  	    return -1;
    30.6  
    30.7 +	/* Determine the current screen size */
    30.8 +	this->info.current_w = DisplayWidth(SDL_Display, SDL_Screen);
    30.9 +	this->info.current_h = DisplayHeight(SDL_Display, SDL_Screen);
   30.10 +
   30.11  	/* Determine the default screen depth:
   30.12  	   Use the default visual (or at least one with the same depth) */
   30.13  	SDL_DisplayColormap = DefaultColormap(SDL_Display, SDL_Screen);
   30.14 @@ -863,8 +867,8 @@
   30.15  	/* resize the (possibly new) window manager window */
   30.16  	if( !SDL_windowid ) {
   30.17  	        X11_SetSizeHints(this, w, h, flags);
   30.18 -		current_w = w;
   30.19 -		current_h = h;
   30.20 +		window_w = w;
   30.21 +		window_h = h;
   30.22  		pXResizeWindow(SDL_Display, WMwindow, w, h);
   30.23  	}
   30.24  
   30.25 @@ -985,8 +989,8 @@
   30.26  	if ( ! SDL_windowid ) {
   30.27  		/* Resize the window manager window */
   30.28  		X11_SetSizeHints(this, w, h, flags);
   30.29 -		current_w = w;
   30.30 -		current_h = h;
   30.31 +		window_w = w;
   30.32 +		window_h = h;
   30.33  		pXResizeWindow(SDL_Display, WMwindow, w, h);
   30.34  
   30.35  		/* Resize the fullscreen and display windows */
    31.1 --- a/src/video/x11/SDL_x11video.h	Wed Mar 15 15:47:49 2006 +0000
    31.2 +++ b/src/video/x11/SDL_x11video.h	Wed Mar 15 17:46:41 2006 +0000
    31.3 @@ -76,8 +76,8 @@
    31.4      GC	gc;			/* The graphic context for drawing */
    31.5  
    31.6      /* The current width and height of the fullscreen mode */
    31.7 -    int current_w;
    31.8 -    int current_h;
    31.9 +    int window_w;
   31.10 +    int window_h;
   31.11  
   31.12      /* Support for internal mouse warping */
   31.13      struct {
   31.14 @@ -159,8 +159,8 @@
   31.15  #define shminfo			(this->hidden->shminfo)
   31.16  #define SDL_Ximage		(this->hidden->Ximage)
   31.17  #define SDL_GC			(this->hidden->gc)
   31.18 -#define current_w		(this->hidden->current_w)
   31.19 -#define current_h		(this->hidden->current_h)
   31.20 +#define window_w		(this->hidden->window_w)
   31.21 +#define window_h		(this->hidden->window_h)
   31.22  #define mouse_last		(this->hidden->mouse_last)
   31.23  #define mouse_accel		(this->hidden->mouse_accel)
   31.24  #define mouse_relative		(this->hidden->mouse_relative)
    32.1 --- a/src/video/xbios/SDL_xbios.c	Wed Mar 15 15:47:49 2006 +0000
    32.2 +++ b/src/video/xbios/SDL_xbios.c	Wed Mar 15 17:46:41 2006 +0000
    32.3 @@ -416,6 +416,12 @@
    32.4  			break;
    32.5  	}
    32.6  
    32.7 +	/* Determine the current screen size */
    32.8 +	if ( XBIOS_nummodes > 0 ) {
    32.9 +		this->info.current_w = XBIOS_modelist[0].width;
   32.10 +		this->info.current_h = XBIOS_modelist[0].height;
   32.11 +	}
   32.12 +
   32.13  	current_mode = XBIOS_modelist;
   32.14  	j8 = j16 = 0;
   32.15  	for (i=0; i<XBIOS_nummodes; i++, current_mode++) {
    33.1 --- a/test/testvidinfo.c	Wed Mar 15 15:47:49 2006 +0000
    33.2 +++ b/test/testvidinfo.c	Wed Mar 15 17:46:41 2006 +0000
    33.3 @@ -400,7 +400,8 @@
    33.4  	}
    33.5  	info = SDL_GetVideoInfo();
    33.6  	printf(
    33.7 -"Current display: %d bits-per-pixel\n",info->vfmt->BitsPerPixel);
    33.8 +"Current display: %dx%d, %d bits-per-pixel\n",
    33.9 +		info->current_w, info->current_h, info->vfmt->BitsPerPixel);
   33.10  	if ( info->vfmt->palette == NULL ) {
   33.11  		printf("	Red Mask = 0x%.8x\n", info->vfmt->Rmask);
   33.12  		printf("	Green Mask = 0x%.8x\n", info->vfmt->Gmask);