Is there any reason we can’t pretend that SDL_WM_ToggleFullScreen()
succeeded in the fbcon driver? I’ve got Candy Cruncher using this API to
toggle fullscreen/window, and falling back on recreating the screen
surface from scratch if it fails, which works well enough, but it’s less
overhead (and prettier to watch) if SDL_WM_ToggleFullScreen() works.
Here is a patch to make the fbcon driver pretend that a fullscreen toggle
worked.
We can actually do it at a higher level so that if a toggle function
doesn’t exist in the driver we can pretend it succeeds…
My thought was that most drivers SHOULD fail…fbcon is always fullscreen,
though, so it made sense there.
So you’re saying that drivers that can be both windowed and fullscreen
but can’t do a real fullscreen toggle should fail the call, so the app
can set a new video mode, but that drivers that are only fullscreen or
only windowed should always succeed?
Makes sense… Comments?
-Sam Lantinga, Software Engineer, Blizzard Entertainment
“Sam Lantinga” wrote in message
news:mailman.1013967303.26758.sdl at libsdl.org…
Is there any reason we can’t pretend that
SDL_WM_ToggleFullScreen()
succeeded in the fbcon driver?
We can actually do it at a higher level so that if a toggle function
doesn’t exist in the driver we can pretend it succeeds…
Can anybody think of any reason not to do this?
It’s somewhat dishonest.
There are three possible situations:
No separate window and full-screen modes available.
Both modes available, switchable by ‘SDL_WM_ToggleFullScreen’.
Both modes available, only switchable by ‘SDL_SetVideoMode’.
All three are logically distinct. For example, if a program includes
a menu option to switch between windowed and full-screen mode, it
should be disabled in situation 1. I think situation 1 can already be
detected through
’SDL_GetVideoInfo()->wm_available’:
if (SDL_GetVideoInfo()->wm_available) {
if (!SDL_WM_ToggleFullScreen()) {
/* need to use SDL_SetVideoMode /
}
} else {
/ no windowed mode, so nothing to toggle */
}
However, I have to admit that it is more convenient to group situation
1 with situation 2 for the return value of ‘SDL_WM_ToggleFullScreen’.
Maybe it would make sense to introduce another return value that means
"I didn’t really do anything, but don’t bother trying
’SDL_SetVideoMode’ either"?–
Rainer Deyke | root at rainerdeyke.com | http://rainerdeyke.com