include/SDL_events.h
author Sam Lantinga <slouken@libsdl.org>
Sun, 18 Jun 2006 13:47:19 +0000
branchSDL-1.3
changeset 1686 8d7fecceb9ef
parent 1669 9857d21967bb
child 1722 5daa04d862f1
permissions -rw-r--r--
Added the unicode keysym memory again for backwards compatibility.
slouken@0
     1
/*
slouken@0
     2
    SDL - Simple DirectMedia Layer
slouken@1312
     3
    Copyright (C) 1997-2006 Sam Lantinga
slouken@0
     4
slouken@0
     5
    This library is free software; you can redistribute it and/or
slouken@1312
     6
    modify it under the terms of the GNU Lesser General Public
slouken@0
     7
    License as published by the Free Software Foundation; either
slouken@1312
     8
    version 2.1 of the License, or (at your option) any later version.
slouken@0
     9
slouken@0
    10
    This library is distributed in the hope that it will be useful,
slouken@0
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@0
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@1312
    13
    Lesser General Public License for more details.
slouken@0
    14
slouken@1312
    15
    You should have received a copy of the GNU Lesser General Public
slouken@1312
    16
    License along with this library; if not, write to the Free Software
slouken@1312
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
slouken@0
    18
slouken@0
    19
    Sam Lantinga
slouken@251
    20
    slouken@libsdl.org
slouken@0
    21
*/
slouken@0
    22
slouken@1662
    23
/**
slouken@1662
    24
 * \file SDL_events.h
slouken@1662
    25
 *
slouken@1662
    26
 * Include file for SDL event handling
slouken@1662
    27
 */
slouken@0
    28
slouken@0
    29
#ifndef _SDL_events_h
slouken@0
    30
#define _SDL_events_h
slouken@0
    31
slouken@1356
    32
#include "SDL_stdinc.h"
slouken@1358
    33
#include "SDL_error.h"
slouken@1662
    34
#include "SDL_video.h"
slouken@0
    35
#include "SDL_keyboard.h"
slouken@0
    36
#include "SDL_mouse.h"
slouken@0
    37
#include "SDL_joystick.h"
slouken@0
    38
#include "SDL_quit.h"
slouken@0
    39
slouken@0
    40
#include "begin_code.h"
slouken@0
    41
/* Set up for C function definitions, even when using C++ */
slouken@0
    42
#ifdef __cplusplus
slouken@1662
    43
/* *INDENT-OFF* */
slouken@0
    44
extern "C" {
slouken@1662
    45
/* *INDENT-ON* */
slouken@0
    46
#endif
slouken@0
    47
slouken@1330
    48
/* General keyboard/mouse state definitions */
slouken@1330
    49
#define SDL_RELEASED	0
slouken@1330
    50
#define SDL_PRESSED	1
slouken@1330
    51
slouken@1662
    52
/**
slouken@1662
    53
 * \enum SDL_EventType
slouken@1662
    54
 *
slouken@1662
    55
 * \brief The types of events that can be delivered
slouken@1662
    56
 */
slouken@1662
    57
typedef enum
slouken@1662
    58
{
slouken@1662
    59
    SDL_NOEVENT = 0,            /**< Unused (do not remove) */
slouken@1662
    60
    SDL_WINDOWEVENT,            /**< Window state change */
slouken@1662
    61
    SDL_KEYDOWN,                /**< Keys pressed */
slouken@1662
    62
    SDL_KEYUP,                  /**< Keys released */
slouken@1662
    63
    SDL_MOUSEMOTION,            /**< Mouse moved */
slouken@1662
    64
    SDL_MOUSEBUTTONDOWN,        /**< Mouse button pressed */
slouken@1662
    65
    SDL_MOUSEBUTTONUP,          /**< Mouse button released */
slouken@1662
    66
    SDL_JOYAXISMOTION,          /**< Joystick axis motion */
slouken@1662
    67
    SDL_JOYBALLMOTION,          /**< Joystick trackball motion */
slouken@1662
    68
    SDL_JOYHATMOTION,           /**< Joystick hat position change */
slouken@1662
    69
    SDL_JOYBUTTONDOWN,          /**< Joystick button pressed */
slouken@1662
    70
    SDL_JOYBUTTONUP,            /**< Joystick button released */
slouken@1662
    71
    SDL_QUIT,                   /**< User-requested quit */
slouken@1662
    72
    SDL_SYSWMEVENT,             /**< System specific event */
slouken@1662
    73
    SDL_EVENT_RESERVED1,        /**< Reserved for future use... */
slouken@1662
    74
    SDL_EVENT_RESERVED2,        /**< Reserved for future use... */
slouken@1662
    75
    SDL_EVENT_RESERVED3,        /**< Reserved for future use... */
slouken@1662
    76
    /* Events SDL_USEREVENT through SDL_MAXEVENTS-1 are for your use */
slouken@1662
    77
    SDL_USEREVENT = 24,
slouken@1662
    78
    /* This last event is only for bounding internal arrays
slouken@1662
    79
       It is the number of bits in the event mask datatype -- Uint32
slouken@1662
    80
     */
slouken@1662
    81
    SDL_NUMEVENTS = 32
slouken@1294
    82
} SDL_EventType;
slouken@0
    83
slouken@1662
    84
/**
slouken@1662
    85
 * \enum SDL_EventMask
slouken@1662
    86
 *
slouken@1662
    87
 * \brief Predefined event masks
slouken@1662
    88
 */
slouken@0
    89
#define SDL_EVENTMASK(X)	(1<<(X))
slouken@1662
    90
typedef enum
slouken@1662
    91
{
slouken@1668
    92
    SDL_WINDOWEVENTMASK = SDL_EVENTMASK(SDL_WINDOWEVENT),
slouken@1668
    93
    SDL_KEYDOWNMASK = SDL_EVENTMASK(SDL_KEYDOWN),
slouken@1668
    94
    SDL_KEYUPMASK = SDL_EVENTMASK(SDL_KEYUP),
slouken@1668
    95
    SDL_KEYEVENTMASK = SDL_EVENTMASK(SDL_KEYDOWN) | SDL_EVENTMASK(SDL_KEYUP),
slouken@1668
    96
    SDL_MOUSEMOTIONMASK = SDL_EVENTMASK(SDL_MOUSEMOTION),
slouken@1668
    97
    SDL_MOUSEBUTTONDOWNMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN),
slouken@1668
    98
    SDL_MOUSEBUTTONUPMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONUP),
