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 1347 - No SDL_WINDOWEVENT_FOCUS_GAINED event when fullscreen
Summary: No SDL_WINDOWEVENT_FOCUS_GAINED event when fullscreen
Status: RESOLVED INVALID
Alias: None
Product: SDL
Classification: Unclassified
Component: events (show other bugs)
Version: HG 2.0
Hardware: x86 Windows (XP)
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-20 11:31 UTC by Vern Jensen
Modified: 2011-12-20 12:19 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 Vern Jensen 2011-12-20 11:31:05 UTC
Version: SDL-1.3.0-5605

When my SDL application is fullscreen and I alt-tab out, I get a SDL_WINDOWEVENT_FOCUS_LOST event, but never get a SDL_WINDOWEVENT_FOCUS_GAINED when clicking on the tab in the Windows taskbar to resume. Nor do I get a SDL_WINDOWEVENT_RESTORED event!

I outputted to a file a log of events I got when alt-tabbing out and then clicking on the tab to restore, printing the value of the event->window.event field. This is what I got:

Window event: 13 "focus lost"
Window event: 3 "window exposed"
Window event: 7 "minimized"
Window event: 4  "window moved"
Window event: 5  "resized"
[quit]

As you can see, there is no SDL_WINDOWEVENT_FOCUS_GAINED or SDL_WINDOWEVENT_RESTORED event.

This bug ONLY happens when fullscreen. When I'm in windowed mode, I get event 12 (SDL_WINDOWEVENT_FOCUS_GAINED) as soon as the user clicks on the tab in the windows task bar.
Comment 1 Vern Jensen 2011-12-20 12:17:35 UTC
My bad. Turns out that after a window resize event, I was flushing other window events, in an attempt to flush window-resize events generated by my own call to SDL_SetWindowSize(). But this in turn was also flushing the window-activated events. D'oh!