4 >SDL_SetEventFilter</TITLE
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
10 TITLE="SDL Library Documentation"
11 HREF="index.html"><LINK
13 TITLE="Event Functions."
14 HREF="eventfunctions.html"><LINK
17 HREF="sdlpushevent.html"><LINK
19 TITLE="SDL_GetEventFilter"
20 HREF="sdlgeteventfilter.html"></HEAD
31 SUMMARY="Header navigation table"
40 >SDL Library Documentation</TH
48 HREF="sdlpushevent.html"
62 HREF="sdlgeteventfilter.html"
73 NAME="SDLSETEVENTFILTER"
75 >SDL_SetEventFilter</H1
83 >SDL_SetEventFilter -- Sets up a filter to process all events before they are posted
84 to the event queue.</DIV
86 CLASS="REFSYNOPSISDIV"
100 CLASS="FUNCSYNOPSISINFO"
101 >#include "SDL.h"</PRE
108 >SDL_SetEventFilter</B
110 >(SDL_EventFilter filter);</CODE
124 >This function sets up a filter to process all events before they are posted
125 to the event queue. This is a very powerful and flexible feature. The filter
128 CLASS="PROGRAMLISTING"
129 >typedef int (*SDL_EventFilter)(const SDL_Event *event);</PRE
131 If the filter returns <SPAN
134 >, then the event will be
135 added to the internal queue. If it returns <SPAN
139 then the event will be dropped from the queue. This allows selective
140 filtering of dynamically.</P
142 >There is one caveat when dealing with the <TT
146 event filter is only called when the window manager desires to close the
147 application window. If the event filter returns 1, then the window will
148 be closed, otherwise the window will remain open if possible.
149 If the quit event is generated by an interrupt signal, it will bypass the
150 internal queue and be delivered to the application at the next event poll.</P
158 >Events pushed onto the queue with <A
159 HREF="sdlpushevent.html"
165 HREF="sdlpeepevents.html"
170 > do not get passed through the event filter.</P
186 > The event filter function may run in a different thread so be careful what you do within it.</P
206 HREF="sdlgeteventfilter.html"
209 >SDL_GetEventFilter</TT
213 HREF="sdlpushevent.html"
225 SUMMARY="Footer navigation table"
236 HREF="sdlpushevent.html"
254 HREF="sdlgeteventfilter.html"
270 HREF="eventfunctions.html"
278 >SDL_GetEventFilter</TD