slouken@1668
    99
    SDL_MOUSEEVENTMASK = SDL_EVENTMASK(SDL_MOUSEMOTION) |
slouken@1668
   100
        SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN) | SDL_EVENTMASK(SDL_MOUSEBUTTONUP),
slouken@1668
   101
    SDL_JOYAXISMOTIONMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION),
slouken@1668
   102
    SDL_JOYBALLMOTIONMASK = SDL_EVENTMASK(SDL_JOYBALLMOTION),
slouken@1668
   103
    SDL_JOYHATMOTIONMASK = SDL_EVENTMASK(SDL_JOYHATMOTION),
slouken@1668
   104
    SDL_JOYBUTTONDOWNMASK = SDL_EVENTMASK(SDL_JOYBUTTONDOWN),
slouken@1668
   105
    SDL_JOYBUTTONUPMASK = SDL_EVENTMASK(SDL_JOYBUTTONUP),
slouken@1668
   106
    SDL_JOYEVENTMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION) |
slouken@1668
   107
        SDL_EVENTMASK(SDL_JOYBALLMOTION) |
slouken@1668
   108
        SDL_EVENTMASK(SDL_JOYHATMOTION) |
slouken@1668
   109
        SDL_EVENTMASK(SDL_JOYBUTTONDOWN) | SDL_EVENTMASK(SDL_JOYBUTTONUP),
slouken@1668
   110
    SDL_QUITMASK = SDL_EVENTMASK(SDL_QUIT),
slouken@1668
   111
    SDL_SYSWMEVENTMASK = SDL_EVENTMASK(SDL_SYSWMEVENT)
slouken@1662
   112
} SDL_EventMask;
slouken@0
   113
#define SDL_ALLEVENTS		0xFFFFFFFF
slouken@0
   114
slouken@1662
   115
/**
slouken@1662
   116
 * \struct SDL_WindowEvent
slouken@1662
   117
 *
slouken@1662
   118
 * \brief Window state change event data
slouken@1662
   119
 */
slouken@1662
   120
typedef struct SDL_WindowEvent
slouken@1662
   121
{
slouken@1662
   122
    Uint8 type;             /**< SDL_WINDOWEVENT */
slouken@1662
   123
    Uint8 event;            /**< SDL_WindowEventID */
slouken@1662
   124
    int data1;              /**< event dependent data */
slouken@1662
   125
    int data2;              /**< event dependent data */
slouken@1662
   126
    SDL_WindowID windowID;  /**< The associated window */
slouken@1662
   127
} SDL_WindowEvent;
slouken@0
   128
