Mercurial > sdl-ios-xcode
comparison include/SDL_events.h @ 4217:4c4113c2162c SDL-1.2
Fixed bug #706
Ken Bull 2009-02-25 13:22:02 PST
Adds Doxygen support for all headers (except config and boilerplate headers) in
the include folder for SDL-1.2 revision 4446.
While in general SDL is quite thoroughly commented, none of these comments are
correctly formatted for Doxygen and are generally inconsistent in their
formatting.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 21 Sep 2009 09:38:10 +0000 |
parents | a1b03ba2fcd0 |
children |
comparison
equal
deleted
inserted
replaced
4216:5b99971a27b4 | 4217:4c4113c2162c |
---|---|
18 | 18 |
19 Sam Lantinga | 19 Sam Lantinga |
20 slouken@libsdl.org | 20 slouken@libsdl.org |
21 */ | 21 */ |
22 | 22 |
23 /* Include file for SDL event handling */ | 23 /** |
24 * @file SDL_events.h | |
25 * Include file for SDL event handling | |
26 */ | |
24 | 27 |
25 #ifndef _SDL_events_h | 28 #ifndef _SDL_events_h |
26 #define _SDL_events_h | 29 #define _SDL_events_h |
27 | 30 |
28 #include "SDL_stdinc.h" | 31 #include "SDL_stdinc.h" |
37 /* Set up for C function definitions, even when using C++ */ | 40 /* Set up for C function definitions, even when using C++ */ |
38 #ifdef __cplusplus | 41 #ifdef __cplusplus |
39 extern "C" { | 42 extern "C" { |
40 #endif | 43 #endif |
41 | 44 |
42 /* General keyboard/mouse state definitions */ | 45 /** @name General keyboard/mouse state definitions */ |
46 /*@{*/ | |
43 #define SDL_RELEASED 0 | 47 #define SDL_RELEASED 0 |
44 #define SDL_PRESSED 1 | 48 #define SDL_PRESSED 1 |
45 | 49 /*@}*/ |
46 /* Event enumerations */ | 50 |
51 /** Event enumerations */ | |
47 typedef enum { | 52 typedef enum { |
48 SDL_NOEVENT = 0, /* Unused (do not remove) */ | 53 SDL_NOEVENT = 0, /**< Unused (do not remove) */ |
49 SDL_ACTIVEEVENT, /* Application loses/gains visibility */ | 54 SDL_ACTIVEEVENT, /**< Application loses/gains visibility */ |
50 SDL_KEYDOWN, /* Keys pressed */ | 55 SDL_KEYDOWN, /**< Keys pressed */ |
51 SDL_KEYUP, /* Keys released */ | 56 SDL_KEYUP, /**< Keys released */ |
52 SDL_MOUSEMOTION, /* Mouse moved */ | 57 SDL_MOUSEMOTION, /**< Mouse moved */ |
53 SDL_MOUSEBUTTONDOWN, /* Mouse button pressed */ | 58 SDL_MOUSEBUTTONDOWN, /**< Mouse button pressed */ |
54 SDL_MOUSEBUTTONUP, /* Mouse button released */ | 59 SDL_MOUSEBUTTONUP, /**< Mouse button released */ |
55 SDL_JOYAXISMOTION, /* Joystick axis motion */ | 60 SDL_JOYAXISMOTION, /**< Joystick axis motion */ |
56 SDL_JOYBALLMOTION, /* Joystick trackball motion */ | 61 SDL_JOYBALLMOTION, /**< Joystick trackball motion */ |
57 SDL_JOYHATMOTION, /* Joystick hat position change */ | 62 SDL_JOYHATMOTION, /**< Joystick hat position change */ |
58 SDL_JOYBUTTONDOWN, /* Joystick button pressed */ | 63 SDL_JOYBUTTONDOWN, /**< Joystick button pressed */ |
59 SDL_JOYBUTTONUP, /* Joystick button released */ | 64 SDL_JOYBUTTONUP, /**< Joystick button released */ |
60 SDL_QUIT, /* User-requested quit */ | 65 SDL_QUIT, /**< User-requested quit */ |
61 SDL_SYSWMEVENT, /* System specific event */ | 66 SDL_SYSWMEVENT, /**< System specific event */ |
62 SDL_EVENT_RESERVEDA, /* Reserved for future use.. */ | 67 SDL_EVENT_RESERVEDA, /**< Reserved for future use.. */ |
63 SDL_EVENT_RESERVEDB, /* Reserved for future use.. */ | 68 SDL_EVENT_RESERVEDB, /**< Reserved for future use.. */ |
64 SDL_VIDEORESIZE, /* User resized video mode */ | 69 SDL_VIDEORESIZE, /**< User resized video mode */ |
65 SDL_VIDEOEXPOSE, /* Screen needs to be redrawn */ | 70 SDL_VIDEOEXPOSE, /**< Screen needs to be redrawn */ |
66 SDL_EVENT_RESERVED2, /* Reserved for future use.. */ | 71 SDL_EVENT_RESERVED2, /**< Reserved for future use.. */ |
67 SDL_EVENT_RESERVED3, /* Reserved for future use.. */ | 72 SDL_EVENT_RESERVED3, /**< Reserved for future use.. */ |
68 SDL_EVENT_RESERVED4, /* Reserved for future use.. */ | 73 SDL_EVENT_RESERVED4, /**< Reserved for future use.. */ |
69 SDL_EVENT_RESERVED5, /* Reserved for future use.. */ | 74 SDL_EVENT_RESERVED5, /**< Reserved for future use.. */ |
70 SDL_EVENT_RESERVED6, /* Reserved for future use.. */ | 75 SDL_EVENT_RESERVED6, /**< Reserved for future use.. */ |
71 SDL_EVENT_RESERVED7, /* Reserved for future use.. */ | 76 SDL_EVENT_RESERVED7, /**< Reserved for future use.. */ |
72 /* Events SDL_USEREVENT through SDL_MAXEVENTS-1 are for your use */ | 77 /** Events SDL_USEREVENT through SDL_MAXEVENTS-1 are for your use */ |
73 SDL_USEREVENT = 24, | 78 SDL_USEREVENT = 24, |
74 /* This last event is only for bounding internal arrays | 79 /** This last event is only for bounding internal arrays |
75 It is the number of bits in the event mask datatype -- Uint32 | 80 * It is the number of bits in the event mask datatype -- Uint32 |
76 */ | 81 */ |
77 SDL_NUMEVENTS = 32 | 82 SDL_NUMEVENTS = 32 |
78 } SDL_EventType; | 83 } SDL_EventType; |
79 | 84 |
80 /* Predefined event masks */ | 85 /** @name Predefined event masks */ |
86 /*@{*/ | |
81 #define SDL_EVENTMASK(X) (1<<(X)) | 87 #define SDL_EVENTMASK(X) (1<<(X)) |
82 typedef enum { | 88 typedef enum { |
83 SDL_ACTIVEEVENTMASK = SDL_EVENTMASK(SDL_ACTIVEEVENT), | 89 SDL_ACTIVEEVENTMASK = SDL_EVENTMASK(SDL_ACTIVEEVENT), |
84 SDL_KEYDOWNMASK = SDL_EVENTMASK(SDL_KEYDOWN), | 90 SDL_KEYDOWNMASK = SDL_EVENTMASK(SDL_KEYDOWN), |
85 SDL_KEYUPMASK = SDL_EVENTMASK(SDL_KEYUP), | 91 SDL_KEYUPMASK = SDL_EVENTMASK(SDL_KEYUP), |
105 SDL_VIDEOEXPOSEMASK = SDL_EVENTMASK(SDL_VIDEOEXPOSE), | 111 SDL_VIDEOEXPOSEMASK = SDL_EVENTMASK(SDL_VIDEOEXPOSE), |
106 SDL_QUITMASK = SDL_EVENTMASK(SDL_QUIT), | 112 SDL_QUITMASK = SDL_EVENTMASK(SDL_QUIT), |
107 SDL_SYSWMEVENTMASK = SDL_EVENTMASK(SDL_SYSWMEVENT) | 113 SDL_SYSWMEVENTMASK = SDL_EVENTMASK(SDL_SYSWMEVENT) |
108 } SDL_EventMask ; | 114 } SDL_EventMask ; |
109 #define SDL_ALLEVENTS 0xFFFFFFFF | 115 #define SDL_ALLEVENTS 0xFFFFFFFF |
110 | 116 /*@}*/ |
111 /* Application visibility event structure */ | 117 |
118 /** Application visibility event structure */ | |
112 typedef struct SDL_ActiveEvent { | 119 typedef struct SDL_ActiveEvent { |
113 Uint8 type; /* SDL_ACTIVEEVENT */ | 120 Uint8 type; /**< SDL_ACTIVEEVENT */ |
114 Uint8 gain; /* Whether given states were gained or lost (1/0) */ | 121 Uint8 gain; /**< Whether given states were gained or lost (1/0) */ |
115 Uint8 state; /* A mask of the focus states */ | 122 Uint8 state; /**< A mask of the focus states */ |
116 } SDL_ActiveEvent; | 123 } SDL_ActiveEvent; |
117 | 124 |
118 /* Keyboard event structure */ | 125 /** Keyboard event structure */ |
119 typedef struct SDL_KeyboardEvent { | 126 typedef struct SDL_KeyboardEvent { |
120 Uint8 type; /* SDL_KEYDOWN or SDL_KEYUP */ | 127 Uint8 type; /**< SDL_KEYDOWN or SDL_KEYUP */ |
121 Uint8 which; /* The keyboard device index */ | 128 Uint8 which; /**< The keyboard device index */ |
122 Uint8 state; /* SDL_PRESSED or SDL_RELEASED */ | 129 Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */ |
123 SDL_keysym keysym; | 130 SDL_keysym keysym; |
124 } SDL_KeyboardEvent; | 131 } SDL_KeyboardEvent; |
125 | 132 |
126 /* Mouse motion event structure */ | 133 /** Mouse motion event structure */ |
127 typedef struct SDL_MouseMotionEvent { | 134 typedef struct SDL_MouseMotionEvent { |
128 Uint8 type; /* SDL_MOUSEMOTION */ | 135 Uint8 type; /**< SDL_MOUSEMOTION */ |
129 Uint8 which; /* The mouse device index */ | 136 Uint8 which; /**< The mouse device index */ |
130 Uint8 state; /* The current button state */ | 137 Uint8 state; /**< The current button state */ |
131 Uint16 x, y; /* The X/Y coordinates of the mouse */ | 138 Uint16 x, y; /**< The X/Y coordinates of the mouse */ |
132 Sint16 xrel; /* The relative motion in the X direction */ | 139 Sint16 xrel; /**< The relative motion in the X direction */ |
133 Sint16 yrel; /* The relative motion in the Y direction */ | 140 Sint16 yrel; /**< The relative motion in the Y direction */ |
134 } SDL_MouseMotionEvent; | 141 } SDL_MouseMotionEvent; |
135 | 142 |
136 /* Mouse button event structure */ | 143 /** Mouse button event structure */ |
137 typedef struct SDL_MouseButtonEvent { | 144 typedef struct SDL_MouseButtonEvent { |
138 Uint8 type; /* SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP */ | 145 Uint8 type; /**< SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP */ |
139 Uint8 which; /* The mouse device index */ | 146 Uint8 which; /**< The mouse device index */ |
140 Uint8 button; /* The mouse button index */ | 147 Uint8 button; /**< The mouse button index */ |
141 Uint8 state; /* SDL_PRESSED or SDL_RELEASED */ | 148 Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */ |
142 Uint16 x, y; /* The X/Y coordinates of the mouse at press time */ | 149 Uint16 x, y; /**< The X/Y coordinates of the mouse at press time */ |
143 } SDL_MouseButtonEvent; | 150 } SDL_MouseButtonEvent; |
144 | 151 |
145 /* Joystick axis motion event structure */ | 152 /** Joystick axis motion event structure */ |
146 typedef struct SDL_JoyAxisEvent { | 153 typedef struct SDL_JoyAxisEvent { |
147 Uint8 type; /* SDL_JOYAXISMOTION */ | 154 Uint8 type; /**< SDL_JOYAXISMOTION */ |
148 Uint8 which; /* The joystick device index */ | 155 Uint8 which; /**< The joystick device index */ |
149 Uint8 axis; /* The joystick axis index */ | 156 Uint8 axis; /**< The joystick axis index */ |
150 Sint16 value; /* The axis value (range: -32768 to 32767) */ | 157 Sint16 value; /**< The axis value (range: -32768 to 32767) */ |
151 } SDL_JoyAxisEvent; | 158 } SDL_JoyAxisEvent; |
152 | 159 |
153 /* Joystick trackball motion event structure */ | 160 /** Joystick trackball motion event structure */ |
154 typedef struct SDL_JoyBallEvent { | 161 typedef struct SDL_JoyBallEvent { |
155 Uint8 type; /* SDL_JOYBALLMOTION */ | 162 Uint8 type; /**< SDL_JOYBALLMOTION */ |
156 Uint8 which; /* The joystick device index */ | 163 Uint8 which; /**< The joystick device index */ |
157 Uint8 ball; /* The joystick trackball index */ | 164 Uint8 ball; /**< The joystick trackball index */ |
158 Sint16 xrel; /* The relative motion in the X direction */ | 165 Sint16 xrel; /**< The relative motion in the X direction */ |
159 Sint16 yrel; /* The relative motion in the Y direction */ | 166 Sint16 yrel; /**< The relative motion in the Y direction */ |
160 } SDL_JoyBallEvent; | 167 } SDL_JoyBallEvent; |
161 | 168 |
162 /* Joystick hat position change event structure */ | 169 /** Joystick hat position change event structure */ |
163 typedef struct SDL_JoyHatEvent { | 170 typedef struct SDL_JoyHatEvent { |
164 Uint8 type; /* SDL_JOYHATMOTION */ | 171 Uint8 type; /**< SDL_JOYHATMOTION */ |
165 Uint8 which; /* The joystick device index */ | 172 Uint8 which; /**< The joystick device index */ |
166 Uint8 hat; /* The joystick hat index */ | 173 Uint8 hat; /**< The joystick hat index */ |
167 Uint8 value; /* The hat position value: | 174 Uint8 value; /**< The hat position value: |
168 SDL_HAT_LEFTUP SDL_HAT_UP SDL_HAT_RIGHTUP | 175 * SDL_HAT_LEFTUP SDL_HAT_UP SDL_HAT_RIGHTUP |
169 SDL_HAT_LEFT SDL_HAT_CENTERED SDL_HAT_RIGHT | 176 * SDL_HAT_LEFT SDL_HAT_CENTERED SDL_HAT_RIGHT |
170 SDL_HAT_LEFTDOWN SDL_HAT_DOWN SDL_HAT_RIGHTDOWN | 177 * SDL_HAT_LEFTDOWN SDL_HAT_DOWN SDL_HAT_RIGHTDOWN |
171 Note that zero means the POV is centered. | 178 * Note that zero means the POV is centered. |
172 */ | 179 */ |
173 } SDL_JoyHatEvent; | 180 } SDL_JoyHatEvent; |
174 | 181 |
175 /* Joystick button event structure */ | 182 /** Joystick button event structure */ |
176 typedef struct SDL_JoyButtonEvent { | 183 typedef struct SDL_JoyButtonEvent { |
177 Uint8 type; /* SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP */ | 184 Uint8 type; /**< SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP */ |
178 Uint8 which; /* The joystick device index */ | 185 Uint8 which; /**< The joystick device index */ |
179 Uint8 button; /* The joystick button index */ | 186 Uint8 button; /**< The joystick button index */ |
180 Uint8 state; /* SDL_PRESSED or SDL_RELEASED */ | 187 Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */ |
181 } SDL_JoyButtonEvent; | 188 } SDL_JoyButtonEvent; |
182 | 189 |
183 /* The "window resized" event | 190 /** The "window resized" event |
184 When you get this event, you are responsible for setting a new video | 191 * When you get this event, you are responsible for setting a new video |
185 mode with the new width and height. | 192 * mode with the new width and height. |
186 */ | 193 */ |
187 typedef struct SDL_ResizeEvent { | 194 typedef struct SDL_ResizeEvent { |
188 Uint8 type; /* SDL_VIDEORESIZE */ | 195 Uint8 type; /**< SDL_VIDEORESIZE */ |
189 int w; /* New width */ | 196 int w; /**< New width */ |
190 int h; /* New height */ | 197 int h; /**< New height */ |
191 } SDL_ResizeEvent; | 198 } SDL_ResizeEvent; |
192 | 199 |
193 /* The "screen redraw" event */ | 200 /** The "screen redraw" event */ |
194 typedef struct SDL_ExposeEvent { | 201 typedef struct SDL_ExposeEvent { |
195 Uint8 type; /* SDL_VIDEOEXPOSE */ | 202 Uint8 type; /**< SDL_VIDEOEXPOSE */ |
196 } SDL_ExposeEvent; | 203 } SDL_ExposeEvent; |
197 | 204 |
198 /* The "quit requested" event */ | 205 /** The "quit requested" event */ |
199 typedef struct SDL_QuitEvent { | 206 typedef struct SDL_QuitEvent { |
200 Uint8 type; /* SDL_QUIT */ | 207 Uint8 type; /**< SDL_QUIT */ |
201 } SDL_QuitEvent; | 208 } SDL_QuitEvent; |
202 | 209 |
203 /* A user-defined event type */ | 210 /** A user-defined event type */ |
204 typedef struct SDL_UserEvent { | 211 typedef struct SDL_UserEvent { |
205 Uint8 type; /* SDL_USEREVENT through SDL_NUMEVENTS-1 */ | 212 Uint8 type; /**< SDL_USEREVENT through SDL_NUMEVENTS-1 */ |
206 int code; /* User defined event code */ | 213 int code; /**< User defined event code */ |
207 void *data1; /* User defined data pointer */ | 214 void *data1; /**< User defined data pointer */ |
208 void *data2; /* User defined data pointer */ | 215 void *data2; /**< User defined data pointer */ |
209 } SDL_UserEvent; | 216 } SDL_UserEvent; |
210 | 217 |
211 /* If you want to use this event, you should include SDL_syswm.h */ | 218 /** If you want to use this event, you should include SDL_syswm.h */ |
212 struct SDL_SysWMmsg; | 219 struct SDL_SysWMmsg; |
213 typedef struct SDL_SysWMmsg SDL_SysWMmsg; | 220 typedef struct SDL_SysWMmsg SDL_SysWMmsg; |
214 typedef struct SDL_SysWMEvent { | 221 typedef struct SDL_SysWMEvent { |
215 Uint8 type; | 222 Uint8 type; |
216 SDL_SysWMmsg *msg; | 223 SDL_SysWMmsg *msg; |
217 } SDL_SysWMEvent; | 224 } SDL_SysWMEvent; |
218 | 225 |
219 /* General event structure */ | 226 /** General event structure */ |
220 typedef union SDL_Event { | 227 typedef union SDL_Event { |
221 Uint8 type; | 228 Uint8 type; |
222 SDL_ActiveEvent active; | 229 SDL_ActiveEvent active; |
223 SDL_KeyboardEvent key; | 230 SDL_KeyboardEvent key; |
224 SDL_MouseMotionEvent motion; | 231 SDL_MouseMotionEvent motion; |
235 } SDL_Event; | 242 } SDL_Event; |
236 | 243 |
237 | 244 |
238 /* Function prototypes */ | 245 /* Function prototypes */ |
239 | 246 |
240 /* Pumps the event loop, gathering events from the input devices. | 247 /** Pumps the event loop, gathering events from the input devices. |
241 This function updates the event queue and internal input device state. | 248 * This function updates the event queue and internal input device state. |
242 This should only be run in the thread that sets the video mode. | 249 * This should only be run in the thread that sets the video mode. |
243 */ | 250 */ |
244 extern DECLSPEC void SDLCALL SDL_PumpEvents(void); | 251 extern DECLSPEC void SDLCALL SDL_PumpEvents(void); |
245 | 252 |
246 /* Checks the event queue for messages and optionally returns them. | |
247 If 'action' is SDL_ADDEVENT, up to 'numevents' events will be added to | |
248 the back of the event queue. | |
249 If 'action' is SDL_PEEKEVENT, up to 'numevents' events at the front | |
250 of the event queue, matching 'mask', will be returned and will not | |
251 be removed from the queue. | |
252 If 'action' is SDL_GETEVENT, up to 'numevents' events at the front | |
253 of the event queue, matching 'mask', will be returned and will be | |
254 removed from the queue. | |
255 This function returns the number of events actually stored, or -1 | |
256 if there was an error. This function is thread-safe. | |
257 */ | |
258 typedef enum { | 253 typedef enum { |
259 SDL_ADDEVENT, | 254 SDL_ADDEVENT, |
260 SDL_PEEKEVENT, | 255 SDL_PEEKEVENT, |
261 SDL_GETEVENT | 256 SDL_GETEVENT |
262 } SDL_eventaction; | 257 } SDL_eventaction; |
263 /* */ | 258 |
259 /** | |
260 * Checks the event queue for messages and optionally returns them. | |
261 * | |
262 * If 'action' is SDL_ADDEVENT, up to 'numevents' events will be added to | |
263 * the back of the event queue. | |
264 * If 'action' is SDL_PEEKEVENT, up to 'numevents' events at the front | |
265 * of the event queue, matching 'mask', will be returned and will not | |
266 * be removed from the queue. | |
267 * If 'action' is SDL_GETEVENT, up to 'numevents' events at the front | |
268 * of the event queue, matching 'mask', will be returned and will be | |
269 * removed from the queue. | |
270 * | |
271 * @return | |
272 * This function returns the number of events actually stored, or -1 | |
273 * if there was an error. | |
274 * | |
275 * This function is thread-safe. | |
276 */ | |
264 extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents, | 277 extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents, |
265 SDL_eventaction action, Uint32 mask); | 278 SDL_eventaction action, Uint32 mask); |
266 | 279 |
267 /* Polls for currently pending events, and returns 1 if there are any pending | 280 /** Polls for currently pending events, and returns 1 if there are any pending |
268 events, or 0 if there are none available. If 'event' is not NULL, the next | 281 * events, or 0 if there are none available. If 'event' is not NULL, the next |
269 event is removed from the queue and stored in that area. | 282 * event is removed from the queue and stored in that area. |
270 */ | 283 */ |
271 extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event *event); | 284 extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event *event); |
272 | 285 |
273 /* Waits indefinitely for the next available event, returning 1, or 0 if there | 286 /** Waits indefinitely for the next available event, returning 1, or 0 if there |
274 was an error while waiting for events. If 'event' is not NULL, the next | 287 * was an error while waiting for events. If 'event' is not NULL, the next |
275 event is removed from the queue and stored in that area. | 288 * event is removed from the queue and stored in that area. |
276 */ | 289 */ |
277 extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event *event); | 290 extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event *event); |
278 | 291 |
279 /* Add an event to the event queue. | 292 /** Add an event to the event queue. |
280 This function returns 0 on success, or -1 if the event queue was full | 293 * This function returns 0 on success, or -1 if the event queue was full |
281 or there was some other error. | 294 * or there was some other error. |
282 */ | 295 */ |
283 extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event); | 296 extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event); |
284 | 297 |
285 /* | 298 /** @name Event Filtering */ |
286 This function sets up a filter to process all events before they | 299 /*@{*/ |
287 change internal state and are posted to the internal event queue. | |
288 | |
289 The filter is protypted as: | |
290 */ | |
291 typedef int (SDLCALL *SDL_EventFilter)(const SDL_Event *event); | 300 typedef int (SDLCALL *SDL_EventFilter)(const SDL_Event *event); |
292 /* | 301 /** |
293 If the filter returns 1, then the event will be added to the internal queue. | 302 * This function sets up a filter to process all events before they |
294 If it returns 0, then the event will be dropped from the queue, but the | 303 * change internal state and are posted to the internal event queue. |
295 internal state will still be updated. This allows selective filtering of | 304 * |
296 dynamically arriving events. | 305 * The filter is protypted as: |
297 | 306 * @code typedef int (SDLCALL *SDL_EventFilter)(const SDL_Event *event); @endcode |
298 WARNING: Be very careful of what you do in the event filter function, as | 307 * |
299 it may run in a different thread! | 308 * If the filter returns 1, then the event will be added to the internal queue. |
300 | 309 * If it returns 0, then the event will be dropped from the queue, but the |
301 There is one caveat when dealing with the SDL_QUITEVENT event type. The | 310 * internal state will still be updated. This allows selective filtering of |
302 event filter is only called when the window manager desires to close the | 311 * dynamically arriving events. |
303 application window. If the event filter returns 1, then the window will | 312 * |
304 be closed, otherwise the window will remain open if possible. | 313 * @warning Be very careful of what you do in the event filter function, as |
305 If the quit event is generated by an interrupt signal, it will bypass the | 314 * it may run in a different thread! |
306 internal queue and be delivered to the application at the next event poll. | 315 * |
307 */ | 316 * There is one caveat when dealing with the SDL_QUITEVENT event type. The |
317 * event filter is only called when the window manager desires to close the | |
318 * application window. If the event filter returns 1, then the window will | |
319 * be closed, otherwise the window will remain open if possible. | |
320 * If the quit event is generated by an interrupt signal, it will bypass the | |
321 * internal queue and be delivered to the application at the next event poll. | |
322 */ | |
308 extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter); | 323 extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter); |
309 | 324 |
310 /* | 325 /** |
311 Return the current event filter - can be used to "chain" filters. | 326 * Return the current event filter - can be used to "chain" filters. |
312 If there is no event filter set, this function returns NULL. | 327 * If there is no event filter set, this function returns NULL. |
313 */ | 328 */ |
314 extern DECLSPEC SDL_EventFilter SDLCALL SDL_GetEventFilter(void); | 329 extern DECLSPEC SDL_EventFilter SDLCALL SDL_GetEventFilter(void); |
315 | 330 /*@}*/ |
316 /* | 331 |
317 This function allows you to set the state of processing certain events. | 332 /** @name Event State */ |
318 If 'state' is set to SDL_IGNORE, that event will be automatically dropped | 333 /*@{*/ |
319 from the event queue and will not event be filtered. | |
320 If 'state' is set to SDL_ENABLE, that event will be processed normally. | |
321 If 'state' is set to SDL_QUERY, SDL_EventState() will return the | |
322 current processing state of the specified event. | |
323 */ | |
324 #define SDL_QUERY -1 | 334 #define SDL_QUERY -1 |
325 #define SDL_IGNORE 0 | 335 #define SDL_IGNORE 0 |
326 #define SDL_DISABLE 0 | 336 #define SDL_DISABLE 0 |
327 #define SDL_ENABLE 1 | 337 #define SDL_ENABLE 1 |
338 /*@}*/ | |
339 | |
340 /** | |
341 * This function allows you to set the state of processing certain events. | |
342 * If 'state' is set to SDL_IGNORE, that event will be automatically dropped | |
343 * from the event queue and will not event be filtered. | |
344 * If 'state' is set to SDL_ENABLE, that event will be processed normally. | |
345 * If 'state' is set to SDL_QUERY, SDL_EventState() will return the | |
346 * current processing state of the specified event. | |
347 */ | |
328 extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint8 type, int state); | 348 extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint8 type, int state); |
329 | |
330 | 349 |
331 /* Ends C function definitions when using C++ */ | 350 /* Ends C function definitions when using C++ */ |
332 #ifdef __cplusplus | 351 #ifdef __cplusplus |
333 } | 352 } |
334 #endif | 353 #endif |