changeset 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 ab1e4c41ab71
children 4b835e36633d
files 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
diffstat 33 files changed, 140 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/WhatsNew	Wed Mar 15 15:47:49 2006 +0000
+++ b/WhatsNew	Wed Mar 15 17:46:41 2006 +0000
@@ -4,7 +4,15 @@
 Version 1.0:
 
 1.2.10:
+	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.)
+
 	Added SDL_GetKeyRepeat()
+
 	Added SDL_config.h, with defaults for various build environments.
 
 1.2.7:
--- a/include/SDL_video.h	Wed Mar 15 15:47:49 2006 +0000
+++ b/include/SDL_video.h	Wed Mar 15 17:46:41 2006 +0000
@@ -161,6 +161,8 @@
 	Uint32 UnusedBits3  :16;
 	Uint32 video_mem;	/* The total amount of video memory (in K) */
 	SDL_PixelFormat *vfmt;	/* Value: The format of the video surface */
+	int    current_w;	/* Value: The current video mode width */
+	int    current_h;	/* Value: The current video mode height */
 } SDL_VideoInfo;
 
 
--- a/src/video/SDL_video.c	Wed Mar 15 15:47:49 2006 +0000
+++ b/src/video/SDL_video.c	Wed Mar 15 17:46:41 2006 +0000
@@ -587,6 +587,13 @@
 	}
 	this = video = current_video;
 
+	/* Default to the current width and height */
+	if ( width == 0 ) {
+		width = video->info.current_w;
+	}
+	if ( height == 0 ) {
+		height = video->info.current_h;
+	}
 	/* Default to the current video bpp */
 	if ( bpp == 0 ) {
 		flags |= SDL_ANYFORMAT;
@@ -889,6 +896,8 @@
 		SDL_PublicSurface = SDL_VideoSurface;
 	}
 	video->info.vfmt = SDL_VideoSurface->format;
+	video->info.current_w = SDL_VideoSurface->w;
+	video->info.current_h = SDL_VideoSurface->h;
 
 	/* We're done! */
 	return(SDL_PublicSurface);
--- a/src/video/bwindow/SDL_sysvideo.cc	Wed Mar 15 15:47:49 2006 +0000
+++ b/src/video/bwindow/SDL_sysvideo.cc	Wed Mar 15 17:46:41 2006 +0000
@@ -275,6 +275,8 @@
 
 	/* Save the current display mode */
 	bscreen.GetMode(&saved_mode);
+	_this->info.current_w = saved_mode.virtual_width;
+	_this->info.current_h = saved_mode.virtual_height;
 
 	/* Determine the screen depth */
 	vformat->BitsPerPixel = ColorSpaceToBitsPerPixel(bscreen.ColorSpace());
--- a/src/video/cybergfx/SDL_cgxvideo.c	Wed Mar 15 15:47:49 2006 +0000
+++ b/src/video/cybergfx/SDL_cgxvideo.c	Wed Mar 15 17:46:41 2006 +0000
@@ -463,6 +463,8 @@
 		SDL_SetError("Couldn't lock the display");
 		return(-1);
 	}
+	this->info.current_w = SDL_Display->Width;
+	this->info.current_h = SDL_Display->Height;
 
 	D(bug("Checking if we are using a CGX native display...\n"));
 
@@ -834,8 +836,6 @@
 
 	if( !SDL_windowid ) {
 	    CGX_SetSizeHints(this, w, h, flags);
-		current_w = w;
-		current_h = h;
 	}
 
 	/* Set our colormaps when not setting a GL mode */