slouken@1662
   129
/**
slouken@1662
   130
 * \struct SDL_KeyboardEvent
slouken@1662
   131
 *
slouken@1686
   132
 * \brief Keyboard button event structure
slouken@1662
   133
 */
slouken@1662
   134
typedef struct SDL_KeyboardEvent
slouken@1662
   135
{
slouken@1662
   136
    Uint8 type;             /**< SDL_KEYDOWN or SDL_KEYUP */
slouken@1662
   137
    Uint8 which;            /**< The keyboard device index */
slouken@1662
   138
    Uint8 state;            /**< SDL_PRESSED or SDL_RELEASED */
slouken@1662
   139
    SDL_keysym keysym;      /**< The key that was pressed or released */
slouken@1662
   140
    SDL_WindowID windowID;  /**< The window with keyboard focus, if any */
slouken@0
   141
} SDL_KeyboardEvent;
slouken@0
   142
slouken@1662
   143
/**
slouken@1686
   144
 * \struct SDL_CharEvent
slouken@1686
   145
 *
slouken@1686
   146
 * \brief Keyboard input event structure
slouken@1686
   147
 */
slouken@1686
   148
typedef struct SDL_CharEvent
slouken@1686
   149
{
slouken@1686
   150
    Uint8 type;             /**< SDL_CHARINPUT (FIXME: NYI) */
slouken@1686
   151
    Uint8 which;            /**< The keyboard device index */
slouken@1686
   152
    char text[32];          /**< The input text */
slouken@1686
   153
    SDL_WindowID windowID;  /**< The window with keyboard focus, if any */
slouken@1686
   154
} SDL_CharEvent;
slouken@1686
   155
slouken@1686
   156
/**
slouken@1662
   157
 * \struct SDL_MouseMotionEvent
slouken@1662
   158
 *
slouken@1662
   159
 * \brief Mouse motion event structure
slouken@1662
   160
 */
slouken@1662
   161
typedef struct SDL_MouseMotionEvent
slouken@1662
   162
{
slouken@1662
   163
    Uint8 type;             /**< SDL_MOUSEMOTION */
slouken@1662
   164
    Uint8 which;            /**< The mouse device index */
slouken@1662
   165
    Uint8 state;            /**< The current button state */
slouken@1662
   166
    int x;                  /**< X coordinate, relative to window */
slouken@1662
   167
    int y;                  /**< Y coordinate, relative to window */
slouken@1662
   168
    int xrel;               /**< The relative motion in the X direction */
slouken@1662
   169
    int yrel;               /**< The relative motion in the Y direction */
slouken@1662
   170
    SDL_WindowID windowID;  /**< The window with mouse focus, if any */
slouken@0
   171
} SDL_MouseMotionEvent;
slouken@0
   172
slouken@1662
   173
/**
slouken@1662
   174
 * \struct SDL_MouseButtonEvent
slouken@1662
   175
 *
slouken@1662
   176
 * \brief Mouse button event structure
slouken@1662
   177
 */
slouken@1662
   178
typedef struct SDL_MouseButtonEvent
slouken@1662
   179
{
slouken@1662
   180
    Uint8 type;             /**< SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP */
slouken@1662
   181
    Uint8 which;            /**< The mouse device index */
slouken@1662
   182
    Uint8 button;           /**< The mouse button index */
slouken@1662
   183
    Uint8 state;            /**< SDL_PRESSED or SDL_RELEASED */
slouken@1662
   184
    int x;                  /**< X coordinate, relative to window */
slouken@1662
   185
    int y;                  /**< Y coordinate, relative to window */
slouken@1662
   186
    SDL_WindowID windowID;  /**< The window with mouse focus, if any */
slouken@0
   187
} SDL_MouseButtonEvent;
slouken@0
   188
slouken@1662
   189
/**
slouken@1662
   190
 * \struct SDL_JoyAxisEvent
slouken@1662
   191
 *
slouken@1662
   192
 * \brief Joystick axis motion event structure
slouken@1662
   193
 */
slouken@1662
   194
typedef struct SDL_JoyAxisEvent
slouken@1662
   195
{
slouken@1662
   196
    Uint8 type;         /**< SDL_JOYAXISMOTION */
slouken@1662
   197
    Uint8 which;        /**< The joystick device index */
slouken@1662
   198
    Uint8 axis;         /**< The joystick axis index */
slouken@1662
   199
    int value;          /**< The axis value (range: -32768 to 32767) */
slouken@0
   200
} SDL_JoyAxisEvent;
slouken@0
   201
