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