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 1241

Summary: Mimimized window doesn't get activate event when fullscreen (OS X)
Product: SDL Reporter: Vern Jensen <vern>
Component: eventsAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: minor    
Priority: P1 CC: icculus
Version: HG 2.0Keywords: target-2.0.0
Hardware: x86   
OS: Mac OS X 10.6   

Description Vern Jensen 2011-07-01 13:05:41 UTC
If I call SDL_MinimizeWindow in response to the user selecting Hide Midnight Mansion from the menu bar (or in this case pushing Command-H, since I'm fullscreen), then when the user clicks on the window's minimized icon in the dock to bring it back to the front again, my application does NOT get a SDL_WINDOWEVENT_FOCUS_GAINED event. Meaning my app will stay paused, because I paused it upon being minimized, and it never gets notified of being restored.

This bug is only when fullscreen. If my app was windowed when it was minimized, all works just fine. Same for user clicking the yellow minimize button in the window -- these both result in a SDL_WINDOWEVENT_FOCUS_GAINED event when the window is restored. Only fullscreen windows fail to get this event.
Comment 1 Vern Jensen 2011-07-01 13:05:55 UTC
SDL-1.3.0-5557
Comment 2 Ryan C. Gordon 2013-07-12 18:52:42 UTC
(Sorry if you get a lot of copies of this email, we're touching dozens of bug reports right now.)

Tagging a bunch of bugs as target-2.0.0, Priority 1.

This means we're in the final stretch for an official SDL 2.0.0 release! These are the bugs we really want to fix before shipping if humanly possible.

That being said, we don't promise to fix them because of this tag, we just want to make sure we don't forget to deal with them before we bless a final 2.0.0 release, and generally be organized about what we're aiming to ship.

Hopefully you'll hear more about this bug soon. If you have more information (including "this got fixed at some point, nevermind"), we would love to have you come add more information to the bug report when you have a moment.

Thanks!
--ryan.
Comment 3 Ryan C. Gordon 2013-07-18 22:29:48 UTC
This appears to be working now.

Test case:

Add this to test/testwm2.c ...

diff --git a/test/testwm2.c b/test/testwm2.c
--- a/test/testwm2.c
+++ b/test/testwm2.c
@@ -81,6 +81,9 @@
             SDLTest_CommonEvent(state, &event, &done);
 
             if (event.type == SDL_WINDOWEVENT) {
+                if (event.window.event == SDL_WINDOWEVENT_HIDDEN) {
+                    SDL_MinimizeWindow(SDL_GetWindowFromID(event.window.windowI
+                }


...and run it as such:

    ./testwm2 --fullscreen --info all

Note that when you hit Command-H, it minimizes the window, even without the above patch, and reports keyboard focus coming and going correctly as you click on the minimized window.

Note that SDL will minimize the window now, even without this patch, which is probably why this started working (the call to SDL_MinimizeWindow() is probably a no-op by the time it's called).

I'm resolving this bug as fixed.

--ryan.