slouken@1662
   202
/**
slouken@1662
   203
 * \struct SDL_JoyBallEvent
slouken@1662
   204
 *
slouken@1662
   205
 * \brief Joystick trackball motion event structure
slouken@1662
   206
 */
slouken@1662
   207
typedef struct SDL_JoyBallEvent
slouken@1662
   208
{
slouken@1662
   209
    Uint8 type;         /**< SDL_JOYBALLMOTION */
slouken@1662
   210
    Uint8 which;        /**< The joystick device index */
slouken@1662
   211
    Uint8 ball;         /**< The joystick trackball index */
slouken@1662
   212
    int xrel;           /**< The relative motion in the X direction */
slouken@1662
   213
    int yrel;           /**< The relative motion in the Y direction */
slouken@0
   214
} SDL_JoyBallEvent;
slouken@0
   215
slouken@1662
   216
/**
slouken@1662
   217
 * \struct SDL_JoyHatEvent
slouken@1662
   218
 *
slouken@1662
   219
 * \brief Joystick hat position change event structure
slouken@1662
   220
 */
slouken@1662
   221
typedef struct SDL_JoyHatEvent
slouken@1662
   222
{
slouken@1662
   223
    Uint8 type;         /**< SDL_JOYHATMOTION */
slouken@1662
   224
    Uint8 which;        /**< The joystick device index */
slouken@1662
   225
    Uint8 hat;          /**< The joystick hat index */
slouken@1662
   226
    Uint8 value;        /**< The hat position value:
slouken@1662
   227
                             SDL_HAT_LEFTUP   SDL_HAT_UP       SDL_HAT_RIGHTUP
slouken@1662
   228
                             SDL_HAT_LEFT     SDL_HAT_CENTERED SDL_HAT_RIGHT
slouken@1662
   229
                             SDL_HAT_LEFTDOWN SDL_HAT_DOWN     SDL_HAT_RIGHTDOWN
slouken@1662
   230
                             Note that zero means the POV is centered.
slouken@1662
   231
                         */
slouken@0
   232
} SDL_JoyHatEvent;
slouken@0
   233
slouken@1662
   234
/**
slouken@1662
   235
 * \struct SDL_JoyButtonEvent
slouken@1662
   236
 *
slouken@1662
   237
 * \brief Joystick button event structure
slouken@1662
   238
 */
slouken@1662
   239
typedef struct SDL_JoyButtonEvent
slouken@1662
   240
{
slouken@1662
   241
    Uint8 type;         /**< SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP */
slouken@1662
   242
    Uint8 which;        /**< The joystick device index */
slouken@1662
   243
    Uint8 button;       /**< The joystick button index */
slouken@1662
   244
    Uint8 state;        /**< SDL_PRESSED or SDL_RELEASED */
slouken@0
   245
} SDL_JoyButtonEvent;
slouken@0
   246
slouken@1662
   247
/**
slouken@1662
   248
 * \struct SDL_QuitEvent
slouken@1662
   249
 *
slouken@1662
   250
 * \brief The "quit requested" event
slouken@0
   251
 */
slouken@1662
   252
typedef struct SDL_QuitEvent
slouken@1662
   253
{
slouken@1662
   254
    Uint8 type;         /**< SDL_QUIT */
slouken@0
   255
} SDL_QuitEvent;
slouken@0
   256
slouken@1662
   257
/**
slouken@1662
   258
 * \struct SDL_UserEvent
slouken@1662
   259
 *
slouken@1662
   260
 * \brief A user-defined event type
slouken@1662
   261
 */
slouken@1662
   262
typedef struct SDL_UserEvent
slouken@1662
   263
{
slouken@1662
   264
    Uint8 type;         /**< SDL_USEREVENT through SDL_NUMEVENTS-1 */
slouken@1662
   265
    int code;           /**< User defined event code */
slouken@1662
   266
    void *data1;        /**< User defined data pointer */
slouken@1662
   267
    void *data2;        /**< User defined data pointer */
slouken@0
   268
} SDL_UserEvent;
slouken@0
   269
slouken@1662
   270
/**
slouken@1662
   271
 * \struct SDL_SysWMEvent
slouken@1662
   272
 *
slouken@1662
   273
 * \brief A video driver dependent system event
slouken@1662
   274
 *
slouken@1662
   275
 * \note If you want to use this event, you should include SDL_syswm.h
slouken@1662
   276
 */
