include/SDL_events.h
author Jim Grandpre <jim.tla@gmail.com>
Wed, 07 Jul 2010 04:13:08 -0700
changeset 4657 eed063a0bf5b
parent 4644 fb500b3e1717
child 4658 454385d76845
permissions -rw-r--r--
Moved Multi finger gesture recognition into the library.
     1 /*
     2     SDL - Simple DirectMedia Layer
     3     Copyright (C) 1997-2010 Sam Lantinga
     4 
     5     This library is free software; you can redistribute it and/or
     6     modify it under the terms of the GNU Lesser General Public
     7     License as published by the Free Software Foundation; either
     8     version 2.1 of the License, or (at your option) any later version.
     9 
    10     This library is distributed in the hope that it will be useful,
    11     but WITHOUT ANY WARRANTY; without even the implied warranty of
    12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    13     Lesser General Public License for more details.
    14 
    15     You should have received a copy of the GNU Lesser General Public
    16     License along with this library; if not, write to the Free Software
    17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    18 
    19     Sam Lantinga
    20     slouken@libsdl.org
    21 */
    22 
    23 /**
    24  *  \file SDL_events.h
    25  *  
    26  *  Include file for SDL event handling.
    27  */
    28 
    29 #ifndef _SDL_events_h
    30 #define _SDL_events_h
    31 
    32 #include "SDL_stdinc.h"
    33 #include "SDL_error.h"
    34 #include "SDL_video.h"
    35 #include "SDL_keyboard.h"
    36 #include "SDL_mouse.h"
    37 #include "SDL_joystick.h"
    38 #include "SDL_quit.h"
    39 
    40 #include "begin_code.h"
    41 /* Set up for C function definitions, even when using C++ */
    42 #ifdef __cplusplus
    43 /* *INDENT-OFF* */
    44 extern "C" {
    45 /* *INDENT-ON* */
    46 #endif
    47 
    48 /* General keyboard/mouse state definitions */
    49 #define SDL_RELEASED	0
    50 #define SDL_PRESSED	1
    51 
    52 /**
    53  * \brief The types of events that can be delivered.
    54  */
    55 typedef enum
    56 {
    57     SDL_FIRSTEVENT     = 0,     /**< Unused (do not remove) */
    58 
    59     /* Application events */
    60     SDL_QUIT           = 0x100, /**< User-requested quit */
    61 
    62     /* Window events */
    63     SDL_WINDOWEVENT    = 0x200, /**< Window state change */
    64     SDL_SYSWMEVENT,             /**< System specific event */
    65 
    66     /* Keyboard events */
    67     SDL_KEYDOWN        = 0x300, /**< Keys pressed */
    68     SDL_KEYUP,                  /**< Keys released */
    69     SDL_TEXTEDITING,            /**< Keyboard text editing (composition) */
    70     SDL_TEXTINPUT,              /**< Keyboard text input */
    71 
    72     /* Mouse events */
    73     SDL_MOUSEMOTION    = 0x400, /**< Mouse moved */
    74     SDL_MOUSEBUTTONDOWN,        /**< Mouse button pressed */
    75     SDL_MOUSEBUTTONUP,          /**< Mouse button released */
    76     SDL_MOUSEWHEEL,             /**< Mouse wheel motion */
    77 
    78     /* Tablet events */
    79     SDL_PROXIMITYIN    = 0x500, /**< Proximity In event */
    80     SDL_PROXIMITYOUT,           /**< Proximity Out event */
    81 
    82     /* Joystick events */
    83     SDL_JOYAXISMOTION  = 0x600, /**< Joystick axis motion */
    84     SDL_JOYBALLMOTION,          /**< Joystick trackball motion */
    85     SDL_JOYHATMOTION,           /**< Joystick hat position change */
    86     SDL_JOYBUTTONDOWN,          /**< Joystick button pressed */
    87     SDL_JOYBUTTONUP,            /**< Joystick button released */
    88 
    89     /*Touch events*/
    90     SDL_FINGERDOWN     = 0x700,
    91     SDL_FINGERUP,
    92     SDL_FINGERMOTION,
    93     SDL_TOUCHBUTTONDOWN,
    94     SDL_TOUCHBUTTONUP,    
    95 
    96     /*Gesture events*/
    97     SDL_DOLLARGESTURE     = 0x800,
    98     SDL_MULTIGESTURE,
    99 
   100     /* Obsolete events */
   101     SDL_EVENT_COMPAT1 = 0x7000, /**< SDL 1.2 events for compatibility */
   102     SDL_EVENT_COMPAT2,
   103     SDL_EVENT_COMPAT3,
   104 
   105 
   106     /** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use,
   107      *  and should be allocated with SDL_RegisterEvents()
   108      */
   109     SDL_USEREVENT    = 0x8000,
   110 
   111     /**
   112      *  This last event is only for bounding internal arrays
   113      */
   114     SDL_LASTEVENT    = 0xFFFF
   115 } SDL_EventType;
   116 
   117 /**
   118  *  \brief Window state change event data (event.window.*)
   119  */
   120 typedef struct SDL_WindowEvent
   121 {
   122     Uint32 type;        /**< ::SDL_WINDOWEVENT */
   123     Uint32 windowID;    /**< The associated window */
   124     Uint8 event;        /**< ::SDL_WindowEventID */
   125     Uint8 padding1;
   126     Uint8 padding2;
   127     Uint8 padding3;
   128     int data1;          /**< event dependent data */
   129     int data2;          /**< event dependent data */
   130 } SDL_WindowEvent;
   131 
   132 /**
   133  *  \brief Keyboard button event structure (event.key.*)
   134  */
   135 typedef struct SDL_KeyboardEvent
   136 {
   137     Uint32 type;        /**< ::SDL_KEYDOWN or ::SDL_KEYUP */
   138     Uint32 windowID;    /**< The window with keyboard focus, if any */
   139     Uint8 which;        /**< The keyboard device index */
   140     Uint8 state;        /**< ::SDL_PRESSED or ::SDL_RELEASED */
   141     Uint8 padding1;
   142     Uint8 padding2;
   143     SDL_keysym keysym;  /**< The key that was pressed or released */
   144 } SDL_KeyboardEvent;
   145 
   146 #define SDL_TEXTEDITINGEVENT_TEXT_SIZE (32)
   147 /**
   148  *  \brief Keyboard text editing event structure (event.edit.*)
   149  */
   150 typedef struct SDL_TextEditingEvent
   151 {
   152     Uint32 type;                                /**< ::SDL_TEXTEDITING */
   153     Uint32 windowID;                            /**< The window with keyboard focus, if any */
   154     Uint8 which;                                /**< The keyboard device index */
   155     char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE];  /**< The editing text */
   156     int start;                                  /**< The start cursor of selected editing text */
   157     int length;                                 /**< The length of selected editing text */
   158 } SDL_TextEditingEvent;
   159 
   160 
   161 #define SDL_TEXTINPUTEVENT_TEXT_SIZE (32)
   162 /**
   163  *  \brief Keyboard text input event structure (event.text.*)
   164  */
   165 typedef struct SDL_TextInputEvent
   166 {
   167     Uint32 type;                              /**< ::SDL_TEXTINPUT */
   168     Uint32 windowID;                          /**< The window with keyboard focus, if any */
   169     Uint8 which;                              /**< The keyboard device index */
   170     Uint8 padding1;
   171     Uint8 padding2;
   172     Uint8 padding3;
   173     char text[SDL_TEXTINPUTEVENT_TEXT_SIZE];  /**< The input text */
   174 } SDL_TextInputEvent;
   175 
   176 /**
   177  *  \brief Mouse motion event structure (event.motion.*)
   178  */
   179 typedef struct SDL_MouseMotionEvent
   180 {
   181     Uint32 type;        /**< ::SDL_MOUSEMOTION */
   182     Uint32 windowID;    /**< The window with mouse focus, if any */
   183     Uint8 which;        /**< The mouse device index */
   184     Uint8 state;        /**< The current button state */
   185     Uint8 padding1;
   186     Uint8 padding2;
   187     int x;              /**< X coordinate, relative to window */
   188     int y;              /**< Y coordinate, relative to window */
   189     int z;              /**< Z coordinate, for future use */
   190     int pressure;       /**< Pressure reported by tablets */
   191     int pressure_max;   /**< Maximum value of the pressure reported by the device */
   192     int pressure_min;   /**< Minimum value of the pressure reported by the device */
   193     int rotation;       /**< For future use */
   194     int tilt_x;         /**< For future use */
   195     int tilt_y;         /**< For future use */
   196     int cursor;         /**< The cursor being used in the event */
   197     int xrel;           /**< The relative motion in the X direction */
   198     int yrel;           /**< The relative motion in the Y direction */
   199 } SDL_MouseMotionEvent;
   200 
   201 /**
   202  *  \brief Mouse button event structure (event.button.*)
   203  */
   204 typedef struct SDL_MouseButtonEvent
   205 {
   206     Uint32 type;        /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */
   207     Uint32 windowID;    /**< The window with mouse focus, if any */
   208     Uint8 which;        /**< The mouse device index */
   209     Uint8 button;       /**< The mouse button index */
   210     Uint8 state;        /**< ::SDL_PRESSED or ::SDL_RELEASED */
   211     Uint8 padding1;
   212     int x;              /**< X coordinate, relative to window */
   213     int y;              /**< Y coordinate, relative to window */
   214 } SDL_MouseButtonEvent;
   215 
   216 /**
   217  *  \brief Mouse wheel event structure (event.wheel.*)
   218  */
   219 typedef struct SDL_MouseWheelEvent
   220 {
   221     Uint32 type;        /**< ::SDL_MOUSEWHEEL */
   222     Uint32 windowID;    /**< The window with mouse focus, if any */
   223     Uint8 which;        /**< The mouse device index */
   224     Uint8 padding1;
   225     Uint8 padding2;
   226     Uint8 padding3;
   227     int x;              /**< The amount scrolled horizontally */
   228     int y;              /**< The amount scrolled vertically */
   229 } SDL_MouseWheelEvent;
   230 
   231 /**
   232  * \brief Tablet pen proximity event
   233  */
   234 typedef struct SDL_ProximityEvent
   235 {
   236     Uint32 type;        /**< ::SDL_PROXIMITYIN or ::SDL_PROXIMITYOUT */
   237     Uint32 windowID;    /**< The associated window */
   238     Uint8 which;
   239     Uint8 padding1;
   240     Uint8 padding2;
   241     Uint8 padding3;
   242     int cursor;
   243     int x;
   244     int y;
   245 } SDL_ProximityEvent;
   246 
   247 /**
   248  *  \brief Joystick axis motion event structure (event.jaxis.*)
   249  */
   250 typedef struct SDL_JoyAxisEvent
   251 {
   252     Uint32 type;        /**< ::SDL_JOYAXISMOTION */
   253     Uint8 which;        /**< The joystick device index */
   254     Uint8 axis;         /**< The joystick axis index */
   255     Uint8 padding1;
   256     Uint8 padding2;
   257     int value;          /**< The axis value (range: -32768 to 32767) */
   258 } SDL_JoyAxisEvent;
   259 
   260 /**
   261  *  \brief Joystick trackball motion event structure (event.jball.*)
   262  */
   263 typedef struct SDL_JoyBallEvent
   264 {
   265     Uint32 type;        /**< ::SDL_JOYBALLMOTION */
   266     Uint8 which;        /**< The joystick device index */
   267     Uint8 ball;         /**< The joystick trackball index */
   268     Uint8 padding1;
   269     Uint8 padding2;
   270     int xrel;           /**< The relative motion in the X direction */
   271     int yrel;           /**< The relative motion in the Y direction */
   272 } SDL_JoyBallEvent;
   273 
   274 /**
   275  *  \brief Joystick hat position change event structure (event.jhat.*)
   276  */
   277 typedef struct SDL_JoyHatEvent
   278 {
   279     Uint32 type;        /**< ::SDL_JOYHATMOTION */
   280     Uint8 which;        /**< The joystick device index */
   281     Uint8 hat;          /**< The joystick hat index */
   282     Uint8 value;        /**< The hat position value.
   283                          *   \sa ::SDL_HAT_LEFTUP ::SDL_HAT_UP ::SDL_HAT_RIGHTUP
   284                          *   \sa ::SDL_HAT_LEFT ::SDL_HAT_CENTERED ::SDL_HAT_RIGHT
   285                          *   \sa ::SDL_HAT_LEFTDOWN ::SDL_HAT_DOWN ::SDL_HAT_RIGHTDOWN
   286                          *   
   287                          *   Note that zero means the POV is centered.
   288                          */
   289     Uint8 padding1;
   290 } SDL_JoyHatEvent;
   291 
   292 /**
   293  *  \brief Joystick button event structure (event.jbutton.*)
   294  */
   295 typedef struct SDL_JoyButtonEvent
   296 {
   297     Uint32 type;        /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */
   298     Uint8 which;        /**< The joystick device index */
   299     Uint8 button;       /**< The joystick button index */
   300     Uint8 state;        /**< ::SDL_PRESSED or ::SDL_RELEASED */
   301     Uint8 padding1;
   302 } SDL_JoyButtonEvent;
   303 
   304 
   305 /**
   306  *  \brief Touch finger motion/finger event structure (event.tmotion.*)
   307  */
   308 typedef struct SDL_TouchFingerEvent
   309 {
   310     Uint32 type;        /**< ::SDL_FINGERMOTION OR 
   311 			   SDL_FINGERDOWN OR SDL_FINGERUP*/
   312     Uint32 windowID;    /**< The window with mouse focus, if any */
   313     Uint8 touchId;        /**< The touch device id */
   314     Uint8 state;        /**< The current button state */
   315     Uint8 fingerId;
   316     Uint8 padding1;
   317     int x;
   318     int y;
   319     int pressure;
   320 } SDL_TouchFingerEvent;
   321 
   322 
   323 /**
   324  *  \brief Touch finger motion/finger event structure (event.tmotion.*)
   325  */
   326 typedef struct SDL_TouchButtonEvent
   327 {
   328     Uint32 type;        /**< ::SDL_TOUCHBUTTONUP OR SDL_TOUCHBUTTONDOWN */
   329     Uint32 windowID;    /**< The window with mouse focus, if any */
   330     Uint8 touchId;        /**< The touch device index */
   331     Uint8 state;        /**< The current button state */
   332     Uint8 button;        /**< The button changing state */
   333     Uint8 padding1;
   334 
   335 } SDL_TouchButtonEvent;
   336 
   337 
   338 
   339 /**
   340  *  \brief Multiple Finger Gesture Event
   341  */
   342 typedef struct SDL_MultiGestureEvent
   343 {
   344     Uint32 type;        /**< ::SDL_MULTIGESTURE */
   345     Uint32 windowID;    /**< The window with mouse focus, if any */
   346     Uint8 touchId;        /**< The touch device index */
   347     Uint8 padding1;
   348     Uint8 padding2;
   349     Uint8 padding3;
   350     float dTheta;
   351     float dDist;
   352     float x;  //currently 0...1. Change to screen coords?
   353     float y;  
   354 
   355 } SDL_MultiGestureEvent;
   356 
   357 
   358 
   359 
   360 /**
   361  *  \brief The "quit requested" event
   362  */
   363 typedef struct SDL_QuitEvent
   364 {
   365     Uint32 type;        /**< ::SDL_QUIT */
   366 } SDL_QuitEvent;
   367 
   368 /**
   369  *  \brief A user-defined event type (event.user.*)
   370  */
   371 typedef struct SDL_UserEvent
   372 {
   373     Uint32 type;        /**< ::SDL_USEREVENT through ::SDL_NUMEVENTS-1 */
   374     Uint32 windowID;    /**< The associated window if any */
   375     int code;           /**< User defined event code */
   376     void *data1;        /**< User defined data pointer */
   377     void *data2;        /**< User defined data pointer */
   378 } SDL_UserEvent;
   379 
   380 struct SDL_SysWMmsg;
   381 typedef struct SDL_SysWMmsg SDL_SysWMmsg;
   382 
   383 /**
   384  *  \brief A video driver dependent system event (event.syswm.*)
   385  *  
   386  *  \note If you want to use this event, you should include SDL_syswm.h.
   387  */
   388 typedef struct SDL_SysWMEvent
   389 {
   390     Uint32 type;        /**< ::SDL_SYSWMEVENT */
   391     SDL_SysWMmsg *msg;  /**< driver dependent data, defined in SDL_syswm.h */
   392 } SDL_SysWMEvent;
   393 
   394 #ifndef SDL_NO_COMPAT
   395 /**
   396  *  \addtogroup Compatibility 
   397  */
   398 /*@{*/
   399 
   400 /**
   401  *  \name Typedefs for backwards compatibility
   402  */
   403 /*@{*/
   404 typedef struct SDL_ActiveEvent
   405 {
   406     Uint32 type;
   407     Uint8 gain;
   408     Uint8 state;
   409 } SDL_ActiveEvent;
   410 
   411 typedef struct SDL_ResizeEvent
   412 {
   413     Uint32 type;
   414     int w;
   415     int h;
   416 } SDL_ResizeEvent;
   417 /*@}*/
   418 
   419 /*@}*//*Compatibility*/
   420 #endif
   421 
   422 /**
   423  *  \brief General event structure
   424  */
   425 typedef union SDL_Event
   426 {
   427     Uint32 type;                    /**< Event type, shared with all events */
   428     SDL_WindowEvent window;         /**< Window event data */
   429     SDL_KeyboardEvent key;          /**< Keyboard event data */
   430     SDL_TextEditingEvent edit;      /**< Text editing event data */
   431     SDL_TextInputEvent text;        /**< Text input event data */
   432     SDL_MouseMotionEvent motion;    /**< Mouse motion event data */
   433     SDL_MouseButtonEvent button;    /**< Mouse button event data */
   434     SDL_MouseWheelEvent wheel;      /**< Mouse wheel event data */
   435     SDL_JoyAxisEvent jaxis;         /**< Joystick axis event data */
   436     SDL_JoyBallEvent jball;         /**< Joystick ball event data */
   437     SDL_JoyHatEvent jhat;           /**< Joystick hat event data */
   438     SDL_JoyButtonEvent jbutton;     /**< Joystick button event data */
   439     SDL_QuitEvent quit;             /**< Quit request event data */
   440     SDL_UserEvent user;             /**< Custom event data */
   441     SDL_SysWMEvent syswm;           /**< System dependent window event data */
   442     SDL_ProximityEvent proximity;   /**< Proximity In or Out event */
   443     SDL_TouchFingerEvent tfinger;   /**< Touch finger event data */
   444     SDL_TouchButtonEvent tbutton;   /**< Touch button event data */
   445     SDL_MultiGestureEvent mgesture; /**< Multi Finger Gesture data*/
   446 
   447     /** Temporarily here for backwards compatibility */
   448     /*@{*/
   449 #ifndef SDL_NO_COMPAT
   450     SDL_ActiveEvent active;
   451     SDL_ResizeEvent resize;
   452 #endif
   453     /*@}*/
   454 } SDL_Event;
   455 
   456 
   457 /* Function prototypes */
   458 
   459 /**
   460  *  Pumps the event loop, gathering events from the input devices.
   461  *  
   462  *  This function updates the event queue and internal input device state.
   463  *  
   464  *  This should only be run in the thread that sets the video mode.
   465  */
   466 extern DECLSPEC void SDLCALL SDL_PumpEvents(void);
   467 
   468 /*@{*/
   469 typedef enum
   470 {
   471     SDL_ADDEVENT,
   472     SDL_PEEKEVENT,
   473     SDL_GETEVENT
   474 } SDL_eventaction;
   475 
   476 /**
   477  *  Checks the event queue for messages and optionally returns them.
   478  *  
   479  *  If \c action is ::SDL_ADDEVENT, up to \c numevents events will be added to
   480  *  the back of the event queue.
   481  *  
   482  *  If \c action is ::SDL_PEEKEVENT, up to \c numevents events at the front
   483  *  of the event queue, matching \c mask, will be returned and will not
   484  *  be removed from the queue.
   485  *  
   486  *  If \c action is ::SDL_GETEVENT, up to \c numevents events at the front 
   487  *  of the event queue, matching \c mask, will be returned and will be
   488  *  removed from the queue.
   489  *  
   490  *  \return The number of events actually stored, or -1 if there was an error.
   491  *  
   492  *  This function is thread-safe.
   493  */
   494 extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event * events, int numevents,
   495                                            SDL_eventaction action,
   496                                            Uint32 minType, Uint32 maxType);
   497 /*@}*/
   498 
   499 /**
   500  *  Checks to see if certain event types are in the event queue.
   501  */
   502 extern DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 type);
   503 extern DECLSPEC SDL_bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType);
   504 
   505 /**
   506  *  This function clears events from the event queue
   507  */
   508 extern DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type);
   509 extern DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType);
   510 
   511 /**
   512  *  \brief Polls for currently pending events.
   513  *  
   514  *  \return 1 if there are any pending events, or 0 if there are none available.
   515  *  
   516  *  \param event If not NULL, the next event is removed from the queue and 
   517  *               stored in that area.
   518  */
   519 extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event * event);
   520 
   521 /**
   522  *  \brief Waits indefinitely for the next available event.
   523  *  
   524  *  \return 1, or 0 if there was an error while waiting for events.
   525  *   
   526  *  \param event If not NULL, the next event is removed from the queue and 
   527  *               stored in that area.
   528  */
   529 extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event * event);
   530 
   531 /**
   532  *  \brief Waits until the specified timeout (in milliseconds) for the next 
   533  *         available event.
   534  *  
   535  *  \return 1, or 0 if there was an error while waiting for events.
   536  *  
   537  *  \param event If not NULL, the next event is removed from the queue and 
   538  *               stored in that area.
   539  */
   540 extern DECLSPEC int SDLCALL SDL_WaitEventTimeout(SDL_Event * event,
   541                                                  int timeout);
   542 
   543 /**
   544  *  \brief Add an event to the event queue.
   545  *  
   546  *  \return 1 on success, 0 if the event was filtered, or -1 if the event queue 
   547  *          was full or there was some other error.
   548  */
   549 extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event * event);
   550 
   551 typedef int (SDLCALL * SDL_EventFilter) (void *userdata, SDL_Event * event);
   552 
   553 /**
   554  *  Sets up a filter to process all events before they change internal state and
   555  *  are posted to the internal event queue.
   556  *  
   557  *  The filter is protypted as:
   558  *  \code
   559  *      int SDL_EventFilter(void *userdata, SDL_Event * event);
   560  *  \endcode
   561  *
   562  *  If the filter returns 1, then the event will be added to the internal queue.
   563  *  If it returns 0, then the event will be dropped from the queue, but the 
   564  *  internal state will still be updated.  This allows selective filtering of
   565  *  dynamically arriving events.
   566  *  
   567  *  \warning  Be very careful of what you do in the event filter function, as 
   568  *            it may run in a different thread!
   569  *  
   570  *  There is one caveat when dealing with the ::SDL_QUITEVENT event type.  The
   571  *  event filter is only called when the window manager desires to close the
   572  *  application window.  If the event filter returns 1, then the window will
   573  *  be closed, otherwise the window will remain open if possible.
   574  *
   575  *  If the quit event is generated by an interrupt signal, it will bypass the
   576  *  internal queue and be delivered to the application at the next event poll.
   577  */
   578 extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter,
   579                                                 void *userdata);
   580 
   581 /**
   582  *  Return the current event filter - can be used to "chain" filters.
   583  *  If there is no event filter set, this function returns SDL_FALSE.
   584  */
   585 extern DECLSPEC SDL_bool SDLCALL SDL_GetEventFilter(SDL_EventFilter * filter,
   586                                                     void **userdata);
   587 
   588 /**
   589  *  Run the filter function on the current event queue, removing any
   590  *  events for which the filter returns 0.
   591  */
   592 extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter,
   593                                               void *userdata);
   594 
   595 /*@{*/
   596 #define SDL_QUERY	-1
   597 #define SDL_IGNORE	 0
   598 #define SDL_DISABLE	 0
   599 #define SDL_ENABLE	 1
   600 
   601 /**
   602  *  This function allows you to set the state of processing certain events.
   603  *   - If \c state is set to ::SDL_IGNORE, that event will be automatically 
   604  *     dropped from the event queue and will not event be filtered.
   605  *   - If \c state is set to ::SDL_ENABLE, that event will be processed 
   606  *     normally.
   607  *   - If \c state is set to ::SDL_QUERY, SDL_EventState() will return the 
   608  *     current processing state of the specified event.
   609  */
   610 extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint32 type, int state);
   611 /*@}*/
   612 #define SDL_GetEventState(type) SDL_EventState(type, SDL_QUERY)
   613 
   614 /**
   615  *  This function allocates a set of user-defined events, and returns
   616  *  the beginning event number for that set of events.
   617  *
   618  *  If there aren't enough user-defined events left, this function
   619  *  returns (Uint32)-1
   620  */
   621 extern DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents);
   622 
   623 /* Ends C function definitions when using C++ */
   624 #ifdef __cplusplus
   625 /* *INDENT-OFF* */
   626 }
   627 /* *INDENT-ON* */
   628 #endif
   629 #include "close_code.h"
   630 
   631 #endif /* _SDL_events_h */
   632 
   633 /* vi: set ts=4 sw=4 expandtab: */