1SDL_SetEventFilter(3) SDL API Reference SDL_SetEventFilter(3)
2
3
4
6 SDL_SetEventFilter - Sets up a filter to process all events before they
7 are posted to the event queue.
8
10 #include "SDL.h"
11
12 void SDL_SetEventFilter(SDL_EventFilter filter);
13
15 This function sets up a filter to process all events before they are
16 posted to the event queue. This is a very powerful and flexible fea‐
17 ture. The filter is prototyped as:
18
19 typedef int (*SDL_EventFilter)(const SDL_Event *event);
20
21 If the filter returns 1, then the event will be added to the internal
22 queue. If it returns 0, then the event will be dropped from the queue.
23 This allows selective filtering of dynamically.
24
25 There is one caveat when dealing with the SDL_QUITEVENT event type. The
26 event filter is only called when the window manager desires to close
27 the application window. If the event filter returns 1, then the window
28 will be closed, otherwise the window will remain open if possible. If
29 the quit event is generated by an interrupt signal, it will bypass the
30 internal queue and be delivered to the application at the next event
31 poll.
32
33 Note:
34
35 Events pushed onto the queue with SDL_PushEvent or SDL_Peep‐
36 Events do not get passed through the event filter.
37
38 Note:
39
40 Be Careful! The event filter function may run in a different
41 thread so be careful what you do within it.
42
44 SDL_Event, SDL_GetEventFilter, SDL_PushEvent
45
46
47
48SDL Tue 11 Sep 2001, 22:59 SDL_SetEventFilter(3)