SDL 3.0
SDL_events.h
Go to the documentation of this file.
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20*/
21
22/**
23 * # CategoryEvents
24 *
25 * Event queue management.
26 */
27
28#ifndef SDL_events_h_
29#define SDL_events_h_
30
31#include <SDL3/SDL_stdinc.h>
32#include <SDL3/SDL_audio.h>
33#include <SDL3/SDL_camera.h>
34#include <SDL3/SDL_error.h>
35#include <SDL3/SDL_gamepad.h>
36#include <SDL3/SDL_joystick.h>
37#include <SDL3/SDL_keyboard.h>
38#include <SDL3/SDL_keycode.h>
39#include <SDL3/SDL_mouse.h>
40#include <SDL3/SDL_pen.h>
41#include <SDL3/SDL_power.h>
42#include <SDL3/SDL_sensor.h>
43#include <SDL3/SDL_scancode.h>
44#include <SDL3/SDL_touch.h>
45#include <SDL3/SDL_video.h>
46
47#include <SDL3/SDL_begin_code.h>
48/* Set up for C function definitions, even when using C++ */
49#ifdef __cplusplus
50extern "C" {
51#endif
52
53/* General keyboard/mouse/pen state definitions */
54
55/**
56 * The types of events that can be delivered.
57 *
58 * \since This enum is available since SDL 3.0.0.
59 */
60typedef enum SDL_EventType
61{
62 SDL_EVENT_FIRST = 0, /**< Unused (do not remove) */
63
64 /* Application events */
65 SDL_EVENT_QUIT = 0x100, /**< User-requested quit */
66
67 /* These application events have special meaning on iOS and Android, see README-ios.md and README-android.md for details */
68 SDL_EVENT_TERMINATING, /**< The application is being terminated by the OS. This event must be handled in a callback set with SDL_AddEventWatch().
69 Called on iOS in applicationWillTerminate()
70 Called on Android in onDestroy()
71 */
72 SDL_EVENT_LOW_MEMORY, /**< The application is low on memory, free memory if possible. This event must be handled in a callback set with SDL_AddEventWatch().
73 Called on iOS in applicationDidReceiveMemoryWarning()
74 Called on Android in onTrimMemory()
75 */
76 SDL_EVENT_WILL_ENTER_BACKGROUND, /**< The application is about to enter the background. This event must be handled in a callback set with SDL_AddEventWatch().
77 Called on iOS in applicationWillResignActive()
78 Called on Android in onPause()
79 */
80 SDL_EVENT_DID_ENTER_BACKGROUND, /**< The application did enter the background and may not get CPU for some time. This event must be handled in a callback set with SDL_AddEventWatch().
81 Called on iOS in applicationDidEnterBackground()
82 Called on Android in onPause()
83 */
84 SDL_EVENT_WILL_ENTER_FOREGROUND, /**< The application is about to enter the foreground. This event must be handled in a callback set with SDL_AddEventWatch().
85 Called on iOS in applicationWillEnterForeground()
86 Called on Android in onResume()
87 */
88 SDL_EVENT_DID_ENTER_FOREGROUND, /**< The application is now interactive. This event must be handled in a callback set with SDL_AddEventWatch().
89 Called on iOS in applicationDidBecomeActive()
90 Called on Android in onResume()
91 */
92
93 SDL_EVENT_LOCALE_CHANGED, /**< The user's locale preferences have changed. */
94
95 SDL_EVENT_SYSTEM_THEME_CHANGED, /**< The system theme changed */
96
97 /* Display events */
98 /* 0x150 was SDL_DISPLAYEVENT, reserve the number for sdl2-compat */
99 SDL_EVENT_DISPLAY_ORIENTATION = 0x151, /**< Display orientation has changed to data1 */
100 SDL_EVENT_DISPLAY_ADDED, /**< Display has been added to the system */
101 SDL_EVENT_DISPLAY_REMOVED, /**< Display has been removed from the system */
102 SDL_EVENT_DISPLAY_MOVED, /**< Display has changed position */
103 SDL_EVENT_DISPLAY_DESKTOP_MODE_CHANGED, /**< Display has changed desktop mode */
104 SDL_EVENT_DISPLAY_CURRENT_MODE_CHANGED, /**< Display has changed current mode */
105 SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED, /**< Display has changed content scale */
108
109 /* Window events */
110 /* 0x200 was SDL_WINDOWEVENT, reserve the number for sdl2-compat */
111 /* 0x201 was SDL_EVENT_SYSWM, reserve the number for sdl2-compat */
112 SDL_EVENT_WINDOW_SHOWN = 0x202, /**< Window has been shown */
113 SDL_EVENT_WINDOW_HIDDEN, /**< Window has been hidden */
114 SDL_EVENT_WINDOW_EXPOSED, /**< Window has been exposed and should be redrawn, and can be redrawn directly from event watchers for this event */
115 SDL_EVENT_WINDOW_MOVED, /**< Window has been moved to data1, data2 */
116 SDL_EVENT_WINDOW_RESIZED, /**< Window has been resized to data1xdata2 */
117 SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED,/**< The pixel size of the window has changed to data1xdata2 */
118 SDL_EVENT_WINDOW_METAL_VIEW_RESIZED,/**< The pixel size of a Metal view associated with the window has changed */
119 SDL_EVENT_WINDOW_MINIMIZED, /**< Window has been minimized */
120 SDL_EVENT_WINDOW_MAXIMIZED, /**< Window has been maximized */
121 SDL_EVENT_WINDOW_RESTORED, /**< Window has been restored to normal size and position */
122 SDL_EVENT_WINDOW_MOUSE_ENTER, /**< Window has gained mouse focus */
123 SDL_EVENT_WINDOW_MOUSE_LEAVE, /**< Window has lost mouse focus */
124 SDL_EVENT_WINDOW_FOCUS_GAINED, /**< Window has gained keyboard focus */
125 SDL_EVENT_WINDOW_FOCUS_LOST, /**< Window has lost keyboard focus */
126 SDL_EVENT_WINDOW_CLOSE_REQUESTED, /**< The window manager requests that the window be closed */
127 SDL_EVENT_WINDOW_HIT_TEST, /**< Window had a hit test that wasn't SDL_HITTEST_NORMAL */
128 SDL_EVENT_WINDOW_ICCPROF_CHANGED, /**< The ICC profile of the window's display has changed */
129 SDL_EVENT_WINDOW_DISPLAY_CHANGED, /**< Window has been moved to display data1 */
130 SDL_EVENT_WINDOW_DISPLAY_SCALE_CHANGED, /**< Window display scale has been changed */
131 SDL_EVENT_WINDOW_SAFE_AREA_CHANGED, /**< The window safe area has been changed */
132 SDL_EVENT_WINDOW_OCCLUDED, /**< The window has been occluded */
133 SDL_EVENT_WINDOW_ENTER_FULLSCREEN, /**< The window has entered fullscreen mode */
134 SDL_EVENT_WINDOW_LEAVE_FULLSCREEN, /**< The window has left fullscreen mode */
135 SDL_EVENT_WINDOW_DESTROYED, /**< The window with the associated ID is being or has been destroyed. If this message is being handled
136 in an event watcher, the window handle is still valid and can still be used to retrieve any userdata
137 associated with the window. Otherwise, the handle has already been destroyed and all resources
138 associated with it are invalid */
139 SDL_EVENT_WINDOW_HDR_STATE_CHANGED, /**< Window HDR properties have changed */
142
143 /* Keyboard events */
144 SDL_EVENT_KEY_DOWN = 0x300, /**< Key pressed */
145 SDL_EVENT_KEY_UP, /**< Key released */
146 SDL_EVENT_TEXT_EDITING, /**< Keyboard text editing (composition) */
147 SDL_EVENT_TEXT_INPUT, /**< Keyboard text input */
148 SDL_EVENT_KEYMAP_CHANGED, /**< Keymap changed due to a system event such as an
149 input language or keyboard layout change. */
150 SDL_EVENT_KEYBOARD_ADDED, /**< A new keyboard has been inserted into the system */
151 SDL_EVENT_KEYBOARD_REMOVED, /**< A keyboard has been removed */
152 SDL_EVENT_TEXT_EDITING_CANDIDATES, /**< Keyboard text editing candidates */
153
154 /* Mouse events */
155 SDL_EVENT_MOUSE_MOTION = 0x400, /**< Mouse moved */
156 SDL_EVENT_MOUSE_BUTTON_DOWN, /**< Mouse button pressed */
157 SDL_EVENT_MOUSE_BUTTON_UP, /**< Mouse button released */
158 SDL_EVENT_MOUSE_WHEEL, /**< Mouse wheel motion */
159 SDL_EVENT_MOUSE_ADDED, /**< A new mouse has been inserted into the system */
160 SDL_EVENT_MOUSE_REMOVED, /**< A mouse has been removed */
161
162 /* Joystick events */
163 SDL_EVENT_JOYSTICK_AXIS_MOTION = 0x600, /**< Joystick axis motion */
164 SDL_EVENT_JOYSTICK_BALL_MOTION, /**< Joystick trackball motion */
165 SDL_EVENT_JOYSTICK_HAT_MOTION, /**< Joystick hat position change */
166 SDL_EVENT_JOYSTICK_BUTTON_DOWN, /**< Joystick button pressed */
167 SDL_EVENT_JOYSTICK_BUTTON_UP, /**< Joystick button released */
168 SDL_EVENT_JOYSTICK_ADDED, /**< A new joystick has been inserted into the system */
169 SDL_EVENT_JOYSTICK_REMOVED, /**< An opened joystick has been removed */
170 SDL_EVENT_JOYSTICK_BATTERY_UPDATED, /**< Joystick battery level change */
171 SDL_EVENT_JOYSTICK_UPDATE_COMPLETE, /**< Joystick update is complete */
172
173 /* Gamepad events */
174 SDL_EVENT_GAMEPAD_AXIS_MOTION = 0x650, /**< Gamepad axis motion */
175 SDL_EVENT_GAMEPAD_BUTTON_DOWN, /**< Gamepad button pressed */
176 SDL_EVENT_GAMEPAD_BUTTON_UP, /**< Gamepad button released */
177 SDL_EVENT_GAMEPAD_ADDED, /**< A new gamepad has been inserted into the system */
178 SDL_EVENT_GAMEPAD_REMOVED, /**< A gamepad has been removed */
179 SDL_EVENT_GAMEPAD_REMAPPED, /**< The gamepad mapping was updated */
180 SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN, /**< Gamepad touchpad was touched */
181 SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION, /**< Gamepad touchpad finger was moved */
182 SDL_EVENT_GAMEPAD_TOUCHPAD_UP, /**< Gamepad touchpad finger was lifted */
183 SDL_EVENT_GAMEPAD_SENSOR_UPDATE, /**< Gamepad sensor was updated */
184 SDL_EVENT_GAMEPAD_UPDATE_COMPLETE, /**< Gamepad update is complete */
185 SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED, /**< Gamepad Steam handle has changed */
186
187 /* Touch events */
191
192 /* 0x800, 0x801, and 0x802 were the Gesture events from SDL2. Do not reuse these values! sdl2-compat needs them! */
193
194 /* Clipboard events */
195 SDL_EVENT_CLIPBOARD_UPDATE = 0x900, /**< The clipboard or primary selection changed */
196
197 /* Drag and drop events */
198 SDL_EVENT_DROP_FILE = 0x1000, /**< The system requests a file open */
199 SDL_EVENT_DROP_TEXT, /**< text/plain drag-and-drop event */
200 SDL_EVENT_DROP_BEGIN, /**< A new set of drops is beginning (NULL filename) */
201 SDL_EVENT_DROP_COMPLETE, /**< Current set of drops is now complete (NULL filename) */
202 SDL_EVENT_DROP_POSITION, /**< Position while moving over the window */
203
204 /* Audio hotplug events */
205 SDL_EVENT_AUDIO_DEVICE_ADDED = 0x1100, /**< A new audio device is available */
206 SDL_EVENT_AUDIO_DEVICE_REMOVED, /**< An audio device has been removed. */
207 SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED, /**< An audio device's format has been changed by the system. */
208
209 /* Sensor events */
210 SDL_EVENT_SENSOR_UPDATE = 0x1200, /**< A sensor was updated */
211
212 /* Pressure-sensitive pen events */
213 SDL_EVENT_PEN_PROXIMITY_IN = 0x1300, /**< Pressure-sensitive pen has become available */
214 SDL_EVENT_PEN_PROXIMITY_OUT, /**< Pressure-sensitive pen has become unavailable */
215 SDL_EVENT_PEN_DOWN, /**< Pressure-sensitive pen touched drawing surface */
216 SDL_EVENT_PEN_UP, /**< Pressure-sensitive pen stopped touching drawing surface */
217 SDL_EVENT_PEN_BUTTON_DOWN, /**< Pressure-sensitive pen button pressed */
218 SDL_EVENT_PEN_BUTTON_UP, /**< Pressure-sensitive pen button released */
219 SDL_EVENT_PEN_MOTION, /**< Pressure-sensitive pen is moving on the tablet */
220 SDL_EVENT_PEN_AXIS, /**< Pressure-sensitive pen angle/pressure/etc changed */
221
222 /* Camera hotplug events */
223 SDL_EVENT_CAMERA_DEVICE_ADDED = 0x1400, /**< A new camera device is available */
224 SDL_EVENT_CAMERA_DEVICE_REMOVED, /**< A camera device has been removed. */
225 SDL_EVENT_CAMERA_DEVICE_APPROVED, /**< A camera device has been approved for use by the user. */
226 SDL_EVENT_CAMERA_DEVICE_DENIED, /**< A camera device has been denied for use by the user. */
227
228 /* Render events */
229 SDL_EVENT_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */
230 SDL_EVENT_RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */
231
232 /* Internal events */
233 SDL_EVENT_POLL_SENTINEL = 0x7F00, /**< Signals the end of an event poll cycle */
234
235 /** Events SDL_EVENT_USER through SDL_EVENT_LAST are for your use,
236 * and should be allocated with SDL_RegisterEvents()
237 */
239
240 /**
241 * This last event is only for bounding internal arrays
242 */
244
245 /* This just makes sure the enum is the size of Uint32 */
246 SDL_EVENT_ENUM_PADDING = 0x7FFFFFFF
247
249
250/**
251 * Fields shared by every event
252 *
253 * \since This struct is available since SDL 3.0.0.
254 */
255typedef struct SDL_CommonEvent
256{
257 Uint32 type; /**< Event type, shared with all events, Uint32 to cover user events which are not in the SDL_EventType enumeration */
259 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
261
262/**
263 * Display state change event data (event.display.*)
264 *
265 * \since This struct is available since SDL 3.0.0.
266 */
267typedef struct SDL_DisplayEvent
268{
269 SDL_EventType type; /**< SDL_DISPLAYEVENT_* */
271 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
272 SDL_DisplayID displayID;/**< The associated display */
273 Sint32 data1; /**< event dependent data */
274 Sint32 data2; /**< event dependent data */
276
277/**
278 * Window state change event data (event.window.*)
279 *
280 * \since This struct is available since SDL 3.0.0.
281 */
282typedef struct SDL_WindowEvent
283{
284 SDL_EventType type; /**< SDL_EVENT_WINDOW_* */
286 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
287 SDL_WindowID windowID; /**< The associated window */
288 Sint32 data1; /**< event dependent data */
289 Sint32 data2; /**< event dependent data */
291
292/**
293 * Keyboard device event structure (event.kdevice.*)
294 *
295 * \since This struct is available since SDL 3.0.0.
296 */
298{
299 SDL_EventType type; /**< SDL_EVENT_KEYBOARD_ADDED or SDL_EVENT_KEYBOARD_REMOVED */
301 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
302 SDL_KeyboardID which; /**< The keyboard instance id */
304
305/**
306 * Keyboard button event structure (event.key.*)
307 *
308 * The `key` is the base SDL_Keycode generated by pressing the `scancode`
309 * using the current keyboard layout, applying any options specified in
310 * SDL_HINT_KEYCODE_OPTIONS. You can get the SDL_Keycode corresponding to the
311 * event scancode and modifiers directly from the keyboard layout, bypassing
312 * SDL_HINT_KEYCODE_OPTIONS, by calling SDL_GetKeyFromScancode().
313 *
314 * \since This struct is available since SDL 3.0.0.
315 *
316 * \sa SDL_GetKeyFromScancode
317 * \sa SDL_HINT_KEYCODE_OPTIONS
318 */
319typedef struct SDL_KeyboardEvent
320{
321 SDL_EventType type; /**< SDL_EVENT_KEY_DOWN or SDL_EVENT_KEY_UP */
323 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
324 SDL_WindowID windowID; /**< The window with keyboard focus, if any */
325 SDL_KeyboardID which; /**< The keyboard instance id, or 0 if unknown or virtual */
326 SDL_Scancode scancode; /**< SDL physical key code */
327 SDL_Keycode key; /**< SDL virtual key code */
328 SDL_Keymod mod; /**< current key modifiers */
329 Uint16 raw; /**< The platform dependent scancode for this event */
330 bool down; /**< true if the key is pressed */
331 bool repeat; /**< true if this is a key repeat */
333
334/**
335 * Keyboard text editing event structure (event.edit.*)
336 *
337 * The start cursor is the position, in UTF-8 characters, where new typing
338 * will be inserted into the editing text. The length is the number of UTF-8
339 * characters that will be replaced by new typing.
340 *
341 * \since This struct is available since SDL 3.0.0.
342 */
344{
345 SDL_EventType type; /**< SDL_EVENT_TEXT_EDITING */
347 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
348 SDL_WindowID windowID; /**< The window with keyboard focus, if any */
349 const char *text; /**< The editing text */
350 Sint32 start; /**< The start cursor of selected editing text, or -1 if not set */
351 Sint32 length; /**< The length of selected editing text, or -1 if not set */
353
354/**
355 * Keyboard IME candidates event structure (event.edit_candidates.*)
356 *
357 * \since This struct is available since SDL 3.0.0.
358 */
360{
361 SDL_EventType type; /**< SDL_EVENT_TEXT_EDITING_CANDIDATES */
363 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
364 SDL_WindowID windowID; /**< The window with keyboard focus, if any */
365 const char * const *candidates; /**< The list of candidates, or NULL if there are no candidates available */
366 Sint32 num_candidates; /**< The number of strings in `candidates` */
367 Sint32 selected_candidate; /**< The index of the selected candidate, or -1 if no candidate is selected */
368 bool horizontal; /**< true if the list is horizontal, false if it's vertical */
373
374/**
375 * Keyboard text input event structure (event.text.*)
376 *
377 * This event will never be delivered unless text input is enabled by calling
378 * SDL_StartTextInput(). Text input is disabled by default!
379 *
380 * \since This struct is available since SDL 3.0.0.
381 *
382 * \sa SDL_StartTextInput
383 * \sa SDL_StopTextInput
384 */
385typedef struct SDL_TextInputEvent
386{
387 SDL_EventType type; /**< SDL_EVENT_TEXT_INPUT */
389 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
390 SDL_WindowID windowID; /**< The window with keyboard focus, if any */
391 const char *text; /**< The input text, UTF-8 encoded */
393
394/**
395 * Mouse device event structure (event.mdevice.*)
396 *
397 * \since This struct is available since SDL 3.0.0.
398 */
400{
401 SDL_EventType type; /**< SDL_EVENT_MOUSE_ADDED or SDL_EVENT_MOUSE_REMOVED */
403 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
404 SDL_MouseID which; /**< The mouse instance id */
406
407/**
408 * Mouse motion event structure (event.motion.*)
409 *
410 * \since This struct is available since SDL 3.0.0.
411 */
413{
414 SDL_EventType type; /**< SDL_EVENT_MOUSE_MOTION */
416 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
417 SDL_WindowID windowID; /**< The window with mouse focus, if any */
418 SDL_MouseID which; /**< The mouse instance id or SDL_TOUCH_MOUSEID */
419 SDL_MouseButtonFlags state; /**< The current button state */
420 float x; /**< X coordinate, relative to window */
421 float y; /**< Y coordinate, relative to window */
422 float xrel; /**< The relative motion in the X direction */
423 float yrel; /**< The relative motion in the Y direction */
425
426/**
427 * Mouse button event structure (event.button.*)
428 *
429 * \since This struct is available since SDL 3.0.0.
430 */
432{
433 SDL_EventType type; /**< SDL_EVENT_MOUSE_BUTTON_DOWN or SDL_EVENT_MOUSE_BUTTON_UP */
435 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
436 SDL_WindowID windowID; /**< The window with mouse focus, if any */
437 SDL_MouseID which; /**< The mouse instance id, SDL_TOUCH_MOUSEID */
438 Uint8 button; /**< The mouse button index */
439 bool down; /**< true if the button is pressed */
440 Uint8 clicks; /**< 1 for single-click, 2 for double-click, etc. */
442 float x; /**< X coordinate, relative to window */
443 float y; /**< Y coordinate, relative to window */
445
446/**
447 * Mouse wheel event structure (event.wheel.*)
448 *
449 * \since This struct is available since SDL 3.0.0.
450 */
452{
453 SDL_EventType type; /**< SDL_EVENT_MOUSE_WHEEL */
455 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
456 SDL_WindowID windowID; /**< The window with mouse focus, if any */
457 SDL_MouseID which; /**< The mouse instance id, SDL_TOUCH_MOUSEID */
458 float x; /**< The amount scrolled horizontally, positive to the right and negative to the left */
459 float y; /**< The amount scrolled vertically, positive away from the user and negative toward the user */
460 SDL_MouseWheelDirection direction; /**< Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back */
461 float mouse_x; /**< X coordinate, relative to window */
462 float mouse_y; /**< Y coordinate, relative to window */
464
465/**
466 * Joystick axis motion event structure (event.jaxis.*)
467 *
468 * \since This struct is available since SDL 3.0.0.
469 */
470typedef struct SDL_JoyAxisEvent
471{
472 SDL_EventType type; /**< SDL_EVENT_JOYSTICK_AXIS_MOTION */
474 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
475 SDL_JoystickID which; /**< The joystick instance id */
476 Uint8 axis; /**< The joystick axis index */
480 Sint16 value; /**< The axis value (range: -32768 to 32767) */
483
484/**
485 * Joystick trackball motion event structure (event.jball.*)
486 *
487 * \since This struct is available since SDL 3.0.0.
488 */
489typedef struct SDL_JoyBallEvent
490{
491 SDL_EventType type; /**< SDL_EVENT_JOYSTICK_BALL_MOTION */
493 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
494 SDL_JoystickID which; /**< The joystick instance id */
495 Uint8 ball; /**< The joystick trackball index */
499 Sint16 xrel; /**< The relative motion in the X direction */
500 Sint16 yrel; /**< The relative motion in the Y direction */
502
503/**
504 * Joystick hat position change event structure (event.jhat.*)
505 *
506 * \since This struct is available since SDL 3.0.0.
507 */
508typedef struct SDL_JoyHatEvent
509{
510 SDL_EventType type; /**< SDL_EVENT_JOYSTICK_HAT_MOTION */
512 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
513 SDL_JoystickID which; /**< The joystick instance id */
514 Uint8 hat; /**< The joystick hat index */
515 Uint8 value; /**< The hat position value.
516 * \sa SDL_HAT_LEFTUP SDL_HAT_UP SDL_HAT_RIGHTUP
517 * \sa SDL_HAT_LEFT SDL_HAT_CENTERED SDL_HAT_RIGHT
518 * \sa SDL_HAT_LEFTDOWN SDL_HAT_DOWN SDL_HAT_RIGHTDOWN
519 *
520 * Note that zero means the POV is centered.
521 */
525
526/**
527 * Joystick button event structure (event.jbutton.*)
528 *
529 * \since This struct is available since SDL 3.0.0.
530 */
531typedef struct SDL_JoyButtonEvent
532{
533 SDL_EventType type; /**< SDL_EVENT_JOYSTICK_BUTTON_DOWN or SDL_EVENT_JOYSTICK_BUTTON_UP */
535 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
536 SDL_JoystickID which; /**< The joystick instance id */
537 Uint8 button; /**< The joystick button index */
538 bool down; /**< true if the button is pressed */
542
543/**
544 * Joystick device event structure (event.jdevice.*)
545 *
546 * \since This struct is available since SDL 3.0.0.
547 */
548typedef struct SDL_JoyDeviceEvent
549{
550 SDL_EventType type; /**< SDL_EVENT_JOYSTICK_ADDED or SDL_EVENT_JOYSTICK_REMOVED or SDL_EVENT_JOYSTICK_UPDATE_COMPLETE */
552 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
553 SDL_JoystickID which; /**< The joystick instance id */
555
556/**
557 * Joysick battery level change event structure (event.jbattery.*)
558 *
559 * \since This struct is available since SDL 3.0.0.
560 */
562{
563 SDL_EventType type; /**< SDL_EVENT_JOYSTICK_BATTERY_UPDATED */
565 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
566 SDL_JoystickID which; /**< The joystick instance id */
567 SDL_PowerState state; /**< The joystick battery state */
568 int percent; /**< The joystick battery percent charge remaining */
570
571/**
572 * Gamepad axis motion event structure (event.gaxis.*)
573 *
574 * \since This struct is available since SDL 3.0.0.
575 */
577{
578 SDL_EventType type; /**< SDL_EVENT_GAMEPAD_AXIS_MOTION */
580 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
581 SDL_JoystickID which; /**< The joystick instance id */
582 Uint8 axis; /**< The gamepad axis (SDL_GamepadAxis) */
586 Sint16 value; /**< The axis value (range: -32768 to 32767) */
589
590
591/**
592 * Gamepad button event structure (event.gbutton.*)
593 *
594 * \since This struct is available since SDL 3.0.0.
595 */
597{
598 SDL_EventType type; /**< SDL_EVENT_GAMEPAD_BUTTON_DOWN or SDL_EVENT_GAMEPAD_BUTTON_UP */
600 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
601 SDL_JoystickID which; /**< The joystick instance id */
602 Uint8 button; /**< The gamepad button (SDL_GamepadButton) */
603 bool down; /**< true if the button is pressed */
607
608
609/**
610 * Gamepad device event structure (event.gdevice.*)
611 *
612 * \since This struct is available since SDL 3.0.0.
613 */
615{
616 SDL_EventType type; /**< SDL_EVENT_GAMEPAD_ADDED, SDL_EVENT_GAMEPAD_REMOVED, or SDL_EVENT_GAMEPAD_REMAPPED, SDL_EVENT_GAMEPAD_UPDATE_COMPLETE or SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED */
618 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
619 SDL_JoystickID which; /**< The joystick instance id */
621
622/**
623 * Gamepad touchpad event structure (event.gtouchpad.*)
624 *
625 * \since This struct is available since SDL 3.0.0.
626 */
628{
629 SDL_EventType type; /**< SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN or SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION or SDL_EVENT_GAMEPAD_TOUCHPAD_UP */
631 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
632 SDL_JoystickID which; /**< The joystick instance id */
633 Sint32 touchpad; /**< The index of the touchpad */
634 Sint32 finger; /**< The index of the finger on the touchpad */
635 float x; /**< Normalized in the range 0...1 with 0 being on the left */
636 float y; /**< Normalized in the range 0...1 with 0 being at the top */
637 float pressure; /**< Normalized in the range 0...1 */
639
640/**
641 * Gamepad sensor event structure (event.gsensor.*)
642 *
643 * \since This struct is available since SDL 3.0.0.
644 */
646{
647 SDL_EventType type; /**< SDL_EVENT_GAMEPAD_SENSOR_UPDATE */
649 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
650 SDL_JoystickID which; /**< The joystick instance id */
651 Sint32 sensor; /**< The type of the sensor, one of the values of SDL_SensorType */
652 float data[3]; /**< Up to 3 values from the sensor, as defined in SDL_sensor.h */
653 Uint64 sensor_timestamp; /**< The timestamp of the sensor reading in nanoseconds, not necessarily synchronized with the system clock */
655
656/**
657 * Audio device event structure (event.adevice.*)
658 *
659 * \since This struct is available since SDL 3.0.0.
660 */
662{
663 SDL_EventType type; /**< SDL_EVENT_AUDIO_DEVICE_ADDED, or SDL_EVENT_AUDIO_DEVICE_REMOVED, or SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED */
665 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
666 SDL_AudioDeviceID which; /**< SDL_AudioDeviceID for the device being added or removed or changing */
667 bool recording; /**< false if a playback device, true if a recording device. */
672
673/**
674 * Camera device event structure (event.cdevice.*)
675 *
676 * \since This struct is available since SDL 3.0.0.
677 */
679{
680 SDL_EventType type; /**< SDL_EVENT_CAMERA_DEVICE_ADDED, SDL_EVENT_CAMERA_DEVICE_REMOVED, SDL_EVENT_CAMERA_DEVICE_APPROVED, SDL_EVENT_CAMERA_DEVICE_DENIED */
682 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
683 SDL_CameraID which; /**< SDL_CameraID for the device being added or removed or changing */
685
686/**
687 * Touch finger event structure (event.tfinger.*)
688 *
689 * \since This struct is available since SDL 3.0.0.
690 */
692{
693 SDL_EventType type; /**< SDL_EVENT_FINGER_MOTION or SDL_EVENT_FINGER_DOWN or SDL_EVENT_FINGER_UP */
695 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
696 SDL_TouchID touchID; /**< The touch device id */
698 float x; /**< Normalized in the range 0...1 */
699 float y; /**< Normalized in the range 0...1 */
700 float dx; /**< Normalized in the range -1...1 */
701 float dy; /**< Normalized in the range -1...1 */
702 float pressure; /**< Normalized in the range 0...1 */
703 SDL_WindowID windowID; /**< The window underneath the finger, if any */
705
706/**
707 * Pressure-sensitive pen proximity event structure (event.pmotion.*)
708 *
709 * When a pen becomes visible to the system (it is close enough to a tablet,
710 * etc), SDL will send an SDL_EVENT_PEN_PROXIMITY_IN event with the new pen's
711 * ID. This ID is valid until the pen leaves proximity again (has been removed
712 * from the tablet's area, the tablet has been unplugged, etc). If the same
713 * pen reenters proximity again, it will be given a new ID.
714 *
715 * Note that "proximity" means "close enough for the tablet to know the tool
716 * is there." The pen touching and lifting off from the tablet while not
717 * leaving the area are handled by SDL_EVENT_PEN_DOWN and SDL_EVENT_PEN_UP.
718 *
719 * \since This struct is available since SDL 3.0.0.
720 */
722{
723 SDL_EventType type; /**< SDL_EVENT_PEN_PROXIMITY_IN or SDL_EVENT_PEN_PROXIMITY_OUT */
725 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
726 SDL_WindowID windowID; /**< The window with mouse focus, if any */
727 SDL_PenID which; /**< The pen instance id */
729
730/**
731 * Pressure-sensitive pen motion event structure (event.pmotion.*)
732 *
733 * Depending on the hardware, you may get motion events when the pen is not
734 * touching a tablet, for tracking a pen even when it isn't drawing. You
735 * should listen for SDL_EVENT_PEN_DOWN and SDL_EVENT_PEN_UP events, or check
736 * `pen_state & SDL_PEN_INPUT_DOWN` to decide if a pen is "drawing" when
737 * dealing with pen motion.
738 *
739 * \since This struct is available since SDL 3.0.0.
740 */
741typedef struct SDL_PenMotionEvent
742{
743 SDL_EventType type; /**< SDL_EVENT_PEN_MOTION */
745 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
746 SDL_WindowID windowID; /**< The window with mouse focus, if any */
747 SDL_PenID which; /**< The pen instance id */
748 SDL_PenInputFlags pen_state; /**< Complete pen input state at time of event */
749 float x; /**< X coordinate, relative to window */
750 float y; /**< Y coordinate, relative to window */
752
753/**
754 * Pressure-sensitive pen touched event structure (event.ptouch.*)
755 *
756 * These events come when a pen touches a surface (a tablet, etc), or lifts
757 * off from one.
758 *
759 * \since This struct is available since SDL 3.0.0.
760 */
761typedef struct SDL_PenTouchEvent
762{
763 SDL_EventType type; /**< SDL_EVENT_PEN_DOWN or SDL_EVENT_PEN_UP */
765 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
766 SDL_WindowID windowID; /**< The window with pen focus, if any */
767 SDL_PenID which; /**< The pen instance id */
768 SDL_PenInputFlags pen_state; /**< Complete pen input state at time of event */
769 float x; /**< X coordinate, relative to window */
770 float y; /**< Y coordinate, relative to window */
771 bool eraser; /**< true if eraser end is used (not all pens support this). */
772 bool down; /**< true if the pen is touching or false if the pen is lifted off */
774
775/**
776 * Pressure-sensitive pen button event structure (event.pbutton.*)
777 *
778 * This is for buttons on the pen itself that the user might click. The pen
779 * itself pressing down to draw triggers a SDL_EVENT_PEN_DOWN event instead.
780 *
781 * \since This struct is available since SDL 3.0.0.
782 */
783typedef struct SDL_PenButtonEvent
784{
785 SDL_EventType type; /**< SDL_EVENT_PEN_BUTTON_DOWN or SDL_EVENT_PEN_BUTTON_UP */
787 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
788 SDL_WindowID windowID; /**< The window with mouse focus, if any */
789 SDL_PenID which; /**< The pen instance id */
790 SDL_PenInputFlags pen_state; /**< Complete pen input state at time of event */
791 float x; /**< X coordinate, relative to window */
792 float y; /**< Y coordinate, relative to window */
793 Uint8 button; /**< The pen button index (first button is 1). */
794 bool down; /**< true if the button is pressed */
796
797/**
798 * Pressure-sensitive pen pressure / angle event structure (event.paxis.*)
799 *
800 * You might get some of these events even if the pen isn't touching the
801 * tablet.
802 *
803 * \since This struct is available since SDL 3.0.0.
804 */
805typedef struct SDL_PenAxisEvent
806{
807 SDL_EventType type; /**< SDL_EVENT_PEN_AXIS */
809 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
810 SDL_WindowID windowID; /**< The window with pen focus, if any */
811 SDL_PenID which; /**< The pen instance id */
812 SDL_PenInputFlags pen_state; /**< Complete pen input state at time of event */
813 float x; /**< X coordinate, relative to window */
814 float y; /**< Y coordinate, relative to window */
815 SDL_PenAxis axis; /**< Axis that has changed */
816 float value; /**< New value of axis */
818
819/**
820 * An event used to drop text or request a file open by the system
821 * (event.drop.*)
822 *
823 * \since This struct is available since SDL 3.0.0.
824 */
825typedef struct SDL_DropEvent
826{
827 SDL_EventType type; /**< SDL_EVENT_DROP_BEGIN or SDL_EVENT_DROP_FILE or SDL_EVENT_DROP_TEXT or SDL_EVENT_DROP_COMPLETE or SDL_EVENT_DROP_POSITION */
829 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
830 SDL_WindowID windowID; /**< The window that was dropped on, if any */
831 float x; /**< X coordinate, relative to window (not on begin) */
832 float y; /**< Y coordinate, relative to window (not on begin) */
833 const char *source; /**< The source app that sent this drop event, or NULL if that isn't available */
834 const char *data; /**< The text for SDL_EVENT_DROP_TEXT and the file name for SDL_EVENT_DROP_FILE, NULL for other events */
836
837/**
838 * An event triggered when the clipboard contents have changed
839 * (event.clipboard.*)
840 *
841 * \since This struct is available since SDL 3.0.0.
842 */
843typedef struct SDL_ClipboardEvent
844{
845 SDL_EventType type; /**< SDL_EVENT_CLIPBOARD_UPDATE */
847 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
849
850/**
851 * Sensor event structure (event.sensor.*)
852 *
853 * \since This struct is available since SDL 3.0.0.
854 */
855typedef struct SDL_SensorEvent
856{
857 SDL_EventType type; /**< SDL_EVENT_SENSOR_UPDATE */
859 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
860 SDL_SensorID which; /**< The instance ID of the sensor */
861 float data[6]; /**< Up to 6 values from the sensor - additional values can be queried using SDL_GetSensorData() */
862 Uint64 sensor_timestamp; /**< The timestamp of the sensor reading in nanoseconds, not necessarily synchronized with the system clock */
864
865/**
866 * The "quit requested" event
867 *
868 * \since This struct is available since SDL 3.0.0.
869 */
870typedef struct SDL_QuitEvent
871{
872 SDL_EventType type; /**< SDL_EVENT_QUIT */
874 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
876
877/**
878 * A user-defined event type (event.user.*)
879 *
880 * This event is unique; it is never created by SDL, but only by the
881 * application. The event can be pushed onto the event queue using
882 * SDL_PushEvent(). The contents of the structure members are completely up to
883 * the programmer; the only requirement is that '''type''' is a value obtained
884 * from SDL_RegisterEvents().
885 *
886 * \since This struct is available since SDL 3.0.0.
887 */
888typedef struct SDL_UserEvent
889{
890 Uint32 type; /**< SDL_EVENT_USER through SDL_EVENT_LAST-1, Uint32 because these are not in the SDL_EventType enumeration */
892 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
893 SDL_WindowID windowID; /**< The associated window if any */
894 Sint32 code; /**< User defined event code */
895 void *data1; /**< User defined data pointer */
896 void *data2; /**< User defined data pointer */
898
899
900/**
901 * The structure for all events in SDL.
902 *
903 * \since This struct is available since SDL 3.0.0.
904 */
905typedef union SDL_Event
906{
907 Uint32 type; /**< Event type, shared with all events, Uint32 to cover user events which are not in the SDL_EventType enumeration */
908 SDL_CommonEvent common; /**< Common event data */
909 SDL_DisplayEvent display; /**< Display event data */
910 SDL_WindowEvent window; /**< Window event data */
911 SDL_KeyboardDeviceEvent kdevice; /**< Keyboard device change event data */
912 SDL_KeyboardEvent key; /**< Keyboard event data */
913 SDL_TextEditingEvent edit; /**< Text editing event data */
914 SDL_TextEditingCandidatesEvent edit_candidates; /**< Text editing candidates event data */
915 SDL_TextInputEvent text; /**< Text input event data */
916 SDL_MouseDeviceEvent mdevice; /**< Mouse device change event data */
917 SDL_MouseMotionEvent motion; /**< Mouse motion event data */
918 SDL_MouseButtonEvent button; /**< Mouse button event data */
919 SDL_MouseWheelEvent wheel; /**< Mouse wheel event data */
920 SDL_JoyDeviceEvent jdevice; /**< Joystick device change event data */
921 SDL_JoyAxisEvent jaxis; /**< Joystick axis event data */
922 SDL_JoyBallEvent jball; /**< Joystick ball event data */
923 SDL_JoyHatEvent jhat; /**< Joystick hat event data */
924 SDL_JoyButtonEvent jbutton; /**< Joystick button event data */
925 SDL_JoyBatteryEvent jbattery; /**< Joystick battery event data */
926 SDL_GamepadDeviceEvent gdevice; /**< Gamepad device event data */
927 SDL_GamepadAxisEvent gaxis; /**< Gamepad axis event data */
928 SDL_GamepadButtonEvent gbutton; /**< Gamepad button event data */
929 SDL_GamepadTouchpadEvent gtouchpad; /**< Gamepad touchpad event data */
930 SDL_GamepadSensorEvent gsensor; /**< Gamepad sensor event data */
931 SDL_AudioDeviceEvent adevice; /**< Audio device event data */
932 SDL_CameraDeviceEvent cdevice; /**< Camera device event data */
933 SDL_SensorEvent sensor; /**< Sensor event data */
934 SDL_QuitEvent quit; /**< Quit request event data */
935 SDL_UserEvent user; /**< Custom event data */
936 SDL_TouchFingerEvent tfinger; /**< Touch finger event data */
937 SDL_PenProximityEvent pproximity; /**< Pen proximity event data */
938 SDL_PenTouchEvent ptouch; /**< Pen tip touching event data */
939 SDL_PenMotionEvent pmotion; /**< Pen motion event data */
940 SDL_PenButtonEvent pbutton; /**< Pen button event data */
941 SDL_PenAxisEvent paxis; /**< Pen axis event data */
942 SDL_DropEvent drop; /**< Drag and drop event data */
943 SDL_ClipboardEvent clipboard; /**< Clipboard event data */
944
945 /* This is necessary for ABI compatibility between Visual C++ and GCC.
946 Visual C++ will respect the push pack pragma and use 52 bytes (size of
947 SDL_TextEditingEvent, the largest structure for 32-bit and 64-bit
948 architectures) for this union, and GCC will use the alignment of the
949 largest datatype within the union, which is 8 bytes on 64-bit
950 architectures.
951
952 So... we'll add padding to force the size to be the same for both.
953
954 On architectures where pointers are 16 bytes, this needs rounding up to
955 the next multiple of 16, 64, and on architectures where pointers are
956 even larger the size of SDL_UserEvent will dominate as being 3 pointers.
957 */
959} SDL_Event;
960
961/* Make sure we haven't broken binary compatibility */
962SDL_COMPILE_TIME_ASSERT(SDL_Event, sizeof(SDL_Event) == sizeof(((SDL_Event *)NULL)->padding));
963
964
965/* Function prototypes */
966
967/**
968 * Pump the event loop, gathering events from the input devices.
969 *
970 * This function updates the event queue and internal input device state.
971 *
972 * **WARNING**: This should only be run in the thread that initialized the
973 * video subsystem, and for extra safety, you should consider only doing those
974 * things on the main thread in any case.
975 *
976 * SDL_PumpEvents() gathers all the pending input information from devices and
977 * places it in the event queue. Without calls to SDL_PumpEvents() no events
978 * would ever be placed on the queue. Often the need for calls to
979 * SDL_PumpEvents() is hidden from the user since SDL_PollEvent() and
980 * SDL_WaitEvent() implicitly call SDL_PumpEvents(). However, if you are not
981 * polling or waiting for events (e.g. you are filtering them), then you must
982 * call SDL_PumpEvents() to force an event queue update.
983 *
984 * \since This function is available since SDL 3.0.0.
985 *
986 * \sa SDL_PollEvent
987 * \sa SDL_WaitEvent
988 */
989extern SDL_DECLSPEC void SDLCALL SDL_PumpEvents(void);
990
991/* @{ */
992
993/**
994 * The type of action to request from SDL_PeepEvents().
995 *
996 * \since This enum is available since SDL 3.0.0.
997 */
998typedef enum SDL_EventAction
999{
1000 SDL_ADDEVENT, /**< Add events to the back of the queue. */
1001 SDL_PEEKEVENT, /**< Check but don't remove events from the queue front. */
1002 SDL_GETEVENT /**< Retrieve/remove events from the front of the queue. */
1004
1005/**
1006 * Check the event queue for messages and optionally return them.
1007 *
1008 * `action` may be any of the following:
1009 *
1010 * - `SDL_ADDEVENT`: up to `numevents` events will be added to the back of the
1011 * event queue.
1012 * - `SDL_PEEKEVENT`: `numevents` events at the front of the event queue,
1013 * within the specified minimum and maximum type, will be returned to the
1014 * caller and will _not_ be removed from the queue. If you pass NULL for
1015 * `events`, then `numevents` is ignored and the total number of matching
1016 * events will be returned.
1017 * - `SDL_GETEVENT`: up to `numevents` events at the front of the event queue,
1018 * within the specified minimum and maximum type, will be returned to the
1019 * caller and will be removed from the queue.
1020 *
1021 * You may have to call SDL_PumpEvents() before calling this function.
1022 * Otherwise, the events may not be ready to be filtered when you call
1023 * SDL_PeepEvents().
1024 *
1025 * This function is thread-safe.
1026 *
1027 * \param events destination buffer for the retrieved events, may be NULL to
1028 * leave the events in the queue and return the number of events
1029 * that would have been stored.
1030 * \param numevents if action is SDL_ADDEVENT, the number of events to add
1031 * back to the event queue; if action is SDL_PEEKEVENT or
1032 * SDL_GETEVENT, the maximum number of events to retrieve.
1033 * \param action action to take; see [[#action|Remarks]] for details.
1034 * \param minType minimum value of the event type to be considered;
1035 * SDL_EVENT_FIRST is a safe choice.
1036 * \param maxType maximum value of the event type to be considered;
1037 * SDL_EVENT_LAST is a safe choice.
1038 * \returns the number of events actually stored or -1 on failure; call
1039 * SDL_GetError() for more information.
1040 *
1041 * \since This function is available since SDL 3.0.0.
1042 *
1043 * \sa SDL_PollEvent
1044 * \sa SDL_PumpEvents
1045 * \sa SDL_PushEvent
1046 */
1047extern SDL_DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents, SDL_EventAction action, Uint32 minType, Uint32 maxType);
1048/* @} */
1049
1050/**
1051 * Check for the existence of a certain event type in the event queue.
1052 *
1053 * If you need to check for a range of event types, use SDL_HasEvents()
1054 * instead.
1055 *
1056 * \param type the type of event to be queried; see SDL_EventType for details.
1057 * \returns true if events matching `type` are present, or false if events
1058 * matching `type` are not present.
1059 *
1060 * \since This function is available since SDL 3.0.0.
1061 *
1062 * \sa SDL_HasEvents
1063 */
1064extern SDL_DECLSPEC bool SDLCALL SDL_HasEvent(Uint32 type);
1065
1066
1067/**
1068 * Check for the existence of certain event types in the event queue.
1069 *
1070 * If you need to check for a single event type, use SDL_HasEvent() instead.
1071 *
1072 * \param minType the low end of event type to be queried, inclusive; see
1073 * SDL_EventType for details.
1074 * \param maxType the high end of event type to be queried, inclusive; see
1075 * SDL_EventType for details.
1076 * \returns true if events with type >= `minType` and <= `maxType` are
1077 * present, or false if not.
1078 *
1079 * \since This function is available since SDL 3.0.0.
1080 *
1081 * \sa SDL_HasEvents
1082 */
1083extern SDL_DECLSPEC bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType);
1084
1085/**
1086 * Clear events of a specific type from the event queue.
1087 *
1088 * This will unconditionally remove any events from the queue that match
1089 * `type`. If you need to remove a range of event types, use SDL_FlushEvents()
1090 * instead.
1091 *
1092 * It's also normal to just ignore events you don't care about in your event
1093 * loop without calling this function.
1094 *
1095 * This function only affects currently queued events. If you want to make
1096 * sure that all pending OS events are flushed, you can call SDL_PumpEvents()
1097 * on the main thread immediately before the flush call.
1098 *
1099 * If you have user events with custom data that needs to be freed, you should
1100 * use SDL_PeepEvents() to remove and clean up those events before calling
1101 * this function.
1102 *
1103 * \param type the type of event to be cleared; see SDL_EventType for details.
1104 *
1105 * \since This function is available since SDL 3.0.0.
1106 *
1107 * \sa SDL_FlushEvents
1108 */
1109extern SDL_DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type);
1110
1111/**
1112 * Clear events of a range of types from the event queue.
1113 *
1114 * This will unconditionally remove any events from the queue that are in the
1115 * range of `minType` to `maxType`, inclusive. If you need to remove a single
1116 * event type, use SDL_FlushEvent() instead.
1117 *
1118 * It's also normal to just ignore events you don't care about in your event
1119 * loop without calling this function.
1120 *
1121 * This function only affects currently queued events. If you want to make
1122 * sure that all pending OS events are flushed, you can call SDL_PumpEvents()
1123 * on the main thread immediately before the flush call.
1124 *
1125 * \param minType the low end of event type to be cleared, inclusive; see
1126 * SDL_EventType for details.
1127 * \param maxType the high end of event type to be cleared, inclusive; see
1128 * SDL_EventType for details.
1129 *
1130 * \since This function is available since SDL 3.0.0.
1131 *
1132 * \sa SDL_FlushEvent
1133 */
1134extern SDL_DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType);
1135
1136/**
1137 * Poll for currently pending events.
1138 *
1139 * If `event` is not NULL, the next event is removed from the queue and stored
1140 * in the SDL_Event structure pointed to by `event`. The 1 returned refers to
1141 * this event, immediately stored in the SDL Event structure -- not an event
1142 * to follow.
1143 *
1144 * If `event` is NULL, it simply returns 1 if there is an event in the queue,
1145 * but will not remove it from the queue.
1146 *
1147 * As this function may implicitly call SDL_PumpEvents(), you can only call
1148 * this function in the thread that set the video mode.
1149 *
1150 * SDL_PollEvent() is the favored way of receiving system events since it can
1151 * be done from the main loop and does not suspend the main loop while waiting
1152 * on an event to be posted.
1153 *
1154 * The common practice is to fully process the event queue once every frame,
1155 * usually as a first step before updating the game's state:
1156 *
1157 * ```c
1158 * while (game_is_still_running) {
1159 * SDL_Event event;
1160 * while (SDL_PollEvent(&event)) { // poll until all events are handled!
1161 * // decide what to do with this event.
1162 * }
1163 *
1164 * // update game state, draw the current frame
1165 * }
1166 * ```
1167 *
1168 * \param event the SDL_Event structure to be filled with the next event from
1169 * the queue, or NULL.
1170 * \returns true if this got an event or false if there are none available.
1171 *
1172 * \since This function is available since SDL 3.0.0.
1173 *
1174 * \sa SDL_PushEvent
1175 * \sa SDL_WaitEvent
1176 * \sa SDL_WaitEventTimeout
1177 */
1178extern SDL_DECLSPEC bool SDLCALL SDL_PollEvent(SDL_Event *event);
1179
1180/**
1181 * Wait indefinitely for the next available event.
1182 *
1183 * If `event` is not NULL, the next event is removed from the queue and stored
1184 * in the SDL_Event structure pointed to by `event`.
1185 *
1186 * As this function may implicitly call SDL_PumpEvents(), you can only call
1187 * this function in the thread that initialized the video subsystem.
1188 *
1189 * \param event the SDL_Event structure to be filled in with the next event
1190 * from the queue, or NULL.
1191 * \returns true on success or false if there was an error while waiting for
1192 * events; call SDL_GetError() for more information.
1193 *
1194 * \since This function is available since SDL 3.0.0.
1195 *
1196 * \sa SDL_PollEvent
1197 * \sa SDL_PushEvent
1198 * \sa SDL_WaitEventTimeout
1199 */
1200extern SDL_DECLSPEC bool SDLCALL SDL_WaitEvent(SDL_Event *event);
1201
1202/**
1203 * Wait until the specified timeout (in milliseconds) for the next available
1204 * event.
1205 *
1206 * If `event` is not NULL, the next event is removed from the queue and stored
1207 * in the SDL_Event structure pointed to by `event`.
1208 *
1209 * As this function may implicitly call SDL_PumpEvents(), you can only call
1210 * this function in the thread that initialized the video subsystem.
1211 *
1212 * The timeout is not guaranteed, the actual wait time could be longer due to
1213 * system scheduling.
1214 *
1215 * \param event the SDL_Event structure to be filled in with the next event
1216 * from the queue, or NULL.
1217 * \param timeoutMS the maximum number of milliseconds to wait for the next
1218 * available event.
1219 * \returns true if this got an event or false if the timeout elapsed without
1220 * any events available.
1221 *
1222 * \since This function is available since SDL 3.0.0.
1223 *
1224 * \sa SDL_PollEvent
1225 * \sa SDL_PushEvent
1226 * \sa SDL_WaitEvent
1227 */
1228extern SDL_DECLSPEC bool SDLCALL SDL_WaitEventTimeout(SDL_Event *event, Sint32 timeoutMS);
1229
1230/**
1231 * Add an event to the event queue.
1232 *
1233 * The event queue can actually be used as a two way communication channel.
1234 * Not only can events be read from the queue, but the user can also push
1235 * their own events onto it. `event` is a pointer to the event structure you
1236 * wish to push onto the queue. The event is copied into the queue, and the
1237 * caller may dispose of the memory pointed to after SDL_PushEvent() returns.
1238 *
1239 * Note: Pushing device input events onto the queue doesn't modify the state
1240 * of the device within SDL.
1241 *
1242 * This function is thread-safe, and can be called from other threads safely.
1243 *
1244 * Note: Events pushed onto the queue with SDL_PushEvent() get passed through
1245 * the event filter but events added with SDL_PeepEvents() do not.
1246 *
1247 * For pushing application-specific events, please use SDL_RegisterEvents() to
1248 * get an event type that does not conflict with other code that also wants
1249 * its own custom event types.
1250 *
1251 * \param event the SDL_Event to be added to the queue.
1252 * \returns true on success, false if the event was filtered or on failure;
1253 * call SDL_GetError() for more information. A common reason for
1254 * error is the event queue being full.
1255 *
1256 * \since This function is available since SDL 3.0.0.
1257 *
1258 * \sa SDL_PeepEvents
1259 * \sa SDL_PollEvent
1260 * \sa SDL_RegisterEvents
1261 */
1262extern SDL_DECLSPEC bool SDLCALL SDL_PushEvent(SDL_Event *event);
1263
1264/**
1265 * A function pointer used for callbacks that watch the event queue.
1266 *
1267 * \param userdata what was passed as `userdata` to SDL_SetEventFilter() or
1268 * SDL_AddEventWatch, etc.
1269 * \param event the event that triggered the callback.
1270 * \returns true to permit event to be added to the queue, and false to
1271 * disallow it. When used with SDL_AddEventWatch, the return value is
1272 * ignored.
1273 *
1274 * \threadsafety SDL may call this callback at any time from any thread; the
1275 * application is responsible for locking resources the callback
1276 * touches that need to be protected.
1277 *
1278 * \since This datatype is available since SDL 3.0.0.
1279 *
1280 * \sa SDL_SetEventFilter
1281 * \sa SDL_AddEventWatch
1282 */
1283typedef bool (SDLCALL *SDL_EventFilter)(void *userdata, SDL_Event *event);
1284
1285/**
1286 * Set up a filter to process all events before they change internal state and
1287 * are posted to the internal event queue.
1288 *
1289 * If the filter function returns true when called, then the event will be
1290 * added to the internal queue. If it returns false, then the event will be
1291 * dropped from the queue, but the internal state will still be updated. This
1292 * allows selective filtering of dynamically arriving events.
1293 *
1294 * **WARNING**: Be very careful of what you do in the event filter function,
1295 * as it may run in a different thread!
1296 *
1297 * On platforms that support it, if the quit event is generated by an
1298 * interrupt signal (e.g. pressing Ctrl-C), it will be delivered to the
1299 * application at the next event poll.
1300 *
1301 * There is one caveat when dealing with the SDL_QuitEvent event type. The
1302 * event filter is only called when the window manager desires to close the
1303 * application window. If the event filter returns 1, then the window will be
1304 * closed, otherwise the window will remain open if possible.
1305 *
1306 * Note: Disabled events never make it to the event filter function; see
1307 * SDL_SetEventEnabled().
1308 *
1309 * Note: If you just want to inspect events without filtering, you should use
1310 * SDL_AddEventWatch() instead.
1311 *
1312 * Note: Events pushed onto the queue with SDL_PushEvent() get passed through
1313 * the event filter, but events pushed onto the queue with SDL_PeepEvents() do
1314 * not.
1315 *
1316 * \param filter an SDL_EventFilter function to call when an event happens.
1317 * \param userdata a pointer that is passed to `filter`.
1318 *
1319 * \threadsafety SDL may call the filter callback at any time from any thread;
1320 * the application is responsible for locking resources the
1321 * callback touches that need to be protected.
1322 *
1323 * \since This function is available since SDL 3.0.0.
1324 *
1325 * \sa SDL_AddEventWatch
1326 * \sa SDL_SetEventEnabled
1327 * \sa SDL_GetEventFilter
1328 * \sa SDL_PeepEvents
1329 * \sa SDL_PushEvent
1330 */
1331extern SDL_DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter, void *userdata);
1332
1333/**
1334 * Query the current event filter.
1335 *
1336 * This function can be used to "chain" filters, by saving the existing filter
1337 * before replacing it with a function that will call that saved filter.
1338 *
1339 * \param filter the current callback function will be stored here.
1340 * \param userdata the pointer that is passed to the current event filter will
1341 * be stored here.
1342 * \returns true on success or false if there is no event filter set.
1343 *
1344 * \since This function is available since SDL 3.0.0.
1345 *
1346 * \sa SDL_SetEventFilter
1347 */
1348extern SDL_DECLSPEC bool SDLCALL SDL_GetEventFilter(SDL_EventFilter *filter, void **userdata);
1349
1350/**
1351 * Add a callback to be triggered when an event is added to the event queue.
1352 *
1353 * `filter` will be called when an event happens, and its return value is
1354 * ignored.
1355 *
1356 * **WARNING**: Be very careful of what you do in the event filter function,
1357 * as it may run in a different thread!
1358 *
1359 * If the quit event is generated by a signal (e.g. SIGINT), it will bypass
1360 * the internal queue and be delivered to the watch callback immediately, and
1361 * arrive at the next event poll.
1362 *
1363 * Note: the callback is called for events posted by the user through
1364 * SDL_PushEvent(), but not for disabled events, nor for events by a filter
1365 * callback set with SDL_SetEventFilter(), nor for events posted by the user
1366 * through SDL_PeepEvents().
1367 *
1368 * \param filter an SDL_EventFilter function to call when an event happens.
1369 * \param userdata a pointer that is passed to `filter`.
1370 * \returns true on success or false on failure; call SDL_GetError() for more
1371 * information.
1372 *
1373 * \threadsafety It is safe to call this function from any thread.
1374 *
1375 * \since This function is available since SDL 3.0.0.
1376 *
1377 * \sa SDL_RemoveEventWatch
1378 * \sa SDL_SetEventFilter
1379 */
1380extern SDL_DECLSPEC bool SDLCALL SDL_AddEventWatch(SDL_EventFilter filter, void *userdata);
1381
1382/**
1383 * Remove an event watch callback added with SDL_AddEventWatch().
1384 *
1385 * This function takes the same input as SDL_AddEventWatch() to identify and
1386 * delete the corresponding callback.
1387 *
1388 * \param filter the function originally passed to SDL_AddEventWatch().
1389 * \param userdata the pointer originally passed to SDL_AddEventWatch().
1390 *
1391 * \since This function is available since SDL 3.0.0.
1392 *
1393 * \sa SDL_AddEventWatch
1394 */
1395extern SDL_DECLSPEC void SDLCALL SDL_RemoveEventWatch(SDL_EventFilter filter, void *userdata);
1396
1397/**
1398 * Run a specific filter function on the current event queue, removing any
1399 * events for which the filter returns false.
1400 *
1401 * See SDL_SetEventFilter() for more information. Unlike SDL_SetEventFilter(),
1402 * this function does not change the filter permanently, it only uses the
1403 * supplied filter until this function returns.
1404 *
1405 * \param filter the SDL_EventFilter function to call when an event happens.
1406 * \param userdata a pointer that is passed to `filter`.
1407 *
1408 * \since This function is available since SDL 3.0.0.
1409 *
1410 * \sa SDL_GetEventFilter
1411 * \sa SDL_SetEventFilter
1412 */
1413extern SDL_DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter, void *userdata);
1414
1415/**
1416 * Set the state of processing events by type.
1417 *
1418 * \param type the type of event; see SDL_EventType for details.
1419 * \param enabled whether to process the event or not.
1420 *
1421 * \since This function is available since SDL 3.0.0.
1422 *
1423 * \sa SDL_EventEnabled
1424 */
1425extern SDL_DECLSPEC void SDLCALL SDL_SetEventEnabled(Uint32 type, bool enabled);
1426
1427/**
1428 * Query the state of processing events by type.
1429 *
1430 * \param type the type of event; see SDL_EventType for details.
1431 * \returns true if the event is being processed, false otherwise.
1432 *
1433 * \since This function is available since SDL 3.0.0.
1434 *
1435 * \sa SDL_SetEventEnabled
1436 */
1437extern SDL_DECLSPEC bool SDLCALL SDL_EventEnabled(Uint32 type);
1438
1439/**
1440 * Allocate a set of user-defined events, and return the beginning event
1441 * number for that set of events.
1442 *
1443 * \param numevents the number of events to be allocated.
1444 * \returns the beginning event number, or 0 if numevents is invalid or if
1445 * there are not enough user-defined events left.
1446 *
1447 * \since This function is available since SDL 3.0.0.
1448 *
1449 * \sa SDL_PushEvent
1450 */
1451extern SDL_DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents);
1452
1453/**
1454 * Get window associated with an event.
1455 *
1456 * \param event an event containing a `windowID`.
1457 * \returns the associated window on success or NULL if there is none.
1458 *
1459 * \since This function is available since SDL 3.0.0.
1460 *
1461 * \sa SDL_PollEvent
1462 * \sa SDL_WaitEvent
1463 * \sa SDL_WaitEventTimeout
1464 */
1465extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetWindowFromEvent(const SDL_Event *event);
1466
1467/* Ends C function definitions when using C++ */
1468#ifdef __cplusplus
1469}
1470#endif
1471#include <SDL3/SDL_close_code.h>
1472
1473#endif /* SDL_events_h_ */
Uint32 SDL_AudioDeviceID
Definition SDL_audio.h:280
#define NULL
Uint32 SDL_CameraID
Definition SDL_camera.h:60
void SDL_RemoveEventWatch(SDL_EventFilter filter, void *userdata)
bool SDL_PollEvent(SDL_Event *event)
void SDL_SetEventEnabled(Uint32 type, bool enabled)
int SDL_PeepEvents(SDL_Event *events, int numevents, SDL_EventAction action, Uint32 minType, Uint32 maxType)
bool SDL_HasEvents(Uint32 minType, Uint32 maxType)
void SDL_FilterEvents(SDL_EventFilter filter, void *userdata)
bool(* SDL_EventFilter)(void *userdata, SDL_Event *event)
bool SDL_GetEventFilter(SDL_EventFilter *filter, void **userdata)
SDL_Window * SDL_GetWindowFromEvent(const SDL_Event *event)
Uint32 SDL_RegisterEvents(int numevents)
SDL_EventType
Definition SDL_events.h:61
@ SDL_EVENT_KEYMAP_CHANGED
Definition SDL_events.h:148
@ SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED
Definition SDL_events.h:105
@ SDL_EVENT_PEN_PROXIMITY_OUT
Definition SDL_events.h:214
@ SDL_EVENT_WINDOW_HIT_TEST
Definition SDL_events.h:127
@ SDL_EVENT_GAMEPAD_ADDED
Definition SDL_events.h:177
@ SDL_EVENT_GAMEPAD_TOUCHPAD_UP
Definition SDL_events.h:182
@ SDL_EVENT_WINDOW_RESTORED
Definition SDL_events.h:121
@ SDL_EVENT_GAMEPAD_AXIS_MOTION
Definition SDL_events.h:174
@ SDL_EVENT_WINDOW_LAST
Definition SDL_events.h:141
@ SDL_EVENT_DROP_BEGIN
Definition SDL_events.h:200
@ SDL_EVENT_MOUSE_MOTION
Definition SDL_events.h:155
@ SDL_EVENT_WINDOW_FOCUS_GAINED
Definition SDL_events.h:124
@ SDL_EVENT_WINDOW_SAFE_AREA_CHANGED
Definition SDL_events.h:131
@ SDL_EVENT_MOUSE_WHEEL
Definition SDL_events.h:158
@ SDL_EVENT_JOYSTICK_REMOVED
Definition SDL_events.h:169
@ SDL_EVENT_WINDOW_ENTER_FULLSCREEN
Definition SDL_events.h:133
@ SDL_EVENT_PEN_DOWN
Definition SDL_events.h:215
@ SDL_EVENT_CLIPBOARD_UPDATE
Definition SDL_events.h:195
@ SDL_EVENT_DID_ENTER_FOREGROUND
Definition SDL_events.h:88
@ SDL_EVENT_JOYSTICK_BUTTON_UP
Definition SDL_events.h:167
@ SDL_EVENT_JOYSTICK_BATTERY_UPDATED
Definition SDL_events.h:170
@ SDL_EVENT_WILL_ENTER_FOREGROUND
Definition SDL_events.h:84
@ SDL_EVENT_PEN_MOTION
Definition SDL_events.h:219
@ SDL_EVENT_POLL_SENTINEL
Definition SDL_events.h:233
@ SDL_EVENT_CAMERA_DEVICE_REMOVED
Definition SDL_events.h:224
@ SDL_EVENT_JOYSTICK_UPDATE_COMPLETE
Definition SDL_events.h:171
@ SDL_EVENT_FINGER_UP
Definition SDL_events.h:189
@ SDL_EVENT_DISPLAY_REMOVED
Definition SDL_events.h:101
@ SDL_EVENT_JOYSTICK_ADDED
Definition SDL_events.h:168
@ SDL_EVENT_MOUSE_ADDED
Definition SDL_events.h:159
@ SDL_EVENT_DROP_POSITION
Definition SDL_events.h:202
@ SDL_EVENT_WINDOW_EXPOSED
Definition SDL_events.h:114
@ SDL_EVENT_WINDOW_DISPLAY_CHANGED
Definition SDL_events.h:129
@ SDL_EVENT_WINDOW_RESIZED
Definition SDL_events.h:116
@ SDL_EVENT_ENUM_PADDING
Definition SDL_events.h:246
@ SDL_EVENT_GAMEPAD_REMAPPED
Definition SDL_events.h:179
@ SDL_EVENT_GAMEPAD_REMOVED
Definition SDL_events.h:178
@ SDL_EVENT_WINDOW_HDR_STATE_CHANGED
Definition SDL_events.h:139
@ SDL_EVENT_FINGER_MOTION
Definition SDL_events.h:190
@ SDL_EVENT_WINDOW_MOUSE_ENTER
Definition SDL_events.h:122
@ SDL_EVENT_WINDOW_HIDDEN
Definition SDL_events.h:113
@ SDL_EVENT_RENDER_TARGETS_RESET
Definition SDL_events.h:229
@ SDL_EVENT_MOUSE_REMOVED
Definition SDL_events.h:160
@ SDL_EVENT_DID_ENTER_BACKGROUND
Definition SDL_events.h:80
@ SDL_EVENT_CAMERA_DEVICE_APPROVED
Definition SDL_events.h:225
@ SDL_EVENT_AUDIO_DEVICE_ADDED
Definition SDL_events.h:205
@ SDL_EVENT_RENDER_DEVICE_RESET
Definition SDL_events.h:230
@ SDL_EVENT_LOW_MEMORY
Definition SDL_events.h:72
@ SDL_EVENT_GAMEPAD_UPDATE_COMPLETE
Definition SDL_events.h:184
@ SDL_EVENT_WINDOW_DESTROYED
Definition SDL_events.h:135
@ SDL_EVENT_PEN_UP
Definition SDL_events.h:216
@ SDL_EVENT_GAMEPAD_BUTTON_DOWN
Definition SDL_events.h:175
@ SDL_EVENT_DISPLAY_ADDED
Definition SDL_events.h:100
@ SDL_EVENT_JOYSTICK_AXIS_MOTION
Definition SDL_events.h:163
@ SDL_EVENT_KEY_UP
Definition SDL_events.h:145
@ SDL_EVENT_WINDOW_CLOSE_REQUESTED
Definition SDL_events.h:126
@ SDL_EVENT_TEXT_INPUT
Definition SDL_events.h:147
@ SDL_EVENT_LOCALE_CHANGED
Definition SDL_events.h:93
@ SDL_EVENT_WINDOW_OCCLUDED
Definition SDL_events.h:132
@ SDL_EVENT_DISPLAY_LAST
Definition SDL_events.h:107
@ SDL_EVENT_WILL_ENTER_BACKGROUND
Definition SDL_events.h:76
@ SDL_EVENT_MOUSE_BUTTON_DOWN
Definition SDL_events.h:156
@ SDL_EVENT_USER
Definition SDL_events.h:238
@ SDL_EVENT_WINDOW_FIRST
Definition SDL_events.h:140
@ SDL_EVENT_SENSOR_UPDATE
Definition SDL_events.h:210
@ SDL_EVENT_PEN_BUTTON_DOWN
Definition SDL_events.h:217
@ SDL_EVENT_FIRST
Definition SDL_events.h:62
@ SDL_EVENT_PEN_PROXIMITY_IN
Definition SDL_events.h:213
@ SDL_EVENT_DISPLAY_MOVED
Definition SDL_events.h:102
@ SDL_EVENT_JOYSTICK_BUTTON_DOWN
Definition SDL_events.h:166
@ SDL_EVENT_PEN_BUTTON_UP
Definition SDL_events.h:218
@ SDL_EVENT_MOUSE_BUTTON_UP
Definition SDL_events.h:157
@ SDL_EVENT_DROP_TEXT
Definition SDL_events.h:199
@ SDL_EVENT_DROP_FILE
Definition SDL_events.h:198
@ SDL_EVENT_KEYBOARD_REMOVED
Definition SDL_events.h:151
@ SDL_EVENT_WINDOW_FOCUS_LOST
Definition SDL_events.h:125
@ SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED
Definition SDL_events.h:185
@ SDL_EVENT_GAMEPAD_BUTTON_UP
Definition SDL_events.h:176
@ SDL_EVENT_DISPLAY_CURRENT_MODE_CHANGED
Definition SDL_events.h:104
@ SDL_EVENT_WINDOW_MAXIMIZED
Definition SDL_events.h:120
@ SDL_EVENT_PEN_AXIS
Definition SDL_events.h:220
@ SDL_EVENT_TERMINATING
Definition SDL_events.h:68
@ SDL_EVENT_WINDOW_ICCPROF_CHANGED
Definition SDL_events.h:128
@ SDL_EVENT_SYSTEM_THEME_CHANGED
Definition SDL_events.h:95
@ SDL_EVENT_WINDOW_LEAVE_FULLSCREEN
Definition SDL_events.h:134
@ SDL_EVENT_CAMERA_DEVICE_ADDED
Definition SDL_events.h:223
@ SDL_EVENT_KEYBOARD_ADDED
Definition SDL_events.h:150
@ SDL_EVENT_GAMEPAD_SENSOR_UPDATE
Definition SDL_events.h:183
@ SDL_EVENT_JOYSTICK_HAT_MOTION
Definition SDL_events.h:165
@ SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED
Definition SDL_events.h:207
@ SDL_EVENT_JOYSTICK_BALL_MOTION
Definition SDL_events.h:164
@ SDL_EVENT_WINDOW_SHOWN
Definition SDL_events.h:112
@ SDL_EVENT_KEY_DOWN
Definition SDL_events.h:144
@ SDL_EVENT_CAMERA_DEVICE_DENIED
Definition SDL_events.h:226
@ SDL_EVENT_TEXT_EDITING_CANDIDATES
Definition SDL_events.h:152
@ SDL_EVENT_WINDOW_MOVED
Definition SDL_events.h:115
@ SDL_EVENT_DISPLAY_FIRST
Definition SDL_events.h:106
@ SDL_EVENT_WINDOW_MINIMIZED
Definition SDL_events.h:119
@ SDL_EVENT_WINDOW_METAL_VIEW_RESIZED
Definition SDL_events.h:118
@ SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED
Definition SDL_events.h:117
@ SDL_EVENT_DISPLAY_ORIENTATION
Definition SDL_events.h:99
@ SDL_EVENT_WINDOW_DISPLAY_SCALE_CHANGED
Definition SDL_events.h:130
@ SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION
Definition SDL_events.h:181
@ SDL_EVENT_LAST
Definition SDL_events.h:243
@ SDL_EVENT_AUDIO_DEVICE_REMOVED
Definition SDL_events.h:206
@ SDL_EVENT_DROP_COMPLETE
Definition SDL_events.h:201
@ SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN
Definition SDL_events.h:180
@ SDL_EVENT_TEXT_EDITING
Definition SDL_events.h:146
@ SDL_EVENT_DISPLAY_DESKTOP_MODE_CHANGED
Definition SDL_events.h:103
@ SDL_EVENT_WINDOW_MOUSE_LEAVE
Definition SDL_events.h:123
@ SDL_EVENT_QUIT
Definition SDL_events.h:65
@ SDL_EVENT_FINGER_DOWN
Definition SDL_events.h:188
bool SDL_WaitEvent(SDL_Event *event)
bool SDL_EventEnabled(Uint32 type)
void SDL_SetEventFilter(SDL_EventFilter filter, void *userdata)
bool SDL_HasEvent(Uint32 type)
bool SDL_PushEvent(SDL_Event *event)
void SDL_FlushEvents(Uint32 minType, Uint32 maxType)
SDL_EventAction
Definition SDL_events.h:999
@ SDL_ADDEVENT
@ SDL_PEEKEVENT
@ SDL_GETEVENT
void SDL_FlushEvent(Uint32 type)
bool SDL_AddEventWatch(SDL_EventFilter filter, void *userdata)
void SDL_PumpEvents(void)
bool SDL_WaitEventTimeout(SDL_Event *event, Sint32 timeoutMS)
Uint32 SDL_JoystickID
Uint32 SDL_KeyboardID
Uint16 SDL_Keymod
Uint32 SDL_Keycode
Definition SDL_keycode.h:47
Uint32 SDL_MouseID
Definition SDL_mouse.h:52
Uint32 SDL_MouseButtonFlags
Definition SDL_mouse.h:119
SDL_MouseWheelDirection
Definition SDL_mouse.h:99
Uint32 SDL_PenID
Definition SDL_pen.h:60
SDL_PenAxis
Definition SDL_pen.h:94
Uint32 SDL_PenInputFlags
Definition SDL_pen.h:68
SDL_PowerState
Definition SDL_power.h:48
SDL_Scancode
Uint32 SDL_SensorID
Definition SDL_sensor.h:57
uint8_t Uint8
Definition SDL_stdinc.h:320
uint16_t Uint16
Definition SDL_stdinc.h:338
int32_t Sint32
Definition SDL_stdinc.h:347
int16_t Sint16
Definition SDL_stdinc.h:329
#define SDL_COMPILE_TIME_ASSERT(name, x)
Definition SDL_stdinc.h:112
#define bool
Definition SDL_stdinc.h:53
uint64_t Uint64
Definition SDL_stdinc.h:378
uint32_t Uint32
Definition SDL_stdinc.h:356
Uint64 SDL_TouchID
Definition SDL_touch.h:41
Uint64 SDL_FingerID
Definition SDL_touch.h:42
Uint32 SDL_DisplayID
Definition SDL_video.h:54
struct SDL_Window SDL_Window
Definition SDL_video.h:144
Uint32 SDL_WindowID
Definition SDL_video.h:63
SDL_AudioDeviceID which
Definition SDL_events.h:666
SDL_EventType type
Definition SDL_events.h:663
SDL_EventType type
Definition SDL_events.h:680
SDL_EventType type
Definition SDL_events.h:845
SDL_DisplayID displayID
Definition SDL_events.h:272
SDL_EventType type
Definition SDL_events.h:269
SDL_EventType type
Definition SDL_events.h:827
SDL_WindowID windowID
Definition SDL_events.h:830
Uint64 timestamp
Definition SDL_events.h:829
const char * data
Definition SDL_events.h:834
Uint32 reserved
Definition SDL_events.h:828
const char * source
Definition SDL_events.h:833
SDL_JoystickID which
Definition SDL_events.h:581
SDL_EventType type
Definition SDL_events.h:578
SDL_JoystickID which
Definition SDL_events.h:601
SDL_JoystickID which
Definition SDL_events.h:619
SDL_JoystickID which
Definition SDL_events.h:650
SDL_EventType type
Definition SDL_events.h:472
SDL_JoystickID which
Definition SDL_events.h:475
SDL_EventType type
Definition SDL_events.h:491
SDL_JoystickID which
Definition SDL_events.h:494
SDL_JoystickID which
Definition SDL_events.h:566
SDL_PowerState state
Definition SDL_events.h:567
SDL_EventType type
Definition SDL_events.h:563
SDL_JoystickID which
Definition SDL_events.h:536
SDL_EventType type
Definition SDL_events.h:533
SDL_EventType type
Definition SDL_events.h:550
SDL_JoystickID which
Definition SDL_events.h:553
SDL_JoystickID which
Definition SDL_events.h:513
SDL_EventType type
Definition SDL_events.h:510
SDL_KeyboardID which
Definition SDL_events.h:302
SDL_EventType type
Definition SDL_events.h:321
SDL_Keycode key
Definition SDL_events.h:327
SDL_KeyboardID which
Definition SDL_events.h:325
SDL_WindowID windowID
Definition SDL_events.h:324
SDL_Scancode scancode
Definition SDL_events.h:326
SDL_WindowID windowID
Definition SDL_events.h:436
SDL_EventType type
Definition SDL_events.h:433
SDL_EventType type
Definition SDL_events.h:401
SDL_WindowID windowID
Definition SDL_events.h:417
SDL_EventType type
Definition SDL_events.h:414
SDL_MouseButtonFlags state
Definition SDL_events.h:419
SDL_MouseWheelDirection direction
Definition SDL_events.h:460
SDL_EventType type
Definition SDL_events.h:453
SDL_MouseID which
Definition SDL_events.h:457
SDL_WindowID windowID
Definition SDL_events.h:456
SDL_PenAxis axis
Definition SDL_events.h:815
SDL_PenID which
Definition SDL_events.h:811
SDL_WindowID windowID
Definition SDL_events.h:810
SDL_PenInputFlags pen_state
Definition SDL_events.h:812
SDL_EventType type
Definition SDL_events.h:807
SDL_WindowID windowID
Definition SDL_events.h:788
SDL_EventType type
Definition SDL_events.h:785
SDL_PenInputFlags pen_state
Definition SDL_events.h:790
SDL_WindowID windowID
Definition SDL_events.h:746
SDL_EventType type
Definition SDL_events.h:743
SDL_PenInputFlags pen_state
Definition SDL_events.h:748
SDL_EventType type
Definition SDL_events.h:723
SDL_WindowID windowID
Definition SDL_events.h:726
SDL_EventType type
Definition SDL_events.h:763
SDL_WindowID windowID
Definition SDL_events.h:766
SDL_PenInputFlags pen_state
Definition SDL_events.h:768
SDL_EventType type
Definition SDL_events.h:872
Uint32 reserved
Definition SDL_events.h:873
Uint64 timestamp
Definition SDL_events.h:874
Uint64 sensor_timestamp
Definition SDL_events.h:862
SDL_EventType type
Definition SDL_events.h:857
SDL_SensorID which
Definition SDL_events.h:860
const char *const * candidates
Definition SDL_events.h:365
SDL_EventType type
Definition SDL_events.h:345
const char * text
Definition SDL_events.h:349
SDL_WindowID windowID
Definition SDL_events.h:348
const char * text
Definition SDL_events.h:391
SDL_WindowID windowID
Definition SDL_events.h:390
SDL_EventType type
Definition SDL_events.h:387
SDL_FingerID fingerID
Definition SDL_events.h:697
SDL_TouchID touchID
Definition SDL_events.h:696
SDL_EventType type
Definition SDL_events.h:693
SDL_WindowID windowID
Definition SDL_events.h:703
Uint32 reserved
Definition SDL_events.h:891
SDL_WindowID windowID
Definition SDL_events.h:893
Uint64 timestamp
Definition SDL_events.h:892
SDL_EventType type
Definition SDL_events.h:284
SDL_WindowID windowID
Definition SDL_events.h:287
SDL_QuitEvent quit
Definition SDL_events.h:934
SDL_AudioDeviceEvent adevice
Definition SDL_events.h:931
SDL_PenProximityEvent pproximity
Definition SDL_events.h:937
Uint8 padding[128]
Definition SDL_events.h:958
SDL_JoyDeviceEvent jdevice
Definition SDL_events.h:920
Uint32 type
Definition SDL_events.h:907
SDL_MouseWheelEvent wheel
Definition SDL_events.h:919
SDL_PenTouchEvent ptouch
Definition SDL_events.h:938
SDL_PenMotionEvent pmotion
Definition SDL_events.h:939
SDL_JoyHatEvent jhat
Definition SDL_events.h:923
SDL_ClipboardEvent clipboard
Definition SDL_events.h:943
SDL_JoyButtonEvent jbutton
Definition SDL_events.h:924
SDL_GamepadDeviceEvent gdevice
Definition SDL_events.h:926
SDL_GamepadAxisEvent gaxis
Definition SDL_events.h:927
SDL_PenAxisEvent paxis
Definition SDL_events.h:941
SDL_WindowEvent window
Definition SDL_events.h:910
SDL_CameraDeviceEvent cdevice
Definition SDL_events.h:932
SDL_GamepadTouchpadEvent gtouchpad
Definition SDL_events.h:929
SDL_KeyboardDeviceEvent kdevice
Definition SDL_events.h:911
SDL_TextEditingEvent edit
Definition SDL_events.h:913
SDL_TextInputEvent text
Definition SDL_events.h:915
SDL_PenButtonEvent pbutton
Definition SDL_events.h:940
SDL_GamepadSensorEvent gsensor
Definition SDL_events.h:930
SDL_TouchFingerEvent tfinger
Definition SDL_events.h:936
SDL_MouseButtonEvent button
Definition SDL_events.h:918
SDL_UserEvent user
Definition SDL_events.h:935
SDL_KeyboardEvent key
Definition SDL_events.h:912
SDL_CommonEvent common
Definition SDL_events.h:908
SDL_MouseMotionEvent motion
Definition SDL_events.h:917
SDL_JoyAxisEvent jaxis
Definition SDL_events.h:921
SDL_MouseDeviceEvent mdevice
Definition SDL_events.h:916
SDL_DropEvent drop
Definition SDL_events.h:942
SDL_JoyBallEvent jball
Definition SDL_events.h:922
SDL_JoyBatteryEvent jbattery
Definition SDL_events.h:925
SDL_SensorEvent sensor
Definition SDL_events.h:933
SDL_GamepadButtonEvent gbutton
Definition SDL_events.h:928
SDL_TextEditingCandidatesEvent edit_candidates
Definition SDL_events.h:914
SDL_DisplayEvent display
Definition SDL_events.h:909