diff src/video/windx5/SDL_dx5video.c @ 1659:14717b52abc0 SDL-1.3

Merge trunk-1.3-3
author Sam Lantinga <slouken@libsdl.org>
date Wed, 17 May 2006 08:18:28 +0000
parents e49147870aac
children 281d3f4870e5
line wrap: on
line diff
--- a/src/video/windx5/SDL_dx5video.c	Mon May 01 06:58:33 2006 +0000
+++ b/src/video/windx5/SDL_dx5video.c	Wed May 17 08:18:28 2006 +0000
@@ -636,6 +636,16 @@
 	DX5_Available, DX5_CreateDevice
 };
 
+static int cmpmodes(const void *va, const void *vb)
+{
+    SDL_Rect *a = *(SDL_Rect **)va;
+    SDL_Rect *b = *(SDL_Rect **)vb;
+    if ( a->w == b->w )
+        return b->h - a->h;
+    else
+        return b->w - a->w;
+}
+
 static HRESULT WINAPI EnumModes2(DDSURFACEDESC *desc, VOID *udata)
 {
 	SDL_VideoDevice *this = (SDL_VideoDevice *)udata;
@@ -955,6 +965,10 @@
 			SDL_modelist[i][j] = &rect->r;
 		}
 		SDL_modelist[i][j] = NULL;
+
+		if ( SDL_nummodes[i] > 0 ) {
+			SDL_qsort(SDL_modelist[i], SDL_nummodes[i], sizeof *SDL_modelist[i], cmpmodes);
+		}
 	}
 	
 	/* Fill in some window manager capabilities */