Mac and Linux Fullscreen issues

I feel kinda bad posting so much about my issues. =\ But here goes…

I finally got windows resizing and fullscreen toggling in Windows working fine, so I started turning my attention to the linux and mac builds. When switching to fullscreen mode in linux, it works initially, but when switching back to windowed mode it seems that it changed the desktop settings, which then have to be reset. Other then that linux seems to work fine. In mac the issue is much worse, causing artifacting issues and ultimately had to be rebooted. I can’t get much more descriptive about the mac issue at this moment because I didn’t see the test personally. I’ll give a better description of the issue in an edit soon though.

Like my previous issues, I’m sure this is something to do with my configuration or setup…probably even something basic. My fullscreen switching code looks like this:

Code:
if(SDL_SetWindowFullscreen(SDLwindow, Fullscreen?SDL_TRUE:SDL_FALSE ) == 0)
{
OgreGameWindow->setFullscreen(Fullscreen,Settings.RenderWidth,Settings.RenderHeight);
CorrectViewportAndCamera();
Settings.Fullscreen = Fullscreen;
}

The viewport and camera function just resets the extents of the ogre viewport to be the size of the entire window, and then sets the camera to it’s new aspect ratio based on the updated dimensions. So just ogre stuff.

I tried looking around in the tests and didn’t see anything that used the new code( Such as the SDL_SetWindowFullscreen() function), so I snooped around in the SDL_compat.c file to see if anything special was there, and I did find the SDL_WM_ToggleFullScreen() function. I recognized the part where it did the switch readily…but the rest I’m not sure what to think of. Am I supposed to be doing these checks in my code as well to get fullscreen toggling to work?

Is there any other code snippets anyone can share to enlighten me as to how this code should be structured or what is going wrong?

Code:
if(SDL_SetWindowFullscreen(SDLwindow, Fullscreen?SDL_TRUE:SDL_FALSE ) == 0)
{
OgreGameWindow->setFullscreen(Fullscreen,Settings.RenderWidth,Settings.RenderHeight);
CorrectViewportAndCamera();
Settings.Fullscreen = Fullscreen;
}

Well that’s interesting … OSX Snow Leopard, using F1 key to switch from
legacy mode window to full screen and back:

~/felix>flx --test=build/release/ --force demos/sdl/sdl-1.01.03-0
Binding libary std
binding library std done
Exports = 0
frames in seconds = FPS
frames in seconds = FPS
frames in seconds = FPS
~/felix>flx --test=build/release/ --force demos/sdl/sdl-1.01.03-0
frames in seconds = FPS
Tue Mar 15 20:42:24 pa114-73-117-179.pa.nsw.optusnet.com.au flx_arun[286] : kCGErrorIllegalArgument: CGSShapeWindow
Tue Mar 15 20:42:24 pa114-73-117-179.pa.nsw.optusnet.com.au flx_arun[286] : kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
Tue Mar 15 20:42:28 pa114-73-117-179.pa.nsw.optusnet.com.au flx_arun[286] : kCGErrorIllegalArgument: CGSShapeWindow
frames in seconds = FPS
frames in seconds = FPS
frames in seconds = FPS
frames in seconds = FPS
frames in seconds = FPS
frames in seconds = FPS
frames in seconds = FPS
frames in seconds = FPS
frames in seconds = FPS
frames in seconds = FPS
frames in seconds = FPS

The missing frame rate is an unknown “other” bug when using dynamic linkage.

Here’s the switching code (written in Felix, translation to C obvious):

  {
    block_sdl_events event_lock;
    ignore$ SDL_WM_ToggleFullScreen( surface );
    unblock_sdl_events event_lock;
  }On 15/03/2011, at 7:56 AM, Mako_energy wrote:


john skaller
@john_skaller

john skaller wrote:

{
block_sdl_events event_lock;
ignore$ SDL_WM_ToggleFullScreen( surface );
unblock_sdl_events event_lock;
}

Thanks for sharing, but unfortunately calling that function had zero effect when used instead of SDL_SetWindowFullscreen(). After debugging the cause seems to be that SDL_PublicSurface in SDL_compat.c was never set, because we never called SDL_SetVideoMode(). We’ve actually removed all the SDL 1.2 specific code from our engine, upgrading to SDL 1.3 so we have no need for the compatibility layer, and it was my understanding that in SDL 1.3 we also don’t need to set the video mode.

john skaller wrote:

{
block_sdl_events event_lock;
ignore$ SDL_WM_ToggleFullScreen( surface );
unblock_sdl_events event_lock;
}

Thanks for sharing, but unfortunately calling that function had zero effect when used instead of SDL_SetWindowFullscreen().

because it doesn’t specify the window?

After debugging the cause seems to be that SDL_PublicSurface in SDL_compat.c was never set, because we never called SDL_SetVideoMode(). We’ve actually removed all the SDL 1.2 specific code from our engine, upgrading to SDL 1.3 so we have no need for the compatibility layer, and it was my understanding that in SDL 1.3 we also don’t need to set the video mode.

I plan to upgrade too, but these are old demos run using the compat layer of Hg version of SDL 1.3.On 16/03/2011, at 3:30 AM, Mako_energy wrote:


john skaller
@john_skaller

john skaller wrote:

because it doesn’t specify the window?

I actually used a function to get the window surface by window pointer, and passed it in that way. So I was specifying the window the only way that was clear to me. I also took a second look at the function and it seems that SDL_WM_ToggleFullscreen completely ignores the surface you pass in anyway. Just in no way works with an otherwise entirely 1.3 API.

I did have a little bit of success with my issues on linux though. It seems it stops applying the fullscreen settings to the desktop when I create a SDL_DisplayMode ahead of time with the parameters I want for the fullscreen window, set it, and then switch to fullscreen. Prior to that I was just letting SDL figure it out.