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 3582

Summary: SDL_SetEventFilter and SDL_QUIT
Product: SDL Reporter: Sprocklem <sprocklem>
Component: eventsAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.1   
Hardware: x86_64   
OS: Linux   

Description Sprocklem 2017-02-06 23:44:51 UTC
In strict defiance of reality, the SDL Wiki's page on SDL_SetEventFilter() (located at: https://wiki.libsdl.org/SDL_SetEventFilter) includes the following text (and seems to have since time immemorial):

There is one caveat when dealing with the SDL_QUITEVENT event type. The event filter is only called when the window manager desires to close the application window. If the event filter returns 1, then the window will be closed, otherwise the window will remain open if possible.

Ignoring the fact that SDL_QUITEVENT is not the correct name for the event type, this is not what happens. In fact, SDL_SetEventFilter() sets a flag that is read by SDL_SendPendingQuit() (called by SDL_PumpEvents()), which indirectly (via SDL_SendAppEvent()) calls SDL_PushEvent(). SDL_PushEvent() always runs filters the event.

While I am of the opinion that the behaviour indicated on the wiki is more useful, I am unsure if any code actually expects this behaviour. (I think ultimately, this is best handled with a more generic mechanism a la Bug #3536, but I'm not sure.)
Comment 1 Sam Lantinga 2017-08-11 17:54:57 UTC
This was just old information from SDL 1.2. This has been fixed on the wiki, thanks!