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 3146 - Improper window resized event generated when toggling fullscreen on Mac OS X
Summary: Improper window resized event generated when toggling fullscreen on Mac OS X
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: events (show other bugs)
Version: HG 2.0
Hardware: x86_64 Mac OS X (All)
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-10 22:14 UTC by Joshua Bodine
Modified: 2020-04-25 00:33 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joshua Bodine 2015-10-10 22:14:26 UTC
This issue was introduced in revision 9790 "Hack to fix missing window decorations after toggling fullscreen mode in Mac OS X 10.10." Upon destroying a fullscreen window and creating a new windowed one, a SDL_WINDOWEVENT_RESIZED is generated with the height and width of the display, not of the newly created window. Prior to that revision, it appears no SDL_WINDOWEVENT_RESIZED was generated at all upon window destruction/re-creation.

This is partially a shortcoming in our code (the BZFlag game), but when our program receives this event, it thinks the display resolution is the needed window resolution and tries to do another resize, after which another SDL_WINDOWEVENT_RESIZED is generated with the same width and a slightly reduced height so that the window fits in between the dock and menu at the top. The end result is that when we toggle from fullscreen to windowed mode, the desired resolution is ignored and the window ends up filling the whole display (except for the dock and menu bar).
Comment 1 Alex Szpakowski 2015-10-11 17:23:33 UTC
You might be able to work around the issue in BZFlag's code by erasing all pending window events after destroying the window. (Or selectively erasing any pending window events that have the same window ID as the destroyed window, if you ever use multiple windows.)

SDL_FlushEvent(SDL_WINDOWEVENT) will do the former.
Comment 2 Joshua Bodine 2020-04-25 00:33:12 UTC
This bug now appears to be fixed in the latest SDL 2 version.