SDL-1.2.14
[sdl_omap.git] / docs / html / sdlseteventfilter.html
CommitLineData
e14743d1 1<HTML
2><HEAD
3><TITLE
4>SDL_SetEventFilter</TITLE
5><META
6NAME="GENERATOR"
7CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
8"><LINK
9REL="HOME"
10TITLE="SDL Library Documentation"
11HREF="index.html"><LINK
12REL="UP"
13TITLE="Event Functions."
14HREF="eventfunctions.html"><LINK
15REL="PREVIOUS"
16TITLE="SDL_PushEvent"
17HREF="sdlpushevent.html"><LINK
18REL="NEXT"
19TITLE="SDL_GetEventFilter"
20HREF="sdlgeteventfilter.html"></HEAD
21><BODY
22CLASS="REFENTRY"
23BGCOLOR="#FFF8DC"
24TEXT="#000000"
25LINK="#0000ee"
26VLINK="#551a8b"
27ALINK="#ff0000"
28><DIV
29CLASS="NAVHEADER"
30><TABLE
31SUMMARY="Header navigation table"
32WIDTH="100%"
33BORDER="0"
34CELLPADDING="0"
35CELLSPACING="0"
36><TR
37><TH
38COLSPAN="3"
39ALIGN="center"
40>SDL Library Documentation</TH
41></TR
42><TR
43><TD
44WIDTH="10%"
45ALIGN="left"
46VALIGN="bottom"
47><A
48HREF="sdlpushevent.html"
49ACCESSKEY="P"
50>Prev</A
51></TD
52><TD
53WIDTH="80%"
54ALIGN="center"
55VALIGN="bottom"
56></TD
57><TD
58WIDTH="10%"
59ALIGN="right"
60VALIGN="bottom"
61><A
62HREF="sdlgeteventfilter.html"
63ACCESSKEY="N"
64>Next</A
65></TD
66></TR
67></TABLE
68><HR
69ALIGN="LEFT"
70WIDTH="100%"></DIV
71><H1
72><A
73NAME="SDLSETEVENTFILTER"
74></A
75>SDL_SetEventFilter</H1
76><DIV
77CLASS="REFNAMEDIV"
78><A
79NAME="AEN5575"
80></A
81><H2
82>Name</H2
83>SDL_SetEventFilter&nbsp;--&nbsp;Sets up a filter to process all events before they are posted
84to the event queue.</DIV
85><DIV
86CLASS="REFSYNOPSISDIV"
87><A
88NAME="AEN5578"
89></A
90><H2
91>Synopsis</H2
92><DIV
93CLASS="FUNCSYNOPSIS"
94><A
95NAME="AEN5579"
96></A
97><P
98></P
99><PRE
100CLASS="FUNCSYNOPSISINFO"
101>#include "SDL.h"</PRE
102><P
103><CODE
104><CODE
105CLASS="FUNCDEF"
106>void <B
107CLASS="FSFUNC"
108>SDL_SetEventFilter</B
109></CODE
110>(SDL_EventFilter filter);</CODE
111></P
112><P
113></P
114></DIV
115></DIV
116><DIV
117CLASS="REFSECT1"
118><A
119NAME="AEN5585"
120></A
121><H2
122>Description</H2
123><P
124>This function sets up a filter to process all events before they are posted
125to the event queue. This is a very powerful and flexible feature. The filter
126is prototyped as:
127<PRE
128CLASS="PROGRAMLISTING"
129>typedef int (*SDL_EventFilter)(const SDL_Event *event);</PRE
130>
131If the filter returns <SPAN
132CLASS="RETURNVALUE"
133>1</SPAN
134>, then the event will be
135added to the internal queue. If it returns <SPAN
136CLASS="RETURNVALUE"
137>0</SPAN
138>,
139then the event will be dropped from the queue. This allows selective
140filtering of dynamically.</P
141><P
142>There is one caveat when dealing with the <TT
143CLASS="LITERAL"
144>SDL_QUITEVENT</TT
145> event type. The
146event filter is only called when the window manager desires to close the
147application window. If the event filter returns 1, then the window will
148be closed, otherwise the window will remain open if possible.
149If the quit event is generated by an interrupt signal, it will bypass the
150internal queue and be delivered to the application at the next event poll.</P
151><DIV
152CLASS="NOTE"
153><BLOCKQUOTE
154CLASS="NOTE"
155><P
156><B
157>Note: </B
158>Events pushed onto the queue with <A
159HREF="sdlpushevent.html"
160><TT
161CLASS="FUNCTION"
162>SDL_PushEvent</TT
163></A
164> or <A
165HREF="sdlpeepevents.html"
166><TT
167CLASS="FUNCTION"
168>SDL_PeepEvents</TT
169></A
170> do not get passed through the event filter.</P
171></BLOCKQUOTE
172></DIV
173><DIV
174CLASS="NOTE"
175><BLOCKQUOTE
176CLASS="NOTE"
177><P
178><B
179>Note: </B
180><SPAN
181CLASS="emphasis"
182><I
183CLASS="EMPHASIS"
184>Be Careful!</I
185></SPAN
186> The event filter function may run in a different thread so be careful what you do within it.</P
187></BLOCKQUOTE
188></DIV
189></DIV
190><DIV
191CLASS="REFSECT1"
192><A
193NAME="AEN5602"
194></A
195><H2
196>See Also</H2
197><P
198><A
199HREF="sdlevent.html"
200><SPAN
201CLASS="STRUCTNAME"
202>SDL_Event</SPAN
203></A
204>,
205<A
206HREF="sdlgeteventfilter.html"
207><TT
208CLASS="FUNCTION"
209>SDL_GetEventFilter</TT
210></A
211>,
212<A
213HREF="sdlpushevent.html"
214><TT
215CLASS="FUNCTION"
216>SDL_PushEvent</TT
217></A
218></P
219></DIV
220><DIV
221CLASS="NAVFOOTER"
222><HR
223ALIGN="LEFT"
224WIDTH="100%"><TABLE
225SUMMARY="Footer navigation table"
226WIDTH="100%"
227BORDER="0"
228CELLPADDING="0"
229CELLSPACING="0"
230><TR
231><TD
232WIDTH="33%"
233ALIGN="left"
234VALIGN="top"
235><A
236HREF="sdlpushevent.html"
237ACCESSKEY="P"
238>Prev</A
239></TD
240><TD
241WIDTH="34%"
242ALIGN="center"
243VALIGN="top"
244><A
245HREF="index.html"
246ACCESSKEY="H"
247>Home</A
248></TD
249><TD
250WIDTH="33%"
251ALIGN="right"
252VALIGN="top"
253><A
254HREF="sdlgeteventfilter.html"
255ACCESSKEY="N"
256>Next</A
257></TD
258></TR
259><TR
260><TD
261WIDTH="33%"
262ALIGN="left"
263VALIGN="top"
264>SDL_PushEvent</TD
265><TD
266WIDTH="34%"
267ALIGN="center"
268VALIGN="top"
269><A
270HREF="eventfunctions.html"
271ACCESSKEY="U"
272>Up</A
273></TD
274><TD
275WIDTH="33%"
276ALIGN="right"
277VALIGN="top"
278>SDL_GetEventFilter</TD
279></TR
280></TABLE
281></DIV
282></BODY
283></HTML
284>