[][src]Function sdl2_sys::SDL_SetEventFilter

pub unsafe extern "C" fn SDL_SetEventFilter(
    filter: SDL_EventFilter,
    userdata: *mut c_void
)

Sets up a filter to process all events before they change internal state and are posted to the internal event queue.

The filter is prototyped as: \code int SDL_EventFilter(void *userdata, SDL_Event * event); \endcode

If the filter returns 1, then the event will be added to the internal queue. If it returns 0, then the event will be dropped from the queue, but the internal state will still be updated. This allows selective filtering of dynamically arriving events.

\warning Be very careful of what you do in the event filter function, as it may run in a different thread!

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.

If the quit event is generated by an interrupt signal, it will bypass the internal queue and be delivered to the application at the next event poll.