src/video/windx5/SDL_dx5video.c
changeset 1771 8d3ca155c396
parent 1545 8d9bb0cf2c2a
child 1854 2280e314a978
     1.1 --- a/src/video/windx5/SDL_dx5video.c	Sun May 07 03:44:58 2006 +0000
     1.2 +++ b/src/video/windx5/SDL_dx5video.c	Sun May 07 04:02:48 2006 +0000
     1.3 @@ -636,6 +636,16 @@
     1.4  	DX5_Available, DX5_CreateDevice
     1.5  };
     1.6  
     1.7 +static int cmpmodes(const void *va, const void *vb)
     1.8 +{
     1.9 +    SDL_Rect *a = *(SDL_Rect **)va;
    1.10 +    SDL_Rect *b = *(SDL_Rect **)vb;
    1.11 +    if ( a->w == b->w )
    1.12 +        return b->h - a->h;
    1.13 +    else
    1.14 +        return b->w - a->w;
    1.15 +}
    1.16 +
    1.17  static HRESULT WINAPI EnumModes2(DDSURFACEDESC *desc, VOID *udata)
    1.18  {
    1.19  	SDL_VideoDevice *this = (SDL_VideoDevice *)udata;
    1.20 @@ -955,6 +965,10 @@
    1.21  			SDL_modelist[i][j] = &rect->r;
    1.22  		}
    1.23  		SDL_modelist[i][j] = NULL;
    1.24 +
    1.25 +		if ( SDL_nummodes[i] > 0 ) {
    1.26 +			SDL_qsort(SDL_modelist[i], SDL_nummodes[i], sizeof *SDL_modelist[i], cmpmodes);
    1.27 +		}
    1.28  	}
    1.29  	
    1.30  	/* Fill in some window manager capabilities */