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 - SDL_SetEventFilter and SDL_QUIT
Summary: SDL_SetEventFilter and SDL_QUIT
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: events (show other bugs)
Version: HG 2.1
Hardware: x86_64 Linux
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-06 23:44 UTC by Sprocklem
Modified: 2017-08-11 17:54 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 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!