include/SDL_events.h
changeset 1895 c121d94672cb
parent 1358 c71e05b4dc2e
child 1914 051df511279c
     1.1 --- a/include/SDL_events.h	Thu Jul 06 18:01:37 2006 +0000
     1.2 +++ b/include/SDL_events.h	Mon Jul 10 21:04:37 2006 +0000
     1.3 @@ -20,14 +20,18 @@
     1.4      slouken@libsdl.org
     1.5  */
     1.6  
     1.7 -/* Include file for SDL event handling */
     1.8 +/**
     1.9 + * \file SDL_events.h
    1.10 + *
    1.11 + * Include file for SDL event handling
    1.12 + */
    1.13  
    1.14  #ifndef _SDL_events_h
    1.15  #define _SDL_events_h
    1.16  
    1.17  #include "SDL_stdinc.h"
    1.18  #include "SDL_error.h"
    1.19 -#include "SDL_active.h"
    1.20 +#include "SDL_video.h"
    1.21  #include "SDL_keyboard.h"
    1.22  #include "SDL_mouse.h"
    1.23  #include "SDL_joystick.h"
    1.24 @@ -36,202 +40,304 @@
    1.25  #include "begin_code.h"
    1.26  /* Set up for C function definitions, even when using C++ */
    1.27  #ifdef __cplusplus
    1.28 +/* *INDENT-OFF* */
    1.29  extern "C" {
    1.30 +/* *INDENT-ON* */
    1.31  #endif
    1.32  
    1.33  /* General keyboard/mouse state definitions */
    1.34  #define SDL_RELEASED	0
    1.35  #define SDL_PRESSED	1
    1.36  
    1.37 -/* Event enumerations */
    1.38 -typedef enum {
    1.39 -       SDL_NOEVENT = 0,			/* Unused (do not remove) */
    1.40 -       SDL_ACTIVEEVENT,			/* Application loses/gains visibility */
    1.41 -       SDL_KEYDOWN,			/* Keys pressed */
    1.42 -       SDL_KEYUP,			/* Keys released */
    1.43 -       SDL_MOUSEMOTION,			/* Mouse moved */
    1.44 -       SDL_MOUSEBUTTONDOWN,		/* Mouse button pressed */
    1.45 -       SDL_MOUSEBUTTONUP,		/* Mouse button released */
    1.46 -       SDL_JOYAXISMOTION,		/* Joystick axis motion */
    1.47 -       SDL_JOYBALLMOTION,		/* Joystick trackball motion */
    1.48 -       SDL_JOYHATMOTION,		/* Joystick hat position change */
    1.49 -       SDL_JOYBUTTONDOWN,		/* Joystick button pressed */
    1.50 -       SDL_JOYBUTTONUP,			/* Joystick button released */
    1.51 -       SDL_QUIT,			/* User-requested quit */
    1.52 -       SDL_SYSWMEVENT,			/* System specific event */
    1.53 -       SDL_EVENT_RESERVEDA,		/* Reserved for future use.. */
    1.54 -       SDL_EVENT_RESERVEDB,		/* Reserved for future use.. */
    1.55 -       SDL_VIDEORESIZE,			/* User resized video mode */
    1.56 -       SDL_VIDEOEXPOSE,			/* Screen needs to be redrawn */
    1.57 -       SDL_EVENT_RESERVED2,		/* Reserved for future use.. */
    1.58 -       SDL_EVENT_RESERVED3,		/* Reserved for future use.. */
    1.59 -       SDL_EVENT_RESERVED4,		/* Reserved for future use.. */
    1.60 -       SDL_EVENT_RESERVED5,		/* Reserved for future use.. */
    1.61 -       SDL_EVENT_RESERVED6,		/* Reserved for future use.. */
    1.62 -       SDL_EVENT_RESERVED7,		/* Reserved for future use.. */
    1.63 -       /* Events SDL_USEREVENT through SDL_MAXEVENTS-1 are for your use */
    1.64 -       SDL_USEREVENT = 24,
    1.65 -       /* This last event is only for bounding internal arrays
    1.66 -	  It is the number of bits in the event mask datatype -- Uint32
    1.67 -        */
    1.68 -       SDL_NUMEVENTS = 32
    1.69 +/**
    1.70 + * \enum SDL_EventType
    1.71 + *
    1.72 + * \brief The types of events that can be delivered
    1.73 + */
    1.74 +typedef enum
    1.75 +{
    1.76 +    SDL_NOEVENT = 0,            /**< Unused (do not remove) */
    1.77 +    SDL_WINDOWEVENT,            /**< Window state change */
    1.78 +    SDL_KEYDOWN,                /**< Keys pressed */
    1.79 +    SDL_KEYUP,                  /**< Keys released */
    1.80 +    SDL_TEXTINPUT,                              /**< Keyboard text input */
    1.81 +    SDL_MOUSEMOTION,            /**< Mouse moved */
    1.82 +    SDL_MOUSEBUTTONDOWN,        /**< Mouse button pressed */
    1.83 +    SDL_MOUSEBUTTONUP,          /**< Mouse button released */
    1.84 +    SDL_MOUSEWHEEL,                             /**< Mouse wheel motion */
    1.85 +    SDL_JOYAXISMOTION,          /**< Joystick axis motion */
    1.86 +    SDL_JOYBALLMOTION,          /**< Joystick trackball motion */
    1.87 +    SDL_JOYHATMOTION,           /**< Joystick hat position change */
    1.88 +    SDL_JOYBUTTONDOWN,          /**< Joystick button pressed */
    1.89 +    SDL_JOYBUTTONUP,            /**< Joystick button released */
    1.90 +    SDL_QUIT,                   /**< User-requested quit */
    1.91 +    SDL_SYSWMEVENT,             /**< System specific event */
    1.92 +    SDL_EVENT_RESERVED1,        /**< Reserved for future use... */
    1.93 +    SDL_EVENT_RESERVED2,        /**< Reserved for future use... */
    1.94 +    SDL_EVENT_RESERVED3,        /**< Reserved for future use... */
    1.95 +    /* Events SDL_USEREVENT through SDL_MAXEVENTS-1 are for your use */
    1.96 +    SDL_USEREVENT = 24,
    1.97 +    /* This last event is only for bounding internal arrays
    1.98 +       It is the number of bits in the event mask datatype -- Uint32
    1.99 +     */
   1.100 +    SDL_NUMEVENTS = 32
   1.101  } SDL_EventType;
   1.102  
   1.103 -/* Predefined event masks */
   1.104 +/**
   1.105 + * \enum SDL_EventMask
   1.106 + *
   1.107 + * \brief Predefined event masks
   1.108 + */
   1.109  #define SDL_EVENTMASK(X)	(1<<(X))
   1.110 -typedef enum {
   1.111 -	SDL_ACTIVEEVENTMASK	= SDL_EVENTMASK(SDL_ACTIVEEVENT),
   1.112 -	SDL_KEYDOWNMASK		= SDL_EVENTMASK(SDL_KEYDOWN),
   1.113 -	SDL_KEYUPMASK		= SDL_EVENTMASK(SDL_KEYUP),
   1.114 -	SDL_KEYEVENTMASK	= SDL_EVENTMASK(SDL_KEYDOWN)|
   1.115 -	                          SDL_EVENTMASK(SDL_KEYUP),
   1.116 -	SDL_MOUSEMOTIONMASK	= SDL_EVENTMASK(SDL_MOUSEMOTION),
   1.117 -	SDL_MOUSEBUTTONDOWNMASK	= SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN),
   1.118 -	SDL_MOUSEBUTTONUPMASK	= SDL_EVENTMASK(SDL_MOUSEBUTTONUP),
   1.119 -	SDL_MOUSEEVENTMASK	= SDL_EVENTMASK(SDL_MOUSEMOTION)|
   1.120 -	                          SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN)|
   1.121 -	                          SDL_EVENTMASK(SDL_MOUSEBUTTONUP),
   1.122 -	SDL_JOYAXISMOTIONMASK	= SDL_EVENTMASK(SDL_JOYAXISMOTION),
   1.123 -	SDL_JOYBALLMOTIONMASK	= SDL_EVENTMASK(SDL_JOYBALLMOTION),
   1.124 -	SDL_JOYHATMOTIONMASK	= SDL_EVENTMASK(SDL_JOYHATMOTION),
   1.125 -	SDL_JOYBUTTONDOWNMASK	= SDL_EVENTMASK(SDL_JOYBUTTONDOWN),
   1.126 -	SDL_JOYBUTTONUPMASK	= SDL_EVENTMASK(SDL_JOYBUTTONUP),
   1.127 -	SDL_JOYEVENTMASK	= SDL_EVENTMASK(SDL_JOYAXISMOTION)|
   1.128 -	                          SDL_EVENTMASK(SDL_JOYBALLMOTION)|
   1.129 -	                          SDL_EVENTMASK(SDL_JOYHATMOTION)|
   1.130 -	                          SDL_EVENTMASK(SDL_JOYBUTTONDOWN)|
   1.131 -	                          SDL_EVENTMASK(SDL_JOYBUTTONUP),
   1.132 -	SDL_VIDEORESIZEMASK	= SDL_EVENTMASK(SDL_VIDEORESIZE),
   1.133 -	SDL_VIDEOEXPOSEMASK	= SDL_EVENTMASK(SDL_VIDEOEXPOSE),
   1.134 -	SDL_QUITMASK		= SDL_EVENTMASK(SDL_QUIT),
   1.135 -	SDL_SYSWMEVENTMASK	= SDL_EVENTMASK(SDL_SYSWMEVENT)
   1.136 -} SDL_EventMask ;
   1.137 +typedef enum
   1.138 +{
   1.139 +    SDL_WINDOWEVENTMASK = SDL_EVENTMASK(SDL_WINDOWEVENT),
   1.140 +    SDL_KEYDOWNMASK = SDL_EVENTMASK(SDL_KEYDOWN),
   1.141 +    SDL_KEYUPMASK = SDL_EVENTMASK(SDL_KEYUP),
   1.142 +    SDL_KEYEVENTMASK = SDL_EVENTMASK(SDL_KEYDOWN) | SDL_EVENTMASK(SDL_KEYUP),
   1.143 +    SDL_TEXTINPUTMASK = SDL_EVENTMASK(SDL_TEXTINPUT),
   1.144 +    SDL_MOUSEMOTIONMASK = SDL_EVENTMASK(SDL_MOUSEMOTION),
   1.145 +    SDL_MOUSEBUTTONDOWNMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN),
   1.146 +    SDL_MOUSEBUTTONUPMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONUP),
   1.147 +    SDL_MOUSEWHEELMASK = SDL_EVENTMASK(SDL_MOUSEWHEEL),
   1.148 +    SDL_MOUSEEVENTMASK = SDL_EVENTMASK(SDL_MOUSEMOTION) |
   1.149 +        SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN) | SDL_EVENTMASK(SDL_MOUSEBUTTONUP),
   1.150 +    SDL_JOYAXISMOTIONMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION),
   1.151 +    SDL_JOYBALLMOTIONMASK = SDL_EVENTMASK(SDL_JOYBALLMOTION),
   1.152 +    SDL_JOYHATMOTIONMASK = SDL_EVENTMASK(SDL_JOYHATMOTION),
   1.153 +    SDL_JOYBUTTONDOWNMASK = SDL_EVENTMASK(SDL_JOYBUTTONDOWN),
   1.154 +    SDL_JOYBUTTONUPMASK = SDL_EVENTMASK(SDL_JOYBUTTONUP),
   1.155 +    SDL_JOYEVENTMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION) |
   1.156 +        SDL_EVENTMASK(SDL_JOYBALLMOTION) |
   1.157 +        SDL_EVENTMASK(SDL_JOYHATMOTION) |
   1.158 +        SDL_EVENTMASK(SDL_JOYBUTTONDOWN) | SDL_EVENTMASK(SDL_JOYBUTTONUP),
   1.159 +    SDL_QUITMASK = SDL_EVENTMASK(SDL_QUIT),
   1.160 +    SDL_SYSWMEVENTMASK = SDL_EVENTMASK(SDL_SYSWMEVENT)
   1.161 +} SDL_EventMask;
   1.162  #define SDL_ALLEVENTS		0xFFFFFFFF
   1.163  
   1.164 -/* Application visibility event structure */
   1.165 -typedef struct SDL_ActiveEvent {
   1.166 -	Uint8 type;	/* SDL_ACTIVEEVENT */
   1.167 -	Uint8 gain;	/* Whether given states were gained or lost (1/0) */
   1.168 -	Uint8 state;	/* A mask of the focus states */
   1.169 -} SDL_ActiveEvent;
   1.170 +/**
   1.171 + * \struct SDL_WindowEvent
   1.172 + *
   1.173 + * \brief Window state change event data
   1.174 + */
   1.175 +typedef struct SDL_WindowEvent
   1.176 +{
   1.177 +    Uint8 type;             /**< SDL_WINDOWEVENT */
   1.178 +    Uint8 event;            /**< SDL_WindowEventID */
   1.179 +    int data1;              /**< event dependent data */
   1.180 +    int data2;              /**< event dependent data */
   1.181 +    SDL_WindowID windowID;  /**< The associated window */
   1.182 +} SDL_WindowEvent;
   1.183  
   1.184 -/* Keyboard event structure */
   1.185 -typedef struct SDL_KeyboardEvent {
   1.186 -	Uint8 type;	/* SDL_KEYDOWN or SDL_KEYUP */
   1.187 -	Uint8 which;	/* The keyboard device index */
   1.188 -	Uint8 state;	/* SDL_PRESSED or SDL_RELEASED */
   1.189 -	SDL_keysym keysym;
   1.190 +/**
   1.191 + * \struct SDL_KeyboardEvent
   1.192 + *
   1.193 + * \brief Keyboard button event structure
   1.194 + */
   1.195 +typedef struct SDL_KeyboardEvent
   1.196 +{
   1.197 +    Uint8 type;             /**< SDL_KEYDOWN or SDL_KEYUP */
   1.198 +    Uint8 which;            /**< The keyboard device index */
   1.199 +    Uint8 state;            /**< SDL_PRESSED or SDL_RELEASED */
   1.200 +    SDL_keysym keysym;      /**< The key that was pressed or released */
   1.201 +    SDL_WindowID windowID;  /**< The window with keyboard focus, if any */
   1.202  } SDL_KeyboardEvent;
   1.203  
   1.204 -/* Mouse motion event structure */
   1.205 -typedef struct SDL_MouseMotionEvent {
   1.206 -	Uint8 type;	/* SDL_MOUSEMOTION */
   1.207 -	Uint8 which;	/* The mouse device index */
   1.208 -	Uint8 state;	/* The current button state */
   1.209 -	Uint16 x, y;	/* The X/Y coordinates of the mouse */
   1.210 -	Sint16 xrel;	/* The relative motion in the X direction */
   1.211 -	Sint16 yrel;	/* The relative motion in the Y direction */
   1.212 +/**
   1.213 + * \struct SDL_TextInputEvent
   1.214 + *
   1.215 + * \brief Keyboard text input event structure
   1.216 + */
   1.217 +typedef struct SDL_TextInputEvent
   1.218 +{
   1.219 +    Uint8 type;             /**< SDL_TEXTINPUT */
   1.220 +    Uint8 which;            /**< The keyboard device index */
   1.221 +    char text[32];          /**< The input text */
   1.222 +    SDL_WindowID windowID;  /**< The window with keyboard focus, if any */
   1.223 +} SDL_TextInputEvent;
   1.224 +
   1.225 +/**
   1.226 + * \struct SDL_MouseMotionEvent
   1.227 + *
   1.228 + * \brief Mouse motion event structure
   1.229 + */
   1.230 +typedef struct SDL_MouseMotionEvent
   1.231 +{
   1.232 +    Uint8 type;             /**< SDL_MOUSEMOTION */
   1.233 +    Uint8 which;            /**< The mouse device index */
   1.234 +    Uint8 state;            /**< The current button state */
   1.235 +    int x;                  /**< X coordinate, relative to window */
   1.236 +    int y;                  /**< Y coordinate, relative to window */
   1.237 +    int xrel;               /**< The relative motion in the X direction */
   1.238 +    int yrel;               /**< The relative motion in the Y direction */
   1.239 +    SDL_WindowID windowID;  /**< The window with mouse focus, if any */
   1.240  } SDL_MouseMotionEvent;
   1.241  
   1.242 -/* Mouse button event structure */
   1.243 -typedef struct SDL_MouseButtonEvent {
   1.244 -	Uint8 type;	/* SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP */
   1.245 -	Uint8 which;	/* The mouse device index */
   1.246 -	Uint8 button;	/* The mouse button index */
   1.247 -	Uint8 state;	/* SDL_PRESSED or SDL_RELEASED */
   1.248 -	Uint16 x, y;	/* The X/Y coordinates of the mouse at press time */
   1.249 +/**
   1.250 + * \struct SDL_MouseButtonEvent
   1.251 + *
   1.252 + * \brief Mouse button event structure
   1.253 + */
   1.254 +typedef struct SDL_MouseButtonEvent
   1.255 +{
   1.256 +    Uint8 type;             /**< SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP */
   1.257 +    Uint8 which;            /**< The mouse device index */
   1.258 +    Uint8 button;           /**< The mouse button index */
   1.259 +    Uint8 state;            /**< SDL_PRESSED or SDL_RELEASED */
   1.260 +    int x;                  /**< X coordinate, relative to window */
   1.261 +    int y;                  /**< Y coordinate, relative to window */
   1.262 +    SDL_WindowID windowID;  /**< The window with mouse focus, if any */
   1.263  } SDL_MouseButtonEvent;
   1.264  
   1.265 -/* Joystick axis motion event structure */
   1.266 -typedef struct SDL_JoyAxisEvent {
   1.267 -	Uint8 type;	/* SDL_JOYAXISMOTION */
   1.268 -	Uint8 which;	/* The joystick device index */
   1.269 -	Uint8 axis;	/* The joystick axis index */
   1.270 -	Sint16 value;	/* The axis value (range: -32768 to 32767) */
   1.271 +/**
   1.272 + * \struct SDL_MouseWheelEvent
   1.273 + *
   1.274 + * \brief Mouse wheel event structure
   1.275 + */
   1.276 +typedef struct SDL_MouseWheelEvent
   1.277 +{
   1.278 +    Uint8 type;             /**< SDL_MOUSEWHEEL */
   1.279 +    Uint8 which;            /**< The mouse device index */
   1.280 +    int motion;                                 /**< The direction and distance scrolled */
   1.281 +    SDL_WindowID windowID;  /**< The window with mouse focus, if any */
   1.282 +} SDL_MouseWheelEvent;
   1.283 +
   1.284 +/**
   1.285 + * \struct SDL_JoyAxisEvent
   1.286 + *
   1.287 + * \brief Joystick axis motion event structure
   1.288 + */
   1.289 +typedef struct SDL_JoyAxisEvent
   1.290 +{
   1.291 +    Uint8 type;         /**< SDL_JOYAXISMOTION */
   1.292 +    Uint8 which;        /**< The joystick device index */
   1.293 +    Uint8 axis;         /**< The joystick axis index */
   1.294 +    int value;          /**< The axis value (range: -32768 to 32767) */
   1.295  } SDL_JoyAxisEvent;
   1.296  
   1.297 -/* Joystick trackball motion event structure */
   1.298 -typedef struct SDL_JoyBallEvent {
   1.299 -	Uint8 type;	/* SDL_JOYBALLMOTION */
   1.300 -	Uint8 which;	/* The joystick device index */
   1.301 -	Uint8 ball;	/* The joystick trackball index */
   1.302 -	Sint16 xrel;	/* The relative motion in the X direction */
   1.303 -	Sint16 yrel;	/* The relative motion in the Y direction */
   1.304 +/**
   1.305 + * \struct SDL_JoyBallEvent
   1.306 + *
   1.307 + * \brief Joystick trackball motion event structure
   1.308 + */
   1.309 +typedef struct SDL_JoyBallEvent
   1.310 +{
   1.311 +    Uint8 type;         /**< SDL_JOYBALLMOTION */
   1.312 +    Uint8 which;        /**< The joystick device index */
   1.313 +    Uint8 ball;         /**< The joystick trackball index */
   1.314 +    int xrel;           /**< The relative motion in the X direction */
   1.315 +    int yrel;           /**< The relative motion in the Y direction */
   1.316  } SDL_JoyBallEvent;
   1.317  
   1.318 -/* Joystick hat position change event structure */
   1.319 -typedef struct SDL_JoyHatEvent {
   1.320 -	Uint8 type;	/* SDL_JOYHATMOTION */
   1.321 -	Uint8 which;	/* The joystick device index */
   1.322 -	Uint8 hat;	/* The joystick hat index */
   1.323 -	Uint8 value;	/* The hat position value:
   1.324 -			    SDL_HAT_LEFTUP   SDL_HAT_UP       SDL_HAT_RIGHTUP
   1.325 -			    SDL_HAT_LEFT     SDL_HAT_CENTERED SDL_HAT_RIGHT
   1.326 -			    SDL_HAT_LEFTDOWN SDL_HAT_DOWN     SDL_HAT_RIGHTDOWN
   1.327 -			   Note that zero means the POV is centered.
   1.328 -			*/
   1.329 +/**
   1.330 + * \struct SDL_JoyHatEvent
   1.331 + *
   1.332 + * \brief Joystick hat position change event structure
   1.333 + */
   1.334 +typedef struct SDL_JoyHatEvent
   1.335 +{
   1.336 +    Uint8 type;         /**< SDL_JOYHATMOTION */
   1.337 +    Uint8 which;        /**< The joystick device index */
   1.338 +    Uint8 hat;          /**< The joystick hat index */
   1.339 +    Uint8 value;        /**< The hat position value:
   1.340 +                             SDL_HAT_LEFTUP   SDL_HAT_UP       SDL_HAT_RIGHTUP
   1.341 +                             SDL_HAT_LEFT     SDL_HAT_CENTERED SDL_HAT_RIGHT
   1.342 +                             SDL_HAT_LEFTDOWN SDL_HAT_DOWN     SDL_HAT_RIGHTDOWN
   1.343 +                             Note that zero means the POV is centered.
   1.344 +                         */
   1.345  } SDL_JoyHatEvent;
   1.346  
   1.347 -/* Joystick button event structure */
   1.348 -typedef struct SDL_JoyButtonEvent {
   1.349 -	Uint8 type;	/* SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP */
   1.350 -	Uint8 which;	/* The joystick device index */
   1.351 -	Uint8 button;	/* The joystick button index */
   1.352 -	Uint8 state;	/* SDL_PRESSED or SDL_RELEASED */
   1.353 +/**
   1.354 + * \struct SDL_JoyButtonEvent
   1.355 + *
   1.356 + * \brief Joystick button event structure
   1.357 + */
   1.358 +typedef struct SDL_JoyButtonEvent
   1.359 +{
   1.360 +    Uint8 type;         /**< SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP */
   1.361 +    Uint8 which;        /**< The joystick device index */
   1.362 +    Uint8 button;       /**< The joystick button index */
   1.363 +    Uint8 state;        /**< SDL_PRESSED or SDL_RELEASED */
   1.364  } SDL_JoyButtonEvent;
   1.365  
   1.366 -/* The "window resized" event
   1.367 -   When you get this event, you are responsible for setting a new video
   1.368 -   mode with the new width and height.
   1.369 +/**
   1.370 + * \struct SDL_QuitEvent
   1.371 + *
   1.372 + * \brief The "quit requested" event
   1.373   */
   1.374 -typedef struct SDL_ResizeEvent {
   1.375 -	Uint8 type;	/* SDL_VIDEORESIZE */
   1.376 -	int w;		/* New width */
   1.377 -	int h;		/* New height */
   1.378 +typedef struct SDL_QuitEvent
   1.379 +{
   1.380 +    Uint8 type;         /**< SDL_QUIT */
   1.381 +} SDL_QuitEvent;
   1.382 +
   1.383 +/**
   1.384 + * \struct SDL_UserEvent
   1.385 + *
   1.386 + * \brief A user-defined event type
   1.387 + */
   1.388 +typedef struct SDL_UserEvent
   1.389 +{
   1.390 +    Uint8 type;         /**< SDL_USEREVENT through SDL_NUMEVENTS-1 */
   1.391 +    int code;           /**< User defined event code */
   1.392 +    void *data1;        /**< User defined data pointer */
   1.393 +    void *data2;        /**< User defined data pointer */
   1.394 +} SDL_UserEvent;
   1.395 +
   1.396 +/**
   1.397 + * \struct SDL_SysWMEvent
   1.398 + *
   1.399 + * \brief A video driver dependent system event
   1.400 + *
   1.401 + * \note If you want to use this event, you should include SDL_syswm.h
   1.402 + */
   1.403 +struct SDL_SysWMmsg;
   1.404 +typedef struct SDL_SysWMmsg SDL_SysWMmsg;
   1.405 +typedef struct SDL_SysWMEvent
   1.406 +{
   1.407 +    Uint8 type;         /**< SDL_SYSWMEVENT */
   1.408 +    SDL_SysWMmsg *msg;  /**< driver dependent data, defined in SDL_syswm.h */
   1.409 +} SDL_SysWMEvent;
   1.410 +
   1.411 +/* Typedefs for backwards compatibility */
   1.412 +typedef struct SDL_ActiveEvent
   1.413 +{
   1.414 +    Uint8 type;
   1.415 +    Uint8 gain;
   1.416 +    Uint8 state;
   1.417 +} SDL_ActiveEvent;
   1.418 +typedef struct SDL_ResizeEvent
   1.419 +{
   1.420 +    Uint8 type;
   1.421 +    int w;
   1.422 +    int h;
   1.423  } SDL_ResizeEvent;
   1.424  
   1.425 -/* The "screen redraw" event */
   1.426 -typedef struct SDL_ExposeEvent {
   1.427 -	Uint8 type;	/* SDL_VIDEOEXPOSE */
   1.428 -} SDL_ExposeEvent;
   1.429 +/**
   1.430 + * \union SDL_Event
   1.431 + *
   1.432 + * \brief General event structure
   1.433 + */
   1.434 +typedef union SDL_Event
   1.435 +{
   1.436 +    Uint8 type;                     /**< Event type, shared with all events */
   1.437 +    SDL_WindowEvent window;         /**< Window event data */
   1.438 +    SDL_KeyboardEvent key;          /**< Keyboard event data */
   1.439 +    SDL_TextInputEvent text;                    /**< Text input event data */
   1.440 +    SDL_MouseMotionEvent motion;    /**< Mouse motion event data */
   1.441 +    SDL_MouseButtonEvent button;    /**< Mouse button event data */
   1.442 +    SDL_MouseWheelEvent wheel;                  /**< Mouse wheel event data */
   1.443 +    SDL_JoyAxisEvent jaxis;         /**< Joystick axis event data */
   1.444 +    SDL_JoyBallEvent jball;         /**< Joystick ball event data */
   1.445 +    SDL_JoyHatEvent jhat;           /**< Joystick hat event data */
   1.446 +    SDL_JoyButtonEvent jbutton;     /**< Joystick button event data */
   1.447 +    SDL_QuitEvent quit;             /**< Quit request event data */
   1.448 +    SDL_UserEvent user;             /**< Custom event data */
   1.449 +    SDL_SysWMEvent syswm;           /**< System dependent window event data */
   1.450  
   1.451 -/* The "quit requested" event */
   1.452 -typedef struct SDL_QuitEvent {
   1.453 -	Uint8 type;	/* SDL_QUIT */
   1.454 -} SDL_QuitEvent;
   1.455 -
   1.456 -/* A user-defined event type */
   1.457 -typedef struct SDL_UserEvent {
   1.458 -	Uint8 type;	/* SDL_USEREVENT through SDL_NUMEVENTS-1 */
   1.459 -	int code;	/* User defined event code */
   1.460 -	void *data1;	/* User defined data pointer */
   1.461 -	void *data2;	/* User defined data pointer */
   1.462 -} SDL_UserEvent;
   1.463 -
   1.464 -/* If you want to use this event, you should include SDL_syswm.h */
   1.465 -struct SDL_SysWMmsg;
   1.466 -typedef struct SDL_SysWMmsg SDL_SysWMmsg;
   1.467 -typedef struct SDL_SysWMEvent {
   1.468 -	Uint8 type;
   1.469 -	SDL_SysWMmsg *msg;
   1.470 -} SDL_SysWMEvent;
   1.471 -
   1.472 -/* General event structure */
   1.473 -typedef union SDL_Event {
   1.474 -	Uint8 type;
   1.475 -	SDL_ActiveEvent active;
   1.476 -	SDL_KeyboardEvent key;
   1.477 -	SDL_MouseMotionEvent motion;
   1.478 -	SDL_MouseButtonEvent button;
   1.479 -	SDL_JoyAxisEvent jaxis;
   1.480 -	SDL_JoyBallEvent jball;
   1.481 -	SDL_JoyHatEvent jhat;
   1.482 -	SDL_JoyButtonEvent jbutton;
   1.483 -	SDL_ResizeEvent resize;
   1.484 -	SDL_ExposeEvent expose;
   1.485 -	SDL_QuitEvent quit;
   1.486 -	SDL_UserEvent user;
   1.487 -	SDL_SysWMEvent syswm;
   1.488 +    /* Temporarily here for backwards compatibility */
   1.489 +    SDL_ActiveEvent active;
   1.490 +    SDL_ResizeEvent resize;
   1.491  } SDL_Event;
   1.492  
   1.493  
   1.494 @@ -255,32 +361,38 @@
   1.495     This function returns the number of events actually stored, or -1
   1.496     if there was an error.  This function is thread-safe.
   1.497  */
   1.498 -typedef enum {
   1.499 -	SDL_ADDEVENT,
   1.500 -	SDL_PEEKEVENT,
   1.501 -	SDL_GETEVENT
   1.502 +typedef enum
   1.503 +{
   1.504 +    SDL_ADDEVENT,
   1.505 +    SDL_PEEKEVENT,
   1.506 +    SDL_GETEVENT
   1.507  } SDL_eventaction;
   1.508  /* */
   1.509 -extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents,
   1.510 -				SDL_eventaction action, Uint32 mask);
   1.511 +extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event * events, int numevents,
   1.512 +                                           SDL_eventaction action,
   1.513 +                                           Uint32 mask);
   1.514 +
   1.515 +/* Checks to see if certain event types are in the event queue.
   1.516 + */
   1.517 +extern DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 mask);
   1.518  
   1.519  /* Polls for currently pending events, and returns 1 if there are any pending
   1.520     events, or 0 if there are none available.  If 'event' is not NULL, the next
   1.521     event is removed from the queue and stored in that area.
   1.522   */
   1.523 -extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event *event);
   1.524 +extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event * event);
   1.525  
   1.526  /* Waits indefinitely for the next available event, returning 1, or 0 if there
   1.527     was an error while waiting for events.  If 'event' is not NULL, the next
   1.528     event is removed from the queue and stored in that area.
   1.529   */
   1.530 -extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event *event);
   1.531 +extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event * event);
   1.532  
   1.533  /* Add an event to the event queue.
   1.534 -   This function returns 0 on success, or -1 if the event queue was full
   1.535 -   or there was some other error.
   1.536 +   This function returns 1 on success, 0 if the event was filtered,
   1.537 +   or -1 if the event queue was full or there was some other error.
   1.538   */
   1.539 -extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event);
   1.540 +extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event * event);
   1.541  
   1.542  /*
   1.543    This function sets up a filter to process all events before they
   1.544 @@ -288,7 +400,7 @@
   1.545  
   1.546    The filter is protypted as:
   1.547  */
   1.548 -typedef int (SDLCALL *SDL_EventFilter)(const SDL_Event *event);
   1.549 +typedef int (SDLCALL * SDL_EventFilter) (void *userdata, SDL_Event * event);
   1.550  /*
   1.551    If the filter returns 1, then the event will be added to the internal queue.
   1.552    If it returns 0, then the event will be dropped from the queue, but the 
   1.553 @@ -305,13 +417,22 @@
   1.554    If the quit event is generated by an interrupt signal, it will bypass the
   1.555    internal queue and be delivered to the application at the next event poll.
   1.556  */
   1.557 -extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter);
   1.558 +extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter,
   1.559 +                                                void *userdata);
   1.560  
   1.561  /*
   1.562    Return the current event filter - can be used to "chain" filters.
   1.563 -  If there is no event filter set, this function returns NULL.
   1.564 +  If there is no event filter set, this function returns SDL_FALSE.
   1.565  */
   1.566 -extern DECLSPEC SDL_EventFilter SDLCALL SDL_GetEventFilter(void);
   1.567 +extern DECLSPEC SDL_bool SDLCALL SDL_GetEventFilter(SDL_EventFilter * filter,
   1.568 +                                                    void **userdata);
   1.569 +
   1.570 +/*
   1.571 +  Run the filter function on the current event queue, removing any
   1.572 +  events for which the filter returns 0.
   1.573 +*/
   1.574 +extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter,
   1.575 +                                              void *userdata);
   1.576  
   1.577  /*
   1.578    This function allows you to set the state of processing certain events.
   1.579 @@ -330,8 +451,12 @@
   1.580  
   1.581  /* Ends C function definitions when using C++ */
   1.582  #ifdef __cplusplus
   1.583 +/* *INDENT-OFF* */
   1.584  }
   1.585 +/* *INDENT-ON* */
   1.586  #endif
   1.587  #include "close_code.h"
   1.588  
   1.589  #endif /* _SDL_events_h */
   1.590 +
   1.591 +/* vi: set ts=4 sw=4 expandtab: */