.\" This manpage content is licensed under Creative Commons .\" Attribution 4.0 International (CC BY 4.0) .\" https://creativecommons.org/licenses/by/4.0/ .\" This manpage was generated from SDL's wiki page for SDL_SetEventFilter: .\" https://wiki.libsdl.org/SDL_SetEventFilter .\" Generated with SDL/build-scripts/wikiheaders.pl .\" revision SDL-3.1.0 .\" Please report issues in this manpage's content at: .\" https://github.com/libsdl-org/sdlwiki/issues/new .\" Please report issues in the generation of this manpage from the wiki at: .\" https://github.com/libsdl-org/SDL/issues/new?title=Misgenerated%20manpage%20for%20SDL_SetEventFilter .\" SDL can be found at https://libsdl.org/ .de URL \$2 \(laURL: \$1 \(ra\$3 .. .if \n[.g] .mso www.tmac .TH SDL_SetEventFilter 3 "SDL 3.1.0" "SDL" "SDL3 FUNCTIONS" .SH NAME SDL_SetEventFilter \- Set up a filter to process all events before they change internal state and are posted to the internal event queue\[char46] .SH SYNOPSIS .nf .B #include \(dqSDL3/SDL.h\(dq .PP .BI "void SDL_SetEventFilter(SDL_EventFilter filter, void *userdata); .fi .SH DESCRIPTION If the filter function returns 1 when called, then the event will be added to the internal queue\[char46] If it returns 0, then the event will be dropped from the queue, but the internal state will still be updated\[char46] This allows selective filtering of dynamically arriving events\[char46] .B WARNING : Be very careful of what you do in the event filter function, as it may run in a different thread! On platforms that support it, if the quit event is generated by an interrupt signal (e\[char46]g\[char46] pressing Ctrl-C), it will be delivered to the application at the next event poll\[char46] There is one caveat when dealing with the :: .BR SDL_QuitEvent event type\[char46] The event filter is only called when the window manager desires to close the application window\[char46] If the event filter returns 1, then the window will be closed, otherwise the window will remain open if possible\[char46] Note: Disabled events never make it to the event filter function; see .BR SDL_SetEventEnabled ()\[char46] Note: If you just want to inspect events without filtering, you should use .BR SDL_AddEventWatch () instead\[char46] Note: Events pushed onto the queue with .BR SDL_PushEvent () get passed through the event filter, but events pushed onto the queue with .BR SDL_PeepEvents () do not\[char46] .SH FUNCTION PARAMETERS .TP .I filter An .BR SDL_EventFilter function to call when an event happens .TP .I userdata a pointer that is passed to .BR filter .SH AVAILABILITY This function is available since SDL 3\[char46]0\[char46]0\[char46] .SH SEE ALSO .BR SDL_AddEventWatch (3), .BR SDL_SetEventEnabled (3), .BR SDL_GetEventFilter (3), .BR SDL_PeepEvents (3), .BR SDL_PushEvent (3)