>SDL_SetEventFilter<
/TITLE
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.64
REL="HOME"
TITLE="SDL Library Documentation"
REL="UP"
TITLE="Event Functions."
HREF="eventfunctions.html"><
LINK
REL="PREVIOUS"
TITLE="SDL_PushEvent"
HREF="sdlpushevent.html"><
LINK
REL="NEXT"
TITLE="SDL_GetEventFilter"
HREF="sdlgeteventfilter.html"><
/HEAD
CLASS="REFENTRY"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
CLASS="NAVHEADER"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation<
/TH
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
HREF="sdlpushevent.html"
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
HREF="sdlgeteventfilter.html"
ALIGN="LEFT"
NAME="SDLSETEVENTFILTER"
CLASS="REFNAMEDIV"
NAME="AEN5032"
>SDL_SetEventFilter -- Sets up a filter to process all events before they are posted
CLASS="REFSYNOPSISDIV"
NAME="AEN5035"
CLASS="FUNCSYNOPSIS"
NAME="AEN5036"
CLASS="FUNCSYNOPSISINFO"
CLASS="FUNCDEF"
CLASS="FSFUNC"
>
(SDL_EventFilter filter
);<
/CODE
CLASS="REFSECT1"
NAME="AEN5042"
>This function sets up a filter to process all events before they are posted
to the event queue. This is a very powerful and flexible feature. The filter
is prototyped as:
CLASS="PROGRAMLISTING"
>typedef int
(*SDL_EventFilter
)(const SDL_Event *event
);<
/PRE
>
If the filter returns <
SPAN
CLASS="RETURNVALUE"
>, then the event will be
added to the internal queue. If it returns <
SPAN
CLASS="RETURNVALUE"
>,
then the event will be dropped from the queue. This allows selective
filtering of dynamically.<
/P
>There is one caveat when dealing with the <
TT
CLASS="LITERAL"
> 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.<
/P
CLASS="NOTE"
CLASS="NOTE"
>Events pushed onto the queue with <
A
HREF="sdlpushevent.html"
CLASS="FUNCTION"
HREF="sdlpeepevents.html"
CLASS="FUNCTION"
> do not get passed through the event filter.<
/P
CLASS="NOTE"
CLASS="NOTE"
CLASS="EMPHASIS"
> The event filter function may run in a different thread so be careful what you do within it.<
/P
CLASS="REFSECT1"
NAME="AEN5059"
HREF="sdlevent.html"
CLASS="STRUCTNAME"
>,
HREF="sdlgeteventfilter.html"
CLASS="FUNCTION"
>,
HREF="sdlpushevent.html"
CLASS="FUNCTION"
CLASS="NAVFOOTER"
ALIGN="LEFT"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
WIDTH="33%"
ALIGN="left"
VALIGN="top"
HREF="sdlpushevent.html"
WIDTH="34%"
ALIGN="center"
VALIGN="top"
HREF="index.html"
WIDTH="33%"
ALIGN="right"
VALIGN="top"
HREF="sdlgeteventfilter.html"
WIDTH="33%"
ALIGN="left"
VALIGN="top"
WIDTH="34%"
ALIGN="center"
VALIGN="top"
HREF="eventfunctions.html"
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>