slouken@0
   277
struct SDL_SysWMmsg;
slouken@0
   278
typedef struct SDL_SysWMmsg SDL_SysWMmsg;
slouken@1662
   279
typedef struct SDL_SysWMEvent
slouken@1662
   280
{
slouken@1662
   281
    Uint8 type;         /**< SDL_SYSWMEVENT */
slouken@1662
   282
    SDL_SysWMmsg *msg;  /**< driver dependent data, defined in SDL_syswm.h */
slouken@0
   283
} SDL_SysWMEvent;
slouken@0
   284
slouken@1669
   285
/* Typedefs for backwards compatibility */
slouken@1669
   286
typedef struct SDL_ActiveEvent
slouken@1669
   287
{
slouken@1669
   288
    Uint8 type;
slouken@1669
   289
    Uint8 gain;
slouken@1669
   290
    Uint8 state;
slouken@1669
   291
} SDL_ActiveEvent;
slouken@1669
   292
typedef struct SDL_ResizeEvent
slouken@1669
   293
{
slouken@1669
   294
    Uint8 type;
slouken@1669
   295
    int w;
slouken@1669
   296
    int h;
slouken@1669
   297
} SDL_ResizeEvent;
slouken@1669
   298
slouken@1662
   299
/**
slouken@1662
   300
 * \union SDL_Event
slouken@1662
   301
 *
slouken@1662
   302
 * \brief General event structure
slouken@1662
   303
 */
slouken@1662
   304
typedef union SDL_Event
slouken@1662
   305
{
slouken@1662
   306
    Uint8 type;                     /**< Event type, shared with all events */
slouken@1662
   307
    SDL_WindowEvent window;         /**< Window event data */
slouken@1662
   308
    SDL_KeyboardEvent key;          /**< Keyboard event data */
slouken@1662
   309
    SDL_MouseMotionEvent motion;    /**< Mouse motion event data */
slouken@1662
   310
    SDL_MouseButtonEvent button;    /**< Mouse button event data */
slouken@1662
   311
    SDL_JoyAxisEvent jaxis;         /**< Joystick axis event data */
slouken@1662
   312
    SDL_JoyBallEvent jball;         /**< Joystick ball event data */
slouken@1662
   313
    SDL_JoyHatEvent jhat;           /**< Joystick hat event data */
slouken@1662
   314
    SDL_JoyButtonEvent jbutton;     /**< Joystick button event data */
slouken@1662
   315
    SDL_QuitEvent quit;             /**< Quit request event data */
slouken@1662
   316
    SDL_UserEvent user;             /**< Custom event data */
slouken@1662
   317
    SDL_SysWMEvent syswm;           /**< System dependent window event data */
slouken@1669
   318
slouken@1669
   319
    /* Temporarily here for backwards compatibility */
slouken@1669
   320
    SDL_ActiveEvent active;
slouken@1669
   321
    SDL_ResizeEvent resize;
slouken@0
   322
} SDL_Event;
slouken@0
   323
slouken@0
   324
slouken@0
   325
/* Function prototypes */
slouken@0
   326
slouken@0
   327
/* Pumps the event loop, gathering events from the input devices.
slouken@0
   328
   This function updates the event queue and internal input device state.
slouken@0
   329
   This should only be run in the thread that sets the video mode.
slouken@0
   330
*/
slouken@1668
   331
extern DECLSPEC void SDLCALL SDL_PumpEvents(void);
slouken@0
   332
slouken@0
   333
/* Checks the event queue for messages and optionally returns them.
slouken@0
   334
   If 'action' is SDL_ADDEVENT, up to 'numevents' events will be added to
slouken@0
   335
   the back of the event queue.
slouken@0
   336
   If 'action' is SDL_PEEKEVENT, up to 'numevents' events at the front
slouken@0
   337
   of the event queue, matching 'mask', will be returned and will not
slouken@0
   338
   be removed from the queue.
slouken@0
   339
   If 'action' is SDL_GETEVENT, up to 'numevents' events at the front 
slouken@0
   340
   of the event queue, matching 'mask', will be returned and will be
slouken@0
   341
   removed from the queue.
slouken@0
   342
   This function returns the number of events actually stored, or -1
slouken@0
   343
   if there was an error.  This function is thread-safe.
slouken@0
   344
*/
slouken@1662
   345
typedef enum
slouken@1662
   346
{
slouken@1662
   347
    SDL_ADDEVENT,
slouken@1662
   348
    SDL_PEEKEVENT,
slouken@1662
   349
    SDL_GETEVENT
slouken@0
   350
} SDL_eventaction;
slouken@0
   351
