We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2505 - Start in FullScreen mode in Windows renders a blank screen when returning to windowed mode
Summary: Start in FullScreen mode in Windows renders a blank screen when returning to ...
Status: RESOLVED ABANDONED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: 2.0.2
Hardware: x86_64 Windows 8
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-19 20:32 UTC by eduardokyrw
Modified: 2018-08-06 21:20 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description eduardokyrw 2014-04-19 20:32:00 UTC
Short Description:
Right after starting my game in SDL_WINDOW_FULLSCREEN, I change it to windowed mode and I get a blank framed screen. If I start the game on window mode I can change it back and forth from fullscreen without problems.

Full Description:
My game has a VideoManager class, that calls sdl_CreateWindow in its Constructor (the problem seems to happen only on the constructor), in SDL_WINDOW_FULLSCREEN mode :

window = SDL_CreateWindow(windowName.c_str(), lastRenderArea.x, lastRenderArea.y, lastRenderArea.w, lastRenderArea.h, SDL_WINDOW_RESIZABLE | SDL_WINDOW_FULLSCREEN);

After that, I can change it to Window_Mode using a toogle method:

bool ManagerVideo::SetWindowFullScreen(bool newState)
{

// Do stuff ...

if(isFullScreen) // IF it`s on fullscreen, get it to windowMode
{
    result =  SDL_SetWindowFullscreen(window, 0/* 0  for windowed mode*/) ? false : true; // -1 = fail, 0 = success
    SDL_SetWindowSize(window, oldWindowSize.w, oldWindowSize.h);
    SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
}
else
{
   SDL_GetCurrentDisplayMode(0, &mode);
   SDL_SetWindowSize(window, mode.w, mode.h);
   result = SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN) ? false : true; // -1 = fail, 0 = success
}
 // Do stuff ...
}

If I start the game in FullScreen, and then change it to WindowMode, I`ll get a blank window with a broken (non windows 8 style) frame. If I change it back to fullscreen (using a shortcut to call the toogle method) I get the game back to fullscreen sound and safe.

If I start my game in windowed mode and then chage it to fullscreen, this bug doesnt happen at all. I can change it to fullscreen and out without any problem.

What we did as a workaround was to take this out of the constructor of our VideoManager, calling SetFullscreen just before the main game loop. This seems to handle it.

We found this bug in Windows 8.1, using MinGW32.
On Linux, this problem do not occur at all, fullscreen toggling is fine.
Comment 1 eduardokyrw 2014-04-19 22:56:09 UTC
We changed the method because it was sending the event twice. Even though, the problem still happens.

bool ManagerVideo::SetWindowFullScreen(bool newState)
{
if(newState == isFullScreen)
       return false;

SDL_DisplayMode windowDisplaymode;
SDL_GetWindowDisplayMode(window, &windowDisplaymode);
bool result = false;
if(isFullScreen)
{
	windowDisplaymode.w = oldWindowSize.w;
	windowDisplaymode.h = oldWindowSize.h;
	SDL_SetWindowDisplayMode(window, &windowDisplaymode);
	result =  SDL_SetWindowFullscreen(window, 0/* 0  for windowed mode*/) ? false : true; // -1 = fail, 0 = success
	SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
}
else // if(!isFullScreen)
{
	int displayIndex = SDL_GetWindowDisplayIndex(window);
	SDL_DisplayMode screenDisplaymode;
	SDL_GetCurrentDisplayMode(displayIndex, &windowDisplaymode);

	oldWindowSize = WindowSize();
	SDL_SetWindowDisplayMode(window, &windowDisplaymode);
	result = SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN) ? false : true; // -1 = fail, 0 = success
}

isFullScreen = newState;
return result;
}
Comment 2 Ryan C. Gordon 2018-08-06 21:20:22 UTC
Hello, and sorry if you're getting dozens of copies of this message by email.

We are closing out bugs that appear to be abandoned in some form. This can happen for lots of reasons: we couldn't reproduce it, conversation faded out, the bug was noted as fixed in a comment but we forgot to mark it resolved, the report is good but the fix is impractical, we fixed it a long time ago without realizing there was an associated report, etc.

Individually, any of these bugs might have a better resolution (such as WONTFIX or WORKSFORME or INVALID) but we've added a new resolution of ABANDONED to make this easily searchable and make it clear that it's not necessarily unreasonable to revive a given bug report.

So if this bug is still a going concern and you feel it should still be open: please feel free to reopen it! But unless you respond, we'd like to consider these bugs closed, as many of them are several years old and overwhelming our ability to prioritize recent issues.

(please note that hundred of bug reports were sorted through here, so we apologize for any human error. Just reopen the bug in that case!)

Thanks,
--ryan.