@@ -885,8 +885,6 @@
 	if ( ! SDL_windowid ) {
 		/* Resize the window manager window */
 		CGX_SetSizeHints(this, w, h, flags);
-		current_w = w;
-		current_h = h;
 
 		ChangeWindowBox(SDL_Window,SDL_Window->LeftEdge,SDL_Window->TopEdge, w+SDL_Window->BorderLeft+SDL_Window->BorderRight,
 					h+SDL_Window->BorderTop+SDL_Window->BorderBottom);
--- a/src/video/cybergfx/SDL_cgxvideo.h	Wed Mar 15 15:47:49 2006 +0000
+++ b/src/video/cybergfx/SDL_cgxvideo.h	Wed Mar 15 17:46:41 2006 +0000
@@ -67,10 +67,6 @@
     Uint8 *Ximage;		/* The X image for our window */
     int swap_pixels;		/* Flag: true if display is swapped endian */
 
-    /* The current width and height of the fullscreen mode */
-    int current_w;
-    int current_h;
-
     /* Support for internal mouse warping */
     struct {
         int x;
@@ -132,8 +128,6 @@
 #define SDL_Ximage		(this->hidden->Ximage)
 #define SDL_GC			(this->hidden->gc)
 #define swap_pixels		(this->hidden->swap_pixels)
-#define current_w		(this->hidden->current_w)
-#define current_h		(this->hidden->current_h)
 #define mouse_last		(this->hidden->mouse_last)
 #define mouse_accel		(this->hidden->mouse_accel)
 #define mouse_relative		(this->hidden->mouse_relative)
--- a/src/video/dga/SDL_dgavideo.c	Wed Mar 15 15:47:49 2006 +0000
+++ b/src/video/dga/SDL_dgavideo.c	Wed Mar 15 17:46:41 2006 +0000
@@ -349,6 +349,10 @@
 	}
 	DGA_event_base = event_base;
 
+	/* Determine the current screen size */
+	this->info.current_w = DisplayWidth(DGA_Display, DGA_Screen);
+	this->info.current_h = DisplayHeight(DGA_Display, DGA_Screen);
+
 	/* Determine the current screen depth */
 	visual = DefaultVisual(DGA_Display, DGA_Screen);
 	{
--- a/src/video/epoc/SDL_epocvideo.cpp	Wed Mar 15 15:47:49 2006 +0000
+++ b/src/video/epoc/SDL_epocvideo.cpp	Wed Mar 15 17:46:41 2006 +0000
@@ -291,6 +291,9 @@
 
     #endif /* __WINS__ */
 
+    _this->info.current_w = Private->EPOC_ScreenSize.iWidth;
+    _this->info.current_h = Private->EPOC_ScreenSize.iHeight;
+
     /* The "best" video format should be returned to caller. */
 
     vformat->BitsPerPixel       = /*!!GetBpp(displayMode) */ 8;
--- a/src/video/fbcon/SDL_fbvideo.c	Wed Mar 15 15:47:49 2006 +0000
+++ b/src/video/fbcon/SDL_fbvideo.c	Wed Mar 15 17:46:41 2006 +0000
@@ -636,6 +636,8 @@
 	}
 
 	/* Fill in our hardware acceleration capabilities */
+	this->info.current_w = current_w;
+	this->info.current_h = current_h;
 	this->info.wm_available = 0;
 	this->info.hw_available = 1;
 	this->info.video_mem = finfo.smem_len/1024;
--- a/src/video/gapi/SDL_gapivideo.c	Wed Mar 15 15:47:49 2006 +0000
+++ b/src/video/gapi/SDL_gapivideo.c	Wed Mar 15 17:46:41 2006 +0000
@@ -529,6 +529,10 @@
 		GAPI_AddMode(this, bpp, gapi->gxProperties.cxWidth, gapi->gxProperties.cyHeight);	
 	}
 
