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 2338

Summary: Window minimizes itself when focus is lost to an app on another display
Product: SDL Reporter: Jeffrey Carpenter <i8degrees>
Component: videoAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: philipp.wiesemann
Version: 2.0.1   
Hardware: x86_64   
OS: Other   

Description Jeffrey Carpenter 2014-01-07 23:31:41 UTC
When using the flag SDL_WINDOW_FULLSCREEN_DESKTOP in a window -- either at creation or during a key input event -- if I click off on an application that is on another display monitor, my previously focused SDL window minimizes itself (without reporting any errors). I then have to find it on the dock and tell it to reshow itself. This happens consistently, 100% of the time.

This does not happen when using the SDL_WINDOW_FULLSCREEN flag.

Is this by design, or have I found a bug? For whatever it is worth, I have never encountered this kind of behavior on any other OS X application.

You can attempt to reproduce this bug as I have by editing src/test/SDL_test_common.c and modifying at line ~48 the variable state->window_flags. I used the testsprite2c.c example in my test case, although I am willing to bet that this will happen in any other example as well. (My game engine is where I first encountered this bug).

P.S. My testing system is a tri-monitor setup -- a Macbook Air and two external displays hooked up (the third one is via USB). My platform is Mac OS X 10.9 "Mavericks". I am curious if this behavior I describe happens on 10.8; before Apple made significant improvements in the handling of multi-displays.
Comment 1 Jeffrey Carpenter 2014-02-12 03:20:06 UTC
Disabling the hint "SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS" fixes the behavior I deemed a bug in my report. I suppose this means that the "bug" is actually a "feature"...?

In any case, I'd love to see this hint mentioned in the official wiki documentation.

Thanks!
Comment 2 Philipp Wiesemann 2014-02-13 02:08:28 UTC
(In reply to Jeffrey Carpenter from comment #1)
> Disabling the hint "SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS" fixes the
> behavior I deemed a bug in my report. I suppose this means that the "bug" is
> actually a "feature"...?
> 
> In any case, I'd love to see this hint mentioned in the official wiki
> documentation.
> 
> Thanks!

Hint added to wiki:

https://wiki.libsdl.org/SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS

Remarks are missing though.