SDL 3.0
SDL_events.h
Go to the documentation of this file.
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2026 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 * It's extremely common--often required--that an app deal with SDL's event
28 * queue. Almost all useful information about interactions with the real world
29 * flow through here: the user interacting with the computer and app, hardware
30 * coming and going, the system changing in some way, etc.
31 *
32 * An app generally takes a moment, perhaps at the start of a new frame, to
33 * examine any events that have occurred since the last time and process or
34 * ignore them. This is generally done by calling SDL_PollEvent() in a loop
35 * until it returns false (or, if using the main callbacks, events are
36 * provided one at a time in calls to SDL_AppEvent() before the next call to
37 * SDL_AppIterate(); in this scenario, the app does not call SDL_PollEvent()
38 * at all).
39 *
40 * There is other forms of control, too: SDL_PeepEvents() has more
41 * functionality at the cost of more complexity, and SDL_WaitEvent() can block
42 * the process until something interesting happens, which might be beneficial
43 * for certain types of programs on low-power hardware. One may also call
44 * SDL_AddEventWatch() to set a callback when new events arrive.
45 *
46 * The app is free to generate their own events, too: SDL_PushEvent allows the
47 * app to put events onto the queue for later retrieval; SDL_RegisterEvents
48 * can guarantee that these events have a type that isn't in use by other
49 * parts of the system.
50 */
51
52#ifndef SDL_events_h_
53#define SDL_events_h_
54
55#include <SDL3/SDL_stdinc.h>
56#include <SDL3/SDL_audio.h>
57#include <SDL3/SDL_camera.h>
58#include <SDL3/SDL_error.h>
59#include <SDL3/SDL_gamepad.h>
60#include <SDL3/SDL_joystick.h>
61#include <SDL3/SDL_keyboard.h>
62#include <SDL3/SDL_keycode.h>
63#include <SDL3/SDL_mouse.h>
65#include <SDL3/SDL_pen.h>
66#include <SDL3/SDL_power.h>
67#include <SDL3/SDL_sensor.h>
68#include <SDL3/SDL_scancode.h>
69#include <SDL3/SDL_touch.h>
70#include <SDL3/SDL_video.h>
71
72#include <SDL3/SDL_begin_code.h>
73/* Set up for C function definitions, even when using C++ */
74#ifdef __cplusplus
75extern "C" {
76#endif
77
78/* General keyboard/mouse/pen state definitions */
79
80/**
81 * The types of events that can be delivered.
82 *
83 * \since This enum is available since SDL 3.2.0.
84 */
85typedef enum SDL_EventType
86{
87 SDL_EVENT_FIRST = 0, /**< Unused (do not remove) */
88
89 /* Application events */
90 SDL_EVENT_QUIT = 0x100, /**< User-requested quit */
91
92 /* These application events have special meaning on iOS and Android, see README-ios.md and README-android.md for details */
93 SDL_EVENT_TERMINATING, /**< The application is being terminated by the OS. This event must be handled in a callback set with SDL_AddEventWatch().
94 Called on iOS in applicationWillTerminate()
95 Called on Android in onDestroy()
96 */
97 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().
98 Called on iOS in applicationDidReceiveMemoryWarning()
99 Called on Android in onTrimMemory()
100 */
101 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().
102 Called on iOS in applicationWillResignActive()
103 Called on Android in onPause()
104 */
105 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().
106 Called on iOS in applicationDidEnterBackground()
107 Called on Android in onPause()
108 */
109 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().
110 Called on iOS in applicationWillEnterForeground()
111 Called on Android in onResume()
112 */
113 SDL_EVENT_DID_ENTER_FOREGROUND, /**< The application is now interactive. This event must be handled in a callback set with SDL_AddEventWatch().
114 Called on iOS in applicationDidBecomeActive()
115 Called on Android in onResume()
116 */
117
118 SDL_EVENT_LOCALE_CHANGED, /**< The user's locale preferences have changed. */
119
120 SDL_EVENT_SYSTEM_THEME_CHANGED, /**< The system theme changed */
121
122 /* Display events */
123 /* 0x150 was SDL_DISPLAYEVENT, reserve the number for sdl2-compat */
124 SDL_EVENT_DISPLAY_ORIENTATION = 0x151, /**< Display orientation has changed to data1 */
125 SDL_EVENT_DISPLAY_ADDED, /**< Display has been added to the system */
126 SDL_EVENT_DISPLAY_REMOVED, /**< Display has been removed from the system */
127 SDL_EVENT_DISPLAY_MOVED, /**< Display has changed position */
128 SDL_EVENT_DISPLAY_DESKTOP_MODE_CHANGED, /**< Display has changed desktop mode */
129 SDL_EVENT_DISPLAY_CURRENT_MODE_CHANGED, /**< Display has changed current mode */
130 SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED, /**< Display has changed content scale */
131 SDL_EVENT_DISPLAY_USABLE_BOUNDS_CHANGED, /**< Display has changed usable bounds */
134
135 /* Window events */
136 /* 0x200 was SDL_WINDOWEVENT, reserve the number for sdl2-compat */
137 /* 0x201 was SDL_SYSWMEVENT, reserve the number for sdl2-compat */
138 SDL_EVENT_WINDOW_SHOWN = 0x202, /**< Window has been shown */
139 SDL_EVENT_WINDOW_HIDDEN, /**< Window has been hidden */
140 SDL_EVENT_WINDOW_EXPOSED, /**< Window has been exposed and should be redrawn, and can be redrawn directly from event watchers for this event.
141 data1 is 1 for live-resize expose events, 0 otherwise. */
142 SDL_EVENT_WINDOW_MOVED, /**< Window has been moved to data1, data2 */
143 SDL_EVENT_WINDOW_RESIZED, /**< Window has been resized to data1xdata2 */
144 SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED,/**< The pixel size of the window has changed to data1xdata2 */
145 SDL_EVENT_WINDOW_METAL_VIEW_RESIZED,/**< The pixel size of a Metal view associated with the window has changed */
146 SDL_EVENT_WINDOW_MINIMIZED, /**< Window has been minimized */
147 SDL_EVENT_WINDOW_MAXIMIZED, /**< Window has been maximized */
148 SDL_EVENT_WINDOW_RESTORED, /**< Window has been restored to normal size and position */
149 SDL_EVENT_WINDOW_MOUSE_ENTER, /**< Window has gained mouse focus */
150 SDL_EVENT_WINDOW_MOUSE_LEAVE, /**< Window has lost mouse focus */
151 SDL_EVENT_WINDOW_FOCUS_GAINED, /**< Window has gained keyboard focus */
152 SDL_EVENT_WINDOW_FOCUS_LOST, /**< Window has lost keyboard focus */
153 SDL_EVENT_WINDOW_CLOSE_REQUESTED, /**< The window manager requests that the window be closed */
154 SDL_EVENT_WINDOW_HIT_TEST, /**< Window had a hit test that wasn't SDL_HITTEST_NORMAL */
155 SDL_EVENT_WINDOW_ICCPROF_CHANGED, /**< The window's ICC profile has changed */
156 SDL_EVENT_WINDOW_DISPLAY_CHANGED, /**< Window has been moved to display data1 */
157 SDL_EVENT_WINDOW_DISPLAY_SCALE_CHANGED, /**< Window display scale has been changed */
158 SDL_EVENT_WINDOW_SAFE_AREA_CHANGED, /**< The window safe area has been changed */
159 SDL_EVENT_WINDOW_OCCLUDED, /**< The window has been occluded */
160 SDL_EVENT_WINDOW_ENTER_FULLSCREEN, /**< The window has entered fullscreen mode */
161 SDL_EVENT_WINDOW_LEAVE_FULLSCREEN, /**< The window has left fullscreen mode */
162 SDL_EVENT_WINDOW_DESTROYED, /**< The window with the associated ID is being or has been destroyed. If this message is being handled
163 in an event watcher, the window handle is still valid and can still be used to retrieve any properties
164 associated with the window. Otherwise, the handle has already been destroyed and all resources
165 associated with it are invalid */
166 SDL_EVENT_WINDOW_HDR_STATE_CHANGED, /**< Window HDR properties have changed */
167 SDL_EVENT_WINDOW_SETTINGS_CHANGED, /**< Window settings have changed (on visionOS) */
170
171 /* Keyboard events */
172 SDL_EVENT_KEY_DOWN = 0x300, /**< Key pressed */
173 SDL_EVENT_KEY_UP, /**< Key released */
174 SDL_EVENT_TEXT_EDITING, /**< Keyboard text editing (composition) */
175 SDL_EVENT_TEXT_INPUT, /**< Keyboard text input */
176 SDL_EVENT_KEYMAP_CHANGED, /**< Keymap changed due to a system event such as an
177 input language or keyboard layout change. */
178 SDL_EVENT_KEYBOARD_ADDED, /**< A new keyboard has been inserted into the system */
179 SDL_EVENT_KEYBOARD_REMOVED, /**< A keyboard has been removed */
180 SDL_EVENT_TEXT_EDITING_CANDIDATES, /**< Keyboard text editing candidates */
181 SDL_EVENT_SCREEN_KEYBOARD_SHOWN, /**< The on-screen keyboard has been shown */
182 SDL_EVENT_SCREEN_KEYBOARD_HIDDEN, /**< The on-screen keyboard has been hidden */
185
186 /* Mouse events */
187 SDL_EVENT_MOUSE_MOTION = 0x400, /**< Mouse moved */
188 SDL_EVENT_MOUSE_BUTTON_DOWN, /**< Mouse button pressed */
189 SDL_EVENT_MOUSE_BUTTON_UP, /**< Mouse button released */
190 SDL_EVENT_MOUSE_WHEEL, /**< Mouse wheel motion */
191 SDL_EVENT_MOUSE_ADDED, /**< A new mouse has been inserted into the system */
192 SDL_EVENT_MOUSE_REMOVED, /**< A mouse has been removed */
195
196 /* Joystick events */
197 SDL_EVENT_JOYSTICK_AXIS_MOTION = 0x600, /**< Joystick axis motion */
198 SDL_EVENT_JOYSTICK_BALL_MOTION, /**< Joystick trackball motion */
199 SDL_EVENT_JOYSTICK_HAT_MOTION, /**< Joystick hat position change */
200 SDL_EVENT_JOYSTICK_BUTTON_DOWN, /**< Joystick button pressed */
201 SDL_EVENT_JOYSTICK_BUTTON_UP, /**< Joystick button released */
202 SDL_EVENT_JOYSTICK_ADDED, /**< A new joystick has been inserted into the system */
203 SDL_EVENT_JOYSTICK_REMOVED, /**< An opened joystick has been removed */
204 SDL_EVENT_JOYSTICK_BATTERY_UPDATED, /**< Joystick battery level change */
205 SDL_EVENT_JOYSTICK_UPDATE_COMPLETE, /**< Joystick update is complete */
208
209 /* Gamepad events */
210 SDL_EVENT_GAMEPAD_AXIS_MOTION = 0x650, /**< Gamepad axis motion */
211 SDL_EVENT_GAMEPAD_BUTTON_DOWN, /**< Gamepad button pressed */
212 SDL_EVENT_GAMEPAD_BUTTON_UP, /**< Gamepad button released */
213 SDL_EVENT_GAMEPAD_ADDED, /**< A new gamepad has been inserted into the system */
214 SDL_EVENT_GAMEPAD_REMOVED, /**< A gamepad has been removed */
215 SDL_EVENT_GAMEPAD_REMAPPED, /**< The gamepad mapping was updated */
216 SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN, /**< Gamepad touchpad was touched */
217 SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION, /**< Gamepad touchpad finger was moved */
218 SDL_EVENT_GAMEPAD_TOUCHPAD_UP, /**< Gamepad touchpad finger was lifted */
219 SDL_EVENT_GAMEPAD_SENSOR_UPDATE, /**< Gamepad sensor was updated */
220 SDL_EVENT_GAMEPAD_UPDATE_COMPLETE, /**< Gamepad update is complete */
221 SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED, /**< Gamepad Steam handle has changed */
222 SDL_EVENT_GAMEPAD_CAPSENSE_TOUCH, /**< Gamepad capsense was touched */
223 SDL_EVENT_GAMEPAD_CAPSENSE_RELEASE, /**< Gamepad capsense was released */
226
227 /* Touch events */
234
235 /* Pinch events */
236 SDL_EVENT_PINCH_BEGIN = 0x710, /**< Pinch gesture started */
237 SDL_EVENT_PINCH_UPDATE, /**< Pinch gesture updated */
238 SDL_EVENT_PINCH_END, /**< Pinch gesture ended */
241
242 /* 0x800, 0x801, and 0x802 were the Gesture events from SDL2. Do not reuse these values! sdl2-compat needs them! */
243
244 /* Clipboard events */
245 SDL_EVENT_CLIPBOARD_UPDATE = 0x900, /**< The clipboard changed */
248
249 /* Drag and drop events */
250 SDL_EVENT_DROP_FILE = 0x1000, /**< The system requests a file open */
251 SDL_EVENT_DROP_TEXT, /**< text/plain drag-and-drop event */
252 SDL_EVENT_DROP_BEGIN, /**< A new set of drops is beginning (NULL filename) */
253 SDL_EVENT_DROP_COMPLETE, /**< Current set of drops is now complete (NULL filename) */
254 SDL_EVENT_DROP_POSITION, /**< Position while moving over the window */
257
258 /* Audio hotplug events */
259 SDL_EVENT_AUDIO_DEVICE_ADDED = 0x1100, /**< A new audio device is available */
260 SDL_EVENT_AUDIO_DEVICE_REMOVED, /**< An audio device has been removed. */
261 SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED, /**< An audio device's format has been changed by the system. */
264
265 /* Sensor events */
266 SDL_EVENT_SENSOR_UPDATE = 0x1200, /**< A sensor was updated */
269
270 /* Pressure-sensitive pen events */
271 SDL_EVENT_PEN_PROXIMITY_IN = 0x1300, /**< Pressure-sensitive pen has become available */
272 SDL_EVENT_PEN_PROXIMITY_OUT, /**< Pressure-sensitive pen has become unavailable */
273 SDL_EVENT_PEN_DOWN, /**< Pressure-sensitive pen touched drawing surface */
274 SDL_EVENT_PEN_UP, /**< Pressure-sensitive pen stopped touching drawing surface */
275 SDL_EVENT_PEN_BUTTON_DOWN, /**< Pressure-sensitive pen button pressed */
276 SDL_EVENT_PEN_BUTTON_UP, /**< Pressure-sensitive pen button released */
277 SDL_EVENT_PEN_MOTION, /**< Pressure-sensitive pen is moving on the tablet */
278 SDL_EVENT_PEN_AXIS, /**< Pressure-sensitive pen angle/pressure/etc changed */
281
282 /* Camera hotplug events */
283 SDL_EVENT_CAMERA_DEVICE_ADDED = 0x1400, /**< A new camera device is available */
284 SDL_EVENT_CAMERA_DEVICE_REMOVED, /**< A camera device has been removed. */
285 SDL_EVENT_CAMERA_DEVICE_APPROVED, /**< A camera device has been approved for use by the user. */
286 SDL_EVENT_CAMERA_DEVICE_DENIED, /**< A camera device has been denied for use by the user. */
289
290 /* Notification events */
291 SDL_EVENT_NOTIFICATION_ACTION_INVOKED = 0x1500, /**< A user response to a system notification was received. */
294
295 /* Render events */
296 SDL_EVENT_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */
297 SDL_EVENT_RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */
298 SDL_EVENT_RENDER_DEVICE_LOST, /**< The device has been lost and can't be recovered. */
301
302 /* Reserved events for private platforms */
307
308 /* Internal events */
309 SDL_EVENT_POLL_SENTINEL = 0x7F00, /**< Signals the end of an event poll cycle */
310
311 /** Events SDL_EVENT_USER through SDL_EVENT_LAST are for your use,
312 * and should be allocated with SDL_RegisterEvents()
313 */
315
316 /**
317 * This last event is only for bounding internal arrays
318 */
320
321 /* This just makes sure the enum is the size of Uint32 */
323
325
326/**
327 * Fields shared by every event (event.common.*)
328 *
329 * All the individual structs that comprise the SDL_Event union start with
330 * these same fields, so you can access them from any struct directly.
331 *
332 * Event types that don't have further data in a specific struct will still
333 * have valid CommonEvent data, accessible via the event.common field.
334 *
335 * \since This struct is available since SDL 3.2.0.
336 */
337typedef struct SDL_CommonEvent
338{
339 Uint32 type; /**< Event type, shared with all events, Uint32 to cover user events which are not in the SDL_EventType enumeration */
341 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
343
344/**
345 * Display state change event data (event.display.*)
346 *
347 * \since This struct is available since SDL 3.2.0.
348 */
349typedef struct SDL_DisplayEvent
350{
351 SDL_EventType type; /**< SDL_EVENT_DISPLAY_* */
353 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
354 SDL_DisplayID displayID;/**< The associated display */
355 Sint32 data1; /**< event dependent data */
356 Sint32 data2; /**< event dependent data */
358
359/**
360 * Window state change event data (event.window.*)
361 *
362 * \since This struct is available since SDL 3.2.0.
363 */
364typedef struct SDL_WindowEvent
365{
366 SDL_EventType type; /**< SDL_EVENT_WINDOW_* */
368 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
369 SDL_WindowID windowID; /**< The associated window */
370 Sint32 data1; /**< event dependent data */
371 Sint32 data2; /**< event dependent data */
373
374/**
375 * Keyboard device event structure (event.kdevice.*)
376 *
377 * \since This struct is available since SDL 3.2.0.
378 */
380{
381 SDL_EventType type; /**< SDL_EVENT_KEYBOARD_ADDED or SDL_EVENT_KEYBOARD_REMOVED */
383 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
384 SDL_KeyboardID which; /**< The keyboard instance id */
386
387/**
388 * Keyboard button event structure (event.key.*)
389 *
390 * The `key` is the base SDL_Keycode generated by pressing the `scancode`
391 * using the current keyboard layout, applying any options specified in
392 * SDL_HINT_KEYCODE_OPTIONS. You can get the SDL_Keycode corresponding to the
393 * event scancode and modifiers directly from the keyboard layout, bypassing
394 * SDL_HINT_KEYCODE_OPTIONS, by calling SDL_GetKeyFromScancode().
395 *
396 * \since This struct is available since SDL 3.2.0.
397 *
398 * \sa SDL_GetKeyFromScancode
399 * \sa SDL_HINT_KEYCODE_OPTIONS
400 */
401typedef struct SDL_KeyboardEvent
402{
403 SDL_EventType type; /**< SDL_EVENT_KEY_DOWN or SDL_EVENT_KEY_UP */
405 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
406 SDL_WindowID windowID; /**< The window with keyboard focus, if any */
407 SDL_KeyboardID which; /**< The keyboard instance id, or 0 if unknown or virtual */
408 SDL_Scancode scancode; /**< SDL physical key code */
409 SDL_Keycode key; /**< SDL virtual key code */
410 SDL_Keymod mod; /**< current key modifiers */
411 Uint16 raw; /**< The platform dependent scancode for this event */
412 bool down; /**< true if the key is pressed */
413 bool repeat; /**< true if this is a key repeat */
415
416/**
417 * Keyboard text editing event structure (event.edit.*)
418 *
419 * The start cursor is the position, in UTF-8 characters, where new typing
420 * will be inserted into the editing text. The length is the number of UTF-8
421 * characters that will be replaced by new typing.
422 *
423 * \since This struct is available since SDL 3.2.0.
424 */
426{
427 SDL_EventType type; /**< SDL_EVENT_TEXT_EDITING */
429 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
430 SDL_WindowID windowID; /**< The window with keyboard focus, if any */
431 const char *text; /**< The editing text */
432 Sint32 start; /**< The start cursor of selected editing text, or -1 if not set */
433 Sint32 length; /**< The length of selected editing text, or -1 if not set */
435
436/**
437 * Keyboard IME candidates event structure (event.edit_candidates.*)
438 *
439 * \since This struct is available since SDL 3.2.0.
440 */
442{
443 SDL_EventType type; /**< SDL_EVENT_TEXT_EDITING_CANDIDATES */
445 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
446 SDL_WindowID windowID; /**< The window with keyboard focus, if any */
447 const char * const *candidates; /**< The list of candidates, or NULL if there are no candidates available */
448 Sint32 num_candidates; /**< The number of strings in `candidates` */
449 Sint32 selected_candidate; /**< The index of the selected candidate, or -1 if no candidate is selected */
450 bool horizontal; /**< true if the list is horizontal, false if it's vertical */
455
456/**
457 * Keyboard text input event structure (event.text.*)
458 *
459 * This event will never be delivered unless text input is enabled by calling
460 * SDL_StartTextInput(). Text input is disabled by default!
461 *
462 * \since This struct is available since SDL 3.2.0.
463 *
464 * \sa SDL_StartTextInput
465 * \sa SDL_StopTextInput
466 */
467typedef struct SDL_TextInputEvent
468{
469 SDL_EventType type; /**< SDL_EVENT_TEXT_INPUT */
471 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
472 SDL_WindowID windowID; /**< The window with keyboard focus, if any */
473 const char *text; /**< The input text, UTF-8 encoded */
475
476/**
477 * Mouse device event structure (event.mdevice.*)
478 *
479 * \since This struct is available since SDL 3.2.0.
480 */
482{
483 SDL_EventType type; /**< SDL_EVENT_MOUSE_ADDED or SDL_EVENT_MOUSE_REMOVED */
485 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
486 SDL_MouseID which; /**< The mouse instance id */
488
489/**
490 * Mouse motion event structure (event.motion.*)
491 *
492 * \since This struct is available since SDL 3.2.0.
493 */
495{
496 SDL_EventType type; /**< SDL_EVENT_MOUSE_MOTION */
498 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
499 SDL_WindowID windowID; /**< The window with mouse focus, if any */
500 SDL_MouseID which; /**< The mouse instance id in relative mode, SDL_TOUCH_MOUSEID for touch events, SDL_PEN_MOUSEID for pen events, or 0 */
501 SDL_MouseButtonFlags state; /**< The current button state */
502 float x; /**< X coordinate, relative to window */
503 float y; /**< Y coordinate, relative to window */
504 float xrel; /**< The relative motion in the X direction */
505 float yrel; /**< The relative motion in the Y direction */
507
508/**
509 * Mouse button event structure (event.button.*)
510 *
511 * \since This struct is available since SDL 3.2.0.
512 */
514{
515 SDL_EventType type; /**< SDL_EVENT_MOUSE_BUTTON_DOWN or SDL_EVENT_MOUSE_BUTTON_UP */
517 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
518 SDL_WindowID windowID; /**< The window with mouse focus, if any */
519 SDL_MouseID which; /**< The mouse instance id in relative mode, SDL_TOUCH_MOUSEID for touch events, or 0 */
520 Uint8 button; /**< The mouse button index */
521 bool down; /**< true if the button is pressed */
522 Uint8 clicks; /**< 1 for single-click, 2 for double-click, etc. */
524 float x; /**< X coordinate, relative to window */
525 float y; /**< Y coordinate, relative to window */
527
528/**
529 * Mouse wheel event structure (event.wheel.*)
530 *
531 * \since This struct is available since SDL 3.2.0.
532 */
534{
535 SDL_EventType type; /**< SDL_EVENT_MOUSE_WHEEL */
537 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
538 SDL_WindowID windowID; /**< The window with mouse focus, if any */
539 SDL_MouseID which; /**< The mouse instance id in relative mode or 0 */
540 float x; /**< The amount scrolled horizontally, positive to the right and negative to the left */
541 float y; /**< The amount scrolled vertically, positive away from the user and negative toward the user */
542 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 */
543 float mouse_x; /**< X coordinate, relative to window */
544 float mouse_y; /**< Y coordinate, relative to window */
545 Sint32 integer_x; /**< The amount scrolled horizontally, accumulated to whole scroll "ticks" (added in 3.2.12) */
546 Sint32 integer_y; /**< The amount scrolled vertically, accumulated to whole scroll "ticks" (added in 3.2.12) */
548
549/**
550 * Joystick axis motion event structure (event.jaxis.*)
551 *
552 * \since This struct is available since SDL 3.2.0.
553 */
554typedef struct SDL_JoyAxisEvent
555{
556 SDL_EventType type; /**< SDL_EVENT_JOYSTICK_AXIS_MOTION */
558 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
559 SDL_JoystickID which; /**< The joystick instance id */
560 Uint8 axis; /**< The joystick axis index */
564 Sint16 value; /**< The axis value (range: -32768 to 32767) */
567
568/**
569 * Joystick trackball motion event structure (event.jball.*)
570 *
571 * \since This struct is available since SDL 3.2.0.
572 */
573typedef struct SDL_JoyBallEvent
574{
575 SDL_EventType type; /**< SDL_EVENT_JOYSTICK_BALL_MOTION */
577 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
578 SDL_JoystickID which; /**< The joystick instance id */
579 Uint8 ball; /**< The joystick trackball index */
583 Sint16 xrel; /**< The relative motion in the X direction */
584 Sint16 yrel; /**< The relative motion in the Y direction */
586
587/**
588 * Joystick hat position change event structure (event.jhat.*)
589 *
590 * \since This struct is available since SDL 3.2.0.
591 */
592typedef struct SDL_JoyHatEvent
593{
594 SDL_EventType type; /**< SDL_EVENT_JOYSTICK_HAT_MOTION */
596 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
597 SDL_JoystickID which; /**< The joystick instance id */
598 Uint8 hat; /**< The joystick hat index */
599 Uint8 value; /**< The hat position value.
600 * \sa SDL_HAT_LEFTUP SDL_HAT_UP SDL_HAT_RIGHTUP
601 * \sa SDL_HAT_LEFT SDL_HAT_CENTERED SDL_HAT_RIGHT
602 * \sa SDL_HAT_LEFTDOWN SDL_HAT_DOWN SDL_HAT_RIGHTDOWN
603 *
604 * Note that zero means the POV is centered.
605 */
609
610/**
611 * Joystick button event structure (event.jbutton.*)
612 *
613 * \since This struct is available since SDL 3.2.0.
614 */
615typedef struct SDL_JoyButtonEvent
616{
617 SDL_EventType type; /**< SDL_EVENT_JOYSTICK_BUTTON_DOWN or SDL_EVENT_JOYSTICK_BUTTON_UP */
619 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
620 SDL_JoystickID which; /**< The joystick instance id */
621 Uint8 button; /**< The joystick button index */
622 bool down; /**< true if the button is pressed */
626
627/**
628 * Joystick device event structure (event.jdevice.*)
629 *
630 * SDL will send JOYSTICK_ADDED events for devices that are already plugged in
631 * during SDL_Init.
632 *
633 * \since This struct is available since SDL 3.2.0.
634 *
635 * \sa SDL_GamepadDeviceEvent
636 */
637typedef struct SDL_JoyDeviceEvent
638{
639 SDL_EventType type; /**< SDL_EVENT_JOYSTICK_ADDED or SDL_EVENT_JOYSTICK_REMOVED or SDL_EVENT_JOYSTICK_UPDATE_COMPLETE */
641 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
642 SDL_JoystickID which; /**< The joystick instance id */
644
645/**
646 * Joystick battery level change event structure (event.jbattery.*)
647 *
648 * \since This struct is available since SDL 3.2.0.
649 */
651{
652 SDL_EventType type; /**< SDL_EVENT_JOYSTICK_BATTERY_UPDATED */
654 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
655 SDL_JoystickID which; /**< The joystick instance id */
656 SDL_PowerState state; /**< The joystick battery state */
657 int percent; /**< The joystick battery percent charge remaining */
659
660/**
661 * Gamepad axis motion event structure (event.gaxis.*)
662 *
663 * \since This struct is available since SDL 3.2.0.
664 */
666{
667 SDL_EventType type; /**< SDL_EVENT_GAMEPAD_AXIS_MOTION */
669 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
670 SDL_JoystickID which; /**< The joystick instance id */
671 Uint8 axis; /**< The gamepad axis (SDL_GamepadAxis) */
675 Sint16 value; /**< The axis value (range: -32768 to 32767) */
678
679
680/**
681 * Gamepad button event structure (event.gbutton.*)
682 *
683 * \since This struct is available since SDL 3.2.0.
684 */
686{
687 SDL_EventType type; /**< SDL_EVENT_GAMEPAD_BUTTON_DOWN or SDL_EVENT_GAMEPAD_BUTTON_UP */
689 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
690 SDL_JoystickID which; /**< The joystick instance id */
691 Uint8 button; /**< The gamepad button (SDL_GamepadButton) */
692 bool down; /**< true if the button is pressed */
696
697
698/**
699 * Gamepad device event structure (event.gdevice.*)
700 *
701 * Joysticks that are supported gamepads receive both an SDL_JoyDeviceEvent
702 * and an SDL_GamepadDeviceEvent.
703 *
704 * SDL will send GAMEPAD_ADDED events for joysticks that are already plugged
705 * in during SDL_Init() and are recognized as gamepads. It will also send
706 * events for joysticks that get gamepad mappings at runtime.
707 *
708 * \since This struct is available since SDL 3.2.0.
709 *
710 * \sa SDL_JoyDeviceEvent
711 */
713{
714 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 */
716 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
717 SDL_JoystickID which; /**< The joystick instance id */
719
720/**
721 * Gamepad touchpad event structure (event.gtouchpad.*)
722 *
723 * \since This struct is available since SDL 3.2.0.
724 */
726{
727 SDL_EventType type; /**< SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN or SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION or SDL_EVENT_GAMEPAD_TOUCHPAD_UP */
729 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
730 SDL_JoystickID which; /**< The joystick instance id */
731 Sint32 touchpad; /**< The index of the touchpad */
732 Sint32 finger; /**< The index of the finger on the touchpad */
733 float x; /**< Normalized in the range 0...1 with 0 being on the left */
734 float y; /**< Normalized in the range 0...1 with 0 being at the top */
735 float pressure; /**< Normalized in the range 0...1 */
737
738/**
739 * Gamepad sensor event structure (event.gsensor.*)
740 *
741 * \since This struct is available since SDL 3.2.0.
742 */
744{
745 SDL_EventType type; /**< SDL_EVENT_GAMEPAD_SENSOR_UPDATE */
747 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
748 SDL_JoystickID which; /**< The joystick instance id */
749 Sint32 sensor; /**< The type of the sensor, one of the values of SDL_SensorType */
750 float data[3]; /**< Up to 3 values from the sensor, as defined in SDL_sensor.h */
751 Uint64 sensor_timestamp; /**< The timestamp of the sensor reading in nanoseconds, not necessarily synchronized with the system clock */
753
754/**
755 * Gamepad capsense event structure (event.gcapsense.*)
756 *
757 * \since This struct is available since SDL 3.6.0.
758 */
760{
761 SDL_EventType type; /**< SDL_EVENT_GAMEPAD_CAPSENSE_TOUCH or SDL_EVENT_GAMEPAD_CAPSENSE_RELEASE */
763 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
764 SDL_JoystickID which; /**< The joystick instance id */
765 Uint8 capsense; /**< The capsense type (SDL_GamepadCapSenseType) */
766 bool down; /**< true if the capsense is touched */
770
771/**
772 * Audio device event structure (event.adevice.*)
773 *
774 * Note that SDL will send a SDL_EVENT_AUDIO_DEVICE_ADDED event for every
775 * device it discovers during initialization. After that, this event will only
776 * arrive when a device is hotplugged during the program's run.
777 *
778 * \since This struct is available since SDL 3.2.0.
779 */
781{
782 SDL_EventType type; /**< SDL_EVENT_AUDIO_DEVICE_ADDED, or SDL_EVENT_AUDIO_DEVICE_REMOVED, or SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED */
784 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
785 SDL_AudioDeviceID which; /**< SDL_AudioDeviceID for the device being added or removed or changing */
786 bool recording; /**< false if a playback device, true if a recording device. */
791
792/**
793 * Camera device event structure (event.cdevice.*)
794 *
795 * \since This struct is available since SDL 3.2.0.
796 */
798{
799 SDL_EventType type; /**< SDL_EVENT_CAMERA_DEVICE_ADDED, SDL_EVENT_CAMERA_DEVICE_REMOVED, SDL_EVENT_CAMERA_DEVICE_APPROVED, SDL_EVENT_CAMERA_DEVICE_DENIED */
801 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
802 SDL_CameraID which; /**< SDL_CameraID for the device being added or removed or changing */
804
805/**
806 * Notification dialog event structure (event.notification.*)
807 *
808 * An `action_id` value of 'default' for an
809 * SDL_EVENT_NOTIFICATION_ACTION_INVOKED event indicates that the notification
810 * was interacted with without selecting a specific action (e.g. the body of
811 * the notification was clicked on).
812 *
813 * \since This struct is available since SDL 3.6.0.
814 */
816{
817 SDL_EventType type; /**< SDL_EVENT_NOTIFICATION_ACTION_INVOKED */
819 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
820 SDL_NotificationID which; /**< The ID of the notification that generated this event. */
821 const char *action_id; /**< The identifier string of the action invoked in the notification dialog. */
823
824/**
825 * Renderer event structure (event.render.*)
826 *
827 * \since This struct is available since SDL 3.2.0.
828 */
829typedef struct SDL_RenderEvent
830{
831 SDL_EventType type; /**< SDL_EVENT_RENDER_TARGETS_RESET, SDL_EVENT_RENDER_DEVICE_RESET, SDL_EVENT_RENDER_DEVICE_LOST */
833 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
834 SDL_WindowID windowID; /**< The window containing the renderer in question. */
836
837
838/**
839 * Touch finger event structure (event.tfinger.*)
840 *
841 * Coordinates in this event are normalized. `x` and `y` are normalized to a
842 * range between 0.0f and 1.0f, relative to the window, so (0,0) is the top
843 * left and (1,1) is the bottom right. Delta coordinates `dx` and `dy` are
844 * normalized in the ranges of -1.0f (traversed all the way from the bottom or
845 * right to all the way up or left) to 1.0f (traversed all the way from the
846 * top or left to all the way down or right).
847 *
848 * Note that while the coordinates are _normalized_, they are not _clamped_,
849 * which means in some circumstances you can get a value outside of this
850 * range. For example, a renderer using logical presentation might give a
851 * negative value when the touch is in the letterboxing. Some platforms might
852 * report a touch outside of the window, which will also be outside of the
853 * range.
854 *
855 * \since This struct is available since SDL 3.2.0.
856 */
858{
859 SDL_EventType type; /**< SDL_EVENT_FINGER_DOWN, SDL_EVENT_FINGER_UP, SDL_EVENT_FINGER_MOTION, or SDL_EVENT_FINGER_CANCELED */
861 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
862 SDL_TouchID touchID; /**< The touch device id */
864 float x; /**< Normalized in the range 0...1 */
865 float y; /**< Normalized in the range 0...1 */
866 float dx; /**< Normalized in the range -1...1 */
867 float dy; /**< Normalized in the range -1...1 */
868 float pressure; /**< Normalized in the range 0...1 */
869 SDL_WindowID windowID; /**< The window underneath the finger, if any */
871
872/**
873 * Pinch event structure (event.pinch.*)
874 *
875 * span_(x/y) and focus_(x/y) are only available for pinch gestures on mobile
876 * devices
877 */
879{
880 SDL_EventType type; /**< ::SDL_EVENT_PINCH_BEGIN or ::SDL_EVENT_PINCH_UPDATE or ::SDL_EVENT_PINCH_END */
882 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
883 float scale; /**< The scale change since the last SDL_EVENT_PINCH_UPDATE. Scale < 1 is "zoom out". Scale > 1 is "zoom in". */
884 SDL_WindowID windowID; /**< The window underneath the finger, if any */
885 float span_x; /**< On mobile devices for BEGIN and UPDATE events, the average X distance between each of the pointers forming the pinch in window coordinates. Otherwise, -1. */
886 float span_y; /**< On mobile devices for BEGIN and UPDATE events, the average Y distance between each of the pointers forming the pinch in window coordinates. Otherwise, -1. */
887 float focus_x; /**< On mobile devices for BEGIN and UPDATE events, the X coordinate of the current gesture's focal point in window coordinates. Otherwise, -1. */
888 float focus_y; /**< On mobile devices for BEGIN and UPDATE events, the Y coordinate of the current gesture's focal point in window coordinates. Otherwise, -1. */
890
891/**
892 * Pressure-sensitive pen proximity event structure (event.pproximity.*)
893 *
894 * When a pen becomes visible to the system (it is close enough to a tablet,
895 * etc), SDL will send an SDL_EVENT_PEN_PROXIMITY_IN event with the new pen's
896 * ID. This ID is valid until the pen leaves proximity again (has been removed
897 * from the tablet's area, the tablet has been unplugged, etc). If the same
898 * pen reenters proximity again, it will be given a new ID.
899 *
900 * Note that "proximity" means "close enough for the tablet to know the tool
901 * is there." The pen touching and lifting off from the tablet while not
902 * leaving the area are handled by SDL_EVENT_PEN_DOWN and SDL_EVENT_PEN_UP.
903 *
904 * Not all platforms have a window associated with the pen during proximity
905 * events. Some wait until motion/button/etc events to offer this info.
906 *
907 * \since This struct is available since SDL 3.2.0.
908 */
910{
911 SDL_EventType type; /**< SDL_EVENT_PEN_PROXIMITY_IN or SDL_EVENT_PEN_PROXIMITY_OUT */
913 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
914 SDL_WindowID windowID; /**< The window with pen focus, if any */
915 SDL_PenID which; /**< The pen instance id */
917
918/**
919 * Pressure-sensitive pen motion event structure (event.pmotion.*)
920 *
921 * Depending on the hardware, you may get motion events when the pen is not
922 * touching a tablet, for tracking a pen even when it isn't drawing. You
923 * should listen for SDL_EVENT_PEN_DOWN and SDL_EVENT_PEN_UP events, or check
924 * `pen_state & SDL_PEN_INPUT_DOWN` to decide if a pen is "drawing" when
925 * dealing with pen motion.
926 *
927 * \since This struct is available since SDL 3.2.0.
928 */
929typedef struct SDL_PenMotionEvent
930{
931 SDL_EventType type; /**< SDL_EVENT_PEN_MOTION */
933 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
934 SDL_WindowID windowID; /**< The window with pen focus, if any */
935 SDL_PenID which; /**< The pen instance id */
936 SDL_PenInputFlags pen_state; /**< Complete pen input state at time of event */
937 float x; /**< X coordinate, relative to window */
938 float y; /**< Y coordinate, relative to window */
940
941/**
942 * Pressure-sensitive pen touched event structure (event.ptouch.*)
943 *
944 * These events come when a pen touches a surface (a tablet, etc), or lifts
945 * off from one.
946 *
947 * \since This struct is available since SDL 3.2.0.
948 */
949typedef struct SDL_PenTouchEvent
950{
951 SDL_EventType type; /**< SDL_EVENT_PEN_DOWN or SDL_EVENT_PEN_UP */
953 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
954 SDL_WindowID windowID; /**< The window with pen focus, if any */
955 SDL_PenID which; /**< The pen instance id */
956 SDL_PenInputFlags pen_state; /**< Complete pen input state at time of event */
957 float x; /**< X coordinate, relative to window */
958 float y; /**< Y coordinate, relative to window */
959 bool eraser; /**< true if eraser end is used (not all pens support this). */
960 bool down; /**< true if the pen is touching or false if the pen is lifted off */
962
963/**
964 * Pressure-sensitive pen button event structure (event.pbutton.*)
965 *
966 * This is for buttons on the pen itself that the user might click. The pen
967 * itself pressing down to draw triggers a SDL_EVENT_PEN_DOWN event instead.
968 *
969 * \since This struct is available since SDL 3.2.0.
970 */
971typedef struct SDL_PenButtonEvent
972{
973 SDL_EventType type; /**< SDL_EVENT_PEN_BUTTON_DOWN or SDL_EVENT_PEN_BUTTON_UP */
975 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
976 SDL_WindowID windowID; /**< The window with mouse focus, if any */
977 SDL_PenID which; /**< The pen instance id */
978 SDL_PenInputFlags pen_state; /**< Complete pen input state at time of event */
979 float x; /**< X coordinate, relative to window */
980 float y; /**< Y coordinate, relative to window */
981 Uint8 button; /**< The pen button index (first button is 1). */
982 bool down; /**< true if the button is pressed */
984
985/**
986 * Pressure-sensitive pen pressure / angle event structure (event.paxis.*)
987 *
988 * You might get some of these events even if the pen isn't touching the
989 * tablet.
990 *
991 * \since This struct is available since SDL 3.2.0.
992 */
993typedef struct SDL_PenAxisEvent
994{
995 SDL_EventType type; /**< SDL_EVENT_PEN_AXIS */
997 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
998 SDL_WindowID windowID; /**< The window with pen focus, if any */
999 SDL_PenID which; /**< The pen instance id */
1000 SDL_PenInputFlags pen_state; /**< Complete pen input state at time of event */
1001 float x; /**< X coordinate, relative to window */
1002 float y; /**< Y coordinate, relative to window */
1003 SDL_PenAxis axis; /**< Axis that has changed */
1004 float value; /**< New value of axis */
1006
1007/**
1008 * An event used to drop text or request a file open by the system
1009 * (event.drop.*)
1010 *
1011 * \since This struct is available since SDL 3.2.0.
1012 */
1013typedef struct SDL_DropEvent
1014{
1015 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 */
1017 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
1018 SDL_WindowID windowID; /**< The window that was dropped on, if any */
1019 float x; /**< X coordinate, relative to window (not on begin) */
1020 float y; /**< Y coordinate, relative to window (not on begin) */
1021 const char *source; /**< The source app that sent this drop event, or NULL if that isn't available */
1022 const char *data; /**< The text for SDL_EVENT_DROP_TEXT and the file name for SDL_EVENT_DROP_FILE, NULL for other events */
1024
1025/**
1026 * An event triggered when the clipboard contents have changed
1027 * (event.clipboard.*)
1028 *
1029 * \since This struct is available since SDL 3.2.0.
1030 */
1032{
1033 SDL_EventType type; /**< SDL_EVENT_CLIPBOARD_UPDATE */
1035 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
1036 bool owner; /**< are we owning the clipboard (internal update) */
1037 Sint32 num_mime_types; /**< number of mime types */
1038 const char **mime_types; /**< current mime types */
1040
1041/**
1042 * Sensor event structure (event.sensor.*)
1043 *
1044 * \since This struct is available since SDL 3.2.0.
1045 */
1046typedef struct SDL_SensorEvent
1047{
1048 SDL_EventType type; /**< SDL_EVENT_SENSOR_UPDATE */
1050 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
1051 SDL_SensorID which; /**< The instance ID of the sensor */
1052 float data[6]; /**< Up to 6 values from the sensor - additional values can be queried using SDL_GetSensorData() */
1053 Uint64 sensor_timestamp; /**< The timestamp of the sensor reading in nanoseconds, not necessarily synchronized with the system clock */
1055
1056/**
1057 * The "quit requested" event
1058 *
1059 * \since This struct is available since SDL 3.2.0.
1060 */
1061typedef struct SDL_QuitEvent
1062{
1063 SDL_EventType type; /**< SDL_EVENT_QUIT */
1065 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
1067
1068/**
1069 * A user-defined event type (event.user.*)
1070 *
1071 * This event is unique; it is never created by SDL, but only by the
1072 * application. The event can be pushed onto the event queue using
1073 * SDL_PushEvent(). The contents of the structure members are completely up to
1074 * the programmer; the only requirement is that '''type''' is a value obtained
1075 * from SDL_RegisterEvents().
1076 *
1077 * \since This struct is available since SDL 3.2.0.
1078 */
1079typedef struct SDL_UserEvent
1080{
1081 Uint32 type; /**< SDL_EVENT_USER through SDL_EVENT_LAST, Uint32 because these are not in the SDL_EventType enumeration */
1083 Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
1084 SDL_WindowID windowID; /**< The associated window if any */
1085 Sint32 code; /**< User defined event code */
1086 void *data1; /**< User defined data pointer */
1087 void *data2; /**< User defined data pointer */
1089
1090
1091/**
1092 * The structure for all events in SDL.
1093 *
1094 * The SDL_Event structure is the core of all event handling in SDL. SDL_Event
1095 * is a union of all event structures used in SDL.
1096 *
1097 * \since This struct is available since SDL 3.2.0.
1098 */
1099typedef union SDL_Event
1100{
1101 Uint32 type; /**< Event type, shared with all events, Uint32 to cover user events which are not in the SDL_EventType enumeration */
1102 SDL_CommonEvent common; /**< Common event data */
1103 SDL_DisplayEvent display; /**< Display event data */
1104 SDL_WindowEvent window; /**< Window event data */
1105 SDL_KeyboardDeviceEvent kdevice; /**< Keyboard device change event data */
1106 SDL_KeyboardEvent key; /**< Keyboard event data */
1107 SDL_TextEditingEvent edit; /**< Text editing event data */
1108 SDL_TextEditingCandidatesEvent edit_candidates; /**< Text editing candidates event data */
1109 SDL_TextInputEvent text; /**< Text input event data */
1110 SDL_MouseDeviceEvent mdevice; /**< Mouse device change event data */
1111 SDL_MouseMotionEvent motion; /**< Mouse motion event data */
1112 SDL_MouseButtonEvent button; /**< Mouse button event data */
1113 SDL_MouseWheelEvent wheel; /**< Mouse wheel event data */
1114 SDL_JoyDeviceEvent jdevice; /**< Joystick device change event data */
1115 SDL_JoyAxisEvent jaxis; /**< Joystick axis event data */
1116 SDL_JoyBallEvent jball; /**< Joystick ball event data */
1117 SDL_JoyHatEvent jhat; /**< Joystick hat event data */
1118 SDL_JoyButtonEvent jbutton; /**< Joystick button event data */
1119 SDL_JoyBatteryEvent jbattery; /**< Joystick battery event data */
1120 SDL_GamepadDeviceEvent gdevice; /**< Gamepad device event data */
1121 SDL_GamepadAxisEvent gaxis; /**< Gamepad axis event data */
1122 SDL_GamepadButtonEvent gbutton; /**< Gamepad button event data */
1123 SDL_GamepadTouchpadEvent gtouchpad; /**< Gamepad touchpad event data */
1124 SDL_GamepadSensorEvent gsensor; /**< Gamepad sensor event data */
1125 SDL_GamepadCapSenseEvent gcapsense; /**< Gamepad capsense event data */
1126 SDL_AudioDeviceEvent adevice; /**< Audio device event data */
1127 SDL_CameraDeviceEvent cdevice; /**< Camera device event data */
1128 SDL_SensorEvent sensor; /**< Sensor event data */
1129 SDL_QuitEvent quit; /**< Quit request event data */
1130 SDL_UserEvent user; /**< Custom event data */
1131 SDL_TouchFingerEvent tfinger; /**< Touch finger event data */
1132 SDL_PinchFingerEvent pinch; /**< Pinch event data */
1133 SDL_PenProximityEvent pproximity; /**< Pen proximity event data */
1134 SDL_PenTouchEvent ptouch; /**< Pen tip touching event data */
1135 SDL_PenMotionEvent pmotion; /**< Pen motion event data */
1136 SDL_PenButtonEvent pbutton; /**< Pen button event data */
1137 SDL_PenAxisEvent paxis; /**< Pen axis event data */
1138 SDL_RenderEvent render; /**< Render event data */
1139 SDL_DropEvent drop; /**< Drag and drop event data */
1140 SDL_ClipboardEvent clipboard; /**< Clipboard event data */
1141 SDL_NotificationEvent notification; /**< Notification event data */
1142
1143 /* This is necessary for ABI compatibility between Visual C++ and GCC.
1144 Visual C++ will respect the push pack pragma and use 52 bytes (size of
1145 SDL_TextEditingEvent, the largest structure for 32-bit and 64-bit
1146 architectures) for this union, and GCC will use the alignment of the
1147 largest datatype within the union, which is 8 bytes on 64-bit
1148 architectures.
1149
1150 So... we'll add padding to force the size to be the same for both.
1151
1152 On architectures where pointers are 16 bytes, this needs rounding up to
1153 the next multiple of 16, 64, and on architectures where pointers are
1154 even larger the size of SDL_UserEvent will dominate as being 3 pointers.
1155 */
1157} SDL_Event;
1158
1159/* Make sure we haven't broken binary compatibility */
1161
1162
1163/* Function prototypes */
1164
1165/**
1166 * Pump the event loop, gathering events from the input devices.
1167 *
1168 * This function updates the event queue and internal input device state.
1169 *
1170 * SDL_PumpEvents() gathers all the pending input information from devices and
1171 * places it in the event queue. Without calls to SDL_PumpEvents() no events
1172 * would ever be placed on the queue. Often the need for calls to
1173 * SDL_PumpEvents() is hidden from the user since SDL_PollEvent() and
1174 * SDL_WaitEvent() implicitly call SDL_PumpEvents(). However, if you are not
1175 * polling or waiting for events (e.g. you are filtering them), then you must
1176 * call SDL_PumpEvents() to force an event queue update.
1177 *
1178 * \threadsafety This function should only be called on the main thread.
1179 *
1180 * \since This function is available since SDL 3.2.0.
1181 *
1182 * \sa SDL_PollEvent
1183 * \sa SDL_WaitEvent
1184 */
1185extern SDL_DECLSPEC void SDLCALL SDL_PumpEvents(void);
1186
1187/* @{ */
1188
1189/**
1190 * The type of action to request from SDL_PeepEvents().
1191 *
1192 * \since This enum is available since SDL 3.2.0.
1193 */
1195{
1196 SDL_ADDEVENT, /**< Add events to the back of the queue. */
1197 SDL_PEEKEVENT, /**< Check but don't remove events from the queue front. */
1198 SDL_GETEVENT /**< Retrieve/remove events from the front of the queue. */
1200
1201/**
1202 * Check the event queue for messages and optionally return them.
1203 *
1204 * `action` may be any of the following:
1205 *
1206 * - `SDL_ADDEVENT`: up to `numevents` events will be added to the back of the
1207 * event queue.
1208 * - `SDL_PEEKEVENT`: `numevents` events at the front of the event queue,
1209 * within the specified minimum and maximum type, will be returned to the
1210 * caller and will _not_ be removed from the queue. If you pass NULL for
1211 * `events`, then `numevents` is ignored and the total number of matching
1212 * events will be returned.
1213 * - `SDL_GETEVENT`: up to `numevents` events at the front of the event queue,
1214 * within the specified minimum and maximum type, will be returned to the
1215 * caller and will be removed from the queue.
1216 *
1217 * You may have to call SDL_PumpEvents() before calling this function.
1218 * Otherwise, the events may not be ready to be filtered when you call
1219 * SDL_PeepEvents().
1220 *
1221 * \param events destination buffer for the retrieved events, may be NULL to
1222 * leave the events in the queue and return the number of events
1223 * that would have been stored.
1224 * \param numevents if action is SDL_ADDEVENT, the number of events to add
1225 * back to the event queue; if action is SDL_PEEKEVENT or
1226 * SDL_GETEVENT, the maximum number of events to retrieve.
1227 * \param action action to take; see [Remarks](#remarks) for details.
1228 * \param minType minimum value of the event type to be considered;
1229 * SDL_EVENT_FIRST is a safe choice.
1230 * \param maxType maximum value of the event type to be considered;
1231 * SDL_EVENT_LAST is a safe choice.
1232 * \returns the number of events actually stored or -1 on failure; call
1233 * SDL_GetError() for more information.
1234 *
1235 * \threadsafety It is safe to call this function from any thread.
1236 *
1237 * \since This function is available since SDL 3.2.0.
1238 *
1239 * \sa SDL_PollEvent
1240 * \sa SDL_PumpEvents
1241 * \sa SDL_PushEvent
1242 */
1243extern SDL_DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents, SDL_EventAction action, Uint32 minType, Uint32 maxType);
1244/* @} */
1245
1246/**
1247 * Check for the existence of a certain event type in the event queue.
1248 *
1249 * If you need to check for a range of event types, use SDL_HasEvents()
1250 * instead.
1251 *
1252 * \param type the type of event to be queried; see SDL_EventType for details.
1253 * \returns true if events matching `type` are present, or false if events
1254 * matching `type` are not present.
1255 *
1256 * \threadsafety It is safe to call this function from any thread.
1257 *
1258 * \since This function is available since SDL 3.2.0.
1259 *
1260 * \sa SDL_HasEvents
1261 */
1262extern SDL_DECLSPEC bool SDLCALL SDL_HasEvent(Uint32 type);
1263
1264
1265/**
1266 * Check for the existence of certain event types in the event queue.
1267 *
1268 * If you need to check for a single event type, use SDL_HasEvent() instead.
1269 *
1270 * \param minType the low end of event type to be queried, inclusive; see
1271 * SDL_EventType for details.
1272 * \param maxType the high end of event type to be queried, inclusive; see
1273 * SDL_EventType for details.
1274 * \returns true if events with type >= `minType` and <= `maxType` are
1275 * present, or false if not.
1276 *
1277 * \threadsafety It is safe to call this function from any thread.
1278 *
1279 * \since This function is available since SDL 3.2.0.
1280 *
1281 * \sa SDL_HasEvents
1282 */
1283extern SDL_DECLSPEC bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType);
1284
1285/**
1286 * Clear events of a specific type from the event queue.
1287 *
1288 * This will unconditionally remove any events from the queue that match
1289 * `type`. If you need to remove a range of event types, use SDL_FlushEvents()
1290 * instead.
1291 *
1292 * It's also normal to just ignore events you don't care about in your event
1293 * loop without calling this function.
1294 *
1295 * This function only affects currently queued events. If you want to make
1296 * sure that all pending OS events are flushed, you can call SDL_PumpEvents()
1297 * on the main thread immediately before the flush call.
1298 *
1299 * If you have user events with custom data that needs to be freed, you should
1300 * use SDL_PeepEvents() to remove and clean up those events before calling
1301 * this function.
1302 *
1303 * \param type the type of event to be cleared; see SDL_EventType for details.
1304 *
1305 * \threadsafety It is safe to call this function from any thread.
1306 *
1307 * \since This function is available since SDL 3.2.0.
1308 *
1309 * \sa SDL_FlushEvents
1310 */
1311extern SDL_DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type);
1312
1313/**
1314 * Clear events of a range of types from the event queue.
1315 *
1316 * This will unconditionally remove any events from the queue that are in the
1317 * range of `minType` to `maxType`, inclusive. If you need to remove a single
1318 * event type, use SDL_FlushEvent() instead.
1319 *
1320 * It's also normal to just ignore events you don't care about in your event
1321 * loop without calling this function.
1322 *
1323 * This function only affects currently queued events. If you want to make
1324 * sure that all pending OS events are flushed, you can call SDL_PumpEvents()
1325 * on the main thread immediately before the flush call.
1326 *
1327 * \param minType the low end of event type to be cleared, inclusive; see
1328 * SDL_EventType for details.
1329 * \param maxType the high end of event type to be cleared, inclusive; see
1330 * SDL_EventType for details.
1331 *
1332 * \threadsafety It is safe to call this function from any thread.
1333 *
1334 * \since This function is available since SDL 3.2.0.
1335 *
1336 * \sa SDL_FlushEvent
1337 */
1338extern SDL_DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType);
1339
1340/**
1341 * Poll for currently pending events.
1342 *
1343 * If `event` is not NULL, the next event is removed from the queue and stored
1344 * in the SDL_Event structure pointed to by `event`.
1345 *
1346 * If `event` is NULL, it simply returns true if there is an event in the
1347 * queue, but will not remove it from the queue.
1348 *
1349 * As this function may implicitly call SDL_PumpEvents(), you can only call
1350 * this function in the thread that initialized the video subsystem.
1351 *
1352 * SDL_PollEvent() is the favored way of receiving system events since it can
1353 * be done from the main loop and does not suspend the main loop while waiting
1354 * on an event to be posted.
1355 *
1356 * The common practice is to fully process the event queue once every frame,
1357 * usually as a first step before updating the game's state:
1358 *
1359 * ```c
1360 * while (game_is_still_running) {
1361 * SDL_Event event;
1362 * while (SDL_PollEvent(&event)) { // poll until all events are handled!
1363 * // decide what to do with this event.
1364 * }
1365 *
1366 * // update game state, draw the current frame
1367 * }
1368 * ```
1369 *
1370 * Note that Windows (and possibly other platforms) has a quirk about how it
1371 * handles events while dragging/resizing a window, which can cause this
1372 * function to block for significant amounts of time. Technical explanations
1373 * and solutions are discussed on the wiki:
1374 *
1375 * https://wiki.libsdl.org/SDL3/AppFreezeDuringDrag
1376 *
1377 * \param event the SDL_Event structure to be filled with the next event from
1378 * the queue, or NULL.
1379 * \returns true if this got an event or false if there are none available.
1380 *
1381 * \threadsafety This function should only be called on the main thread.
1382 *
1383 * \since This function is available since SDL 3.2.0.
1384 *
1385 * \sa SDL_PushEvent
1386 * \sa SDL_WaitEvent
1387 * \sa SDL_WaitEventTimeout
1388 */
1389extern SDL_DECLSPEC bool SDLCALL SDL_PollEvent(SDL_Event *event);
1390
1391/**
1392 * Wait indefinitely for the next available event.
1393 *
1394 * If `event` is not NULL, the next event is removed from the queue and stored
1395 * in the SDL_Event structure pointed to by `event`.
1396 *
1397 * As this function may implicitly call SDL_PumpEvents(), you can only call
1398 * this function in the thread that initialized the video subsystem.
1399 *
1400 * \param event the SDL_Event structure to be filled in with the next event
1401 * from the queue, or NULL.
1402 * \returns true on success or false if there was an error while waiting for
1403 * events; call SDL_GetError() for more information.
1404 *
1405 * \threadsafety This function should only be called on the main thread.
1406 *
1407 * \since This function is available since SDL 3.2.0.
1408 *
1409 * \sa SDL_PollEvent
1410 * \sa SDL_PushEvent
1411 * \sa SDL_WaitEventTimeout
1412 */
1413extern SDL_DECLSPEC bool SDLCALL SDL_WaitEvent(SDL_Event *event);
1414
1415/**
1416 * Wait until the specified timeout (in milliseconds) for the next available
1417 * event.
1418 *
1419 * If `event` is not NULL, the next event is removed from the queue and stored
1420 * in the SDL_Event structure pointed to by `event`.
1421 *
1422 * As this function may implicitly call SDL_PumpEvents(), you can only call
1423 * this function in the thread that initialized the video subsystem.
1424 *
1425 * The timeout is not guaranteed, the actual wait time could be longer due to
1426 * system scheduling.
1427 *
1428 * \param event the SDL_Event structure to be filled in with the next event
1429 * from the queue, or NULL.
1430 * \param timeoutMS the maximum number of milliseconds to wait for the next
1431 * available event, or -1 to wait indefinitely.
1432 * \returns true if this got an event or false if the timeout elapsed without
1433 * any events available.
1434 *
1435 * \threadsafety This function should only be called on the main thread.
1436 *
1437 * \since This function is available since SDL 3.2.0.
1438 *
1439 * \sa SDL_PollEvent
1440 * \sa SDL_PushEvent
1441 * \sa SDL_WaitEvent
1442 */
1443extern SDL_DECLSPEC bool SDLCALL SDL_WaitEventTimeout(SDL_Event *event, Sint32 timeoutMS);
1444
1445/**
1446 * Add an event to the event queue.
1447 *
1448 * The event queue can actually be used as a two way communication channel.
1449 * Not only can events be read from the queue, but the user can also push
1450 * their own events onto it. `event` is a pointer to the event structure you
1451 * wish to push onto the queue. The event is copied into the queue, and the
1452 * caller may dispose of the memory pointed to after SDL_PushEvent() returns.
1453 *
1454 * Note: Pushing device input events onto the queue doesn't modify the state
1455 * of the device within SDL.
1456 *
1457 * Note: Events pushed onto the queue with SDL_PushEvent() get passed through
1458 * the event filter but events added with SDL_PeepEvents() do not.
1459 *
1460 * For pushing application-specific events, please use SDL_RegisterEvents() to
1461 * get an event type that does not conflict with other code that also wants
1462 * its own custom event types.
1463 *
1464 * \param event the SDL_Event to be added to the queue.
1465 * \returns true on success, false if the event was filtered or on failure;
1466 * call SDL_GetError() for more information. A common reason for
1467 * error is the event queue being full.
1468 *
1469 * \threadsafety It is safe to call this function from any thread.
1470 *
1471 * \since This function is available since SDL 3.2.0.
1472 *
1473 * \sa SDL_PeepEvents
1474 * \sa SDL_PollEvent
1475 * \sa SDL_RegisterEvents
1476 */
1477extern SDL_DECLSPEC bool SDLCALL SDL_PushEvent(SDL_Event *event);
1478
1479/**
1480 * A function pointer used for callbacks that watch the event queue.
1481 *
1482 * \param userdata what was passed as `userdata` to SDL_SetEventFilter() or
1483 * SDL_AddEventWatch, etc.
1484 * \param event the event that triggered the callback.
1485 * \returns true to permit event to be added to the queue, and false to
1486 * disallow it. When used with SDL_AddEventWatch, the return value is
1487 * ignored.
1488 *
1489 * \threadsafety SDL may call this callback at any time from any thread; the
1490 * application is responsible for locking resources the callback
1491 * touches that need to be protected.
1492 *
1493 * \since This datatype is available since SDL 3.2.0.
1494 *
1495 * \sa SDL_SetEventFilter
1496 * \sa SDL_AddEventWatch
1497 */
1498typedef bool (SDLCALL *SDL_EventFilter)(void *userdata, SDL_Event *event);
1499
1500/**
1501 * Set up a filter to process all events before they are added to the internal
1502 * event queue.
1503 *
1504 * If you just want to see events without modifying them or preventing them
1505 * from being queued, you should use SDL_AddEventWatch() instead.
1506 *
1507 * If the filter function returns true when called, then the event will be
1508 * added to the internal queue. If it returns false, then the event will be
1509 * dropped from the queue, but the internal state will still be updated. This
1510 * allows selective filtering of dynamically arriving events.
1511 *
1512 * **WARNING**: Be very careful of what you do in the event filter function,
1513 * as it may run in a different thread! The exception is handling of
1514 * SDL_EVENT_WINDOW_EXPOSED, which is guaranteed to be sent from the OS on the
1515 * main thread and you are expected to redraw your window in response to this
1516 * event.
1517 *
1518 * On platforms that support it, if the quit event is generated by an
1519 * interrupt signal (e.g. pressing Ctrl-C), it will be delivered to the
1520 * application at the next event poll.
1521 *
1522 * Note: Disabled events never make it to the event filter function; see
1523 * SDL_SetEventEnabled().
1524 *
1525 * Note: Events pushed onto the queue with SDL_PushEvent() get passed through
1526 * the event filter, but events pushed onto the queue with SDL_PeepEvents() do
1527 * not.
1528 *
1529 * \param filter a function to call when an event happens.
1530 * \param userdata a pointer that is passed to `filter`.
1531 *
1532 * \threadsafety It is safe to call this function from any thread.
1533 *
1534 * \since This function is available since SDL 3.2.0.
1535 *
1536 * \sa SDL_AddEventWatch
1537 * \sa SDL_SetEventEnabled
1538 * \sa SDL_GetEventFilter
1539 * \sa SDL_PeepEvents
1540 * \sa SDL_PushEvent
1541 */
1542extern SDL_DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter, void *userdata);
1543
1544/**
1545 * Query the current event filter.
1546 *
1547 * This function can be used to "chain" filters, by saving the existing filter
1548 * before replacing it with a function that will call that saved filter.
1549 *
1550 * \param filter the current callback function will be stored here.
1551 * \param userdata the pointer that is passed to the current event filter will
1552 * be stored here.
1553 * \returns true on success or false if there is no event filter set.
1554 *
1555 * \threadsafety It is safe to call this function from any thread.
1556 *
1557 * \since This function is available since SDL 3.2.0.
1558 *
1559 * \sa SDL_SetEventFilter
1560 */
1561extern SDL_DECLSPEC bool SDLCALL SDL_GetEventFilter(SDL_EventFilter *filter, void **userdata);
1562
1563/**
1564 * Add a callback to be triggered when an event is added to the event queue.
1565 *
1566 * `filter` will be called when an event happens, and its return value is
1567 * ignored.
1568 *
1569 * **WARNING**: Be very careful of what you do in the event filter function,
1570 * as it may run in a different thread!
1571 *
1572 * If the quit event is generated by a signal (e.g. SIGINT), it will bypass
1573 * the internal queue and be delivered to the watch callback immediately, and
1574 * arrive at the next event poll.
1575 *
1576 * Note: the callback is called for events posted by the user through
1577 * SDL_PushEvent(), but not for disabled events, nor for events by a filter
1578 * callback set with SDL_SetEventFilter(), nor for events posted by the user
1579 * through SDL_PeepEvents().
1580 *
1581 * \param filter an SDL_EventFilter function to call when an event happens.
1582 * \param userdata a pointer that is passed to `filter`.
1583 * \returns true on success or false on failure; call SDL_GetError() for more
1584 * information.
1585 *
1586 * \threadsafety It is safe to call this function from any thread.
1587 *
1588 * \since This function is available since SDL 3.2.0.
1589 *
1590 * \sa SDL_RemoveEventWatch
1591 * \sa SDL_SetEventFilter
1592 */
1593extern SDL_DECLSPEC bool SDLCALL SDL_AddEventWatch(SDL_EventFilter filter, void *userdata);
1594
1595/**
1596 * Remove an event watch callback added with SDL_AddEventWatch().
1597 *
1598 * This function takes the same input as SDL_AddEventWatch() to identify and
1599 * delete the corresponding callback.
1600 *
1601 * \param filter the function originally passed to SDL_AddEventWatch().
1602 * \param userdata the pointer originally passed to SDL_AddEventWatch().
1603 *
1604 * \threadsafety It is safe to call this function from any thread.
1605 *
1606 * \since This function is available since SDL 3.2.0.
1607 *
1608 * \sa SDL_AddEventWatch
1609 */
1610extern SDL_DECLSPEC void SDLCALL SDL_RemoveEventWatch(SDL_EventFilter filter, void *userdata);
1611
1612/**
1613 * Run a specific filter function on the current event queue, removing any
1614 * events for which the filter returns false.
1615 *
1616 * See SDL_SetEventFilter() for more information. Unlike SDL_SetEventFilter(),
1617 * this function does not change the filter permanently, it only uses the
1618 * supplied filter until this function returns.
1619 *
1620 * \param filter the SDL_EventFilter function to call when an event happens.
1621 * \param userdata a pointer that is passed to `filter`.
1622 *
1623 * \threadsafety It is safe to call this function from any thread.
1624 *
1625 * \since This function is available since SDL 3.2.0.
1626 *
1627 * \sa SDL_GetEventFilter
1628 * \sa SDL_SetEventFilter
1629 */
1630extern SDL_DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter, void *userdata);
1631
1632/**
1633 * Set the state of processing events by type.
1634 *
1635 * \param type the type of event; see SDL_EventType for details.
1636 * \param enabled whether to process the event or not.
1637 *
1638 * \threadsafety It is safe to call this function from any thread.
1639 *
1640 * \since This function is available since SDL 3.2.0.
1641 *
1642 * \sa SDL_EventEnabled
1643 */
1644extern SDL_DECLSPEC void SDLCALL SDL_SetEventEnabled(Uint32 type, bool enabled);
1645
1646/**
1647 * Query the state of processing events by type.
1648 *
1649 * \param type the type of event; see SDL_EventType for details.
1650 * \returns true if the event is being processed, false otherwise.
1651 *
1652 * \threadsafety It is safe to call this function from any thread.
1653 *
1654 * \since This function is available since SDL 3.2.0.
1655 *
1656 * \sa SDL_SetEventEnabled
1657 */
1658extern SDL_DECLSPEC bool SDLCALL SDL_EventEnabled(Uint32 type);
1659
1660/**
1661 * Allocate a set of user-defined events, and return the beginning event
1662 * number for that set of events.
1663 *
1664 * \param numevents the number of events to be allocated.
1665 * \returns the beginning event number, or 0 if numevents is invalid or if
1666 * there are not enough user-defined events left.
1667 *
1668 * \threadsafety It is safe to call this function from any thread.
1669 *
1670 * \since This function is available since SDL 3.2.0.
1671 *
1672 * \sa SDL_PushEvent
1673 */
1674extern SDL_DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents);
1675
1676/**
1677 * Get window associated with an event.
1678 *
1679 * \param event an event containing a `windowID`.
1680 * \returns the associated window on success or NULL if there is none.
1681 *
1682 * \threadsafety It is safe to call this function from any thread.
1683 *
1684 * \since This function is available since SDL 3.2.0.
1685 *
1686 * \sa SDL_PollEvent
1687 * \sa SDL_WaitEvent
1688 * \sa SDL_WaitEventTimeout
1689 */
1690extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetWindowFromEvent(const SDL_Event *event);
1691
1692/**
1693 * Generate an English description of an event.
1694 *
1695 * This will fill `buf` with a null-terminated string that might look
1696 * something like this:
1697 *
1698 * ```
1699 * SDL_EVENT_MOUSE_MOTION (timestamp=1140256324 windowid=2 which=0 state=0 x=492.99 y=139.09 xrel=52 yrel=6)
1700 * ```
1701 *
1702 * The exact format of the string is not guaranteed; it is intended for
1703 * logging purposes, to be read by a human, and not parsed by a computer.
1704 *
1705 * The returned value follows the same rules as SDL_snprintf(): `buf` will
1706 * always be NULL-terminated (unless `buflen` is zero), and will be truncated
1707 * if `buflen` is too small. The return code is the number of bytes needed for
1708 * the complete string, not counting the NULL-terminator, whether the string
1709 * was truncated or not. Unlike SDL_snprintf(), though, this function never
1710 * returns -1.
1711 *
1712 * \param event an event to describe. May be NULL.
1713 * \param buf the buffer to fill with the description string. May be NULL.
1714 * \param buflen the maximum bytes that can be written to `buf`.
1715 * \returns number of bytes needed for the full string, not counting the
1716 * null-terminator byte.
1717 *
1718 * \threadsafety It is safe to call this function from any thread.
1719 *
1720 * \since This function is available since SDL 3.4.0.
1721 */
1722extern SDL_DECLSPEC int SDLCALL SDL_GetEventDescription(const SDL_Event *event, char *buf, int buflen);
1723
1724/* Ends C function definitions when using C++ */
1725#ifdef __cplusplus
1726}
1727#endif
1728#include <SDL3/SDL_close_code.h>
1729
1730#endif /* SDL_events_h_ */
Uint32 SDL_AudioDeviceID
Definition SDL_audio.h:374
#define NULL
Uint32 SDL_CameraID
Definition SDL_camera.h:95
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:86
@ SDL_EVENT_KEYMAP_CHANGED
Definition SDL_events.h:176
@ SDL_EVENT_SCREEN_KEYBOARD_HIDDEN
Definition SDL_events.h:182
@ SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED
Definition SDL_events.h:130
@ SDL_EVENT_PRIVATE0
Definition SDL_events.h:303
@ SDL_EVENT_PEN_PROXIMITY_OUT
Definition SDL_events.h:272
@ SDL_EVENT_WINDOW_HIT_TEST
Definition SDL_events.h:154
@ SDL_EVENT_GAMEPAD_ADDED
Definition SDL_events.h:213
@ SDL_EVENT_GAMEPAD_TOUCHPAD_UP
Definition SDL_events.h:218
@ SDL_EVENT_WINDOW_RESTORED
Definition SDL_events.h:148
@ SDL_EVENT_GAMEPAD_AXIS_MOTION
Definition SDL_events.h:210
@ SDL_EVENT_WINDOW_LAST
Definition SDL_events.h:169
@ SDL_EVENT_DROP_BEGIN
Definition SDL_events.h:252
@ SDL_EVENT_MOUSE_MOTION
Definition SDL_events.h:187
@ SDL_EVENT_WINDOW_FOCUS_GAINED
Definition SDL_events.h:151
@ SDL_EVENT_WINDOW_SAFE_AREA_CHANGED
Definition SDL_events.h:158
@ SDL_EVENT_FINGER_FIRST
Definition SDL_events.h:232
@ SDL_EVENT_MOUSE_WHEEL
Definition SDL_events.h:190
@ SDL_EVENT_JOYSTICK_REMOVED
Definition SDL_events.h:203
@ SDL_EVENT_NOTIFICATION_ACTION_INVOKED
Definition SDL_events.h:291
@ SDL_EVENT_WINDOW_ENTER_FULLSCREEN
Definition SDL_events.h:160
@ SDL_EVENT_PEN_DOWN
Definition SDL_events.h:273
@ SDL_EVENT_CLIPBOARD_UPDATE
Definition SDL_events.h:245
@ SDL_EVENT_DID_ENTER_FOREGROUND
Definition SDL_events.h:113
@ SDL_EVENT_JOYSTICK_BUTTON_UP
Definition SDL_events.h:201
@ SDL_EVENT_JOYSTICK_BATTERY_UPDATED
Definition SDL_events.h:204
@ SDL_EVENT_WILL_ENTER_FOREGROUND
Definition SDL_events.h:109
@ SDL_EVENT_PEN_MOTION
Definition SDL_events.h:277
@ SDL_EVENT_POLL_SENTINEL
Definition SDL_events.h:309
@ SDL_EVENT_CAMERA_DEVICE_REMOVED
Definition SDL_events.h:284
@ SDL_EVENT_JOYSTICK_UPDATE_COMPLETE
Definition SDL_events.h:205
@ SDL_EVENT_FINGER_UP
Definition SDL_events.h:229
@ SDL_EVENT_DISPLAY_REMOVED
Definition SDL_events.h:126
@ SDL_EVENT_JOYSTICK_ADDED
Definition SDL_events.h:202
@ SDL_EVENT_DROP_FIRST
Definition SDL_events.h:255
@ SDL_EVENT_JOYSTICK_LAST
Definition SDL_events.h:207
@ SDL_EVENT_GAMEPAD_LAST
Definition SDL_events.h:225
@ SDL_EVENT_MOUSE_ADDED
Definition SDL_events.h:191
@ SDL_EVENT_NOTIFICATION_LAST
Definition SDL_events.h:293
@ SDL_EVENT_PINCH_LAST
Definition SDL_events.h:240
@ SDL_EVENT_JOYSTICK_FIRST
Definition SDL_events.h:206
@ SDL_EVENT_DROP_POSITION
Definition SDL_events.h:254
@ SDL_EVENT_RENDER_FIRST
Definition SDL_events.h:299
@ SDL_EVENT_WINDOW_EXPOSED
Definition SDL_events.h:140
@ SDL_EVENT_RENDER_LAST
Definition SDL_events.h:300
@ SDL_EVENT_WINDOW_DISPLAY_CHANGED
Definition SDL_events.h:156
@ SDL_EVENT_WINDOW_RESIZED
Definition SDL_events.h:143
@ SDL_EVENT_ENUM_PADDING
Definition SDL_events.h:322
@ SDL_EVENT_AUDIO_DEVICE_LAST
Definition SDL_events.h:263
@ SDL_EVENT_DROP_LAST
Definition SDL_events.h:256
@ SDL_EVENT_PINCH_END
Definition SDL_events.h:238
@ SDL_EVENT_GAMEPAD_REMAPPED
Definition SDL_events.h:215
@ SDL_EVENT_PEN_LAST
Definition SDL_events.h:280
@ SDL_EVENT_GAMEPAD_REMOVED
Definition SDL_events.h:214
@ SDL_EVENT_WINDOW_HDR_STATE_CHANGED
Definition SDL_events.h:166
@ SDL_EVENT_PINCH_FIRST
Definition SDL_events.h:239
@ SDL_EVENT_FINGER_MOTION
Definition SDL_events.h:230
@ SDL_EVENT_WINDOW_MOUSE_ENTER
Definition SDL_events.h:149
@ SDL_EVENT_WINDOW_HIDDEN
Definition SDL_events.h:139
@ SDL_EVENT_WINDOW_SETTINGS_CHANGED
Definition SDL_events.h:167
@ SDL_EVENT_NOTIFICATION_FIRST
Definition SDL_events.h:292
@ SDL_EVENT_MOUSE_FIRST
Definition SDL_events.h:193
@ SDL_EVENT_RENDER_TARGETS_RESET
Definition SDL_events.h:296
@ SDL_EVENT_MOUSE_REMOVED
Definition SDL_events.h:192
@ SDL_EVENT_DISPLAY_USABLE_BOUNDS_CHANGED
Definition SDL_events.h:131
@ SDL_EVENT_SCREEN_KEYBOARD_SHOWN
Definition SDL_events.h:181
@ SDL_EVENT_DID_ENTER_BACKGROUND
Definition SDL_events.h:105
@ SDL_EVENT_CAMERA_DEVICE_APPROVED
Definition SDL_events.h:285
@ SDL_EVENT_GAMEPAD_CAPSENSE_RELEASE
Definition SDL_events.h:223
@ SDL_EVENT_AUDIO_DEVICE_ADDED
Definition SDL_events.h:259
@ SDL_EVENT_RENDER_DEVICE_RESET
Definition SDL_events.h:297
@ SDL_EVENT_LOW_MEMORY
Definition SDL_events.h:97
@ SDL_EVENT_GAMEPAD_UPDATE_COMPLETE
Definition SDL_events.h:220
@ SDL_EVENT_WINDOW_DESTROYED
Definition SDL_events.h:162
@ SDL_EVENT_PEN_UP
Definition SDL_events.h:274
@ SDL_EVENT_GAMEPAD_BUTTON_DOWN
Definition SDL_events.h:211
@ SDL_EVENT_DISPLAY_ADDED
Definition SDL_events.h:125
@ SDL_EVENT_JOYSTICK_AXIS_MOTION
Definition SDL_events.h:197
@ SDL_EVENT_KEY_UP
Definition SDL_events.h:173
@ SDL_EVENT_WINDOW_CLOSE_REQUESTED
Definition SDL_events.h:153
@ SDL_EVENT_TEXT_INPUT
Definition SDL_events.h:175
@ SDL_EVENT_LOCALE_CHANGED
Definition SDL_events.h:118
@ SDL_EVENT_WINDOW_OCCLUDED
Definition SDL_events.h:159
@ SDL_EVENT_GAMEPAD_CAPSENSE_TOUCH
Definition SDL_events.h:222
@ SDL_EVENT_DISPLAY_LAST
Definition SDL_events.h:133
@ SDL_EVENT_WILL_ENTER_BACKGROUND
Definition SDL_events.h:101
@ SDL_EVENT_MOUSE_BUTTON_DOWN
Definition SDL_events.h:188
@ SDL_EVENT_USER
Definition SDL_events.h:314
@ SDL_EVENT_WINDOW_FIRST
Definition SDL_events.h:168
@ SDL_EVENT_SENSOR_UPDATE
Definition SDL_events.h:266
@ SDL_EVENT_PEN_BUTTON_DOWN
Definition SDL_events.h:275
@ SDL_EVENT_SENSOR_FIRST
Definition SDL_events.h:267
@ SDL_EVENT_FIRST
Definition SDL_events.h:87
@ SDL_EVENT_SENSOR_LAST
Definition SDL_events.h:268
@ SDL_EVENT_PEN_PROXIMITY_IN
Definition SDL_events.h:271
@ SDL_EVENT_FINGER_CANCELED
Definition SDL_events.h:231
@ SDL_EVENT_DISPLAY_MOVED
Definition SDL_events.h:127
@ SDL_EVENT_JOYSTICK_BUTTON_DOWN
Definition SDL_events.h:200
@ SDL_EVENT_PEN_BUTTON_UP
Definition SDL_events.h:276
@ SDL_EVENT_MOUSE_BUTTON_UP
Definition SDL_events.h:189
@ SDL_EVENT_PRIVATE1
Definition SDL_events.h:304
@ SDL_EVENT_DROP_TEXT
Definition SDL_events.h:251
@ SDL_EVENT_DROP_FILE
Definition SDL_events.h:250
@ SDL_EVENT_KEYBOARD_REMOVED
Definition SDL_events.h:179
@ SDL_EVENT_WINDOW_FOCUS_LOST
Definition SDL_events.h:152
@ SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED
Definition SDL_events.h:221
@ SDL_EVENT_GAMEPAD_BUTTON_UP
Definition SDL_events.h:212
@ SDL_EVENT_DISPLAY_CURRENT_MODE_CHANGED
Definition SDL_events.h:129
@ SDL_EVENT_WINDOW_MAXIMIZED
Definition SDL_events.h:147
@ SDL_EVENT_PINCH_UPDATE
Definition SDL_events.h:237
@ SDL_EVENT_PINCH_BEGIN
Definition SDL_events.h:236
@ SDL_EVENT_PEN_AXIS
Definition SDL_events.h:278
@ SDL_EVENT_CAMERA_DEVICE_LAST
Definition SDL_events.h:288
@ SDL_EVENT_TERMINATING
Definition SDL_events.h:93
@ SDL_EVENT_RENDER_DEVICE_LOST
Definition SDL_events.h:298
@ SDL_EVENT_WINDOW_ICCPROF_CHANGED
Definition SDL_events.h:155
@ SDL_EVENT_SYSTEM_THEME_CHANGED
Definition SDL_events.h:120
@ SDL_EVENT_WINDOW_LEAVE_FULLSCREEN
Definition SDL_events.h:161
@ SDL_EVENT_CAMERA_DEVICE_ADDED
Definition SDL_events.h:283
@ SDL_EVENT_KEYBOARD_ADDED
Definition SDL_events.h:178
@ SDL_EVENT_GAMEPAD_SENSOR_UPDATE
Definition SDL_events.h:219
@ SDL_EVENT_CAMERA_DEVICE_FIRST
Definition SDL_events.h:287
@ SDL_EVENT_MOUSE_LAST
Definition SDL_events.h:194
@ SDL_EVENT_CLIPBOARD_FIRST
Definition SDL_events.h:246
@ SDL_EVENT_JOYSTICK_HAT_MOTION
Definition SDL_events.h:199
@ SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED
Definition SDL_events.h:261
@ SDL_EVENT_JOYSTICK_BALL_MOTION
Definition SDL_events.h:198
@ SDL_EVENT_PRIVATE3
Definition SDL_events.h:306
@ SDL_EVENT_WINDOW_SHOWN
Definition SDL_events.h:138
@ SDL_EVENT_KEY_DOWN
Definition SDL_events.h:172
@ SDL_EVENT_CAMERA_DEVICE_DENIED
Definition SDL_events.h:286
@ SDL_EVENT_KEYBOARD_FIRST
Definition SDL_events.h:183
@ SDL_EVENT_TEXT_EDITING_CANDIDATES
Definition SDL_events.h:180
@ SDL_EVENT_CLIPBOARD_LAST
Definition SDL_events.h:247
@ SDL_EVENT_WINDOW_MOVED
Definition SDL_events.h:142
@ SDL_EVENT_DISPLAY_FIRST
Definition SDL_events.h:132
@ SDL_EVENT_KEYBOARD_LAST
Definition SDL_events.h:184
@ SDL_EVENT_AUDIO_DEVICE_FIRST
Definition SDL_events.h:262
@ SDL_EVENT_FINGER_LAST
Definition SDL_events.h:233
@ SDL_EVENT_WINDOW_MINIMIZED
Definition SDL_events.h:146
@ SDL_EVENT_WINDOW_METAL_VIEW_RESIZED
Definition SDL_events.h:145
@ SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED
Definition SDL_events.h:144
@ SDL_EVENT_DISPLAY_ORIENTATION
Definition SDL_events.h:124
@ SDL_EVENT_WINDOW_DISPLAY_SCALE_CHANGED
Definition SDL_events.h:157
@ SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION
Definition SDL_events.h:217
@ SDL_EVENT_LAST
Definition SDL_events.h:319
@ SDL_EVENT_GAMEPAD_FIRST
Definition SDL_events.h:224
@ SDL_EVENT_PEN_FIRST
Definition SDL_events.h:279
@ SDL_EVENT_AUDIO_DEVICE_REMOVED
Definition SDL_events.h:260
@ SDL_EVENT_DROP_COMPLETE
Definition SDL_events.h:253
@ SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN
Definition SDL_events.h:216
@ SDL_EVENT_TEXT_EDITING
Definition SDL_events.h:174
@ SDL_EVENT_DISPLAY_DESKTOP_MODE_CHANGED
Definition SDL_events.h:128
@ SDL_EVENT_WINDOW_MOUSE_LEAVE
Definition SDL_events.h:150
@ SDL_EVENT_QUIT
Definition SDL_events.h:90
@ SDL_EVENT_PRIVATE2
Definition SDL_events.h:305
@ SDL_EVENT_FINGER_DOWN
Definition SDL_events.h:228
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)
int SDL_GetEventDescription(const SDL_Event *event, char *buf, int buflen)
void SDL_FlushEvents(Uint32 minType, Uint32 maxType)
SDL_EventAction
@ 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:59
Uint32 SDL_MouseID
Definition SDL_mouse.h:81
Uint32 SDL_MouseButtonFlags
Definition SDL_mouse.h:173
SDL_MouseWheelDirection
Definition SDL_mouse.h:142
Uint32 SDL_NotificationID
Uint32 SDL_PenID
Definition SDL_pen.h:93
SDL_PenAxis
Definition SDL_pen.h:141
Uint32 SDL_PenInputFlags
Definition SDL_pen.h:114
SDL_PowerState
Definition SDL_power.h:57
SDL_Scancode
Uint32 SDL_SensorID
Definition SDL_sensor.h:64
uint8_t Uint8
Definition SDL_stdinc.h:459
uint16_t Uint16
Definition SDL_stdinc.h:477
#define SDL_static_cast(type, expression)
Definition SDL_stdinc.h:358
int32_t Sint32
Definition SDL_stdinc.h:486
int16_t Sint16
Definition SDL_stdinc.h:468
#define SDL_COMPILE_TIME_ASSERT(name, x)
Definition SDL_stdinc.h:238
#define bool
Definition SDL_stdinc.h:101
uint64_t Uint64
Definition SDL_stdinc.h:517
uint32_t Uint32
Definition SDL_stdinc.h:495
Uint64 SDL_TouchID
Definition SDL_touch.h:62
Uint64 SDL_FingerID
Definition SDL_touch.h:76
Uint32 SDL_DisplayID
Definition SDL_video.h:75
struct SDL_Window SDL_Window
Definition SDL_video.h:210
Uint32 SDL_WindowID
Definition SDL_video.h:84
SDL_AudioDeviceID which
Definition SDL_events.h:785
SDL_EventType type
Definition SDL_events.h:782
SDL_EventType type
Definition SDL_events.h:799
const char ** mime_types
SDL_EventType type
SDL_DisplayID displayID
Definition SDL_events.h:354
SDL_EventType type
Definition SDL_events.h:351
SDL_EventType type
SDL_WindowID windowID
const char * data
const char * source
SDL_JoystickID which
Definition SDL_events.h:670
SDL_EventType type
Definition SDL_events.h:667
SDL_JoystickID which
Definition SDL_events.h:690
SDL_JoystickID which
Definition SDL_events.h:717
SDL_JoystickID which
Definition SDL_events.h:748
SDL_EventType type
Definition SDL_events.h:556
SDL_JoystickID which
Definition SDL_events.h:559
SDL_EventType type
Definition SDL_events.h:575
SDL_JoystickID which
Definition SDL_events.h:578
SDL_JoystickID which
Definition SDL_events.h:655
SDL_PowerState state
Definition SDL_events.h:656
SDL_EventType type
Definition SDL_events.h:652
SDL_JoystickID which
Definition SDL_events.h:620
SDL_EventType type
Definition SDL_events.h:617
SDL_EventType type
Definition SDL_events.h:639
SDL_JoystickID which
Definition SDL_events.h:642
SDL_JoystickID which
Definition SDL_events.h:597
SDL_EventType type
Definition SDL_events.h:594
SDL_KeyboardID which
Definition SDL_events.h:384
SDL_EventType type
Definition SDL_events.h:403
SDL_Keycode key
Definition SDL_events.h:409
SDL_KeyboardID which
Definition SDL_events.h:407
SDL_WindowID windowID
Definition SDL_events.h:406
SDL_Scancode scancode
Definition SDL_events.h:408
SDL_WindowID windowID
Definition SDL_events.h:518
SDL_EventType type
Definition SDL_events.h:515
SDL_EventType type
Definition SDL_events.h:483
SDL_WindowID windowID
Definition SDL_events.h:499
SDL_EventType type
Definition SDL_events.h:496
SDL_MouseButtonFlags state
Definition SDL_events.h:501
SDL_MouseWheelDirection direction
Definition SDL_events.h:542
SDL_EventType type
Definition SDL_events.h:535
SDL_MouseID which
Definition SDL_events.h:539
SDL_WindowID windowID
Definition SDL_events.h:538
SDL_EventType type
Definition SDL_events.h:817
SDL_NotificationID which
Definition SDL_events.h:820
const char * action_id
Definition SDL_events.h:821
SDL_PenAxis axis
SDL_PenID which
Definition SDL_events.h:999
SDL_WindowID windowID
Definition SDL_events.h:998
SDL_PenInputFlags pen_state
SDL_EventType type
Definition SDL_events.h:995
SDL_WindowID windowID
Definition SDL_events.h:976
SDL_EventType type
Definition SDL_events.h:973
SDL_PenInputFlags pen_state
Definition SDL_events.h:978
SDL_WindowID windowID
Definition SDL_events.h:934
SDL_EventType type
Definition SDL_events.h:931
SDL_PenInputFlags pen_state
Definition SDL_events.h:936
SDL_EventType type
Definition SDL_events.h:911
SDL_WindowID windowID
Definition SDL_events.h:914
SDL_EventType type
Definition SDL_events.h:951
SDL_WindowID windowID
Definition SDL_events.h:954
SDL_PenInputFlags pen_state
Definition SDL_events.h:956
SDL_EventType type
Definition SDL_events.h:880
SDL_WindowID windowID
Definition SDL_events.h:884
SDL_EventType type
SDL_EventType type
Definition SDL_events.h:831
SDL_WindowID windowID
Definition SDL_events.h:834
Uint64 sensor_timestamp
SDL_EventType type
SDL_SensorID which
const char *const * candidates
Definition SDL_events.h:447
SDL_EventType type
Definition SDL_events.h:427
const char * text
Definition SDL_events.h:431
SDL_WindowID windowID
Definition SDL_events.h:430
const char * text
Definition SDL_events.h:473
SDL_WindowID windowID
Definition SDL_events.h:472
SDL_EventType type
Definition SDL_events.h:469
SDL_FingerID fingerID
Definition SDL_events.h:863
SDL_TouchID touchID
Definition SDL_events.h:862
SDL_EventType type
Definition SDL_events.h:859
SDL_WindowID windowID
Definition SDL_events.h:869
SDL_WindowID windowID
SDL_EventType type
Definition SDL_events.h:366
SDL_WindowID windowID
Definition SDL_events.h:369
SDL_QuitEvent quit
SDL_AudioDeviceEvent adevice
SDL_PenProximityEvent pproximity
Uint8 padding[128]
SDL_JoyDeviceEvent jdevice
Uint32 type
SDL_MouseWheelEvent wheel
SDL_PenTouchEvent ptouch
SDL_PenMotionEvent pmotion
SDL_JoyHatEvent jhat
SDL_ClipboardEvent clipboard
SDL_RenderEvent render
SDL_JoyButtonEvent jbutton
SDL_GamepadDeviceEvent gdevice
SDL_GamepadCapSenseEvent gcapsense
SDL_GamepadAxisEvent gaxis
SDL_PenAxisEvent paxis
SDL_WindowEvent window
SDL_CameraDeviceEvent cdevice
SDL_PinchFingerEvent pinch
SDL_GamepadTouchpadEvent gtouchpad
SDL_KeyboardDeviceEvent kdevice
SDL_TextEditingEvent edit
SDL_TextInputEvent text
SDL_PenButtonEvent pbutton
SDL_GamepadSensorEvent gsensor
SDL_TouchFingerEvent tfinger
SDL_MouseButtonEvent button
SDL_UserEvent user
SDL_KeyboardEvent key
SDL_CommonEvent common
SDL_MouseMotionEvent motion
SDL_JoyAxisEvent jaxis
SDL_MouseDeviceEvent mdevice
SDL_DropEvent drop
SDL_JoyBallEvent jball
SDL_JoyBatteryEvent jbattery
SDL_SensorEvent sensor
SDL_GamepadButtonEvent gbutton
SDL_TextEditingCandidatesEvent edit_candidates
SDL_NotificationEvent notification
SDL_DisplayEvent display