+	/* Determine the current screen size */
+	this->info.current_w = gapi->gxProperties.cxWidth;
+	this->info.current_h = gapi->gxProperties.cyHeight;
+
 	/* Sort the mode lists */
 	for ( i=0; i<NUM_MODELISTS; ++i ) {
 		if ( gapi->SDL_nummodes[i] > 0 ) {
--- a/src/video/gem/SDL_gemvideo.c	Wed Mar 15 15:47:49 2006 +0000
+++ b/src/video/gem/SDL_gemvideo.c	Wed Mar 15 17:46:41 2006 +0000
@@ -430,9 +430,9 @@
 	/* Setup destination mfdb */
 	VDI_dst_mfdb.fd_addr = NULL;
 
-	/* Update hardware info */
-	this->info.hw_available = 0;
-	this->info.video_mem = 0;
+	/* Determine the current screen size */
+	this->info.current_w = VDI_w;
+	this->info.current_h = VDI_h;
 
 	/* Determine the screen depth */
 	/* we change this during the SDL_SetVideoMode implementation... */
--- a/src/video/ggi/SDL_ggivideo.c	Wed Mar 15 15:47:49 2006 +0000
+++ b/src/video/ggi/SDL_ggivideo.c	Wed Mar 15 17:46:41 2006 +0000
@@ -197,6 +197,10 @@
 		GGI_VideoQuit(NULL);
 	}
 
+	/* Determine the current screen size */
+	this->info.current_w = mode.virt.x;
+	this->info.current_h = mode.virt.y;
+
 	/* Set a palette for palletized modes */
 	if (GT_SCHEME(mode.graphtype) == GT_PALETTE)
 	{
--- a/src/video/ipod/SDL_ipodvideo.c	Wed Mar 15 15:47:49 2006 +0000
+++ b/src/video/ipod/SDL_ipodvideo.c	Wed Mar 15 17:46:41 2006 +0000
@@ -287,6 +287,10 @@
 
 	fcntl (kbfd, F_SETFL, O_RDWR | O_NONBLOCK);
 
+	/* Determine the current screen size */
+	this->info.current_w = lcd_width;
+	this->info.current_h = lcd_height;
+
 	if ((generation >= 60000) && (generation < 70000)) {
 	    vformat->BitsPerPixel = 16;
 	    vformat->Rmask = 0xF800;
--- a/src/video/macdsp/SDL_dspvideo.c	Wed Mar 15 15:47:49 2006 +0000
+++ b/src/video/macdsp/SDL_dspvideo.c	Wed Mar 15 17:46:41 2006 +0000
@@ -329,7 +329,7 @@
 };
 
 /* Use DSp/Display Manager to build mode list for given screen */
-static SDL_Rect**  DSp_BuildModeList (const GDHandle gDevice)
+static SDL_Rect**  DSp_BuildModeList (const GDHandle gDevice, int *displayWidth, int *displayHeight)
 {
 	DSpContextAttributes  attributes;
 	DSpContextReference   context;
@@ -355,6 +355,9 @@
 	
 	if ( DSpContext_GetAttributes (context, &attributes) != noErr )
 		return NULL;
+
+	*displayWidth = attributes.displayWidth;
+	*displayHeight = attributes.displayHeight;
 			
 	for ( i = 0; i < SDL_arraysize(temp_list); i++ ) {
 		width  = attributes.displayWidth;
@@ -556,14 +559,14 @@
 			break;
 	}
    
-   if ( DSp_CreatePalette (this) < 0 ) {
-   
-      SDL_SetError ("Could not create palette");
-      return (-1);
-   }
+	if ( DSp_CreatePalette (this) < 0 ) {
+		SDL_SetError ("Could not create palette");
+		return (-1);
+	}
    
 	/* Get a list of available fullscreen modes */
-	SDL_modelist = DSp_BuildModeList (SDL_Display);
+	SDL_modelist = DSp_BuildModeList (SDL_Display,
+	                                  &this->info.current_w, &this->info.current_h);
 	if (SDL_modelist == NULL) {
 		SDL_SetError ("DrawSprocket could not build a mode list");
 		return (-1);
--- a/src/video/macrom/SDL_romvideo.c	Wed Mar 15 15:47:49 2006 +0000
+++ b/src/video/macrom/SDL_romvideo.c	Wed Mar 15 17:46:41 2006 +0000
@@ -203,6 +203,10 @@
 	/* Get a handle to the main monitor */
 	SDL_Display = GetMainDevice();
 
+	/* Determine the current screen size */
+	this->info.current_w = (**SDL_Display).gdRect.right;
+	this->info.current_h = (**SDL_Display).gdRect.bottom;
+
 	/* Determine pixel format */
 	vformat->BitsPerPixel = (**(**SDL_Display).gdPMap).pixelSize;
 	switch (vformat->BitsPerPixel) {
--- a/src/video/nanox/SDL_nxvideo.c	Wed Mar 15 15:47:49 2006 +0000
+++ b/src/video/nanox/SDL_nxvideo.c	Wed Mar 15 17:46:41 2006 +0000
@@ -209,6 +209,10 @@
     GrGetScreenInfo (& si) ;
     SDL_Visual.bpp = si.bpp ;
 
+    /* Determine the current screen size */
+    this->info.current_w = si.cols ;
+    this->info.current_h = si.rows ;
+
     // GetVideoMode
     SDL_modelist = (SDL_Rect **) SDL_malloc (sizeof (SDL_Rect *) * 2) ;
     if (SDL_modelist) {
--- a/src/video/os2fslib/SDL_os2fslib.c	Wed Mar 15 15:47:49 2006 +0000
+++ b/src/video/os2fslib/SDL_os2fslib.c	Wed Mar 15 17:46:41 2006 +0000
@@ -2724,6 +2724,10 @@
     return -1;
   }
 
+  /* Determine the current screen size */
+  _this->info.current_w = 0; // FIXME!
+  _this->info.current_h = 0; // FIXME!
+
   /* Determine the screen depth */
   vformat->BitsPerPixel = pDesktopMode->uiBPP;
   vformat->BytesPerPixel = (vformat->BitsPerPixel+7)/8;
--- a/src/video/photon/SDL_ph_video.c	Wed Mar 15 15:47:49 2006 +0000
+++ b/src/video/photon/SDL_ph_video.c	Wed Mar 15 17:46:41 2006 +0000
@@ -400,6 +400,10 @@
         return -1;
     }
 
+   /* Determine the current screen size */
+   this->info.current_w = desktop_mode.width;
+   this->info.current_h = desktop_mode.height;
+
     /* We need to return BytesPerPixel as it in used by CreateRGBsurface */
     vformat->BitsPerPixel = desktop_mode.bits_per_pixel;
     vformat->BytesPerPixel = desktop_mode.bytes_per_scanline/desktop_mode.width;
--- a/src/video/picogui/SDL_pgvideo.c	Wed Mar 15 15:47:49 2006 +0000
+++ b/src/video/picogui/SDL_pgvideo.c	Wed Mar 15 17:46:41 2006 +0000
@@ -166,6 +166,10 @@
 
 	PG_InitEvents(this);
 
+	/* Determine the current screen size */
+	this->info.current_w = this->hidden->mi.lxres;
+	this->info.current_h = this->hidden->mi.lyres;
+
 	/* Determine the screen depth.
 	 * We change this during the SDL_SetVideoMode implementation... 
 	 * Round up to the nearest Bytes per pixel
--- a/src/video/ps2gs/SDL_gsvideo.c	Wed Mar 15 15:47:49 2006 +0000
+++ b/src/video/ps2gs/SDL_gsvideo.c	Wed Mar 15 17:46:41 2006 +0000
@@ -298,7 +298,6 @@
 		return(-1);
 	}
 
-	/* Determine the current screen depth */
 	if ( ioctl(console_fd, PS2IOC_GSCREENINFO, &vinfo) < 0 ) {
 		close(memory_fd);
 		close(console_fd);
@@ -306,6 +305,12 @@
 		SDL_SetError("Couldn't get console pixel format");
 		return(-1);
 	}
+
+	/* Determine the current screen size */
+	this->info.current_w = vinfo.w;
+	this->info.current_h = vinfo.h;
+
+	/* Determine the current screen depth */
 	switch (vinfo.psm) {
 	    /* Supported pixel formats */
 	    case PS2_GS_PSMCT32:
--- a/src/video/qtopia/SDL_sysvideo.cc	Wed Mar 15 15:47:49 2006 +0000
+++ b/src/video/qtopia/SDL_sysvideo.cc	Wed Mar 15 17:46:41 2006 +0000
@@ -226,6 +226,10 @@
     QT_AddMode(_this, ((vformat->BitsPerPixel+7)/8)-1,
 	       desktop_size.height(), desktop_size.width());
 
+    /* Determine the current screen size */
+    this->info.current_w = desktop_size.width();
+    this->info.current_h = desktop_size.height();
+
     /* Create the window / widget */
     SDL_Win = new SDL_QWin(QSize(QT_HIDDEN_SIZE, QT_HIDDEN_SIZE));
     ((QPEApplication*)qApp)->showMainWidget(SDL_Win);
--- a/src/video/quartz/SDL_QuartzVideo.m	Wed Mar 15 15:47:49 2006 +0000
+++ b/src/video/quartz/SDL_QuartzVideo.m	Wed Mar 15 17:46:41 2006 +0000
@@ -200,6 +200,11 @@
     CFNumberGetValue (CFDictionaryGetValue (save_mode, kCGDisplayHeight),
                       kCFNumberSInt32Type, &device_height);
 
+    /* Determine the current screen size */
+    this->info.current_w = device_width;
+    this->info.current_h = device_height;
+
+    /* Determine the default screen depth */
     video_format->BitsPerPixel = device_bpp;
 
     /* Set misc globals */
--- a/src/video/riscos/SDL_riscosvideo.c	Wed Mar 15 15:47:49 2006 +0000
+++ b/src/video/riscos/SDL_riscosvideo.c	Wed Mar 15 17:46:41 2006 +0000
@@ -175,6 +175,10 @@
 	_kernel_swi(OS_ReadModeVariable, &regs, &regs);
 	vformat->BitsPerPixel = (1 << regs.r[2]);
 
+	/* Determine the current screen size */
+	this->info.current_w = 0; /* FIXME! */
+	this->info.current_h = 0; /* FIXME! */
+
 	/* Minimum bpp for SDL is 8 */
 	if (vformat->BitsPerPixel < 8) vformat->BitsPerPixel = 8;
 
--- a/src/video/svga/SDL_svgavideo.c	Wed Mar 15 15:47:49 2006 +0000
+++ b/src/video/svga/SDL_svgavideo.c	Wed Mar 15 17:46:41 2006 +0000
@@ -257,6 +257,10 @@
 	}
 	keyboard_seteventhandler(SVGA_keyboardcallback);
 
+	/* Determine the current screen size */
+	this->info.current_w = 0;
+	this->info.current_h = 0;
+
 	/* Determine the screen depth (use default 8-bit depth) */
 	vformat->BitsPerPixel = 8;
 
--- a/src/video/vgl/SDL_vglvideo.c	Wed Mar 15 15:47:49 2006 +0000
+++ b/src/video/vgl/SDL_vglvideo.c	Wed Mar 15 17:46:41 2006 +0000
@@ -257,6 +257,12 @@
 		return -1;
 	}
 
+	/* Determine the current screen size */
+	if (VGLCurMode != NULL) {
+		this->info.current_w = VGLCurMode->ModeInfo.Xsize;
+		this->info.current_h = VGLCurMode->ModeInfo.Ysize;
+	}
+
 	/* Determine the screen depth */
 	if (VGLCurMode != NULL)
 		vformat->BitsPerPixel = VGLCurMode->Depth;
--- a/src/video/windib/SDL_dibvideo.c	Wed Mar 15 15:47:49 2006 +0000
+++ b/src/video/windib/SDL_dibvideo.c	Wed Mar 15 17:46:41 2006 +0000
@@ -334,6 +334,8 @@
 #endif
 	/* Query for the desktop resolution */
 	EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &SDL_desktop_mode);
+	this->info.current_w = SDL_desktop_mode.dmPelsWidth;
+	this->info.current_h = SDL_desktop_mode.dmPelsHeight;
 
 	/* Query for the list of available video modes */
 	for ( i=0; EnumDisplaySettings(NULL, i, &settings); ++i ) {
--- a/src/video/windx5/SDL_dx5video.c	Wed Mar 15 15:47:49 2006 +0000
+++ b/src/video/windx5/SDL_dx5video.c	Wed Mar 15 17:46:41 2006 +0000
@@ -930,6 +930,8 @@
 #ifndef NO_CHANGEDISPLAYSETTINGS
 	/* Query for the desktop resolution */
 	EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &SDL_desktop_mode);
+	this->info.current_w = SDL_desktop_mode.dmPelsWidth;
+	this->info.current_h = SDL_desktop_mode.dmPelsHeight;
 #endif
 
 	/* Enumerate the available fullscreen modes */
--- a/src/video/wscons/SDL_wsconsvideo.c	Wed Mar 15 15:47:49 2006 +0000
+++ b/src/video/wscons/SDL_wsconsvideo.c	Wed Mar 15 17:46:41 2006 +0000
@@ -300,6 +300,9 @@
     height = private->info.height;
   }
 
+  this->info.current_w = width;
+  this->info.current_h = height;
+
   if (private->shadowFB) {
     private->shadowmem = (Uint8 *)SDL_malloc(len);
     if (private->shadowmem == NULL) {
--- a/src/video/x11/SDL_x11modes.c	Wed Mar 15 15:47:49 2006 +0000
+++ b/src/video/x11/SDL_x11modes.c	Wed Mar 15 17:46:41 2006 +0000
@@ -652,21 +652,21 @@
     if ( currently_fullscreen ) {
         /* Switch resolution and cover it with the FSwindow */
         move_cursor_to(this, x, y);
-        set_best_resolution(this, current_w, current_h);
+        set_best_resolution(this, window_w, window_h);
         move_cursor_to(this, x, y);
         get_real_resolution(this, &real_w, &real_h);
-        if ( current_w > real_w ) {
+        if ( window_w > real_w ) {
             real_w = MAX(real_w, screen_w);
         }
-        if ( current_h > real_h ) {
+        if ( window_h > real_h ) {
             real_h = MAX(real_h, screen_h);
         }
         pXMoveResizeWindow(SDL_Display, FSwindow, x, y, real_w, real_h);
         move_cursor_to(this, real_w/2, real_h/2);
 
         /* Center and reparent the drawing window */
-        x = (real_w - current_w)/2;
-        y = (real_h - current_h)/2;
+        x = (real_w - window_w)/2;
+        y = (real_h - window_h)/2;
         pXReparentWindow(SDL_Display, SDL_Window, FSwindow, x, y);
         /* FIXME: move the mouse to the old relative location */
         pXSync(SDL_Display, True);   /* Flush spurious mode change events */
@@ -706,10 +706,10 @@
     screen_w = DisplayWidth(SDL_Display, SDL_Screen);
     screen_h = DisplayHeight(SDL_Display, SDL_Screen);
     get_real_resolution(this, &real_w, &real_h);
-    if ( current_w > real_w ) {
+    if ( window_w > real_w ) {
         real_w = MAX(real_w, screen_w);
     }
-    if ( current_h > real_h ) {
+    if ( window_h > real_h ) {
         real_h = MAX(real_h, screen_h);
     }
     pXMoveResizeWindow(SDL_Display, FSwindow,
--- a/src/video/x11/SDL_x11video.c	Wed Mar 15 15:47:49 2006 +0000
+++ b/src/video/x11/SDL_x11video.c	Wed Mar 15 17:46:41 2006 +0000
@@ -508,6 +508,10 @@
 	if(X11_GetVideoModes(this) < 0)
 	    return -1;
 
+	/* Determine the current screen size */
+	this->info.current_w = DisplayWidth(SDL_Display, SDL_Screen);
+	this->info.current_h = DisplayHeight(SDL_Display, SDL_Screen);
+
 	/* Determine the default screen depth:
 	   Use the default visual (or at least one with the same depth) */
 	SDL_DisplayColormap = DefaultColormap(SDL_Display, SDL_Screen);
@@ -863,8 +867,8 @@
 	/* resize the (possibly new) window manager window */
 	if( !SDL_windowid ) {
 	        X11_SetSizeHints(this, w, h, flags);
-		current_w = w;
-		current_h = h;
+		window_w = w;
+		window_h = h;
 		pXResizeWindow(SDL_Display, WMwindow, w, h);
 	}
 
@@ -985,8 +989,8 @@
 	if ( ! SDL_windowid ) {
 		/* Resize the window manager window */
 		X11_SetSizeHints(this, w, h, flags);
-		current_w = w;
-		current_h = h;
+		window_w = w;
+		window_h = h;
 		pXResizeWindow(SDL_Display, WMwindow, w, h);
 
 		/* Resize the fullscreen and display windows */
--- a/src/video/x11/SDL_x11video.h	Wed Mar 15 15:47:49 2006 +0000
+++ b/src/video/x11/SDL_x11video.h	Wed Mar 15 17:46:41 2006 +0000
@@ -76,8 +76,8 @@
     GC	gc;			/* The graphic context for drawing */
 
     /* The current width and height of the fullscreen mode */
-    int current_w;
-    int current_h;
+    int window_w;
+    int window_h;
 
     /* Support for internal mouse warping */
     struct {
@@ -159,8 +159,8 @@
 #define shminfo			(this->hidden->shminfo)
 #define SDL_Ximage		(this->hidden->Ximage)
 #define SDL_GC			(this->hidden->gc)
-#define current_w		(this->hidden->current_w)
-#define current_h		(this->hidden->current_h)
+#define window_w		(this->hidden->window_w)
+#define window_h		(this->hidden->window_h)
 #define mouse_last		(this->hidden->mouse_last)
 #define mouse_accel		(this->hidden->mouse_accel)
 #define mouse_relative		(this->hidden->mouse_relative)
--- a/src/video/xbios/SDL_xbios.c	Wed Mar 15 15:47:49 2006 +0000
+++ b/src/video/xbios/SDL_xbios.c	Wed Mar 15 17:46:41 2006 +0000
@@ -416,6 +416,12 @@
 			break;
 	}
 
+	/* Determine the current screen size */
+	if ( XBIOS_nummodes > 0 ) {
+		this->info.current_w = XBIOS_modelist[0].width;
+		this->info.current_h = XBIOS_modelist[0].height;
+	}
+
 	current_mode = XBIOS_modelist;
 	j8 = j16 = 0;
 	for (i=0; i<XBIOS_nummodes; i++, current_mode++) {
--- a/test/testvidinfo.c	Wed Mar 15 15:47:49 2006 +0000
+++ b/test/testvidinfo.c	Wed Mar 15 17:46:41 2006 +0000
@@ -400,7 +400,8 @@
 	}
 	info = SDL_GetVideoInfo();
 	printf(
-"Current display: %d bits-per-pixel\n",info->vfmt->BitsPerPixel);
+"Current display: %dx%d, %d bits-per-pixel\n",
+		info->current_w, info->current_h, info->vfmt->BitsPerPixel);
 	if ( info->vfmt->palette == NULL ) {
 		printf("	Red Mask = 0x%.8x\n", info->vfmt->Rmask);
 		printf("	Green Mask = 0x%.8x\n", info->vfmt->Gmask);