[SDL] [PATCH] Function to get desktop resolution

Stephane Marchesin stephane.marchesin at wanadoo.fr
Tue Jan 25 14:46:02 PST 2005

Stephane Marchesin wrote:

> Jon Colverson wrote:
>> I've added a new SDL function that will get the user's current 
>> resolution. This won't have meaning for some drivers, but the 
>> function just returns failure if it's not implemented for the driver 
>> in use.
>> The rationale for the function is that I want a way of picking a 
>> reasonable default fullscreen resolution without having to ask the 
>> user. Using SDL_ListModes() and picking the highest resolution isn't 
>> appropriate because, for example, LCD users will presumably prefer 
>> the native resolution of the monitor.
>> Attached is a patch against CVS (at 2005-01-24 14:45:00 GMT) that 
>> includes implementations for X11 and Windows.
>> Problems:
>>  - This is my first attempt at hacking on SDL. If I've done something 
>> silly like broken binary compatability, I wouldn't be suprised.
>>  - video/wincommon/SDL_syswm.c doesn't seem like a particularly good 
>> home for WIN_GetDesktopMode, but I couldn't face adding a new source 
>> file to the various build systems.
>>  - Only implemented on X11 and Windows. Do I have to set 
>> device->GetDesktopMode = NULL for all the other video drivers 
>> manually? It seems that I do, but I wanted to check before doing it, 
>> in case it's a waste of time.
>>  - GetDesktopMode isn't a great name. I'm open to suggestions.
> If I was to implement this, I'd extend the existing SDL_GetVideoInfo 
> stuff. This function returns a pointer to a video info structure, 
> which could very well contain the width and height of the current 
> desktop (unusedbits3 can be used to hold that while keeping backwards 
> compatibility).

Hmm, there isn't enough room with these 16 bits. So you'll break binary 
compat if you add it.
Well, maybe that is SDL 1.3 material...


More information about the SDL mailing list