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