/* */
slouken@1668
   352
extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event * events, int numevents,
slouken@1668
   353
                                           SDL_eventaction action,
slouken@1668
   354
                                           Uint32 mask);
slouken@0
   355
slouken@0
   356
/* Polls for currently pending events, and returns 1 if there are any pending
slouken@0
   357
   events, or 0 if there are none available.  If 'event' is not NULL, the next
slouken@0
   358
   event is removed from the queue and stored in that area.
slouken@0
   359
 */
slouken@1668
   360
extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event * event);
slouken@0
   361
slouken@0
   362
/* Waits indefinitely for the next available event, returning 1, or 0 if there
slouken@0
   363
   was an error while waiting for events.  If 'event' is not NULL, the next
slouken@0
   364
   event is removed from the queue and stored in that area.
slouken@0
   365
 */
slouken@1668
   366
extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event * event);
slouken@0
   367
slouken@0
   368
/* Add an event to the event queue.
slouken@844
   369
   This function returns 0 on success, or -1 if the event queue was full
slouken@844
   370
   or there was some other error.
slouken@0
   371
 */
slouken@1668
   372
extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event * event);
slouken@0
   373
slouken@0
   374
/*
slouken@0
   375
  This function sets up a filter to process all events before they
slouken@0
   376
  change internal state and are posted to the internal event queue.
slouken@0
   377
slouken@0
   378
  The filter is protypted as:
slouken@0
   379
*/
slouken@1686
   380
typedef int (SDLCALL * SDL_EventFilter) (SDL_Event * event);
slouken@0
   381
/*
slouken@0
   382
  If the filter returns 1, then the event will be added to the internal queue.
slouken@0
   383
  If it returns 0, then the event will be dropped from the queue, but the 
slouken@0
   384
  internal state will still be updated.  This allows selective filtering of
slouken@0
   385
  dynamically arriving events.
slouken@0
   386
slouken@0
   387
  WARNING:  Be very careful of what you do in the event filter function, as 
slouken@0
   388
            it may run in a different thread!
slouken@0
   389
slouken@0
   390
  There is one caveat when dealing with the SDL_QUITEVENT event type.  The
slouken@0
   391
  event filter is only called when the window manager desires to close the
slouken@0
   392
  application window.  If the event filter returns 1, then the window will
slouken@0
   393
  be closed, otherwise the window will remain open if possible.
slouken@0
   394
  If the quit event is generated by an interrupt signal, it will bypass the
slouken@0
   395
  internal queue and be delivered to the application at the next event poll.
slouken@0
   396
*/
slouken@1668
   397
extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter);
slouken@0
   398
slouken@0
   399
/*
slouken@0
   400
  Return the current event filter - can be used to "chain" filters.
slouken@0
   401
  If there is no event filter set, this function returns NULL.
slouken@0
   402
*/
slouken@1668
   403
extern DECLSPEC SDL_EventFilter SDLCALL SDL_GetEventFilter(void);
slouken@0
   404
slouken@0
   405
/*
slouken@0
   406
  This function allows you to set the state of processing certain events.
slouken@0
   407
  If 'state' is set to SDL_IGNORE, that event will be automatically dropped
slouken@0
   408
  from the event queue and will not event be filtered.
slouken@0
   409
  If 'state' is set to SDL_ENABLE, that event will be processed normally.
slouken@0
   410
  If 'state' is set to SDL_QUERY, SDL_EventState() will return the 
slouken@0
   411
  current processing state of the specified event.
slouken@0
   412
*/
slouken@0
   413
#define SDL_QUERY	-1
slouken@0
   414
#define SDL_IGNORE	 0
slouken@0
   415
#define SDL_DISABLE	 0
slouken@0
   416
#define SDL_ENABLE	 1
slouken@1668
   417
extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint8 type, int state);
slouken@0
   418
slouken@0
   419
slouken@0
   420
/* Ends C function definitions when using C++ */
slouken@0
   421
#ifdef __cplusplus
slouken@1662
   422
/* *INDENT-OFF* */
slouken@0
   423
}
slouken@1662
   424
/* *INDENT-ON* */
slouken@0
   425
#endif
slouken@0
   426
#include "close_code.h"
slouken@0
   427
slouken@0
   428
#endif /* _SDL_events_h */
slouken@1662
   429
slouken@1662
   430
/* vi: set ts=4 sw=4 expandtab: */