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