[PATCH] SDL_VideoModeOK() vs. SDL_FULLSCREEN

SDL 1.2.7’s SDL_VideoModeOK(), somewhere around SDL_video.c:362, does
this:

if ( (sizes == (SDL_Rect **)-1) ||
     current_video->handles_any_size ) {
     /* Any size supported at this bit-depth */
     supported = 1;
     continue;
}

The X11 driver (among others), sets handles_any_size to 1, but this
check is not really accurate when querying for SDL_FULLSCREEN modes…if
I call SDL_VideoModeOK(983834, 8293423, 32, SDL_FULLSCREEN), it’ll
report that this mode is okay, but obviously SDL_SetVideoMode() will
fail on it.

I think this is a bug. Should SDL_VideoModeOK() disregard
current_video->handles_any_size when SDL_FULLSCREEN is set?

Patch to alter behaviour attached.

–ryan.

-------------- next part --------------
A non-text attachment was scrubbed…
Name: SDL-vidmodeok-fullscreen-RYAN-1.diff
Type: text/x-patch
Size: 819 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20040223/e4f2df33/attachment.bin

SDL 1.2.7’s SDL_VideoModeOK(), somewhere around SDL_video.c:362, does
this:

if ( (sizes == (SDL_Rect **)-1) ||
     current_video->handles_any_size ) {
     /* Any size supported at this bit-depth */
     supported = 1;
     continue;
}

The X11 driver (among others), sets handles_any_size to 1, but this
check is not really accurate when querying for SDL_FULLSCREEN modes…if
I call SDL_VideoModeOK(983834, 8293423, 32, SDL_FULLSCREEN), it’ll
report that this mode is okay, but obviously SDL_SetVideoMode() will
fail on it.

What that flag really means is that the underlying video driver can handle
centering any requested video mode within the available real video modes,
specifically when fullscreen. Of course, this is limited by the maximum
available fullscreen mode, which is probably what should be checked.

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment

What that flag really means is that the underlying video driver can handle
centering any requested video mode within the available real video modes,
specifically when fullscreen. Of course, this is limited by the maximum
available fullscreen mode, which is probably what should be checked.

Ah, ok, how about this, then?

–ryan.

-------------- next part --------------
A non-text attachment was scrubbed…
Name: SDL-vidmodeok-fullscreen-RYAN-2.diff
Type: text/x-patch
Size: 1502 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20040223/20b66415/attachment.bin

What that flag really means is that the underlying video driver can handle
centering any requested video mode within the available real video modes,
specifically when fullscreen. Of course, this is limited by the maximum
available fullscreen mode, which is probably what should be checked.

Ah, ok, how about this, then?

Sounds good to me.

Thanks!
-Sam Lantinga, Software Engineer, Blizzard Entertainment