[SDL] Window/surface dimensions mismatch problem

Glenn Maynard g_sdl at zewt.org
Sun Jan 12 19:16:00 PST 2003


On Mon, Jan 13, 2003 at 03:59:15AM +0100, Daniel Phillips wrote:
> An SDL app with a resizable window doesn't play nicely with this KDE feature, 
> in that it will go ahead and create the surface at the size it thinks is 
> right.  This may not be the size of the window that the window manager 
> actually created, which results in a nasty mismatch that doesn't go away 
> until a window resize event is received, probably generated by an irritated 
> user.

SDL_SetVideoMode returns an SDL_Surface; the height and width values in
it should be the real dimensions of the window, which might be different
than requested.  Are they being set?  Use them instead of the values you
gave to SDL.

Aside:

Be careful not to actually change what you request.  One bug I
encountered was that I was overwriting the "desired" resolution/dimensions
with those returned by SDL_SetVideoMode.  With my 1024x768 screen, I
often get screens around 1024x760 in a window, since SDL makes it a
little smaller in Windows (to keep the titlebar on screen), then when
switching to fullscreen I was asking for 1024x760, which failed, of
course.  Oops.

> What to do about this?  I don't know, this seems a little messy, and I'm not 
> prepared to make a concrete suggestion or offer a patch at this point.  Have 
> I missed something obvious?

Check the above.  If the values returned in the SDL_Surface aren't the
actual active window dimensions, there's probably a bug somewhere.

-- 
Glenn Maynard




More information about the SDL mailing list