Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDL_SetWindowFullscreen fails when switching between SDL_WINDOW_FULLSCREEN and SDL_WINDOW_FULLSCREEN_DESKTOP #1041

Closed
SDLBugzilla opened this issue Feb 10, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

SDLBugzilla commented Feb 10, 2021

This bug report was migrated from our old Bugzilla tracker.

Reported in version: HG 2.0
Reported for operating system, platform: All, x86

Comments on the original bug report:

On 2013-08-23 07:01:21 +0000, Alex Szpakowski wrote:

SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN) will fail (but return 0 for success) if the current state of the window is SDL_WINDOW_FULLSCREEN_DESKTOP.

The reverse is true as well: SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP) will fail (but return success) if the state of the window is currently SDL_WINDOW_FULLSCREEN.

In both cases SDL changes some internal state of the window before it fails to properly set the fullscreen mode, so the window's state gets messed up which causes unexpected things to happen.

The reason this seems to happen is this: SDL_SetWindowFullscreen calls SDL_UpdateFullscreenMode after setting the window's flags to the new fullscreen state, but SDL_UpdateFullscreenMode will early return if fullscreen is requested and the window is already in some type of fullscreen (doesn't matter whether it's normal display-mode or desktop fullscreen.)

So the window's flags get set to the new fullscreen state but the state never actually gets applied.

You can see the problematic early return code here: http://hg.libsdl.org/SDL/file/cf99258f905c/src/video/SDL_video.c#l1091

On 2013-08-23 07:47:43 +0000, Sam Lantinga wrote:

Jorgen, this looks like it's reasonably easy to fix. Want to take a crack at it?

On 2014-01-15 19:20:02 +0000, (disabled) Jørgen Tjernø wrote:

This should be fixed in http://hg.libsdl.org/SDL/rev/98646f687e2b -- can you look and see if that seems sane, Sam?

On 2016-03-19 05:03:16 +0000, Alex Szpakowski wrote:

This was indeed fixed a while ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant