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 1996 - Mac: hiding a fullscreen-desktop window with cmd-H prevents it from restoring correctly
Summary: Mac: hiding a fullscreen-desktop window with cmd-H prevents it from restoring...
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.0
Hardware: x86_64 Mac OS X 10.8
: P2 normal
Assignee: (disabled) Jørgen Tjernø
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-28 18:22 UTC by Alex Szpakowski
Modified: 2014-03-26 15:28 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Szpakowski 2013-07-28 18:22:27 UTC
In OS X, if an SDL window is in SDL_WINDOW_FULLSCREEN_DESKTOP mode and SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS is set to "0", the window's visibility state seems to get messed up if the user hides the program with command-H.

Hiding the program while the window is in fullscreen-desktop mode sets the window to windowed mode (calling the implementation's SetWindowFullscreen function), and un-hiding it is supposed to restore the window back to fullscreen-desktop mode.

Because the visibility state gets messed up, the window restoration process will not happen properly when the user un-hides the program, and the SDL window will be left in borderless windowed mode at its original windowed resolution, rather than in fullscreen desktop mode with the desktop's resolution.

This only seems to happen when SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS is disabled because window minimization and un-minimization apparently takes care of the bad state.

The offending code appears to be these 3 lines: http://hg.libsdl.org/SDL/file/399ff49069a5/src/video/cocoa/SDL_cocoawindow.m#l1035
[nswindow makeKeyAndOrderFront:nil] is called when the program has just become hidden, and combined with the pauseVisibleObservation/resumeVisibleObservation calls it seems to mess with the window's visibility state.

I worked around the issue by only executing the above 3 lines if if [nswindow isVisible] returns YES. It fixes the problem for me, but I'm not sure if it's the best way or if there are other implications to consider.
Comment 1 Sam Lantinga 2013-07-28 20:11:19 UTC
Hey Jorgen, can you take a quick look at this and see if that's a good fix?

Thanks!
Comment 2 (disabled) Jørgen Tjernø 2013-08-12 14:12:28 UTC
This should hopefully be fixed in this: http://hg.libsdl.org/SDL/rev/d5167d0818b3