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

Mac: hiding a fullscreen-desktop window with cmd-H prevents it from restoring correctly #987

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: Mac OS X 10.8, x86_64

Comments on the original bug report:

On 2013-07-28 18:22:27 +0000, Alex Szpakowski wrote:

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.

On 2013-07-28 20:11:19 +0000, Sam Lantinga wrote:

Hey Jorgen, can you take a quick look at this and see if that's a good fix?

Thanks!

On 2013-08-12 14:12:28 +0000, (disabled) Jørgen Tjernø wrote:

This should hopefully be fixed in this: http://hg.libsdl.org/SDL/rev/d5167d0818b3

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