sdl3_sys/generated/events.rs
1//! Event queue management.
2//!
3//! It's extremely common--often required--that an app deal with SDL's event
4//! queue. Almost all useful information about interactions with the real world
5//! flow through here: the user interacting with the computer and app, hardware
6//! coming and going, the system changing in some way, etc.
7//!
8//! An app generally takes a moment, perhaps at the start of a new frame, to
9//! examine any events that have occurred since the last time and process or
10//! ignore them. This is generally done by calling [`SDL_PollEvent()`] in a loop
11//! until it returns false (or, if using the main callbacks, events are
12//! provided one at a time in calls to [`SDL_AppEvent()`] before the next call to
13//! [`SDL_AppIterate()`]; in this scenario, the app does not call [`SDL_PollEvent()`]
14//! at all).
15//!
16//! There is other forms of control, too: [`SDL_PeepEvents()`] has more
17//! functionality at the cost of more complexity, and [`SDL_WaitEvent()`] can block
18//! the process until something interesting happens, which might be beneficial
19//! for certain types of programs on low-power hardware. One may also call
20//! [`SDL_AddEventWatch()`] to set a callback when new events arrive.
21//!
22//! The app is free to generate their own events, too: [`SDL_PushEvent`] allows the
23//! app to put events onto the queue for later retrieval; [`SDL_RegisterEvents`]
24//! can guarantee that these events have a type that isn't in use by other
25//! parts of the system.
26
27use super::stdinc::*;
28
29use super::audio::*;
30
31use super::camera::*;
32
33use super::error::*;
34
35use super::gamepad::*;
36
37use super::joystick::*;
38
39use super::keyboard::*;
40
41use super::keycode::*;
42
43use super::mouse::*;
44
45use super::pen::*;
46
47use super::power::*;
48
49use super::sensor::*;
50
51use super::scancode::*;
52
53use super::touch::*;
54
55use super::video::*;
56
57/// The types of events that can be delivered.
58///
59/// ## Availability
60/// This enum is available since SDL 3.2.0.
61///
62/// ## Known values (`sdl3-sys`)
63/// | Associated constant | Global constant | Description |
64/// | ------------------- | --------------- | ----------- |
65/// | [`FIRST`](SDL_EventType::FIRST) | [`SDL_EVENT_FIRST`] | Unused (do not remove) |
66/// | [`QUIT`](SDL_EventType::QUIT) | [`SDL_EVENT_QUIT`] | User-requested quit |
67/// | [`TERMINATING`](SDL_EventType::TERMINATING) | [`SDL_EVENT_TERMINATING`] | The application is being terminated by the OS. This event must be handled in a callback set with [`SDL_AddEventWatch()`]. Called on iOS in applicationWillTerminate() Called on Android in onDestroy() |
68/// | [`LOW_MEMORY`](SDL_EventType::LOW_MEMORY) | [`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()`]. Called on iOS in applicationDidReceiveMemoryWarning() Called on Android in onTrimMemory() |
69/// | [`WILL_ENTER_BACKGROUND`](SDL_EventType::WILL_ENTER_BACKGROUND) | [`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()`]. Called on iOS in applicationWillResignActive() Called on Android in onPause() |
70/// | [`DID_ENTER_BACKGROUND`](SDL_EventType::DID_ENTER_BACKGROUND) | [`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()`]. Called on iOS in applicationDidEnterBackground() Called on Android in onPause() |
71/// | [`WILL_ENTER_FOREGROUND`](SDL_EventType::WILL_ENTER_FOREGROUND) | [`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()`]. Called on iOS in applicationWillEnterForeground() Called on Android in onResume() |
72/// | [`DID_ENTER_FOREGROUND`](SDL_EventType::DID_ENTER_FOREGROUND) | [`SDL_EVENT_DID_ENTER_FOREGROUND`] | The application is now interactive. This event must be handled in a callback set with [`SDL_AddEventWatch()`]. Called on iOS in applicationDidBecomeActive() Called on Android in onResume() |
73/// | [`LOCALE_CHANGED`](SDL_EventType::LOCALE_CHANGED) | [`SDL_EVENT_LOCALE_CHANGED`] | The user's locale preferences have changed. |
74/// | [`SYSTEM_THEME_CHANGED`](SDL_EventType::SYSTEM_THEME_CHANGED) | [`SDL_EVENT_SYSTEM_THEME_CHANGED`] | The system theme changed |
75/// | [`DISPLAY_ORIENTATION`](SDL_EventType::DISPLAY_ORIENTATION) | [`SDL_EVENT_DISPLAY_ORIENTATION`] | Display orientation has changed to data1 |
76/// | [`DISPLAY_ADDED`](SDL_EventType::DISPLAY_ADDED) | [`SDL_EVENT_DISPLAY_ADDED`] | Display has been added to the system |
77/// | [`DISPLAY_REMOVED`](SDL_EventType::DISPLAY_REMOVED) | [`SDL_EVENT_DISPLAY_REMOVED`] | Display has been removed from the system |
78/// | [`DISPLAY_MOVED`](SDL_EventType::DISPLAY_MOVED) | [`SDL_EVENT_DISPLAY_MOVED`] | Display has changed position |
79/// | [`DISPLAY_DESKTOP_MODE_CHANGED`](SDL_EventType::DISPLAY_DESKTOP_MODE_CHANGED) | [`SDL_EVENT_DISPLAY_DESKTOP_MODE_CHANGED`] | Display has changed desktop mode |
80/// | [`DISPLAY_CURRENT_MODE_CHANGED`](SDL_EventType::DISPLAY_CURRENT_MODE_CHANGED) | [`SDL_EVENT_DISPLAY_CURRENT_MODE_CHANGED`] | Display has changed current mode |
81/// | [`DISPLAY_CONTENT_SCALE_CHANGED`](SDL_EventType::DISPLAY_CONTENT_SCALE_CHANGED) | [`SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED`] | Display has changed content scale |
82/// | [`DISPLAY_USABLE_BOUNDS_CHANGED`](SDL_EventType::DISPLAY_USABLE_BOUNDS_CHANGED) | [`SDL_EVENT_DISPLAY_USABLE_BOUNDS_CHANGED`] | Display has changed usable bounds |
83/// | [`DISPLAY_FIRST`](SDL_EventType::DISPLAY_FIRST) | [`SDL_EVENT_DISPLAY_FIRST`] | |
84/// | [`DISPLAY_LAST`](SDL_EventType::DISPLAY_LAST) | [`SDL_EVENT_DISPLAY_LAST`] | |
85/// | [`WINDOW_SHOWN`](SDL_EventType::WINDOW_SHOWN) | [`SDL_EVENT_WINDOW_SHOWN`] | Window has been shown |
86/// | [`WINDOW_HIDDEN`](SDL_EventType::WINDOW_HIDDEN) | [`SDL_EVENT_WINDOW_HIDDEN`] | Window has been hidden |
87/// | [`WINDOW_EXPOSED`](SDL_EventType::WINDOW_EXPOSED) | [`SDL_EVENT_WINDOW_EXPOSED`] | Window has been exposed and should be redrawn, and can be redrawn directly from event watchers for this event. data1 is 1 for live-resize expose events, 0 otherwise. |
88/// | [`WINDOW_MOVED`](SDL_EventType::WINDOW_MOVED) | [`SDL_EVENT_WINDOW_MOVED`] | Window has been moved to data1, data2 |
89/// | [`WINDOW_RESIZED`](SDL_EventType::WINDOW_RESIZED) | [`SDL_EVENT_WINDOW_RESIZED`] | Window has been resized to data1xdata2 |
90/// | [`WINDOW_PIXEL_SIZE_CHANGED`](SDL_EventType::WINDOW_PIXEL_SIZE_CHANGED) | [`SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED`] | The pixel size of the window has changed to data1xdata2 |
91/// | [`WINDOW_METAL_VIEW_RESIZED`](SDL_EventType::WINDOW_METAL_VIEW_RESIZED) | [`SDL_EVENT_WINDOW_METAL_VIEW_RESIZED`] | The pixel size of a Metal view associated with the window has changed |
92/// | [`WINDOW_MINIMIZED`](SDL_EventType::WINDOW_MINIMIZED) | [`SDL_EVENT_WINDOW_MINIMIZED`] | Window has been minimized |
93/// | [`WINDOW_MAXIMIZED`](SDL_EventType::WINDOW_MAXIMIZED) | [`SDL_EVENT_WINDOW_MAXIMIZED`] | Window has been maximized |
94/// | [`WINDOW_RESTORED`](SDL_EventType::WINDOW_RESTORED) | [`SDL_EVENT_WINDOW_RESTORED`] | Window has been restored to normal size and position |
95/// | [`WINDOW_MOUSE_ENTER`](SDL_EventType::WINDOW_MOUSE_ENTER) | [`SDL_EVENT_WINDOW_MOUSE_ENTER`] | Window has gained mouse focus |
96/// | [`WINDOW_MOUSE_LEAVE`](SDL_EventType::WINDOW_MOUSE_LEAVE) | [`SDL_EVENT_WINDOW_MOUSE_LEAVE`] | Window has lost mouse focus |
97/// | [`WINDOW_FOCUS_GAINED`](SDL_EventType::WINDOW_FOCUS_GAINED) | [`SDL_EVENT_WINDOW_FOCUS_GAINED`] | Window has gained keyboard focus |
98/// | [`WINDOW_FOCUS_LOST`](SDL_EventType::WINDOW_FOCUS_LOST) | [`SDL_EVENT_WINDOW_FOCUS_LOST`] | Window has lost keyboard focus |
99/// | [`WINDOW_CLOSE_REQUESTED`](SDL_EventType::WINDOW_CLOSE_REQUESTED) | [`SDL_EVENT_WINDOW_CLOSE_REQUESTED`] | The window manager requests that the window be closed |
100/// | [`WINDOW_HIT_TEST`](SDL_EventType::WINDOW_HIT_TEST) | [`SDL_EVENT_WINDOW_HIT_TEST`] | Window had a hit test that wasn't [`SDL_HITTEST_NORMAL`] |
101/// | [`WINDOW_ICCPROF_CHANGED`](SDL_EventType::WINDOW_ICCPROF_CHANGED) | [`SDL_EVENT_WINDOW_ICCPROF_CHANGED`] | The ICC profile of the window's display has changed |
102/// | [`WINDOW_DISPLAY_CHANGED`](SDL_EventType::WINDOW_DISPLAY_CHANGED) | [`SDL_EVENT_WINDOW_DISPLAY_CHANGED`] | Window has been moved to display data1 |
103/// | [`WINDOW_DISPLAY_SCALE_CHANGED`](SDL_EventType::WINDOW_DISPLAY_SCALE_CHANGED) | [`SDL_EVENT_WINDOW_DISPLAY_SCALE_CHANGED`] | Window display scale has been changed |
104/// | [`WINDOW_SAFE_AREA_CHANGED`](SDL_EventType::WINDOW_SAFE_AREA_CHANGED) | [`SDL_EVENT_WINDOW_SAFE_AREA_CHANGED`] | The window safe area has been changed |
105/// | [`WINDOW_OCCLUDED`](SDL_EventType::WINDOW_OCCLUDED) | [`SDL_EVENT_WINDOW_OCCLUDED`] | The window has been occluded |
106/// | [`WINDOW_ENTER_FULLSCREEN`](SDL_EventType::WINDOW_ENTER_FULLSCREEN) | [`SDL_EVENT_WINDOW_ENTER_FULLSCREEN`] | The window has entered fullscreen mode |
107/// | [`WINDOW_LEAVE_FULLSCREEN`](SDL_EventType::WINDOW_LEAVE_FULLSCREEN) | [`SDL_EVENT_WINDOW_LEAVE_FULLSCREEN`] | The window has left fullscreen mode |
108/// | [`WINDOW_DESTROYED`](SDL_EventType::WINDOW_DESTROYED) | [`SDL_EVENT_WINDOW_DESTROYED`] | The window with the associated ID is being or has been destroyed. If this message is being handled in an event watcher, the window handle is still valid and can still be used to retrieve any properties associated with the window. Otherwise, the handle has already been destroyed and all resources associated with it are invalid |
109/// | [`WINDOW_HDR_STATE_CHANGED`](SDL_EventType::WINDOW_HDR_STATE_CHANGED) | [`SDL_EVENT_WINDOW_HDR_STATE_CHANGED`] | Window HDR properties have changed |
110/// | [`WINDOW_FIRST`](SDL_EventType::WINDOW_FIRST) | [`SDL_EVENT_WINDOW_FIRST`] | |
111/// | [`WINDOW_LAST`](SDL_EventType::WINDOW_LAST) | [`SDL_EVENT_WINDOW_LAST`] | |
112/// | [`KEY_DOWN`](SDL_EventType::KEY_DOWN) | [`SDL_EVENT_KEY_DOWN`] | Key pressed |
113/// | [`KEY_UP`](SDL_EventType::KEY_UP) | [`SDL_EVENT_KEY_UP`] | Key released |
114/// | [`TEXT_EDITING`](SDL_EventType::TEXT_EDITING) | [`SDL_EVENT_TEXT_EDITING`] | Keyboard text editing (composition) |
115/// | [`TEXT_INPUT`](SDL_EventType::TEXT_INPUT) | [`SDL_EVENT_TEXT_INPUT`] | Keyboard text input |
116/// | [`KEYMAP_CHANGED`](SDL_EventType::KEYMAP_CHANGED) | [`SDL_EVENT_KEYMAP_CHANGED`] | Keymap changed due to a system event such as an input language or keyboard layout change. |
117/// | [`KEYBOARD_ADDED`](SDL_EventType::KEYBOARD_ADDED) | [`SDL_EVENT_KEYBOARD_ADDED`] | A new keyboard has been inserted into the system |
118/// | [`KEYBOARD_REMOVED`](SDL_EventType::KEYBOARD_REMOVED) | [`SDL_EVENT_KEYBOARD_REMOVED`] | A keyboard has been removed |
119/// | [`TEXT_EDITING_CANDIDATES`](SDL_EventType::TEXT_EDITING_CANDIDATES) | [`SDL_EVENT_TEXT_EDITING_CANDIDATES`] | Keyboard text editing candidates |
120/// | [`SCREEN_KEYBOARD_SHOWN`](SDL_EventType::SCREEN_KEYBOARD_SHOWN) | [`SDL_EVENT_SCREEN_KEYBOARD_SHOWN`] | The on-screen keyboard has been shown |
121/// | [`SCREEN_KEYBOARD_HIDDEN`](SDL_EventType::SCREEN_KEYBOARD_HIDDEN) | [`SDL_EVENT_SCREEN_KEYBOARD_HIDDEN`] | The on-screen keyboard has been hidden |
122/// | [`MOUSE_MOTION`](SDL_EventType::MOUSE_MOTION) | [`SDL_EVENT_MOUSE_MOTION`] | Mouse moved |
123/// | [`MOUSE_BUTTON_DOWN`](SDL_EventType::MOUSE_BUTTON_DOWN) | [`SDL_EVENT_MOUSE_BUTTON_DOWN`] | Mouse button pressed |
124/// | [`MOUSE_BUTTON_UP`](SDL_EventType::MOUSE_BUTTON_UP) | [`SDL_EVENT_MOUSE_BUTTON_UP`] | Mouse button released |
125/// | [`MOUSE_WHEEL`](SDL_EventType::MOUSE_WHEEL) | [`SDL_EVENT_MOUSE_WHEEL`] | Mouse wheel motion |
126/// | [`MOUSE_ADDED`](SDL_EventType::MOUSE_ADDED) | [`SDL_EVENT_MOUSE_ADDED`] | A new mouse has been inserted into the system |
127/// | [`MOUSE_REMOVED`](SDL_EventType::MOUSE_REMOVED) | [`SDL_EVENT_MOUSE_REMOVED`] | A mouse has been removed |
128/// | [`JOYSTICK_AXIS_MOTION`](SDL_EventType::JOYSTICK_AXIS_MOTION) | [`SDL_EVENT_JOYSTICK_AXIS_MOTION`] | Joystick axis motion |
129/// | [`JOYSTICK_BALL_MOTION`](SDL_EventType::JOYSTICK_BALL_MOTION) | [`SDL_EVENT_JOYSTICK_BALL_MOTION`] | Joystick trackball motion |
130/// | [`JOYSTICK_HAT_MOTION`](SDL_EventType::JOYSTICK_HAT_MOTION) | [`SDL_EVENT_JOYSTICK_HAT_MOTION`] | Joystick hat position change |
131/// | [`JOYSTICK_BUTTON_DOWN`](SDL_EventType::JOYSTICK_BUTTON_DOWN) | [`SDL_EVENT_JOYSTICK_BUTTON_DOWN`] | Joystick button pressed |
132/// | [`JOYSTICK_BUTTON_UP`](SDL_EventType::JOYSTICK_BUTTON_UP) | [`SDL_EVENT_JOYSTICK_BUTTON_UP`] | Joystick button released |
133/// | [`JOYSTICK_ADDED`](SDL_EventType::JOYSTICK_ADDED) | [`SDL_EVENT_JOYSTICK_ADDED`] | A new joystick has been inserted into the system |
134/// | [`JOYSTICK_REMOVED`](SDL_EventType::JOYSTICK_REMOVED) | [`SDL_EVENT_JOYSTICK_REMOVED`] | An opened joystick has been removed |
135/// | [`JOYSTICK_BATTERY_UPDATED`](SDL_EventType::JOYSTICK_BATTERY_UPDATED) | [`SDL_EVENT_JOYSTICK_BATTERY_UPDATED`] | Joystick battery level change |
136/// | [`JOYSTICK_UPDATE_COMPLETE`](SDL_EventType::JOYSTICK_UPDATE_COMPLETE) | [`SDL_EVENT_JOYSTICK_UPDATE_COMPLETE`] | Joystick update is complete |
137/// | [`GAMEPAD_AXIS_MOTION`](SDL_EventType::GAMEPAD_AXIS_MOTION) | [`SDL_EVENT_GAMEPAD_AXIS_MOTION`] | Gamepad axis motion |
138/// | [`GAMEPAD_BUTTON_DOWN`](SDL_EventType::GAMEPAD_BUTTON_DOWN) | [`SDL_EVENT_GAMEPAD_BUTTON_DOWN`] | Gamepad button pressed |
139/// | [`GAMEPAD_BUTTON_UP`](SDL_EventType::GAMEPAD_BUTTON_UP) | [`SDL_EVENT_GAMEPAD_BUTTON_UP`] | Gamepad button released |
140/// | [`GAMEPAD_ADDED`](SDL_EventType::GAMEPAD_ADDED) | [`SDL_EVENT_GAMEPAD_ADDED`] | A new gamepad has been inserted into the system |
141/// | [`GAMEPAD_REMOVED`](SDL_EventType::GAMEPAD_REMOVED) | [`SDL_EVENT_GAMEPAD_REMOVED`] | A gamepad has been removed |
142/// | [`GAMEPAD_REMAPPED`](SDL_EventType::GAMEPAD_REMAPPED) | [`SDL_EVENT_GAMEPAD_REMAPPED`] | The gamepad mapping was updated |
143/// | [`GAMEPAD_TOUCHPAD_DOWN`](SDL_EventType::GAMEPAD_TOUCHPAD_DOWN) | [`SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN`] | Gamepad touchpad was touched |
144/// | [`GAMEPAD_TOUCHPAD_MOTION`](SDL_EventType::GAMEPAD_TOUCHPAD_MOTION) | [`SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION`] | Gamepad touchpad finger was moved |
145/// | [`GAMEPAD_TOUCHPAD_UP`](SDL_EventType::GAMEPAD_TOUCHPAD_UP) | [`SDL_EVENT_GAMEPAD_TOUCHPAD_UP`] | Gamepad touchpad finger was lifted |
146/// | [`GAMEPAD_SENSOR_UPDATE`](SDL_EventType::GAMEPAD_SENSOR_UPDATE) | [`SDL_EVENT_GAMEPAD_SENSOR_UPDATE`] | Gamepad sensor was updated |
147/// | [`GAMEPAD_UPDATE_COMPLETE`](SDL_EventType::GAMEPAD_UPDATE_COMPLETE) | [`SDL_EVENT_GAMEPAD_UPDATE_COMPLETE`] | Gamepad update is complete |
148/// | [`GAMEPAD_STEAM_HANDLE_UPDATED`](SDL_EventType::GAMEPAD_STEAM_HANDLE_UPDATED) | [`SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED`] | Gamepad Steam handle has changed |
149/// | [`FINGER_DOWN`](SDL_EventType::FINGER_DOWN) | [`SDL_EVENT_FINGER_DOWN`] | |
150/// | [`FINGER_UP`](SDL_EventType::FINGER_UP) | [`SDL_EVENT_FINGER_UP`] | |
151/// | [`FINGER_MOTION`](SDL_EventType::FINGER_MOTION) | [`SDL_EVENT_FINGER_MOTION`] | |
152/// | [`FINGER_CANCELED`](SDL_EventType::FINGER_CANCELED) | [`SDL_EVENT_FINGER_CANCELED`] | |
153/// | [`PINCH_BEGIN`](SDL_EventType::PINCH_BEGIN) | [`SDL_EVENT_PINCH_BEGIN`] | Pinch gesture started |
154/// | [`PINCH_UPDATE`](SDL_EventType::PINCH_UPDATE) | [`SDL_EVENT_PINCH_UPDATE`] | Pinch gesture updated |
155/// | [`PINCH_END`](SDL_EventType::PINCH_END) | [`SDL_EVENT_PINCH_END`] | Pinch gesture ended |
156/// | [`CLIPBOARD_UPDATE`](SDL_EventType::CLIPBOARD_UPDATE) | [`SDL_EVENT_CLIPBOARD_UPDATE`] | The clipboard changed |
157/// | [`DROP_FILE`](SDL_EventType::DROP_FILE) | [`SDL_EVENT_DROP_FILE`] | The system requests a file open |
158/// | [`DROP_TEXT`](SDL_EventType::DROP_TEXT) | [`SDL_EVENT_DROP_TEXT`] | text/plain drag-and-drop event |
159/// | [`DROP_BEGIN`](SDL_EventType::DROP_BEGIN) | [`SDL_EVENT_DROP_BEGIN`] | A new set of drops is beginning (NULL filename) |
160/// | [`DROP_COMPLETE`](SDL_EventType::DROP_COMPLETE) | [`SDL_EVENT_DROP_COMPLETE`] | Current set of drops is now complete (NULL filename) |
161/// | [`DROP_POSITION`](SDL_EventType::DROP_POSITION) | [`SDL_EVENT_DROP_POSITION`] | Position while moving over the window |
162/// | [`AUDIO_DEVICE_ADDED`](SDL_EventType::AUDIO_DEVICE_ADDED) | [`SDL_EVENT_AUDIO_DEVICE_ADDED`] | A new audio device is available |
163/// | [`AUDIO_DEVICE_REMOVED`](SDL_EventType::AUDIO_DEVICE_REMOVED) | [`SDL_EVENT_AUDIO_DEVICE_REMOVED`] | An audio device has been removed. |
164/// | [`AUDIO_DEVICE_FORMAT_CHANGED`](SDL_EventType::AUDIO_DEVICE_FORMAT_CHANGED) | [`SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED`] | An audio device's format has been changed by the system. |
165/// | [`SENSOR_UPDATE`](SDL_EventType::SENSOR_UPDATE) | [`SDL_EVENT_SENSOR_UPDATE`] | A sensor was updated |
166/// | [`PEN_PROXIMITY_IN`](SDL_EventType::PEN_PROXIMITY_IN) | [`SDL_EVENT_PEN_PROXIMITY_IN`] | Pressure-sensitive pen has become available |
167/// | [`PEN_PROXIMITY_OUT`](SDL_EventType::PEN_PROXIMITY_OUT) | [`SDL_EVENT_PEN_PROXIMITY_OUT`] | Pressure-sensitive pen has become unavailable |
168/// | [`PEN_DOWN`](SDL_EventType::PEN_DOWN) | [`SDL_EVENT_PEN_DOWN`] | Pressure-sensitive pen touched drawing surface |
169/// | [`PEN_UP`](SDL_EventType::PEN_UP) | [`SDL_EVENT_PEN_UP`] | Pressure-sensitive pen stopped touching drawing surface |
170/// | [`PEN_BUTTON_DOWN`](SDL_EventType::PEN_BUTTON_DOWN) | [`SDL_EVENT_PEN_BUTTON_DOWN`] | Pressure-sensitive pen button pressed |
171/// | [`PEN_BUTTON_UP`](SDL_EventType::PEN_BUTTON_UP) | [`SDL_EVENT_PEN_BUTTON_UP`] | Pressure-sensitive pen button released |
172/// | [`PEN_MOTION`](SDL_EventType::PEN_MOTION) | [`SDL_EVENT_PEN_MOTION`] | Pressure-sensitive pen is moving on the tablet |
173/// | [`PEN_AXIS`](SDL_EventType::PEN_AXIS) | [`SDL_EVENT_PEN_AXIS`] | Pressure-sensitive pen angle/pressure/etc changed |
174/// | [`CAMERA_DEVICE_ADDED`](SDL_EventType::CAMERA_DEVICE_ADDED) | [`SDL_EVENT_CAMERA_DEVICE_ADDED`] | A new camera device is available |
175/// | [`CAMERA_DEVICE_REMOVED`](SDL_EventType::CAMERA_DEVICE_REMOVED) | [`SDL_EVENT_CAMERA_DEVICE_REMOVED`] | A camera device has been removed. |
176/// | [`CAMERA_DEVICE_APPROVED`](SDL_EventType::CAMERA_DEVICE_APPROVED) | [`SDL_EVENT_CAMERA_DEVICE_APPROVED`] | A camera device has been approved for use by the user. |
177/// | [`CAMERA_DEVICE_DENIED`](SDL_EventType::CAMERA_DEVICE_DENIED) | [`SDL_EVENT_CAMERA_DEVICE_DENIED`] | A camera device has been denied for use by the user. |
178/// | [`RENDER_TARGETS_RESET`](SDL_EventType::RENDER_TARGETS_RESET) | [`SDL_EVENT_RENDER_TARGETS_RESET`] | The render targets have been reset and their contents need to be updated |
179/// | [`RENDER_DEVICE_RESET`](SDL_EventType::RENDER_DEVICE_RESET) | [`SDL_EVENT_RENDER_DEVICE_RESET`] | The device has been reset and all textures need to be recreated |
180/// | [`RENDER_DEVICE_LOST`](SDL_EventType::RENDER_DEVICE_LOST) | [`SDL_EVENT_RENDER_DEVICE_LOST`] | The device has been lost and can't be recovered. |
181/// | [`PRIVATE0`](SDL_EventType::PRIVATE0) | [`SDL_EVENT_PRIVATE0`] | |
182/// | [`PRIVATE1`](SDL_EventType::PRIVATE1) | [`SDL_EVENT_PRIVATE1`] | |
183/// | [`PRIVATE2`](SDL_EventType::PRIVATE2) | [`SDL_EVENT_PRIVATE2`] | |
184/// | [`PRIVATE3`](SDL_EventType::PRIVATE3) | [`SDL_EVENT_PRIVATE3`] | |
185/// | [`POLL_SENTINEL`](SDL_EventType::POLL_SENTINEL) | [`SDL_EVENT_POLL_SENTINEL`] | Signals the end of an event poll cycle |
186/// | [`USER`](SDL_EventType::USER) | [`SDL_EVENT_USER`] | Events [`SDL_EVENT_USER`] through [`SDL_EVENT_LAST`] are for your use, and should be allocated with [`SDL_RegisterEvents()`] |
187/// | [`LAST`](SDL_EventType::LAST) | [`SDL_EVENT_LAST`] | * This last event is only for bounding internal arrays |
188/// | [`ENUM_PADDING`](SDL_EventType::ENUM_PADDING) | [`SDL_EVENT_ENUM_PADDING`] | |
189#[repr(transparent)]
190#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
191pub struct SDL_EventType(pub Uint32);
192
193impl ::core::cmp::PartialEq<Uint32> for SDL_EventType {
194 #[inline(always)]
195 fn eq(&self, other: &Uint32) -> bool {
196 &self.0 == other
197 }
198}
199
200impl ::core::cmp::PartialEq<SDL_EventType> for Uint32 {
201 #[inline(always)]
202 fn eq(&self, other: &SDL_EventType) -> bool {
203 self == &other.0
204 }
205}
206
207impl From<SDL_EventType> for Uint32 {
208 #[inline(always)]
209 fn from(value: SDL_EventType) -> Self {
210 value.0
211 }
212}
213
214#[cfg(feature = "debug-impls")]
215impl ::core::fmt::Debug for SDL_EventType {
216 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
217 #[allow(unreachable_patterns)]
218 f.write_str(match *self {
219 Self::FIRST => "SDL_EVENT_FIRST",
220 Self::QUIT => "SDL_EVENT_QUIT",
221 Self::TERMINATING => "SDL_EVENT_TERMINATING",
222 Self::LOW_MEMORY => "SDL_EVENT_LOW_MEMORY",
223 Self::WILL_ENTER_BACKGROUND => "SDL_EVENT_WILL_ENTER_BACKGROUND",
224 Self::DID_ENTER_BACKGROUND => "SDL_EVENT_DID_ENTER_BACKGROUND",
225 Self::WILL_ENTER_FOREGROUND => "SDL_EVENT_WILL_ENTER_FOREGROUND",
226 Self::DID_ENTER_FOREGROUND => "SDL_EVENT_DID_ENTER_FOREGROUND",
227 Self::LOCALE_CHANGED => "SDL_EVENT_LOCALE_CHANGED",
228 Self::SYSTEM_THEME_CHANGED => "SDL_EVENT_SYSTEM_THEME_CHANGED",
229 Self::DISPLAY_ORIENTATION => "SDL_EVENT_DISPLAY_ORIENTATION",
230 Self::DISPLAY_ADDED => "SDL_EVENT_DISPLAY_ADDED",
231 Self::DISPLAY_REMOVED => "SDL_EVENT_DISPLAY_REMOVED",
232 Self::DISPLAY_MOVED => "SDL_EVENT_DISPLAY_MOVED",
233 Self::DISPLAY_DESKTOP_MODE_CHANGED => "SDL_EVENT_DISPLAY_DESKTOP_MODE_CHANGED",
234 Self::DISPLAY_CURRENT_MODE_CHANGED => "SDL_EVENT_DISPLAY_CURRENT_MODE_CHANGED",
235 Self::DISPLAY_CONTENT_SCALE_CHANGED => "SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED",
236 Self::DISPLAY_USABLE_BOUNDS_CHANGED => "SDL_EVENT_DISPLAY_USABLE_BOUNDS_CHANGED",
237 Self::DISPLAY_FIRST => "SDL_EVENT_DISPLAY_FIRST",
238 Self::DISPLAY_LAST => "SDL_EVENT_DISPLAY_LAST",
239 Self::WINDOW_SHOWN => "SDL_EVENT_WINDOW_SHOWN",
240 Self::WINDOW_HIDDEN => "SDL_EVENT_WINDOW_HIDDEN",
241 Self::WINDOW_EXPOSED => "SDL_EVENT_WINDOW_EXPOSED",
242 Self::WINDOW_MOVED => "SDL_EVENT_WINDOW_MOVED",
243 Self::WINDOW_RESIZED => "SDL_EVENT_WINDOW_RESIZED",
244 Self::WINDOW_PIXEL_SIZE_CHANGED => "SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED",
245 Self::WINDOW_METAL_VIEW_RESIZED => "SDL_EVENT_WINDOW_METAL_VIEW_RESIZED",
246 Self::WINDOW_MINIMIZED => "SDL_EVENT_WINDOW_MINIMIZED",
247 Self::WINDOW_MAXIMIZED => "SDL_EVENT_WINDOW_MAXIMIZED",
248 Self::WINDOW_RESTORED => "SDL_EVENT_WINDOW_RESTORED",
249 Self::WINDOW_MOUSE_ENTER => "SDL_EVENT_WINDOW_MOUSE_ENTER",
250 Self::WINDOW_MOUSE_LEAVE => "SDL_EVENT_WINDOW_MOUSE_LEAVE",
251 Self::WINDOW_FOCUS_GAINED => "SDL_EVENT_WINDOW_FOCUS_GAINED",
252 Self::WINDOW_FOCUS_LOST => "SDL_EVENT_WINDOW_FOCUS_LOST",
253 Self::WINDOW_CLOSE_REQUESTED => "SDL_EVENT_WINDOW_CLOSE_REQUESTED",
254 Self::WINDOW_HIT_TEST => "SDL_EVENT_WINDOW_HIT_TEST",
255 Self::WINDOW_ICCPROF_CHANGED => "SDL_EVENT_WINDOW_ICCPROF_CHANGED",
256 Self::WINDOW_DISPLAY_CHANGED => "SDL_EVENT_WINDOW_DISPLAY_CHANGED",
257 Self::WINDOW_DISPLAY_SCALE_CHANGED => "SDL_EVENT_WINDOW_DISPLAY_SCALE_CHANGED",
258 Self::WINDOW_SAFE_AREA_CHANGED => "SDL_EVENT_WINDOW_SAFE_AREA_CHANGED",
259 Self::WINDOW_OCCLUDED => "SDL_EVENT_WINDOW_OCCLUDED",
260 Self::WINDOW_ENTER_FULLSCREEN => "SDL_EVENT_WINDOW_ENTER_FULLSCREEN",
261 Self::WINDOW_LEAVE_FULLSCREEN => "SDL_EVENT_WINDOW_LEAVE_FULLSCREEN",
262 Self::WINDOW_DESTROYED => "SDL_EVENT_WINDOW_DESTROYED",
263 Self::WINDOW_HDR_STATE_CHANGED => "SDL_EVENT_WINDOW_HDR_STATE_CHANGED",
264 Self::WINDOW_FIRST => "SDL_EVENT_WINDOW_FIRST",
265 Self::WINDOW_LAST => "SDL_EVENT_WINDOW_LAST",
266 Self::KEY_DOWN => "SDL_EVENT_KEY_DOWN",
267 Self::KEY_UP => "SDL_EVENT_KEY_UP",
268 Self::TEXT_EDITING => "SDL_EVENT_TEXT_EDITING",
269 Self::TEXT_INPUT => "SDL_EVENT_TEXT_INPUT",
270 Self::KEYMAP_CHANGED => "SDL_EVENT_KEYMAP_CHANGED",
271 Self::KEYBOARD_ADDED => "SDL_EVENT_KEYBOARD_ADDED",
272 Self::KEYBOARD_REMOVED => "SDL_EVENT_KEYBOARD_REMOVED",
273 Self::TEXT_EDITING_CANDIDATES => "SDL_EVENT_TEXT_EDITING_CANDIDATES",
274 Self::SCREEN_KEYBOARD_SHOWN => "SDL_EVENT_SCREEN_KEYBOARD_SHOWN",
275 Self::SCREEN_KEYBOARD_HIDDEN => "SDL_EVENT_SCREEN_KEYBOARD_HIDDEN",
276 Self::MOUSE_MOTION => "SDL_EVENT_MOUSE_MOTION",
277 Self::MOUSE_BUTTON_DOWN => "SDL_EVENT_MOUSE_BUTTON_DOWN",
278 Self::MOUSE_BUTTON_UP => "SDL_EVENT_MOUSE_BUTTON_UP",
279 Self::MOUSE_WHEEL => "SDL_EVENT_MOUSE_WHEEL",
280 Self::MOUSE_ADDED => "SDL_EVENT_MOUSE_ADDED",
281 Self::MOUSE_REMOVED => "SDL_EVENT_MOUSE_REMOVED",
282 Self::JOYSTICK_AXIS_MOTION => "SDL_EVENT_JOYSTICK_AXIS_MOTION",
283 Self::JOYSTICK_BALL_MOTION => "SDL_EVENT_JOYSTICK_BALL_MOTION",
284 Self::JOYSTICK_HAT_MOTION => "SDL_EVENT_JOYSTICK_HAT_MOTION",
285 Self::JOYSTICK_BUTTON_DOWN => "SDL_EVENT_JOYSTICK_BUTTON_DOWN",
286 Self::JOYSTICK_BUTTON_UP => "SDL_EVENT_JOYSTICK_BUTTON_UP",
287 Self::JOYSTICK_ADDED => "SDL_EVENT_JOYSTICK_ADDED",
288 Self::JOYSTICK_REMOVED => "SDL_EVENT_JOYSTICK_REMOVED",
289 Self::JOYSTICK_BATTERY_UPDATED => "SDL_EVENT_JOYSTICK_BATTERY_UPDATED",
290 Self::JOYSTICK_UPDATE_COMPLETE => "SDL_EVENT_JOYSTICK_UPDATE_COMPLETE",
291 Self::GAMEPAD_AXIS_MOTION => "SDL_EVENT_GAMEPAD_AXIS_MOTION",
292 Self::GAMEPAD_BUTTON_DOWN => "SDL_EVENT_GAMEPAD_BUTTON_DOWN",
293 Self::GAMEPAD_BUTTON_UP => "SDL_EVENT_GAMEPAD_BUTTON_UP",
294 Self::GAMEPAD_ADDED => "SDL_EVENT_GAMEPAD_ADDED",
295 Self::GAMEPAD_REMOVED => "SDL_EVENT_GAMEPAD_REMOVED",
296 Self::GAMEPAD_REMAPPED => "SDL_EVENT_GAMEPAD_REMAPPED",
297 Self::GAMEPAD_TOUCHPAD_DOWN => "SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN",
298 Self::GAMEPAD_TOUCHPAD_MOTION => "SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION",
299 Self::GAMEPAD_TOUCHPAD_UP => "SDL_EVENT_GAMEPAD_TOUCHPAD_UP",
300 Self::GAMEPAD_SENSOR_UPDATE => "SDL_EVENT_GAMEPAD_SENSOR_UPDATE",
301 Self::GAMEPAD_UPDATE_COMPLETE => "SDL_EVENT_GAMEPAD_UPDATE_COMPLETE",
302 Self::GAMEPAD_STEAM_HANDLE_UPDATED => "SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED",
303 Self::FINGER_DOWN => "SDL_EVENT_FINGER_DOWN",
304 Self::FINGER_UP => "SDL_EVENT_FINGER_UP",
305 Self::FINGER_MOTION => "SDL_EVENT_FINGER_MOTION",
306 Self::FINGER_CANCELED => "SDL_EVENT_FINGER_CANCELED",
307 Self::PINCH_BEGIN => "SDL_EVENT_PINCH_BEGIN",
308 Self::PINCH_UPDATE => "SDL_EVENT_PINCH_UPDATE",
309 Self::PINCH_END => "SDL_EVENT_PINCH_END",
310 Self::CLIPBOARD_UPDATE => "SDL_EVENT_CLIPBOARD_UPDATE",
311 Self::DROP_FILE => "SDL_EVENT_DROP_FILE",
312 Self::DROP_TEXT => "SDL_EVENT_DROP_TEXT",
313 Self::DROP_BEGIN => "SDL_EVENT_DROP_BEGIN",
314 Self::DROP_COMPLETE => "SDL_EVENT_DROP_COMPLETE",
315 Self::DROP_POSITION => "SDL_EVENT_DROP_POSITION",
316 Self::AUDIO_DEVICE_ADDED => "SDL_EVENT_AUDIO_DEVICE_ADDED",
317 Self::AUDIO_DEVICE_REMOVED => "SDL_EVENT_AUDIO_DEVICE_REMOVED",
318 Self::AUDIO_DEVICE_FORMAT_CHANGED => "SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED",
319 Self::SENSOR_UPDATE => "SDL_EVENT_SENSOR_UPDATE",
320 Self::PEN_PROXIMITY_IN => "SDL_EVENT_PEN_PROXIMITY_IN",
321 Self::PEN_PROXIMITY_OUT => "SDL_EVENT_PEN_PROXIMITY_OUT",
322 Self::PEN_DOWN => "SDL_EVENT_PEN_DOWN",
323 Self::PEN_UP => "SDL_EVENT_PEN_UP",
324 Self::PEN_BUTTON_DOWN => "SDL_EVENT_PEN_BUTTON_DOWN",
325 Self::PEN_BUTTON_UP => "SDL_EVENT_PEN_BUTTON_UP",
326 Self::PEN_MOTION => "SDL_EVENT_PEN_MOTION",
327 Self::PEN_AXIS => "SDL_EVENT_PEN_AXIS",
328 Self::CAMERA_DEVICE_ADDED => "SDL_EVENT_CAMERA_DEVICE_ADDED",
329 Self::CAMERA_DEVICE_REMOVED => "SDL_EVENT_CAMERA_DEVICE_REMOVED",
330 Self::CAMERA_DEVICE_APPROVED => "SDL_EVENT_CAMERA_DEVICE_APPROVED",
331 Self::CAMERA_DEVICE_DENIED => "SDL_EVENT_CAMERA_DEVICE_DENIED",
332 Self::RENDER_TARGETS_RESET => "SDL_EVENT_RENDER_TARGETS_RESET",
333 Self::RENDER_DEVICE_RESET => "SDL_EVENT_RENDER_DEVICE_RESET",
334 Self::RENDER_DEVICE_LOST => "SDL_EVENT_RENDER_DEVICE_LOST",
335 Self::PRIVATE0 => "SDL_EVENT_PRIVATE0",
336 Self::PRIVATE1 => "SDL_EVENT_PRIVATE1",
337 Self::PRIVATE2 => "SDL_EVENT_PRIVATE2",
338 Self::PRIVATE3 => "SDL_EVENT_PRIVATE3",
339 Self::POLL_SENTINEL => "SDL_EVENT_POLL_SENTINEL",
340 Self::USER => "SDL_EVENT_USER",
341 Self::LAST => "SDL_EVENT_LAST",
342 Self::ENUM_PADDING => "SDL_EVENT_ENUM_PADDING",
343
344 _ => return write!(f, "SDL_EventType({})", self.0),
345 })
346 }
347}
348
349impl SDL_EventType {
350 /// Unused (do not remove)
351 pub const FIRST: Self = Self((0 as Uint32));
352 /// User-requested quit
353 pub const QUIT: Self = Self((0x100 as Uint32));
354 /// The application is being terminated by the OS. This event must be handled in a callback set with [`SDL_AddEventWatch()`].
355 /// Called on iOS in applicationWillTerminate()
356 /// Called on Android in onDestroy()
357 pub const TERMINATING: Self = Self((257 as Uint32));
358 /// The application is low on memory, free memory if possible. This event must be handled in a callback set with [`SDL_AddEventWatch()`].
359 /// Called on iOS in applicationDidReceiveMemoryWarning()
360 /// Called on Android in onTrimMemory()
361 pub const LOW_MEMORY: Self = Self((258 as Uint32));
362 /// The application is about to enter the background. This event must be handled in a callback set with [`SDL_AddEventWatch()`].
363 /// Called on iOS in applicationWillResignActive()
364 /// Called on Android in onPause()
365 pub const WILL_ENTER_BACKGROUND: Self = Self((259 as Uint32));
366 /// 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()`].
367 /// Called on iOS in applicationDidEnterBackground()
368 /// Called on Android in onPause()
369 pub const DID_ENTER_BACKGROUND: Self = Self((260 as Uint32));
370 /// The application is about to enter the foreground. This event must be handled in a callback set with [`SDL_AddEventWatch()`].
371 /// Called on iOS in applicationWillEnterForeground()
372 /// Called on Android in onResume()
373 pub const WILL_ENTER_FOREGROUND: Self = Self((261 as Uint32));
374 /// The application is now interactive. This event must be handled in a callback set with [`SDL_AddEventWatch()`].
375 /// Called on iOS in applicationDidBecomeActive()
376 /// Called on Android in onResume()
377 pub const DID_ENTER_FOREGROUND: Self = Self((262 as Uint32));
378 /// The user's locale preferences have changed.
379 pub const LOCALE_CHANGED: Self = Self((263 as Uint32));
380 /// The system theme changed
381 pub const SYSTEM_THEME_CHANGED: Self = Self((264 as Uint32));
382 /// Display orientation has changed to data1
383 pub const DISPLAY_ORIENTATION: Self = Self((0x151 as Uint32));
384 /// Display has been added to the system
385 pub const DISPLAY_ADDED: Self = Self((338 as Uint32));
386 /// Display has been removed from the system
387 pub const DISPLAY_REMOVED: Self = Self((339 as Uint32));
388 /// Display has changed position
389 pub const DISPLAY_MOVED: Self = Self((340 as Uint32));
390 /// Display has changed desktop mode
391 pub const DISPLAY_DESKTOP_MODE_CHANGED: Self = Self((341 as Uint32));
392 /// Display has changed current mode
393 pub const DISPLAY_CURRENT_MODE_CHANGED: Self = Self((342 as Uint32));
394 /// Display has changed content scale
395 pub const DISPLAY_CONTENT_SCALE_CHANGED: Self = Self((343 as Uint32));
396 /// Display has changed usable bounds
397 pub const DISPLAY_USABLE_BOUNDS_CHANGED: Self = Self((344 as Uint32));
398 pub const DISPLAY_FIRST: Self = SDL_EVENT_DISPLAY_ORIENTATION;
399 pub const DISPLAY_LAST: Self = SDL_EVENT_DISPLAY_USABLE_BOUNDS_CHANGED;
400 /// Window has been shown
401 pub const WINDOW_SHOWN: Self = Self((0x202 as Uint32));
402 /// Window has been hidden
403 pub const WINDOW_HIDDEN: Self = Self((515 as Uint32));
404 /// Window has been exposed and should be redrawn, and can be redrawn directly from event watchers for this event.
405 /// data1 is 1 for live-resize expose events, 0 otherwise.
406 pub const WINDOW_EXPOSED: Self = Self((516 as Uint32));
407 /// Window has been moved to data1, data2
408 pub const WINDOW_MOVED: Self = Self((517 as Uint32));
409 /// Window has been resized to data1xdata2
410 pub const WINDOW_RESIZED: Self = Self((518 as Uint32));
411 /// The pixel size of the window has changed to data1xdata2
412 pub const WINDOW_PIXEL_SIZE_CHANGED: Self = Self((519 as Uint32));
413 /// The pixel size of a Metal view associated with the window has changed
414 pub const WINDOW_METAL_VIEW_RESIZED: Self = Self((520 as Uint32));
415 /// Window has been minimized
416 pub const WINDOW_MINIMIZED: Self = Self((521 as Uint32));
417 /// Window has been maximized
418 pub const WINDOW_MAXIMIZED: Self = Self((522 as Uint32));
419 /// Window has been restored to normal size and position
420 pub const WINDOW_RESTORED: Self = Self((523 as Uint32));
421 /// Window has gained mouse focus
422 pub const WINDOW_MOUSE_ENTER: Self = Self((524 as Uint32));
423 /// Window has lost mouse focus
424 pub const WINDOW_MOUSE_LEAVE: Self = Self((525 as Uint32));
425 /// Window has gained keyboard focus
426 pub const WINDOW_FOCUS_GAINED: Self = Self((526 as Uint32));
427 /// Window has lost keyboard focus
428 pub const WINDOW_FOCUS_LOST: Self = Self((527 as Uint32));
429 /// The window manager requests that the window be closed
430 pub const WINDOW_CLOSE_REQUESTED: Self = Self((528 as Uint32));
431 /// Window had a hit test that wasn't [`SDL_HITTEST_NORMAL`]
432 pub const WINDOW_HIT_TEST: Self = Self((529 as Uint32));
433 /// The ICC profile of the window's display has changed
434 pub const WINDOW_ICCPROF_CHANGED: Self = Self((530 as Uint32));
435 /// Window has been moved to display data1
436 pub const WINDOW_DISPLAY_CHANGED: Self = Self((531 as Uint32));
437 /// Window display scale has been changed
438 pub const WINDOW_DISPLAY_SCALE_CHANGED: Self = Self((532 as Uint32));
439 /// The window safe area has been changed
440 pub const WINDOW_SAFE_AREA_CHANGED: Self = Self((533 as Uint32));
441 /// The window has been occluded
442 pub const WINDOW_OCCLUDED: Self = Self((534 as Uint32));
443 /// The window has entered fullscreen mode
444 pub const WINDOW_ENTER_FULLSCREEN: Self = Self((535 as Uint32));
445 /// The window has left fullscreen mode
446 pub const WINDOW_LEAVE_FULLSCREEN: Self = Self((536 as Uint32));
447 /// The window with the associated ID is being or has been destroyed. If this message is being handled
448 /// in an event watcher, the window handle is still valid and can still be used to retrieve any properties
449 /// associated with the window. Otherwise, the handle has already been destroyed and all resources
450 /// associated with it are invalid
451 pub const WINDOW_DESTROYED: Self = Self((537 as Uint32));
452 /// Window HDR properties have changed
453 pub const WINDOW_HDR_STATE_CHANGED: Self = Self((538 as Uint32));
454 pub const WINDOW_FIRST: Self = SDL_EVENT_WINDOW_SHOWN;
455 pub const WINDOW_LAST: Self = SDL_EVENT_WINDOW_HDR_STATE_CHANGED;
456 /// Key pressed
457 pub const KEY_DOWN: Self = Self((0x300 as Uint32));
458 /// Key released
459 pub const KEY_UP: Self = Self((769 as Uint32));
460 /// Keyboard text editing (composition)
461 pub const TEXT_EDITING: Self = Self((770 as Uint32));
462 /// Keyboard text input
463 pub const TEXT_INPUT: Self = Self((771 as Uint32));
464 /// Keymap changed due to a system event such as an
465 /// input language or keyboard layout change.
466 pub const KEYMAP_CHANGED: Self = Self((772 as Uint32));
467 /// A new keyboard has been inserted into the system
468 pub const KEYBOARD_ADDED: Self = Self((773 as Uint32));
469 /// A keyboard has been removed
470 pub const KEYBOARD_REMOVED: Self = Self((774 as Uint32));
471 /// Keyboard text editing candidates
472 pub const TEXT_EDITING_CANDIDATES: Self = Self((775 as Uint32));
473 /// The on-screen keyboard has been shown
474 pub const SCREEN_KEYBOARD_SHOWN: Self = Self((776 as Uint32));
475 /// The on-screen keyboard has been hidden
476 pub const SCREEN_KEYBOARD_HIDDEN: Self = Self((777 as Uint32));
477 /// Mouse moved
478 pub const MOUSE_MOTION: Self = Self((0x400 as Uint32));
479 /// Mouse button pressed
480 pub const MOUSE_BUTTON_DOWN: Self = Self((1025 as Uint32));
481 /// Mouse button released
482 pub const MOUSE_BUTTON_UP: Self = Self((1026 as Uint32));
483 /// Mouse wheel motion
484 pub const MOUSE_WHEEL: Self = Self((1027 as Uint32));
485 /// A new mouse has been inserted into the system
486 pub const MOUSE_ADDED: Self = Self((1028 as Uint32));
487 /// A mouse has been removed
488 pub const MOUSE_REMOVED: Self = Self((1029 as Uint32));
489 /// Joystick axis motion
490 pub const JOYSTICK_AXIS_MOTION: Self = Self((0x600 as Uint32));
491 /// Joystick trackball motion
492 pub const JOYSTICK_BALL_MOTION: Self = Self((1537 as Uint32));
493 /// Joystick hat position change
494 pub const JOYSTICK_HAT_MOTION: Self = Self((1538 as Uint32));
495 /// Joystick button pressed
496 pub const JOYSTICK_BUTTON_DOWN: Self = Self((1539 as Uint32));
497 /// Joystick button released
498 pub const JOYSTICK_BUTTON_UP: Self = Self((1540 as Uint32));
499 /// A new joystick has been inserted into the system
500 pub const JOYSTICK_ADDED: Self = Self((1541 as Uint32));
501 /// An opened joystick has been removed
502 pub const JOYSTICK_REMOVED: Self = Self((1542 as Uint32));
503 /// Joystick battery level change
504 pub const JOYSTICK_BATTERY_UPDATED: Self = Self((1543 as Uint32));
505 /// Joystick update is complete
506 pub const JOYSTICK_UPDATE_COMPLETE: Self = Self((1544 as Uint32));
507 /// Gamepad axis motion
508 pub const GAMEPAD_AXIS_MOTION: Self = Self((0x650 as Uint32));
509 /// Gamepad button pressed
510 pub const GAMEPAD_BUTTON_DOWN: Self = Self((1617 as Uint32));
511 /// Gamepad button released
512 pub const GAMEPAD_BUTTON_UP: Self = Self((1618 as Uint32));
513 /// A new gamepad has been inserted into the system
514 pub const GAMEPAD_ADDED: Self = Self((1619 as Uint32));
515 /// A gamepad has been removed
516 pub const GAMEPAD_REMOVED: Self = Self((1620 as Uint32));
517 /// The gamepad mapping was updated
518 pub const GAMEPAD_REMAPPED: Self = Self((1621 as Uint32));
519 /// Gamepad touchpad was touched
520 pub const GAMEPAD_TOUCHPAD_DOWN: Self = Self((1622 as Uint32));
521 /// Gamepad touchpad finger was moved
522 pub const GAMEPAD_TOUCHPAD_MOTION: Self = Self((1623 as Uint32));
523 /// Gamepad touchpad finger was lifted
524 pub const GAMEPAD_TOUCHPAD_UP: Self = Self((1624 as Uint32));
525 /// Gamepad sensor was updated
526 pub const GAMEPAD_SENSOR_UPDATE: Self = Self((1625 as Uint32));
527 /// Gamepad update is complete
528 pub const GAMEPAD_UPDATE_COMPLETE: Self = Self((1626 as Uint32));
529 /// Gamepad Steam handle has changed
530 pub const GAMEPAD_STEAM_HANDLE_UPDATED: Self = Self((1627 as Uint32));
531 pub const FINGER_DOWN: Self = Self((0x700 as Uint32));
532 pub const FINGER_UP: Self = Self((1793 as Uint32));
533 pub const FINGER_MOTION: Self = Self((1794 as Uint32));
534 pub const FINGER_CANCELED: Self = Self((1795 as Uint32));
535 /// Pinch gesture started
536 pub const PINCH_BEGIN: Self = Self((0x710 as Uint32));
537 /// Pinch gesture updated
538 pub const PINCH_UPDATE: Self = Self((1809 as Uint32));
539 /// Pinch gesture ended
540 pub const PINCH_END: Self = Self((1810 as Uint32));
541 /// The clipboard changed
542 pub const CLIPBOARD_UPDATE: Self = Self((0x900 as Uint32));
543 /// The system requests a file open
544 pub const DROP_FILE: Self = Self((0x1000 as Uint32));
545 /// text/plain drag-and-drop event
546 pub const DROP_TEXT: Self = Self((4097 as Uint32));
547 /// A new set of drops is beginning (NULL filename)
548 pub const DROP_BEGIN: Self = Self((4098 as Uint32));
549 /// Current set of drops is now complete (NULL filename)
550 pub const DROP_COMPLETE: Self = Self((4099 as Uint32));
551 /// Position while moving over the window
552 pub const DROP_POSITION: Self = Self((4100 as Uint32));
553 /// A new audio device is available
554 pub const AUDIO_DEVICE_ADDED: Self = Self((0x1100 as Uint32));
555 /// An audio device has been removed.
556 pub const AUDIO_DEVICE_REMOVED: Self = Self((4353 as Uint32));
557 /// An audio device's format has been changed by the system.
558 pub const AUDIO_DEVICE_FORMAT_CHANGED: Self = Self((4354 as Uint32));
559 /// A sensor was updated
560 pub const SENSOR_UPDATE: Self = Self((0x1200 as Uint32));
561 /// Pressure-sensitive pen has become available
562 pub const PEN_PROXIMITY_IN: Self = Self((0x1300 as Uint32));
563 /// Pressure-sensitive pen has become unavailable
564 pub const PEN_PROXIMITY_OUT: Self = Self((4865 as Uint32));
565 /// Pressure-sensitive pen touched drawing surface
566 pub const PEN_DOWN: Self = Self((4866 as Uint32));
567 /// Pressure-sensitive pen stopped touching drawing surface
568 pub const PEN_UP: Self = Self((4867 as Uint32));
569 /// Pressure-sensitive pen button pressed
570 pub const PEN_BUTTON_DOWN: Self = Self((4868 as Uint32));
571 /// Pressure-sensitive pen button released
572 pub const PEN_BUTTON_UP: Self = Self((4869 as Uint32));
573 /// Pressure-sensitive pen is moving on the tablet
574 pub const PEN_MOTION: Self = Self((4870 as Uint32));
575 /// Pressure-sensitive pen angle/pressure/etc changed
576 pub const PEN_AXIS: Self = Self((4871 as Uint32));
577 /// A new camera device is available
578 pub const CAMERA_DEVICE_ADDED: Self = Self((0x1400 as Uint32));
579 /// A camera device has been removed.
580 pub const CAMERA_DEVICE_REMOVED: Self = Self((5121 as Uint32));
581 /// A camera device has been approved for use by the user.
582 pub const CAMERA_DEVICE_APPROVED: Self = Self((5122 as Uint32));
583 /// A camera device has been denied for use by the user.
584 pub const CAMERA_DEVICE_DENIED: Self = Self((5123 as Uint32));
585 /// The render targets have been reset and their contents need to be updated
586 pub const RENDER_TARGETS_RESET: Self = Self((0x2000 as Uint32));
587 /// The device has been reset and all textures need to be recreated
588 pub const RENDER_DEVICE_RESET: Self = Self((8193 as Uint32));
589 /// The device has been lost and can't be recovered.
590 pub const RENDER_DEVICE_LOST: Self = Self((8194 as Uint32));
591 pub const PRIVATE0: Self = Self((0x4000 as Uint32));
592 pub const PRIVATE1: Self = Self((16385 as Uint32));
593 pub const PRIVATE2: Self = Self((16386 as Uint32));
594 pub const PRIVATE3: Self = Self((16387 as Uint32));
595 /// Signals the end of an event poll cycle
596 pub const POLL_SENTINEL: Self = Self((0x7f00 as Uint32));
597 /// Events [`SDL_EVENT_USER`] through [`SDL_EVENT_LAST`] are for your use,
598 /// and should be allocated with [`SDL_RegisterEvents()`]
599 pub const USER: Self = Self((0x8000 as Uint32));
600 /// * This last event is only for bounding internal arrays
601 pub const LAST: Self = Self((0xffff as Uint32));
602 pub const ENUM_PADDING: Self = Self((0x7fffffff as Uint32));
603}
604
605/// Unused (do not remove)
606pub const SDL_EVENT_FIRST: SDL_EventType = SDL_EventType::FIRST;
607/// User-requested quit
608pub const SDL_EVENT_QUIT: SDL_EventType = SDL_EventType::QUIT;
609/// The application is being terminated by the OS. This event must be handled in a callback set with [`SDL_AddEventWatch()`].
610/// Called on iOS in applicationWillTerminate()
611/// Called on Android in onDestroy()
612pub const SDL_EVENT_TERMINATING: SDL_EventType = SDL_EventType::TERMINATING;
613/// The application is low on memory, free memory if possible. This event must be handled in a callback set with [`SDL_AddEventWatch()`].
614/// Called on iOS in applicationDidReceiveMemoryWarning()
615/// Called on Android in onTrimMemory()
616pub const SDL_EVENT_LOW_MEMORY: SDL_EventType = SDL_EventType::LOW_MEMORY;
617/// The application is about to enter the background. This event must be handled in a callback set with [`SDL_AddEventWatch()`].
618/// Called on iOS in applicationWillResignActive()
619/// Called on Android in onPause()
620pub const SDL_EVENT_WILL_ENTER_BACKGROUND: SDL_EventType = SDL_EventType::WILL_ENTER_BACKGROUND;
621/// 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()`].
622/// Called on iOS in applicationDidEnterBackground()
623/// Called on Android in onPause()
624pub const SDL_EVENT_DID_ENTER_BACKGROUND: SDL_EventType = SDL_EventType::DID_ENTER_BACKGROUND;
625/// The application is about to enter the foreground. This event must be handled in a callback set with [`SDL_AddEventWatch()`].
626/// Called on iOS in applicationWillEnterForeground()
627/// Called on Android in onResume()
628pub const SDL_EVENT_WILL_ENTER_FOREGROUND: SDL_EventType = SDL_EventType::WILL_ENTER_FOREGROUND;
629/// The application is now interactive. This event must be handled in a callback set with [`SDL_AddEventWatch()`].
630/// Called on iOS in applicationDidBecomeActive()
631/// Called on Android in onResume()
632pub const SDL_EVENT_DID_ENTER_FOREGROUND: SDL_EventType = SDL_EventType::DID_ENTER_FOREGROUND;
633/// The user's locale preferences have changed.
634pub const SDL_EVENT_LOCALE_CHANGED: SDL_EventType = SDL_EventType::LOCALE_CHANGED;
635/// The system theme changed
636pub const SDL_EVENT_SYSTEM_THEME_CHANGED: SDL_EventType = SDL_EventType::SYSTEM_THEME_CHANGED;
637/// Display orientation has changed to data1
638pub const SDL_EVENT_DISPLAY_ORIENTATION: SDL_EventType = SDL_EventType::DISPLAY_ORIENTATION;
639/// Display has been added to the system
640pub const SDL_EVENT_DISPLAY_ADDED: SDL_EventType = SDL_EventType::DISPLAY_ADDED;
641/// Display has been removed from the system
642pub const SDL_EVENT_DISPLAY_REMOVED: SDL_EventType = SDL_EventType::DISPLAY_REMOVED;
643/// Display has changed position
644pub const SDL_EVENT_DISPLAY_MOVED: SDL_EventType = SDL_EventType::DISPLAY_MOVED;
645/// Display has changed desktop mode
646pub const SDL_EVENT_DISPLAY_DESKTOP_MODE_CHANGED: SDL_EventType =
647 SDL_EventType::DISPLAY_DESKTOP_MODE_CHANGED;
648/// Display has changed current mode
649pub const SDL_EVENT_DISPLAY_CURRENT_MODE_CHANGED: SDL_EventType =
650 SDL_EventType::DISPLAY_CURRENT_MODE_CHANGED;
651/// Display has changed content scale
652pub const SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED: SDL_EventType =
653 SDL_EventType::DISPLAY_CONTENT_SCALE_CHANGED;
654/// Display has changed usable bounds
655pub const SDL_EVENT_DISPLAY_USABLE_BOUNDS_CHANGED: SDL_EventType =
656 SDL_EventType::DISPLAY_USABLE_BOUNDS_CHANGED;
657pub const SDL_EVENT_DISPLAY_FIRST: SDL_EventType = SDL_EventType::DISPLAY_FIRST;
658pub const SDL_EVENT_DISPLAY_LAST: SDL_EventType = SDL_EventType::DISPLAY_LAST;
659/// Window has been shown
660pub const SDL_EVENT_WINDOW_SHOWN: SDL_EventType = SDL_EventType::WINDOW_SHOWN;
661/// Window has been hidden
662pub const SDL_EVENT_WINDOW_HIDDEN: SDL_EventType = SDL_EventType::WINDOW_HIDDEN;
663/// Window has been exposed and should be redrawn, and can be redrawn directly from event watchers for this event.
664/// data1 is 1 for live-resize expose events, 0 otherwise.
665pub const SDL_EVENT_WINDOW_EXPOSED: SDL_EventType = SDL_EventType::WINDOW_EXPOSED;
666/// Window has been moved to data1, data2
667pub const SDL_EVENT_WINDOW_MOVED: SDL_EventType = SDL_EventType::WINDOW_MOVED;
668/// Window has been resized to data1xdata2
669pub const SDL_EVENT_WINDOW_RESIZED: SDL_EventType = SDL_EventType::WINDOW_RESIZED;
670/// The pixel size of the window has changed to data1xdata2
671pub const SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED: SDL_EventType =
672 SDL_EventType::WINDOW_PIXEL_SIZE_CHANGED;
673/// The pixel size of a Metal view associated with the window has changed
674pub const SDL_EVENT_WINDOW_METAL_VIEW_RESIZED: SDL_EventType =
675 SDL_EventType::WINDOW_METAL_VIEW_RESIZED;
676/// Window has been minimized
677pub const SDL_EVENT_WINDOW_MINIMIZED: SDL_EventType = SDL_EventType::WINDOW_MINIMIZED;
678/// Window has been maximized
679pub const SDL_EVENT_WINDOW_MAXIMIZED: SDL_EventType = SDL_EventType::WINDOW_MAXIMIZED;
680/// Window has been restored to normal size and position
681pub const SDL_EVENT_WINDOW_RESTORED: SDL_EventType = SDL_EventType::WINDOW_RESTORED;
682/// Window has gained mouse focus
683pub const SDL_EVENT_WINDOW_MOUSE_ENTER: SDL_EventType = SDL_EventType::WINDOW_MOUSE_ENTER;
684/// Window has lost mouse focus
685pub const SDL_EVENT_WINDOW_MOUSE_LEAVE: SDL_EventType = SDL_EventType::WINDOW_MOUSE_LEAVE;
686/// Window has gained keyboard focus
687pub const SDL_EVENT_WINDOW_FOCUS_GAINED: SDL_EventType = SDL_EventType::WINDOW_FOCUS_GAINED;
688/// Window has lost keyboard focus
689pub const SDL_EVENT_WINDOW_FOCUS_LOST: SDL_EventType = SDL_EventType::WINDOW_FOCUS_LOST;
690/// The window manager requests that the window be closed
691pub const SDL_EVENT_WINDOW_CLOSE_REQUESTED: SDL_EventType = SDL_EventType::WINDOW_CLOSE_REQUESTED;
692/// Window had a hit test that wasn't [`SDL_HITTEST_NORMAL`]
693pub const SDL_EVENT_WINDOW_HIT_TEST: SDL_EventType = SDL_EventType::WINDOW_HIT_TEST;
694/// The ICC profile of the window's display has changed
695pub const SDL_EVENT_WINDOW_ICCPROF_CHANGED: SDL_EventType = SDL_EventType::WINDOW_ICCPROF_CHANGED;
696/// Window has been moved to display data1
697pub const SDL_EVENT_WINDOW_DISPLAY_CHANGED: SDL_EventType = SDL_EventType::WINDOW_DISPLAY_CHANGED;
698/// Window display scale has been changed
699pub const SDL_EVENT_WINDOW_DISPLAY_SCALE_CHANGED: SDL_EventType =
700 SDL_EventType::WINDOW_DISPLAY_SCALE_CHANGED;
701/// The window safe area has been changed
702pub const SDL_EVENT_WINDOW_SAFE_AREA_CHANGED: SDL_EventType =
703 SDL_EventType::WINDOW_SAFE_AREA_CHANGED;
704/// The window has been occluded
705pub const SDL_EVENT_WINDOW_OCCLUDED: SDL_EventType = SDL_EventType::WINDOW_OCCLUDED;
706/// The window has entered fullscreen mode
707pub const SDL_EVENT_WINDOW_ENTER_FULLSCREEN: SDL_EventType = SDL_EventType::WINDOW_ENTER_FULLSCREEN;
708/// The window has left fullscreen mode
709pub const SDL_EVENT_WINDOW_LEAVE_FULLSCREEN: SDL_EventType = SDL_EventType::WINDOW_LEAVE_FULLSCREEN;
710/// The window with the associated ID is being or has been destroyed. If this message is being handled
711/// in an event watcher, the window handle is still valid and can still be used to retrieve any properties
712/// associated with the window. Otherwise, the handle has already been destroyed and all resources
713/// associated with it are invalid
714pub const SDL_EVENT_WINDOW_DESTROYED: SDL_EventType = SDL_EventType::WINDOW_DESTROYED;
715/// Window HDR properties have changed
716pub const SDL_EVENT_WINDOW_HDR_STATE_CHANGED: SDL_EventType =
717 SDL_EventType::WINDOW_HDR_STATE_CHANGED;
718pub const SDL_EVENT_WINDOW_FIRST: SDL_EventType = SDL_EventType::WINDOW_FIRST;
719pub const SDL_EVENT_WINDOW_LAST: SDL_EventType = SDL_EventType::WINDOW_LAST;
720/// Key pressed
721pub const SDL_EVENT_KEY_DOWN: SDL_EventType = SDL_EventType::KEY_DOWN;
722/// Key released
723pub const SDL_EVENT_KEY_UP: SDL_EventType = SDL_EventType::KEY_UP;
724/// Keyboard text editing (composition)
725pub const SDL_EVENT_TEXT_EDITING: SDL_EventType = SDL_EventType::TEXT_EDITING;
726/// Keyboard text input
727pub const SDL_EVENT_TEXT_INPUT: SDL_EventType = SDL_EventType::TEXT_INPUT;
728/// Keymap changed due to a system event such as an
729/// input language or keyboard layout change.
730pub const SDL_EVENT_KEYMAP_CHANGED: SDL_EventType = SDL_EventType::KEYMAP_CHANGED;
731/// A new keyboard has been inserted into the system
732pub const SDL_EVENT_KEYBOARD_ADDED: SDL_EventType = SDL_EventType::KEYBOARD_ADDED;
733/// A keyboard has been removed
734pub const SDL_EVENT_KEYBOARD_REMOVED: SDL_EventType = SDL_EventType::KEYBOARD_REMOVED;
735/// Keyboard text editing candidates
736pub const SDL_EVENT_TEXT_EDITING_CANDIDATES: SDL_EventType = SDL_EventType::TEXT_EDITING_CANDIDATES;
737/// The on-screen keyboard has been shown
738pub const SDL_EVENT_SCREEN_KEYBOARD_SHOWN: SDL_EventType = SDL_EventType::SCREEN_KEYBOARD_SHOWN;
739/// The on-screen keyboard has been hidden
740pub const SDL_EVENT_SCREEN_KEYBOARD_HIDDEN: SDL_EventType = SDL_EventType::SCREEN_KEYBOARD_HIDDEN;
741/// Mouse moved
742pub const SDL_EVENT_MOUSE_MOTION: SDL_EventType = SDL_EventType::MOUSE_MOTION;
743/// Mouse button pressed
744pub const SDL_EVENT_MOUSE_BUTTON_DOWN: SDL_EventType = SDL_EventType::MOUSE_BUTTON_DOWN;
745/// Mouse button released
746pub const SDL_EVENT_MOUSE_BUTTON_UP: SDL_EventType = SDL_EventType::MOUSE_BUTTON_UP;
747/// Mouse wheel motion
748pub const SDL_EVENT_MOUSE_WHEEL: SDL_EventType = SDL_EventType::MOUSE_WHEEL;
749/// A new mouse has been inserted into the system
750pub const SDL_EVENT_MOUSE_ADDED: SDL_EventType = SDL_EventType::MOUSE_ADDED;
751/// A mouse has been removed
752pub const SDL_EVENT_MOUSE_REMOVED: SDL_EventType = SDL_EventType::MOUSE_REMOVED;
753/// Joystick axis motion
754pub const SDL_EVENT_JOYSTICK_AXIS_MOTION: SDL_EventType = SDL_EventType::JOYSTICK_AXIS_MOTION;
755/// Joystick trackball motion
756pub const SDL_EVENT_JOYSTICK_BALL_MOTION: SDL_EventType = SDL_EventType::JOYSTICK_BALL_MOTION;
757/// Joystick hat position change
758pub const SDL_EVENT_JOYSTICK_HAT_MOTION: SDL_EventType = SDL_EventType::JOYSTICK_HAT_MOTION;
759/// Joystick button pressed
760pub const SDL_EVENT_JOYSTICK_BUTTON_DOWN: SDL_EventType = SDL_EventType::JOYSTICK_BUTTON_DOWN;
761/// Joystick button released
762pub const SDL_EVENT_JOYSTICK_BUTTON_UP: SDL_EventType = SDL_EventType::JOYSTICK_BUTTON_UP;
763/// A new joystick has been inserted into the system
764pub const SDL_EVENT_JOYSTICK_ADDED: SDL_EventType = SDL_EventType::JOYSTICK_ADDED;
765/// An opened joystick has been removed
766pub const SDL_EVENT_JOYSTICK_REMOVED: SDL_EventType = SDL_EventType::JOYSTICK_REMOVED;
767/// Joystick battery level change
768pub const SDL_EVENT_JOYSTICK_BATTERY_UPDATED: SDL_EventType =
769 SDL_EventType::JOYSTICK_BATTERY_UPDATED;
770/// Joystick update is complete
771pub const SDL_EVENT_JOYSTICK_UPDATE_COMPLETE: SDL_EventType =
772 SDL_EventType::JOYSTICK_UPDATE_COMPLETE;
773/// Gamepad axis motion
774pub const SDL_EVENT_GAMEPAD_AXIS_MOTION: SDL_EventType = SDL_EventType::GAMEPAD_AXIS_MOTION;
775/// Gamepad button pressed
776pub const SDL_EVENT_GAMEPAD_BUTTON_DOWN: SDL_EventType = SDL_EventType::GAMEPAD_BUTTON_DOWN;
777/// Gamepad button released
778pub const SDL_EVENT_GAMEPAD_BUTTON_UP: SDL_EventType = SDL_EventType::GAMEPAD_BUTTON_UP;
779/// A new gamepad has been inserted into the system
780pub const SDL_EVENT_GAMEPAD_ADDED: SDL_EventType = SDL_EventType::GAMEPAD_ADDED;
781/// A gamepad has been removed
782pub const SDL_EVENT_GAMEPAD_REMOVED: SDL_EventType = SDL_EventType::GAMEPAD_REMOVED;
783/// The gamepad mapping was updated
784pub const SDL_EVENT_GAMEPAD_REMAPPED: SDL_EventType = SDL_EventType::GAMEPAD_REMAPPED;
785/// Gamepad touchpad was touched
786pub const SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN: SDL_EventType = SDL_EventType::GAMEPAD_TOUCHPAD_DOWN;
787/// Gamepad touchpad finger was moved
788pub const SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION: SDL_EventType = SDL_EventType::GAMEPAD_TOUCHPAD_MOTION;
789/// Gamepad touchpad finger was lifted
790pub const SDL_EVENT_GAMEPAD_TOUCHPAD_UP: SDL_EventType = SDL_EventType::GAMEPAD_TOUCHPAD_UP;
791/// Gamepad sensor was updated
792pub const SDL_EVENT_GAMEPAD_SENSOR_UPDATE: SDL_EventType = SDL_EventType::GAMEPAD_SENSOR_UPDATE;
793/// Gamepad update is complete
794pub const SDL_EVENT_GAMEPAD_UPDATE_COMPLETE: SDL_EventType = SDL_EventType::GAMEPAD_UPDATE_COMPLETE;
795/// Gamepad Steam handle has changed
796pub const SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED: SDL_EventType =
797 SDL_EventType::GAMEPAD_STEAM_HANDLE_UPDATED;
798pub const SDL_EVENT_FINGER_DOWN: SDL_EventType = SDL_EventType::FINGER_DOWN;
799pub const SDL_EVENT_FINGER_UP: SDL_EventType = SDL_EventType::FINGER_UP;
800pub const SDL_EVENT_FINGER_MOTION: SDL_EventType = SDL_EventType::FINGER_MOTION;
801pub const SDL_EVENT_FINGER_CANCELED: SDL_EventType = SDL_EventType::FINGER_CANCELED;
802/// Pinch gesture started
803pub const SDL_EVENT_PINCH_BEGIN: SDL_EventType = SDL_EventType::PINCH_BEGIN;
804/// Pinch gesture updated
805pub const SDL_EVENT_PINCH_UPDATE: SDL_EventType = SDL_EventType::PINCH_UPDATE;
806/// Pinch gesture ended
807pub const SDL_EVENT_PINCH_END: SDL_EventType = SDL_EventType::PINCH_END;
808/// The clipboard changed
809pub const SDL_EVENT_CLIPBOARD_UPDATE: SDL_EventType = SDL_EventType::CLIPBOARD_UPDATE;
810/// The system requests a file open
811pub const SDL_EVENT_DROP_FILE: SDL_EventType = SDL_EventType::DROP_FILE;
812/// text/plain drag-and-drop event
813pub const SDL_EVENT_DROP_TEXT: SDL_EventType = SDL_EventType::DROP_TEXT;
814/// A new set of drops is beginning (NULL filename)
815pub const SDL_EVENT_DROP_BEGIN: SDL_EventType = SDL_EventType::DROP_BEGIN;
816/// Current set of drops is now complete (NULL filename)
817pub const SDL_EVENT_DROP_COMPLETE: SDL_EventType = SDL_EventType::DROP_COMPLETE;
818/// Position while moving over the window
819pub const SDL_EVENT_DROP_POSITION: SDL_EventType = SDL_EventType::DROP_POSITION;
820/// A new audio device is available
821pub const SDL_EVENT_AUDIO_DEVICE_ADDED: SDL_EventType = SDL_EventType::AUDIO_DEVICE_ADDED;
822/// An audio device has been removed.
823pub const SDL_EVENT_AUDIO_DEVICE_REMOVED: SDL_EventType = SDL_EventType::AUDIO_DEVICE_REMOVED;
824/// An audio device's format has been changed by the system.
825pub const SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED: SDL_EventType =
826 SDL_EventType::AUDIO_DEVICE_FORMAT_CHANGED;
827/// A sensor was updated
828pub const SDL_EVENT_SENSOR_UPDATE: SDL_EventType = SDL_EventType::SENSOR_UPDATE;
829/// Pressure-sensitive pen has become available
830pub const SDL_EVENT_PEN_PROXIMITY_IN: SDL_EventType = SDL_EventType::PEN_PROXIMITY_IN;
831/// Pressure-sensitive pen has become unavailable
832pub const SDL_EVENT_PEN_PROXIMITY_OUT: SDL_EventType = SDL_EventType::PEN_PROXIMITY_OUT;
833/// Pressure-sensitive pen touched drawing surface
834pub const SDL_EVENT_PEN_DOWN: SDL_EventType = SDL_EventType::PEN_DOWN;
835/// Pressure-sensitive pen stopped touching drawing surface
836pub const SDL_EVENT_PEN_UP: SDL_EventType = SDL_EventType::PEN_UP;
837/// Pressure-sensitive pen button pressed
838pub const SDL_EVENT_PEN_BUTTON_DOWN: SDL_EventType = SDL_EventType::PEN_BUTTON_DOWN;
839/// Pressure-sensitive pen button released
840pub const SDL_EVENT_PEN_BUTTON_UP: SDL_EventType = SDL_EventType::PEN_BUTTON_UP;
841/// Pressure-sensitive pen is moving on the tablet
842pub const SDL_EVENT_PEN_MOTION: SDL_EventType = SDL_EventType::PEN_MOTION;
843/// Pressure-sensitive pen angle/pressure/etc changed
844pub const SDL_EVENT_PEN_AXIS: SDL_EventType = SDL_EventType::PEN_AXIS;
845/// A new camera device is available
846pub const SDL_EVENT_CAMERA_DEVICE_ADDED: SDL_EventType = SDL_EventType::CAMERA_DEVICE_ADDED;
847/// A camera device has been removed.
848pub const SDL_EVENT_CAMERA_DEVICE_REMOVED: SDL_EventType = SDL_EventType::CAMERA_DEVICE_REMOVED;
849/// A camera device has been approved for use by the user.
850pub const SDL_EVENT_CAMERA_DEVICE_APPROVED: SDL_EventType = SDL_EventType::CAMERA_DEVICE_APPROVED;
851/// A camera device has been denied for use by the user.
852pub const SDL_EVENT_CAMERA_DEVICE_DENIED: SDL_EventType = SDL_EventType::CAMERA_DEVICE_DENIED;
853/// The render targets have been reset and their contents need to be updated
854pub const SDL_EVENT_RENDER_TARGETS_RESET: SDL_EventType = SDL_EventType::RENDER_TARGETS_RESET;
855/// The device has been reset and all textures need to be recreated
856pub const SDL_EVENT_RENDER_DEVICE_RESET: SDL_EventType = SDL_EventType::RENDER_DEVICE_RESET;
857/// The device has been lost and can't be recovered.
858pub const SDL_EVENT_RENDER_DEVICE_LOST: SDL_EventType = SDL_EventType::RENDER_DEVICE_LOST;
859pub const SDL_EVENT_PRIVATE0: SDL_EventType = SDL_EventType::PRIVATE0;
860pub const SDL_EVENT_PRIVATE1: SDL_EventType = SDL_EventType::PRIVATE1;
861pub const SDL_EVENT_PRIVATE2: SDL_EventType = SDL_EventType::PRIVATE2;
862pub const SDL_EVENT_PRIVATE3: SDL_EventType = SDL_EventType::PRIVATE3;
863/// Signals the end of an event poll cycle
864pub const SDL_EVENT_POLL_SENTINEL: SDL_EventType = SDL_EventType::POLL_SENTINEL;
865/// Events [`SDL_EVENT_USER`] through [`SDL_EVENT_LAST`] are for your use,
866/// and should be allocated with [`SDL_RegisterEvents()`]
867pub const SDL_EVENT_USER: SDL_EventType = SDL_EventType::USER;
868/// * This last event is only for bounding internal arrays
869pub const SDL_EVENT_LAST: SDL_EventType = SDL_EventType::LAST;
870pub const SDL_EVENT_ENUM_PADDING: SDL_EventType = SDL_EventType::ENUM_PADDING;
871
872#[cfg(feature = "metadata")]
873impl sdl3_sys::metadata::GroupMetadata for SDL_EventType {
874 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
875 &crate::metadata::events::METADATA_SDL_EventType;
876}
877
878/// Fields shared by every event
879///
880/// ## Availability
881/// This struct is available since SDL 3.2.0.
882#[repr(C)]
883#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
884#[cfg_attr(feature = "debug-impls", derive(Debug))]
885pub struct SDL_CommonEvent {
886 /// Event type, shared with all events, Uint32 to cover user events which are not in the [`SDL_EventType`] enumeration
887 pub r#type: Uint32,
888 pub reserved: Uint32,
889 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
890 pub timestamp: Uint64,
891}
892
893/// Display state change event data (event.display.*)
894///
895/// ## Availability
896/// This struct is available since SDL 3.2.0.
897#[repr(C)]
898#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
899#[cfg_attr(feature = "debug-impls", derive(Debug))]
900pub struct SDL_DisplayEvent {
901 /// SDL_EVENT_DISPLAY_*
902 pub r#type: SDL_EventType,
903 pub reserved: Uint32,
904 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
905 pub timestamp: Uint64,
906 /// The associated display
907 pub displayID: SDL_DisplayID,
908 /// event dependent data
909 pub data1: Sint32,
910 /// event dependent data
911 pub data2: Sint32,
912}
913
914/// Window state change event data (event.window.*)
915///
916/// ## Availability
917/// This struct is available since SDL 3.2.0.
918#[repr(C)]
919#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
920#[cfg_attr(feature = "debug-impls", derive(Debug))]
921pub struct SDL_WindowEvent {
922 /// SDL_EVENT_WINDOW_*
923 pub r#type: SDL_EventType,
924 pub reserved: Uint32,
925 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
926 pub timestamp: Uint64,
927 /// The associated window
928 pub windowID: SDL_WindowID,
929 /// event dependent data
930 pub data1: Sint32,
931 /// event dependent data
932 pub data2: Sint32,
933}
934
935/// Keyboard device event structure (event.kdevice.*)
936///
937/// ## Availability
938/// This struct is available since SDL 3.2.0.
939#[repr(C)]
940#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
941#[cfg_attr(feature = "debug-impls", derive(Debug))]
942pub struct SDL_KeyboardDeviceEvent {
943 /// [`SDL_EVENT_KEYBOARD_ADDED`] or [`SDL_EVENT_KEYBOARD_REMOVED`]
944 pub r#type: SDL_EventType,
945 pub reserved: Uint32,
946 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
947 pub timestamp: Uint64,
948 /// The keyboard instance id
949 pub which: SDL_KeyboardID,
950}
951
952/// Keyboard button event structure (event.key.*)
953///
954/// The `key` is the base [`SDL_Keycode`] generated by pressing the `scancode`
955/// using the current keyboard layout, applying any options specified in
956/// [`SDL_HINT_KEYCODE_OPTIONS`]. You can get the [`SDL_Keycode`] corresponding to the
957/// event scancode and modifiers directly from the keyboard layout, bypassing
958/// [`SDL_HINT_KEYCODE_OPTIONS`], by calling [`SDL_GetKeyFromScancode()`].
959///
960/// ## Availability
961/// This struct is available since SDL 3.2.0.
962///
963/// ## See also
964/// - [`SDL_GetKeyFromScancode`]
965/// - [`SDL_HINT_KEYCODE_OPTIONS`]
966#[repr(C)]
967#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
968#[cfg_attr(feature = "debug-impls", derive(Debug))]
969pub struct SDL_KeyboardEvent {
970 /// [`SDL_EVENT_KEY_DOWN`] or [`SDL_EVENT_KEY_UP`]
971 pub r#type: SDL_EventType,
972 pub reserved: Uint32,
973 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
974 pub timestamp: Uint64,
975 /// The window with keyboard focus, if any
976 pub windowID: SDL_WindowID,
977 /// The keyboard instance id, or 0 if unknown or virtual
978 pub which: SDL_KeyboardID,
979 /// SDL physical key code
980 pub scancode: SDL_Scancode,
981 /// SDL virtual key code
982 pub key: SDL_Keycode,
983 /// current key modifiers
984 pub r#mod: SDL_Keymod,
985 /// The platform dependent scancode for this event
986 pub raw: Uint16,
987 /// true if the key is pressed
988 pub down: ::core::primitive::bool,
989 /// true if this is a key repeat
990 pub repeat: ::core::primitive::bool,
991}
992
993/// Keyboard text editing event structure (event.edit.*)
994///
995/// The start cursor is the position, in UTF-8 characters, where new typing
996/// will be inserted into the editing text. The length is the number of UTF-8
997/// characters that will be replaced by new typing.
998///
999/// ## Availability
1000/// This struct is available since SDL 3.2.0.
1001#[repr(C)]
1002#[derive(Clone, Copy)]
1003#[cfg_attr(feature = "debug-impls", derive(Debug))]
1004pub struct SDL_TextEditingEvent {
1005 /// [`SDL_EVENT_TEXT_EDITING`]
1006 pub r#type: SDL_EventType,
1007 pub reserved: Uint32,
1008 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
1009 pub timestamp: Uint64,
1010 /// The window with keyboard focus, if any
1011 pub windowID: SDL_WindowID,
1012 /// The editing text
1013 pub text: *const ::core::ffi::c_char,
1014 /// The start cursor of selected editing text, or -1 if not set
1015 pub start: Sint32,
1016 /// The length of selected editing text, or -1 if not set
1017 pub length: Sint32,
1018}
1019
1020impl ::core::default::Default for SDL_TextEditingEvent {
1021 /// Initialize all fields to zero
1022 #[inline(always)]
1023 fn default() -> Self {
1024 unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
1025 }
1026}
1027
1028/// Keyboard IME candidates event structure (event.edit_candidates.*)
1029///
1030/// ## Availability
1031/// This struct is available since SDL 3.2.0.
1032///
1033/// ## Notes for `sdl3-sys`
1034/// This struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction.
1035#[repr(C)]
1036#[derive(Clone, Copy)]
1037#[cfg_attr(feature = "debug-impls", derive(Debug))]
1038pub struct SDL_TextEditingCandidatesEvent {
1039 /// [`SDL_EVENT_TEXT_EDITING_CANDIDATES`]
1040 pub r#type: SDL_EventType,
1041 pub reserved: Uint32,
1042 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
1043 pub timestamp: Uint64,
1044 /// The window with keyboard focus, if any
1045 pub windowID: SDL_WindowID,
1046 /// The list of candidates, or NULL if there are no candidates available
1047 pub candidates: *const *const ::core::ffi::c_char,
1048 /// The number of strings in `candidates`
1049 pub num_candidates: Sint32,
1050 /// The index of the selected candidate, or -1 if no candidate is selected
1051 pub selected_candidate: Sint32,
1052 /// true if the list is horizontal, false if it's vertical
1053 pub horizontal: ::core::primitive::bool,
1054 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
1055 pub padding1: Uint8,
1056 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
1057 pub padding2: Uint8,
1058 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
1059 pub padding3: Uint8,
1060}
1061
1062impl ::core::default::Default for SDL_TextEditingCandidatesEvent {
1063 /// Initialize all fields to zero
1064 #[inline(always)]
1065 fn default() -> Self {
1066 unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
1067 }
1068}
1069
1070/// Keyboard text input event structure (event.text.*)
1071///
1072/// This event will never be delivered unless text input is enabled by calling
1073/// [`SDL_StartTextInput()`]. Text input is disabled by default!
1074///
1075/// ## Availability
1076/// This struct is available since SDL 3.2.0.
1077///
1078/// ## See also
1079/// - [`SDL_StartTextInput`]
1080/// - [`SDL_StopTextInput`]
1081#[repr(C)]
1082#[derive(Clone, Copy)]
1083#[cfg_attr(feature = "debug-impls", derive(Debug))]
1084pub struct SDL_TextInputEvent {
1085 /// [`SDL_EVENT_TEXT_INPUT`]
1086 pub r#type: SDL_EventType,
1087 pub reserved: Uint32,
1088 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
1089 pub timestamp: Uint64,
1090 /// The window with keyboard focus, if any
1091 pub windowID: SDL_WindowID,
1092 /// The input text, UTF-8 encoded
1093 pub text: *const ::core::ffi::c_char,
1094}
1095
1096impl ::core::default::Default for SDL_TextInputEvent {
1097 /// Initialize all fields to zero
1098 #[inline(always)]
1099 fn default() -> Self {
1100 unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
1101 }
1102}
1103
1104/// Mouse device event structure (event.mdevice.*)
1105///
1106/// ## Availability
1107/// This struct is available since SDL 3.2.0.
1108#[repr(C)]
1109#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
1110#[cfg_attr(feature = "debug-impls", derive(Debug))]
1111pub struct SDL_MouseDeviceEvent {
1112 /// [`SDL_EVENT_MOUSE_ADDED`] or [`SDL_EVENT_MOUSE_REMOVED`]
1113 pub r#type: SDL_EventType,
1114 pub reserved: Uint32,
1115 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
1116 pub timestamp: Uint64,
1117 /// The mouse instance id
1118 pub which: SDL_MouseID,
1119}
1120
1121/// Mouse motion event structure (event.motion.*)
1122///
1123/// ## Availability
1124/// This struct is available since SDL 3.2.0.
1125#[repr(C)]
1126#[derive(Clone, Copy, Default, PartialEq)]
1127#[cfg_attr(feature = "debug-impls", derive(Debug))]
1128pub struct SDL_MouseMotionEvent {
1129 /// [`SDL_EVENT_MOUSE_MOTION`]
1130 pub r#type: SDL_EventType,
1131 pub reserved: Uint32,
1132 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
1133 pub timestamp: Uint64,
1134 /// The window with mouse focus, if any
1135 pub windowID: SDL_WindowID,
1136 /// The mouse instance id in relative mode, [`SDL_TOUCH_MOUSEID`] for touch events, or 0
1137 pub which: SDL_MouseID,
1138 /// The current button state
1139 pub state: SDL_MouseButtonFlags,
1140 /// X coordinate, relative to window
1141 pub x: ::core::ffi::c_float,
1142 /// Y coordinate, relative to window
1143 pub y: ::core::ffi::c_float,
1144 /// The relative motion in the X direction
1145 pub xrel: ::core::ffi::c_float,
1146 /// The relative motion in the Y direction
1147 pub yrel: ::core::ffi::c_float,
1148}
1149
1150/// Mouse button event structure (event.button.*)
1151///
1152/// ## Availability
1153/// This struct is available since SDL 3.2.0.
1154///
1155/// ## Notes for `sdl3-sys`
1156/// This struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction.
1157#[repr(C)]
1158#[derive(Clone, Copy, Default, PartialEq)]
1159#[cfg_attr(feature = "debug-impls", derive(Debug))]
1160pub struct SDL_MouseButtonEvent {
1161 /// [`SDL_EVENT_MOUSE_BUTTON_DOWN`] or [`SDL_EVENT_MOUSE_BUTTON_UP`]
1162 pub r#type: SDL_EventType,
1163 pub reserved: Uint32,
1164 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
1165 pub timestamp: Uint64,
1166 /// The window with mouse focus, if any
1167 pub windowID: SDL_WindowID,
1168 /// The mouse instance id in relative mode, [`SDL_TOUCH_MOUSEID`] for touch events, or 0
1169 pub which: SDL_MouseID,
1170 /// The mouse button index
1171 pub button: Uint8,
1172 /// true if the button is pressed
1173 pub down: ::core::primitive::bool,
1174 /// 1 for single-click, 2 for double-click, etc.
1175 pub clicks: Uint8,
1176 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
1177 pub padding: Uint8,
1178 /// X coordinate, relative to window
1179 pub x: ::core::ffi::c_float,
1180 /// Y coordinate, relative to window
1181 pub y: ::core::ffi::c_float,
1182}
1183
1184/// Mouse wheel event structure (event.wheel.*)
1185///
1186/// ## Availability
1187/// This struct is available since SDL 3.2.0.
1188#[repr(C)]
1189#[derive(Clone, Copy, Default, PartialEq)]
1190#[cfg_attr(feature = "debug-impls", derive(Debug))]
1191pub struct SDL_MouseWheelEvent {
1192 /// [`SDL_EVENT_MOUSE_WHEEL`]
1193 pub r#type: SDL_EventType,
1194 pub reserved: Uint32,
1195 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
1196 pub timestamp: Uint64,
1197 /// The window with mouse focus, if any
1198 pub windowID: SDL_WindowID,
1199 /// The mouse instance id in relative mode or 0
1200 pub which: SDL_MouseID,
1201 /// The amount scrolled horizontally, positive to the right and negative to the left
1202 pub x: ::core::ffi::c_float,
1203 /// The amount scrolled vertically, positive away from the user and negative toward the user
1204 pub y: ::core::ffi::c_float,
1205 /// 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
1206 pub direction: SDL_MouseWheelDirection,
1207 /// X coordinate, relative to window
1208 pub mouse_x: ::core::ffi::c_float,
1209 /// Y coordinate, relative to window
1210 pub mouse_y: ::core::ffi::c_float,
1211 /// The amount scrolled horizontally, accumulated to whole scroll "ticks" (added in 3.2.12)
1212 pub integer_x: Sint32,
1213 /// The amount scrolled vertically, accumulated to whole scroll "ticks" (added in 3.2.12)
1214 pub integer_y: Sint32,
1215}
1216
1217/// Joystick axis motion event structure (event.jaxis.*)
1218///
1219/// ## Availability
1220/// This struct is available since SDL 3.2.0.
1221///
1222/// ## Notes for `sdl3-sys`
1223/// This struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction.
1224#[repr(C)]
1225#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
1226#[cfg_attr(feature = "debug-impls", derive(Debug))]
1227pub struct SDL_JoyAxisEvent {
1228 /// [`SDL_EVENT_JOYSTICK_AXIS_MOTION`]
1229 pub r#type: SDL_EventType,
1230 pub reserved: Uint32,
1231 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
1232 pub timestamp: Uint64,
1233 /// The joystick instance id
1234 pub which: SDL_JoystickID,
1235 /// The joystick axis index
1236 pub axis: Uint8,
1237 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
1238 pub padding1: Uint8,
1239 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
1240 pub padding2: Uint8,
1241 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
1242 pub padding3: Uint8,
1243 /// The axis value (range: -32768 to 32767)
1244 pub value: Sint16,
1245 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
1246 pub padding4: Uint16,
1247}
1248
1249/// Joystick trackball motion event structure (event.jball.*)
1250///
1251/// ## Availability
1252/// This struct is available since SDL 3.2.0.
1253///
1254/// ## Notes for `sdl3-sys`
1255/// This struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction.
1256#[repr(C)]
1257#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
1258#[cfg_attr(feature = "debug-impls", derive(Debug))]
1259pub struct SDL_JoyBallEvent {
1260 /// [`SDL_EVENT_JOYSTICK_BALL_MOTION`]
1261 pub r#type: SDL_EventType,
1262 pub reserved: Uint32,
1263 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
1264 pub timestamp: Uint64,
1265 /// The joystick instance id
1266 pub which: SDL_JoystickID,
1267 /// The joystick trackball index
1268 pub ball: Uint8,
1269 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
1270 pub padding1: Uint8,
1271 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
1272 pub padding2: Uint8,
1273 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
1274 pub padding3: Uint8,
1275 /// The relative motion in the X direction
1276 pub xrel: Sint16,
1277 /// The relative motion in the Y direction
1278 pub yrel: Sint16,
1279}
1280
1281/// Joystick hat position change event structure (event.jhat.*)
1282///
1283/// ## Availability
1284/// This struct is available since SDL 3.2.0.
1285///
1286/// ## Notes for `sdl3-sys`
1287/// This struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction.
1288#[repr(C)]
1289#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
1290#[cfg_attr(feature = "debug-impls", derive(Debug))]
1291pub struct SDL_JoyHatEvent {
1292 /// [`SDL_EVENT_JOYSTICK_HAT_MOTION`]
1293 pub r#type: SDL_EventType,
1294 pub reserved: Uint32,
1295 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
1296 pub timestamp: Uint64,
1297 /// The joystick instance id
1298 pub which: SDL_JoystickID,
1299 /// The joystick hat index
1300 pub hat: Uint8,
1301 /// The hat position value.
1302 /// ## See also
1303 /// - [`SDL_HAT_LEFTUP`] [`SDL_HAT_UP`] [`SDL_HAT_RIGHTUP`]
1304 /// - [`SDL_HAT_LEFT`] [`SDL_HAT_CENTERED`] [`SDL_HAT_RIGHT`]
1305 /// - [`SDL_HAT_LEFTDOWN`] [`SDL_HAT_DOWN`] [`SDL_HAT_RIGHTDOWN`]
1306 ///
1307 /// Note that zero means the POV is centered.
1308 pub value: Uint8,
1309 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
1310 pub padding1: Uint8,
1311 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
1312 pub padding2: Uint8,
1313}
1314
1315/// Joystick button event structure (event.jbutton.*)
1316///
1317/// ## Availability
1318/// This struct is available since SDL 3.2.0.
1319///
1320/// ## Notes for `sdl3-sys`
1321/// This struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction.
1322#[repr(C)]
1323#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
1324#[cfg_attr(feature = "debug-impls", derive(Debug))]
1325pub struct SDL_JoyButtonEvent {
1326 /// [`SDL_EVENT_JOYSTICK_BUTTON_DOWN`] or [`SDL_EVENT_JOYSTICK_BUTTON_UP`]
1327 pub r#type: SDL_EventType,
1328 pub reserved: Uint32,
1329 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
1330 pub timestamp: Uint64,
1331 /// The joystick instance id
1332 pub which: SDL_JoystickID,
1333 /// The joystick button index
1334 pub button: Uint8,
1335 /// true if the button is pressed
1336 pub down: ::core::primitive::bool,
1337 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
1338 pub padding1: Uint8,
1339 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
1340 pub padding2: Uint8,
1341}
1342
1343/// Joystick device event structure (event.jdevice.*)
1344///
1345/// SDL will send JOYSTICK_ADDED events for devices that are already plugged in
1346/// during [`SDL_Init`].
1347///
1348/// ## Availability
1349/// This struct is available since SDL 3.2.0.
1350///
1351/// ## See also
1352/// - [`SDL_GamepadDeviceEvent`]
1353#[repr(C)]
1354#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
1355#[cfg_attr(feature = "debug-impls", derive(Debug))]
1356pub struct SDL_JoyDeviceEvent {
1357 /// [`SDL_EVENT_JOYSTICK_ADDED`] or [`SDL_EVENT_JOYSTICK_REMOVED`] or [`SDL_EVENT_JOYSTICK_UPDATE_COMPLETE`]
1358 pub r#type: SDL_EventType,
1359 pub reserved: Uint32,
1360 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
1361 pub timestamp: Uint64,
1362 /// The joystick instance id
1363 pub which: SDL_JoystickID,
1364}
1365
1366/// Joystick battery level change event structure (event.jbattery.*)
1367///
1368/// ## Availability
1369/// This struct is available since SDL 3.2.0.
1370#[repr(C)]
1371#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
1372#[cfg_attr(feature = "debug-impls", derive(Debug))]
1373pub struct SDL_JoyBatteryEvent {
1374 /// [`SDL_EVENT_JOYSTICK_BATTERY_UPDATED`]
1375 pub r#type: SDL_EventType,
1376 pub reserved: Uint32,
1377 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
1378 pub timestamp: Uint64,
1379 /// The joystick instance id
1380 pub which: SDL_JoystickID,
1381 /// The joystick battery state
1382 pub state: SDL_PowerState,
1383 /// The joystick battery percent charge remaining
1384 pub percent: ::core::ffi::c_int,
1385}
1386
1387/// Gamepad axis motion event structure (event.gaxis.*)
1388///
1389/// ## Availability
1390/// This struct is available since SDL 3.2.0.
1391///
1392/// ## Notes for `sdl3-sys`
1393/// This struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction.
1394#[repr(C)]
1395#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
1396#[cfg_attr(feature = "debug-impls", derive(Debug))]
1397pub struct SDL_GamepadAxisEvent {
1398 /// [`SDL_EVENT_GAMEPAD_AXIS_MOTION`]
1399 pub r#type: SDL_EventType,
1400 pub reserved: Uint32,
1401 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
1402 pub timestamp: Uint64,
1403 /// The joystick instance id
1404 pub which: SDL_JoystickID,
1405 /// The gamepad axis ([`SDL_GamepadAxis`])
1406 pub axis: Uint8,
1407 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
1408 pub padding1: Uint8,
1409 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
1410 pub padding2: Uint8,
1411 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
1412 pub padding3: Uint8,
1413 /// The axis value (range: -32768 to 32767)
1414 pub value: Sint16,
1415 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
1416 pub padding4: Uint16,
1417}
1418
1419/// Gamepad button event structure (event.gbutton.*)
1420///
1421/// ## Availability
1422/// This struct is available since SDL 3.2.0.
1423///
1424/// ## Notes for `sdl3-sys`
1425/// This struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction.
1426#[repr(C)]
1427#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
1428#[cfg_attr(feature = "debug-impls", derive(Debug))]
1429pub struct SDL_GamepadButtonEvent {
1430 /// [`SDL_EVENT_GAMEPAD_BUTTON_DOWN`] or [`SDL_EVENT_GAMEPAD_BUTTON_UP`]
1431 pub r#type: SDL_EventType,
1432 pub reserved: Uint32,
1433 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
1434 pub timestamp: Uint64,
1435 /// The joystick instance id
1436 pub which: SDL_JoystickID,
1437 /// The gamepad button ([`SDL_GamepadButton`])
1438 pub button: Uint8,
1439 /// true if the button is pressed
1440 pub down: ::core::primitive::bool,
1441 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
1442 pub padding1: Uint8,
1443 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
1444 pub padding2: Uint8,
1445}
1446
1447/// Gamepad device event structure (event.gdevice.*)
1448///
1449/// Joysticks that are supported gamepads receive both an [`SDL_JoyDeviceEvent`]
1450/// and an [`SDL_GamepadDeviceEvent`].
1451///
1452/// SDL will send GAMEPAD_ADDED events for joysticks that are already plugged
1453/// in during [`SDL_Init()`] and are recognized as gamepads. It will also send
1454/// events for joysticks that get gamepad mappings at runtime.
1455///
1456/// ## Availability
1457/// This struct is available since SDL 3.2.0.
1458///
1459/// ## See also
1460/// - [`SDL_JoyDeviceEvent`]
1461#[repr(C)]
1462#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
1463#[cfg_attr(feature = "debug-impls", derive(Debug))]
1464pub struct SDL_GamepadDeviceEvent {
1465 /// [`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`]
1466 pub r#type: SDL_EventType,
1467 pub reserved: Uint32,
1468 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
1469 pub timestamp: Uint64,
1470 /// The joystick instance id
1471 pub which: SDL_JoystickID,
1472}
1473
1474/// Gamepad touchpad event structure (event.gtouchpad.*)
1475///
1476/// ## Availability
1477/// This struct is available since SDL 3.2.0.
1478#[repr(C)]
1479#[derive(Clone, Copy, Default, PartialEq)]
1480#[cfg_attr(feature = "debug-impls", derive(Debug))]
1481pub struct SDL_GamepadTouchpadEvent {
1482 /// [`SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN`] or [`SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION`] or [`SDL_EVENT_GAMEPAD_TOUCHPAD_UP`]
1483 pub r#type: SDL_EventType,
1484 pub reserved: Uint32,
1485 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
1486 pub timestamp: Uint64,
1487 /// The joystick instance id
1488 pub which: SDL_JoystickID,
1489 /// The index of the touchpad
1490 pub touchpad: Sint32,
1491 /// The index of the finger on the touchpad
1492 pub finger: Sint32,
1493 /// Normalized in the range 0...1 with 0 being on the left
1494 pub x: ::core::ffi::c_float,
1495 /// Normalized in the range 0...1 with 0 being at the top
1496 pub y: ::core::ffi::c_float,
1497 /// Normalized in the range 0...1
1498 pub pressure: ::core::ffi::c_float,
1499}
1500
1501/// Gamepad sensor event structure (event.gsensor.*)
1502///
1503/// ## Availability
1504/// This struct is available since SDL 3.2.0.
1505#[repr(C)]
1506#[derive(Clone, Copy, Default, PartialEq)]
1507#[cfg_attr(feature = "debug-impls", derive(Debug))]
1508pub struct SDL_GamepadSensorEvent {
1509 /// [`SDL_EVENT_GAMEPAD_SENSOR_UPDATE`]
1510 pub r#type: SDL_EventType,
1511 pub reserved: Uint32,
1512 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
1513 pub timestamp: Uint64,
1514 /// The joystick instance id
1515 pub which: SDL_JoystickID,
1516 /// The type of the sensor, one of the values of [`SDL_SensorType`]
1517 pub sensor: Sint32,
1518 /// Up to 3 values from the sensor, as defined in SDL_sensor.h
1519 pub data: [::core::ffi::c_float; 3],
1520 /// The timestamp of the sensor reading in nanoseconds, not necessarily synchronized with the system clock
1521 pub sensor_timestamp: Uint64,
1522}
1523
1524/// Audio device event structure (event.adevice.*)
1525///
1526/// Note that SDL will send a [`SDL_EVENT_AUDIO_DEVICE_ADDED`] event for every
1527/// device it discovers during initialization. After that, this event will only
1528/// arrive when a device is hotplugged during the program's run.
1529///
1530/// ## Availability
1531/// This struct is available since SDL 3.2.0.
1532///
1533/// ## Notes for `sdl3-sys`
1534/// This struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction.
1535#[repr(C)]
1536#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
1537#[cfg_attr(feature = "debug-impls", derive(Debug))]
1538pub struct SDL_AudioDeviceEvent {
1539 /// [`SDL_EVENT_AUDIO_DEVICE_ADDED`], or [`SDL_EVENT_AUDIO_DEVICE_REMOVED`], or [`SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED`]
1540 pub r#type: SDL_EventType,
1541 pub reserved: Uint32,
1542 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
1543 pub timestamp: Uint64,
1544 /// [`SDL_AudioDeviceID`] for the device being added or removed or changing
1545 pub which: SDL_AudioDeviceID,
1546 /// false if a playback device, true if a recording device.
1547 pub recording: ::core::primitive::bool,
1548 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
1549 pub padding1: Uint8,
1550 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
1551 pub padding2: Uint8,
1552 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
1553 pub padding3: Uint8,
1554}
1555
1556/// Camera device event structure (event.cdevice.*)
1557///
1558/// ## Availability
1559/// This struct is available since SDL 3.2.0.
1560#[repr(C)]
1561#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
1562#[cfg_attr(feature = "debug-impls", derive(Debug))]
1563pub struct SDL_CameraDeviceEvent {
1564 /// [`SDL_EVENT_CAMERA_DEVICE_ADDED`], [`SDL_EVENT_CAMERA_DEVICE_REMOVED`], [`SDL_EVENT_CAMERA_DEVICE_APPROVED`], [`SDL_EVENT_CAMERA_DEVICE_DENIED`]
1565 pub r#type: SDL_EventType,
1566 pub reserved: Uint32,
1567 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
1568 pub timestamp: Uint64,
1569 /// [`SDL_CameraID`] for the device being added or removed or changing
1570 pub which: SDL_CameraID,
1571}
1572
1573/// Renderer event structure (event.render.*)
1574///
1575/// ## Availability
1576/// This struct is available since SDL 3.2.0.
1577#[repr(C)]
1578#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
1579#[cfg_attr(feature = "debug-impls", derive(Debug))]
1580pub struct SDL_RenderEvent {
1581 /// [`SDL_EVENT_RENDER_TARGETS_RESET`], [`SDL_EVENT_RENDER_DEVICE_RESET`], [`SDL_EVENT_RENDER_DEVICE_LOST`]
1582 pub r#type: SDL_EventType,
1583 pub reserved: Uint32,
1584 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
1585 pub timestamp: Uint64,
1586 /// The window containing the renderer in question.
1587 pub windowID: SDL_WindowID,
1588}
1589
1590/// Touch finger event structure (event.tfinger.*)
1591///
1592/// Coordinates in this event are normalized. `x` and `y` are normalized to a
1593/// range between 0.0f and 1.0f, relative to the window, so (0,0) is the top
1594/// left and (1,1) is the bottom right. Delta coordinates `dx` and `dy` are
1595/// normalized in the ranges of -1.0f (traversed all the way from the bottom or
1596/// right to all the way up or left) to 1.0f (traversed all the way from the
1597/// top or left to all the way down or right).
1598///
1599/// Note that while the coordinates are _normalized_, they are not _clamped_,
1600/// which means in some circumstances you can get a value outside of this
1601/// range. For example, a renderer using logical presentation might give a
1602/// negative value when the touch is in the letterboxing. Some platforms might
1603/// report a touch outside of the window, which will also be outside of the
1604/// range.
1605///
1606/// ## Availability
1607/// This struct is available since SDL 3.2.0.
1608#[repr(C)]
1609#[derive(Clone, Copy, Default, PartialEq)]
1610#[cfg_attr(feature = "debug-impls", derive(Debug))]
1611pub struct SDL_TouchFingerEvent {
1612 /// [`SDL_EVENT_FINGER_DOWN`], [`SDL_EVENT_FINGER_UP`], [`SDL_EVENT_FINGER_MOTION`], or [`SDL_EVENT_FINGER_CANCELED`]
1613 pub r#type: SDL_EventType,
1614 pub reserved: Uint32,
1615 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
1616 pub timestamp: Uint64,
1617 /// The touch device id
1618 pub touchID: SDL_TouchID,
1619 pub fingerID: SDL_FingerID,
1620 /// Normalized in the range 0...1
1621 pub x: ::core::ffi::c_float,
1622 /// Normalized in the range 0...1
1623 pub y: ::core::ffi::c_float,
1624 /// Normalized in the range -1...1
1625 pub dx: ::core::ffi::c_float,
1626 /// Normalized in the range -1...1
1627 pub dy: ::core::ffi::c_float,
1628 /// Normalized in the range 0...1
1629 pub pressure: ::core::ffi::c_float,
1630 /// The window underneath the finger, if any
1631 pub windowID: SDL_WindowID,
1632}
1633
1634/// * Pinch event structure (event.pinch.*)
1635#[repr(C)]
1636#[derive(Clone, Copy, Default, PartialEq)]
1637#[cfg_attr(feature = "debug-impls", derive(Debug))]
1638pub struct SDL_PinchFingerEvent {
1639 /// ::SDL_EVENT_PINCH_BEGIN or ::SDL_EVENT_PINCH_UPDATE or ::SDL_EVENT_PINCH_END
1640 pub r#type: SDL_EventType,
1641 pub reserved: Uint32,
1642 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
1643 pub timestamp: Uint64,
1644 /// The scale change since the last [`SDL_EVENT_PINCH_UPDATE`]. Scale < 1 is "zoom out". Scale > 1 is "zoom in".
1645 pub scale: ::core::ffi::c_float,
1646 /// The window underneath the finger, if any
1647 pub windowID: SDL_WindowID,
1648}
1649
1650/// Pressure-sensitive pen proximity event structure (event.pproximity.*)
1651///
1652/// When a pen becomes visible to the system (it is close enough to a tablet,
1653/// etc), SDL will send an [`SDL_EVENT_PEN_PROXIMITY_IN`] event with the new pen's
1654/// ID. This ID is valid until the pen leaves proximity again (has been removed
1655/// from the tablet's area, the tablet has been unplugged, etc). If the same
1656/// pen reenters proximity again, it will be given a new ID.
1657///
1658/// Note that "proximity" means "close enough for the tablet to know the tool
1659/// is there." The pen touching and lifting off from the tablet while not
1660/// leaving the area are handled by [`SDL_EVENT_PEN_DOWN`] and [`SDL_EVENT_PEN_UP`].
1661///
1662/// Not all platforms have a window associated with the pen during proximity
1663/// events. Some wait until motion/button/etc events to offer this info.
1664///
1665/// ## Availability
1666/// This struct is available since SDL 3.2.0.
1667#[repr(C)]
1668#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
1669#[cfg_attr(feature = "debug-impls", derive(Debug))]
1670pub struct SDL_PenProximityEvent {
1671 /// [`SDL_EVENT_PEN_PROXIMITY_IN`] or [`SDL_EVENT_PEN_PROXIMITY_OUT`]
1672 pub r#type: SDL_EventType,
1673 pub reserved: Uint32,
1674 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
1675 pub timestamp: Uint64,
1676 /// The window with pen focus, if any
1677 pub windowID: SDL_WindowID,
1678 /// The pen instance id
1679 pub which: SDL_PenID,
1680}
1681
1682/// Pressure-sensitive pen motion event structure (event.pmotion.*)
1683///
1684/// Depending on the hardware, you may get motion events when the pen is not
1685/// touching a tablet, for tracking a pen even when it isn't drawing. You
1686/// should listen for [`SDL_EVENT_PEN_DOWN`] and [`SDL_EVENT_PEN_UP`] events, or check
1687/// `pen_state & SDL_PEN_INPUT_DOWN` to decide if a pen is "drawing" when
1688/// dealing with pen motion.
1689///
1690/// ## Availability
1691/// This struct is available since SDL 3.2.0.
1692#[repr(C)]
1693#[derive(Clone, Copy, Default, PartialEq)]
1694#[cfg_attr(feature = "debug-impls", derive(Debug))]
1695pub struct SDL_PenMotionEvent {
1696 /// [`SDL_EVENT_PEN_MOTION`]
1697 pub r#type: SDL_EventType,
1698 pub reserved: Uint32,
1699 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
1700 pub timestamp: Uint64,
1701 /// The window with pen focus, if any
1702 pub windowID: SDL_WindowID,
1703 /// The pen instance id
1704 pub which: SDL_PenID,
1705 /// Complete pen input state at time of event
1706 pub pen_state: SDL_PenInputFlags,
1707 /// X coordinate, relative to window
1708 pub x: ::core::ffi::c_float,
1709 /// Y coordinate, relative to window
1710 pub y: ::core::ffi::c_float,
1711}
1712
1713/// Pressure-sensitive pen touched event structure (event.ptouch.*)
1714///
1715/// These events come when a pen touches a surface (a tablet, etc), or lifts
1716/// off from one.
1717///
1718/// ## Availability
1719/// This struct is available since SDL 3.2.0.
1720#[repr(C)]
1721#[derive(Clone, Copy, Default, PartialEq)]
1722#[cfg_attr(feature = "debug-impls", derive(Debug))]
1723pub struct SDL_PenTouchEvent {
1724 /// [`SDL_EVENT_PEN_DOWN`] or [`SDL_EVENT_PEN_UP`]
1725 pub r#type: SDL_EventType,
1726 pub reserved: Uint32,
1727 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
1728 pub timestamp: Uint64,
1729 /// The window with pen focus, if any
1730 pub windowID: SDL_WindowID,
1731 /// The pen instance id
1732 pub which: SDL_PenID,
1733 /// Complete pen input state at time of event
1734 pub pen_state: SDL_PenInputFlags,
1735 /// X coordinate, relative to window
1736 pub x: ::core::ffi::c_float,
1737 /// Y coordinate, relative to window
1738 pub y: ::core::ffi::c_float,
1739 /// true if eraser end is used (not all pens support this).
1740 pub eraser: ::core::primitive::bool,
1741 /// true if the pen is touching or false if the pen is lifted off
1742 pub down: ::core::primitive::bool,
1743}
1744
1745/// Pressure-sensitive pen button event structure (event.pbutton.*)
1746///
1747/// This is for buttons on the pen itself that the user might click. The pen
1748/// itself pressing down to draw triggers a [`SDL_EVENT_PEN_DOWN`] event instead.
1749///
1750/// ## Availability
1751/// This struct is available since SDL 3.2.0.
1752#[repr(C)]
1753#[derive(Clone, Copy, Default, PartialEq)]
1754#[cfg_attr(feature = "debug-impls", derive(Debug))]
1755pub struct SDL_PenButtonEvent {
1756 /// [`SDL_EVENT_PEN_BUTTON_DOWN`] or [`SDL_EVENT_PEN_BUTTON_UP`]
1757 pub r#type: SDL_EventType,
1758 pub reserved: Uint32,
1759 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
1760 pub timestamp: Uint64,
1761 /// The window with mouse focus, if any
1762 pub windowID: SDL_WindowID,
1763 /// The pen instance id
1764 pub which: SDL_PenID,
1765 /// Complete pen input state at time of event
1766 pub pen_state: SDL_PenInputFlags,
1767 /// X coordinate, relative to window
1768 pub x: ::core::ffi::c_float,
1769 /// Y coordinate, relative to window
1770 pub y: ::core::ffi::c_float,
1771 /// The pen button index (first button is 1).
1772 pub button: Uint8,
1773 /// true if the button is pressed
1774 pub down: ::core::primitive::bool,
1775}
1776
1777/// Pressure-sensitive pen pressure / angle event structure (event.paxis.*)
1778///
1779/// You might get some of these events even if the pen isn't touching the
1780/// tablet.
1781///
1782/// ## Availability
1783/// This struct is available since SDL 3.2.0.
1784#[repr(C)]
1785#[derive(Clone, Copy, Default, PartialEq)]
1786#[cfg_attr(feature = "debug-impls", derive(Debug))]
1787pub struct SDL_PenAxisEvent {
1788 /// [`SDL_EVENT_PEN_AXIS`]
1789 pub r#type: SDL_EventType,
1790 pub reserved: Uint32,
1791 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
1792 pub timestamp: Uint64,
1793 /// The window with pen focus, if any
1794 pub windowID: SDL_WindowID,
1795 /// The pen instance id
1796 pub which: SDL_PenID,
1797 /// Complete pen input state at time of event
1798 pub pen_state: SDL_PenInputFlags,
1799 /// X coordinate, relative to window
1800 pub x: ::core::ffi::c_float,
1801 /// Y coordinate, relative to window
1802 pub y: ::core::ffi::c_float,
1803 /// Axis that has changed
1804 pub axis: SDL_PenAxis,
1805 /// New value of axis
1806 pub value: ::core::ffi::c_float,
1807}
1808
1809/// An event used to drop text or request a file open by the system
1810/// (event.drop.*)
1811///
1812/// ## Availability
1813/// This struct is available since SDL 3.2.0.
1814#[repr(C)]
1815#[derive(Clone, Copy)]
1816#[cfg_attr(feature = "debug-impls", derive(Debug))]
1817pub struct SDL_DropEvent {
1818 /// [`SDL_EVENT_DROP_BEGIN`] or [`SDL_EVENT_DROP_FILE`] or [`SDL_EVENT_DROP_TEXT`] or [`SDL_EVENT_DROP_COMPLETE`] or [`SDL_EVENT_DROP_POSITION`]
1819 pub r#type: SDL_EventType,
1820 pub reserved: Uint32,
1821 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
1822 pub timestamp: Uint64,
1823 /// The window that was dropped on, if any
1824 pub windowID: SDL_WindowID,
1825 /// X coordinate, relative to window (not on begin)
1826 pub x: ::core::ffi::c_float,
1827 /// Y coordinate, relative to window (not on begin)
1828 pub y: ::core::ffi::c_float,
1829 /// The source app that sent this drop event, or NULL if that isn't available
1830 pub source: *const ::core::ffi::c_char,
1831 /// The text for [`SDL_EVENT_DROP_TEXT`] and the file name for [`SDL_EVENT_DROP_FILE`], NULL for other events
1832 pub data: *const ::core::ffi::c_char,
1833}
1834
1835impl ::core::default::Default for SDL_DropEvent {
1836 /// Initialize all fields to zero
1837 #[inline(always)]
1838 fn default() -> Self {
1839 unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
1840 }
1841}
1842
1843/// An event triggered when the clipboard contents have changed
1844/// (event.clipboard.*)
1845///
1846/// ## Availability
1847/// This struct is available since SDL 3.2.0.
1848#[repr(C)]
1849#[derive(Clone, Copy)]
1850#[cfg_attr(feature = "debug-impls", derive(Debug))]
1851pub struct SDL_ClipboardEvent {
1852 /// [`SDL_EVENT_CLIPBOARD_UPDATE`]
1853 pub r#type: SDL_EventType,
1854 pub reserved: Uint32,
1855 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
1856 pub timestamp: Uint64,
1857 /// are we owning the clipboard (internal update)
1858 pub owner: ::core::primitive::bool,
1859 /// number of mime types
1860 pub num_mime_types: Sint32,
1861 /// current mime types
1862 pub mime_types: *mut *const ::core::ffi::c_char,
1863}
1864
1865impl ::core::default::Default for SDL_ClipboardEvent {
1866 /// Initialize all fields to zero
1867 #[inline(always)]
1868 fn default() -> Self {
1869 unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
1870 }
1871}
1872
1873/// Sensor event structure (event.sensor.*)
1874///
1875/// ## Availability
1876/// This struct is available since SDL 3.2.0.
1877#[repr(C)]
1878#[derive(Clone, Copy, Default, PartialEq)]
1879#[cfg_attr(feature = "debug-impls", derive(Debug))]
1880pub struct SDL_SensorEvent {
1881 /// [`SDL_EVENT_SENSOR_UPDATE`]
1882 pub r#type: SDL_EventType,
1883 pub reserved: Uint32,
1884 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
1885 pub timestamp: Uint64,
1886 /// The instance ID of the sensor
1887 pub which: SDL_SensorID,
1888 /// Up to 6 values from the sensor - additional values can be queried using [`SDL_GetSensorData()`]
1889 pub data: [::core::ffi::c_float; 6],
1890 /// The timestamp of the sensor reading in nanoseconds, not necessarily synchronized with the system clock
1891 pub sensor_timestamp: Uint64,
1892}
1893
1894/// The "quit requested" event
1895///
1896/// ## Availability
1897/// This struct is available since SDL 3.2.0.
1898#[repr(C)]
1899#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
1900#[cfg_attr(feature = "debug-impls", derive(Debug))]
1901pub struct SDL_QuitEvent {
1902 /// [`SDL_EVENT_QUIT`]
1903 pub r#type: SDL_EventType,
1904 pub reserved: Uint32,
1905 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
1906 pub timestamp: Uint64,
1907}
1908
1909/// A user-defined event type (event.user.*)
1910///
1911/// This event is unique; it is never created by SDL, but only by the
1912/// application. The event can be pushed onto the event queue using
1913/// [`SDL_PushEvent()`]. The contents of the structure members are completely up to
1914/// the programmer; the only requirement is that '''type''' is a value obtained
1915/// from [`SDL_RegisterEvents()`].
1916///
1917/// ## Availability
1918/// This struct is available since SDL 3.2.0.
1919#[repr(C)]
1920#[derive(Clone, Copy)]
1921#[cfg_attr(feature = "debug-impls", derive(Debug))]
1922pub struct SDL_UserEvent {
1923 /// [`SDL_EVENT_USER`] through [`SDL_EVENT_LAST`], Uint32 because these are not in the [`SDL_EventType`] enumeration
1924 pub r#type: Uint32,
1925 pub reserved: Uint32,
1926 /// In nanoseconds, populated using [`SDL_GetTicksNS()`]
1927 pub timestamp: Uint64,
1928 /// The associated window if any
1929 pub windowID: SDL_WindowID,
1930 /// User defined event code
1931 pub code: Sint32,
1932 /// User defined data pointer
1933 pub data1: *mut ::core::ffi::c_void,
1934 /// User defined data pointer
1935 pub data2: *mut ::core::ffi::c_void,
1936}
1937
1938impl ::core::default::Default for SDL_UserEvent {
1939 /// Initialize all fields to zero
1940 #[inline(always)]
1941 fn default() -> Self {
1942 unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
1943 }
1944}
1945
1946impl SDL_Event {
1947 /// Get the type of this event
1948 #[inline(always)]
1949 pub const fn event_type(&self) -> SDL_EventType {
1950 SDL_EventType(unsafe { self.r#type })
1951 }
1952}
1953
1954/// The structure for all events in SDL.
1955///
1956/// The [`SDL_Event`] structure is the core of all event handling in SDL. [`SDL_Event`]
1957/// is a union of all event structures used in SDL.
1958///
1959/// ## Availability
1960/// This struct is available since SDL 3.2.0.
1961///
1962/// ## Notes for `sdl3-sys`
1963/// This struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction.
1964#[repr(C)]
1965#[derive(Clone, Copy)]
1966pub union SDL_Event {
1967 /// Event type, shared with all events, Uint32 to cover user events which are not in the [`SDL_EventType`] enumeration
1968 pub r#type: Uint32,
1969 /// Common event data
1970 pub common: SDL_CommonEvent,
1971 /// Display event data
1972 pub display: SDL_DisplayEvent,
1973 /// Window event data
1974 pub window: SDL_WindowEvent,
1975 /// Keyboard device change event data
1976 pub kdevice: SDL_KeyboardDeviceEvent,
1977 /// Keyboard event data
1978 pub key: SDL_KeyboardEvent,
1979 /// Text editing event data
1980 pub edit: SDL_TextEditingEvent,
1981 /// Text editing candidates event data
1982 pub edit_candidates: SDL_TextEditingCandidatesEvent,
1983 /// Text input event data
1984 pub text: SDL_TextInputEvent,
1985 /// Mouse device change event data
1986 pub mdevice: SDL_MouseDeviceEvent,
1987 /// Mouse motion event data
1988 pub motion: SDL_MouseMotionEvent,
1989 /// Mouse button event data
1990 pub button: SDL_MouseButtonEvent,
1991 /// Mouse wheel event data
1992 pub wheel: SDL_MouseWheelEvent,
1993 /// Joystick device change event data
1994 pub jdevice: SDL_JoyDeviceEvent,
1995 /// Joystick axis event data
1996 pub jaxis: SDL_JoyAxisEvent,
1997 /// Joystick ball event data
1998 pub jball: SDL_JoyBallEvent,
1999 /// Joystick hat event data
2000 pub jhat: SDL_JoyHatEvent,
2001 /// Joystick button event data
2002 pub jbutton: SDL_JoyButtonEvent,
2003 /// Joystick battery event data
2004 pub jbattery: SDL_JoyBatteryEvent,
2005 /// Gamepad device event data
2006 pub gdevice: SDL_GamepadDeviceEvent,
2007 /// Gamepad axis event data
2008 pub gaxis: SDL_GamepadAxisEvent,
2009 /// Gamepad button event data
2010 pub gbutton: SDL_GamepadButtonEvent,
2011 /// Gamepad touchpad event data
2012 pub gtouchpad: SDL_GamepadTouchpadEvent,
2013 /// Gamepad sensor event data
2014 pub gsensor: SDL_GamepadSensorEvent,
2015 /// Audio device event data
2016 pub adevice: SDL_AudioDeviceEvent,
2017 /// Camera device event data
2018 pub cdevice: SDL_CameraDeviceEvent,
2019 /// Sensor event data
2020 pub sensor: SDL_SensorEvent,
2021 /// Quit request event data
2022 pub quit: SDL_QuitEvent,
2023 /// Custom event data
2024 pub user: SDL_UserEvent,
2025 /// Touch finger event data
2026 pub tfinger: SDL_TouchFingerEvent,
2027 /// Pinch event data
2028 pub pinch: SDL_PinchFingerEvent,
2029 /// Pen proximity event data
2030 pub pproximity: SDL_PenProximityEvent,
2031 /// Pen tip touching event data
2032 pub ptouch: SDL_PenTouchEvent,
2033 /// Pen motion event data
2034 pub pmotion: SDL_PenMotionEvent,
2035 /// Pen button event data
2036 pub pbutton: SDL_PenButtonEvent,
2037 /// Pen axis event data
2038 pub paxis: SDL_PenAxisEvent,
2039 /// Render event data
2040 pub render: SDL_RenderEvent,
2041 /// Drag and drop event data
2042 pub drop: SDL_DropEvent,
2043 /// Clipboard event data
2044 pub clipboard: SDL_ClipboardEvent,
2045 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
2046 pub padding: [Uint8; 128],
2047}
2048
2049impl ::core::default::Default for SDL_Event {
2050 /// Initialize all fields to zero
2051 #[inline(always)]
2052 fn default() -> Self {
2053 unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
2054 }
2055}
2056
2057const _: () = ::core::assert!(
2058 (::core::mem::size_of::<SDL_Event>() == crate::size_of_field!(SDL_Event, padding))
2059);
2060
2061unsafe extern "C" {
2062 /// Pump the event loop, gathering events from the input devices.
2063 ///
2064 /// This function updates the event queue and internal input device state.
2065 ///
2066 /// [`SDL_PumpEvents()`] gathers all the pending input information from devices and
2067 /// places it in the event queue. Without calls to [`SDL_PumpEvents()`] no events
2068 /// would ever be placed on the queue. Often the need for calls to
2069 /// [`SDL_PumpEvents()`] is hidden from the user since [`SDL_PollEvent()`] and
2070 /// [`SDL_WaitEvent()`] implicitly call [`SDL_PumpEvents()`]. However, if you are not
2071 /// polling or waiting for events (e.g. you are filtering them), then you must
2072 /// call [`SDL_PumpEvents()`] to force an event queue update.
2073 ///
2074 /// ## Thread safety
2075 /// This function should only be called on the main thread.
2076 ///
2077 /// ## Availability
2078 /// This function is available since SDL 3.2.0.
2079 ///
2080 /// ## See also
2081 /// - [`SDL_PollEvent`]
2082 /// - [`SDL_WaitEvent`]
2083 pub fn SDL_PumpEvents();
2084}
2085
2086/// The type of action to request from [`SDL_PeepEvents()`].
2087///
2088/// ## Availability
2089/// This enum is available since SDL 3.2.0.
2090///
2091/// ## Known values (`sdl3-sys`)
2092/// | Associated constant | Global constant | Description |
2093/// | ------------------- | --------------- | ----------- |
2094/// | [`ADDEVENT`](SDL_EventAction::ADDEVENT) | [`SDL_ADDEVENT`] | Add events to the back of the queue. |
2095/// | [`PEEKEVENT`](SDL_EventAction::PEEKEVENT) | [`SDL_PEEKEVENT`] | Check but don't remove events from the queue front. |
2096/// | [`GETEVENT`](SDL_EventAction::GETEVENT) | [`SDL_GETEVENT`] | Retrieve/remove events from the front of the queue. |
2097#[repr(transparent)]
2098#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
2099pub struct SDL_EventAction(pub ::core::ffi::c_int);
2100
2101impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_EventAction {
2102 #[inline(always)]
2103 fn eq(&self, other: &::core::ffi::c_int) -> bool {
2104 &self.0 == other
2105 }
2106}
2107
2108impl ::core::cmp::PartialEq<SDL_EventAction> for ::core::ffi::c_int {
2109 #[inline(always)]
2110 fn eq(&self, other: &SDL_EventAction) -> bool {
2111 self == &other.0
2112 }
2113}
2114
2115impl From<SDL_EventAction> for ::core::ffi::c_int {
2116 #[inline(always)]
2117 fn from(value: SDL_EventAction) -> Self {
2118 value.0
2119 }
2120}
2121
2122#[cfg(feature = "debug-impls")]
2123impl ::core::fmt::Debug for SDL_EventAction {
2124 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2125 #[allow(unreachable_patterns)]
2126 f.write_str(match *self {
2127 Self::ADDEVENT => "SDL_ADDEVENT",
2128 Self::PEEKEVENT => "SDL_PEEKEVENT",
2129 Self::GETEVENT => "SDL_GETEVENT",
2130
2131 _ => return write!(f, "SDL_EventAction({})", self.0),
2132 })
2133 }
2134}
2135
2136impl SDL_EventAction {
2137 /// Add events to the back of the queue.
2138 pub const ADDEVENT: Self = Self((0 as ::core::ffi::c_int));
2139 /// Check but don't remove events from the queue front.
2140 pub const PEEKEVENT: Self = Self((1 as ::core::ffi::c_int));
2141 /// Retrieve/remove events from the front of the queue.
2142 pub const GETEVENT: Self = Self((2 as ::core::ffi::c_int));
2143}
2144
2145/// Add events to the back of the queue.
2146pub const SDL_ADDEVENT: SDL_EventAction = SDL_EventAction::ADDEVENT;
2147/// Check but don't remove events from the queue front.
2148pub const SDL_PEEKEVENT: SDL_EventAction = SDL_EventAction::PEEKEVENT;
2149/// Retrieve/remove events from the front of the queue.
2150pub const SDL_GETEVENT: SDL_EventAction = SDL_EventAction::GETEVENT;
2151
2152#[cfg(feature = "metadata")]
2153impl sdl3_sys::metadata::GroupMetadata for SDL_EventAction {
2154 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
2155 &crate::metadata::events::METADATA_SDL_EventAction;
2156}
2157
2158unsafe extern "C" {
2159 /// Check the event queue for messages and optionally return them.
2160 ///
2161 /// `action` may be any of the following:
2162 ///
2163 /// - [`SDL_ADDEVENT`]\: up to `numevents` events will be added to the back of the
2164 /// event queue.
2165 /// - [`SDL_PEEKEVENT`]\: `numevents` events at the front of the event queue,
2166 /// within the specified minimum and maximum type, will be returned to the
2167 /// caller and will _not_ be removed from the queue. If you pass NULL for
2168 /// `events`, then `numevents` is ignored and the total number of matching
2169 /// events will be returned.
2170 /// - [`SDL_GETEVENT`]\: up to `numevents` events at the front of the event queue,
2171 /// within the specified minimum and maximum type, will be returned to the
2172 /// caller and will be removed from the queue.
2173 ///
2174 /// You may have to call [`SDL_PumpEvents()`] before calling this function.
2175 /// Otherwise, the events may not be ready to be filtered when you call
2176 /// [`SDL_PeepEvents()`].
2177 ///
2178 /// ## Parameters
2179 /// - `events`: destination buffer for the retrieved events, may be NULL to
2180 /// leave the events in the queue and return the number of events
2181 /// that would have been stored.
2182 /// - `numevents`: if action is [`SDL_ADDEVENT`], the number of events to add
2183 /// back to the event queue; if action is [`SDL_PEEKEVENT`] or
2184 /// [`SDL_GETEVENT`], the maximum number of events to retrieve.
2185 /// - `action`: action to take; see [Remarks](#remarks) for details.
2186 /// - `minType`: minimum value of the event type to be considered;
2187 /// [`SDL_EVENT_FIRST`] is a safe choice.
2188 /// - `maxType`: maximum value of the event type to be considered;
2189 /// [`SDL_EVENT_LAST`] is a safe choice.
2190 ///
2191 /// ## Return value
2192 /// Returns the number of events actually stored or -1 on failure; call
2193 /// [`SDL_GetError()`] for more information.
2194 ///
2195 /// ## Thread safety
2196 /// It is safe to call this function from any thread.
2197 ///
2198 /// ## Availability
2199 /// This function is available since SDL 3.2.0.
2200 ///
2201 /// ## See also
2202 /// - [`SDL_PollEvent`]
2203 /// - [`SDL_PumpEvents`]
2204 /// - [`SDL_PushEvent`]
2205 pub fn SDL_PeepEvents(
2206 events: *mut SDL_Event,
2207 numevents: ::core::ffi::c_int,
2208 action: SDL_EventAction,
2209 minType: Uint32,
2210 maxType: Uint32,
2211 ) -> ::core::ffi::c_int;
2212}
2213
2214unsafe extern "C" {
2215 /// Check for the existence of a certain event type in the event queue.
2216 ///
2217 /// If you need to check for a range of event types, use [`SDL_HasEvents()`]
2218 /// instead.
2219 ///
2220 /// ## Parameters
2221 /// - `type`: the type of event to be queried; see [`SDL_EventType`] for details.
2222 ///
2223 /// ## Return value
2224 /// Returns true if events matching `type` are present, or false if events
2225 /// matching `type` are not present.
2226 ///
2227 /// ## Thread safety
2228 /// It is safe to call this function from any thread.
2229 ///
2230 /// ## Availability
2231 /// This function is available since SDL 3.2.0.
2232 ///
2233 /// ## See also
2234 /// - [`SDL_HasEvents`]
2235 pub fn SDL_HasEvent(r#type: Uint32) -> ::core::primitive::bool;
2236}
2237
2238unsafe extern "C" {
2239 /// Check for the existence of certain event types in the event queue.
2240 ///
2241 /// If you need to check for a single event type, use [`SDL_HasEvent()`] instead.
2242 ///
2243 /// ## Parameters
2244 /// - `minType`: the low end of event type to be queried, inclusive; see
2245 /// [`SDL_EventType`] for details.
2246 /// - `maxType`: the high end of event type to be queried, inclusive; see
2247 /// [`SDL_EventType`] for details.
2248 ///
2249 /// ## Return value
2250 /// Returns true if events with type >= `minType` and <= `maxType` are
2251 /// present, or false if not.
2252 ///
2253 /// ## Thread safety
2254 /// It is safe to call this function from any thread.
2255 ///
2256 /// ## Availability
2257 /// This function is available since SDL 3.2.0.
2258 ///
2259 /// ## See also
2260 /// - [`SDL_HasEvents`]
2261 pub fn SDL_HasEvents(minType: Uint32, maxType: Uint32) -> ::core::primitive::bool;
2262}
2263
2264unsafe extern "C" {
2265 /// Clear events of a specific type from the event queue.
2266 ///
2267 /// This will unconditionally remove any events from the queue that match
2268 /// `type`. If you need to remove a range of event types, use [`SDL_FlushEvents()`]
2269 /// instead.
2270 ///
2271 /// It's also normal to just ignore events you don't care about in your event
2272 /// loop without calling this function.
2273 ///
2274 /// This function only affects currently queued events. If you want to make
2275 /// sure that all pending OS events are flushed, you can call [`SDL_PumpEvents()`]
2276 /// on the main thread immediately before the flush call.
2277 ///
2278 /// If you have user events with custom data that needs to be freed, you should
2279 /// use [`SDL_PeepEvents()`] to remove and clean up those events before calling
2280 /// this function.
2281 ///
2282 /// ## Parameters
2283 /// - `type`: the type of event to be cleared; see [`SDL_EventType`] for details.
2284 ///
2285 /// ## Thread safety
2286 /// It is safe to call this function from any thread.
2287 ///
2288 /// ## Availability
2289 /// This function is available since SDL 3.2.0.
2290 ///
2291 /// ## See also
2292 /// - [`SDL_FlushEvents`]
2293 pub fn SDL_FlushEvent(r#type: Uint32);
2294}
2295
2296unsafe extern "C" {
2297 /// Clear events of a range of types from the event queue.
2298 ///
2299 /// This will unconditionally remove any events from the queue that are in the
2300 /// range of `minType` to `maxType`, inclusive. If you need to remove a single
2301 /// event type, use [`SDL_FlushEvent()`] instead.
2302 ///
2303 /// It's also normal to just ignore events you don't care about in your event
2304 /// loop without calling this function.
2305 ///
2306 /// This function only affects currently queued events. If you want to make
2307 /// sure that all pending OS events are flushed, you can call [`SDL_PumpEvents()`]
2308 /// on the main thread immediately before the flush call.
2309 ///
2310 /// ## Parameters
2311 /// - `minType`: the low end of event type to be cleared, inclusive; see
2312 /// [`SDL_EventType`] for details.
2313 /// - `maxType`: the high end of event type to be cleared, inclusive; see
2314 /// [`SDL_EventType`] for details.
2315 ///
2316 /// ## Thread safety
2317 /// It is safe to call this function from any thread.
2318 ///
2319 /// ## Availability
2320 /// This function is available since SDL 3.2.0.
2321 ///
2322 /// ## See also
2323 /// - [`SDL_FlushEvent`]
2324 pub fn SDL_FlushEvents(minType: Uint32, maxType: Uint32);
2325}
2326
2327unsafe extern "C" {
2328 /// Poll for currently pending events.
2329 ///
2330 /// If `event` is not NULL, the next event is removed from the queue and stored
2331 /// in the [`SDL_Event`] structure pointed to by `event`. The 1 returned refers to
2332 /// this event, immediately stored in the SDL Event structure -- not an event
2333 /// to follow.
2334 ///
2335 /// If `event` is NULL, it simply returns 1 if there is an event in the queue,
2336 /// but will not remove it from the queue.
2337 ///
2338 /// As this function may implicitly call [`SDL_PumpEvents()`], you can only call
2339 /// this function in the thread that set the video mode.
2340 ///
2341 /// [`SDL_PollEvent()`] is the favored way of receiving system events since it can
2342 /// be done from the main loop and does not suspend the main loop while waiting
2343 /// on an event to be posted.
2344 ///
2345 /// The common practice is to fully process the event queue once every frame,
2346 /// usually as a first step before updating the game's state:
2347 ///
2348 /// ```c
2349 /// while (game_is_still_running) {
2350 /// SDL_Event event;
2351 /// while (SDL_PollEvent(&event)) { // poll until all events are handled!
2352 /// // decide what to do with this event.
2353 /// }
2354 ///
2355 /// // update game state, draw the current frame
2356 /// }
2357 /// ```
2358 ///
2359 /// Note that Windows (and possibly other platforms) has a quirk about how it
2360 /// handles events while dragging/resizing a window, which can cause this
2361 /// function to block for significant amounts of time. Technical explanations
2362 /// and solutions are discussed on the wiki:
2363 ///
2364 /// <https://wiki.libsdl.org/SDL3/AppFreezeDuringDrag>
2365 ///
2366 /// ## Parameters
2367 /// - `event`: the [`SDL_Event`] structure to be filled with the next event from
2368 /// the queue, or NULL.
2369 ///
2370 /// ## Return value
2371 /// Returns true if this got an event or false if there are none available.
2372 ///
2373 /// ## Thread safety
2374 /// This function should only be called on the main thread.
2375 ///
2376 /// ## Availability
2377 /// This function is available since SDL 3.2.0.
2378 ///
2379 /// ## See also
2380 /// - [`SDL_PushEvent`]
2381 /// - [`SDL_WaitEvent`]
2382 /// - [`SDL_WaitEventTimeout`]
2383 pub fn SDL_PollEvent(event: *mut SDL_Event) -> ::core::primitive::bool;
2384}
2385
2386unsafe extern "C" {
2387 /// Wait indefinitely for the next available event.
2388 ///
2389 /// If `event` is not NULL, the next event is removed from the queue and stored
2390 /// in the [`SDL_Event`] structure pointed to by `event`.
2391 ///
2392 /// As this function may implicitly call [`SDL_PumpEvents()`], you can only call
2393 /// this function in the thread that initialized the video subsystem.
2394 ///
2395 /// ## Parameters
2396 /// - `event`: the [`SDL_Event`] structure to be filled in with the next event
2397 /// from the queue, or NULL.
2398 ///
2399 /// ## Return value
2400 /// Returns true on success or false if there was an error while waiting for
2401 /// events; call [`SDL_GetError()`] for more information.
2402 ///
2403 /// ## Thread safety
2404 /// This function should only be called on the main thread.
2405 ///
2406 /// ## Availability
2407 /// This function is available since SDL 3.2.0.
2408 ///
2409 /// ## See also
2410 /// - [`SDL_PollEvent`]
2411 /// - [`SDL_PushEvent`]
2412 /// - [`SDL_WaitEventTimeout`]
2413 pub fn SDL_WaitEvent(event: *mut SDL_Event) -> ::core::primitive::bool;
2414}
2415
2416unsafe extern "C" {
2417 /// Wait until the specified timeout (in milliseconds) for the next available
2418 /// event.
2419 ///
2420 /// If `event` is not NULL, the next event is removed from the queue and stored
2421 /// in the [`SDL_Event`] structure pointed to by `event`.
2422 ///
2423 /// As this function may implicitly call [`SDL_PumpEvents()`], you can only call
2424 /// this function in the thread that initialized the video subsystem.
2425 ///
2426 /// The timeout is not guaranteed, the actual wait time could be longer due to
2427 /// system scheduling.
2428 ///
2429 /// ## Parameters
2430 /// - `event`: the [`SDL_Event`] structure to be filled in with the next event
2431 /// from the queue, or NULL.
2432 /// - `timeoutMS`: the maximum number of milliseconds to wait for the next
2433 /// available event.
2434 ///
2435 /// ## Return value
2436 /// Returns true if this got an event or false if the timeout elapsed without
2437 /// any events available.
2438 ///
2439 /// ## Thread safety
2440 /// This function should only be called on the main thread.
2441 ///
2442 /// ## Availability
2443 /// This function is available since SDL 3.2.0.
2444 ///
2445 /// ## See also
2446 /// - [`SDL_PollEvent`]
2447 /// - [`SDL_PushEvent`]
2448 /// - [`SDL_WaitEvent`]
2449 pub fn SDL_WaitEventTimeout(
2450 event: *mut SDL_Event,
2451 timeoutMS: Sint32,
2452 ) -> ::core::primitive::bool;
2453}
2454
2455unsafe extern "C" {
2456 /// Add an event to the event queue.
2457 ///
2458 /// The event queue can actually be used as a two way communication channel.
2459 /// Not only can events be read from the queue, but the user can also push
2460 /// their own events onto it. `event` is a pointer to the event structure you
2461 /// wish to push onto the queue. The event is copied into the queue, and the
2462 /// caller may dispose of the memory pointed to after [`SDL_PushEvent()`] returns.
2463 ///
2464 /// Note: Pushing device input events onto the queue doesn't modify the state
2465 /// of the device within SDL.
2466 ///
2467 /// Note: Events pushed onto the queue with [`SDL_PushEvent()`] get passed through
2468 /// the event filter but events added with [`SDL_PeepEvents()`] do not.
2469 ///
2470 /// For pushing application-specific events, please use [`SDL_RegisterEvents()`] to
2471 /// get an event type that does not conflict with other code that also wants
2472 /// its own custom event types.
2473 ///
2474 /// ## Parameters
2475 /// - `event`: the [`SDL_Event`] to be added to the queue.
2476 ///
2477 /// ## Return value
2478 /// Returns true on success, false if the event was filtered or on failure;
2479 /// call [`SDL_GetError()`] for more information. A common reason for
2480 /// error is the event queue being full.
2481 ///
2482 /// ## Thread safety
2483 /// It is safe to call this function from any thread.
2484 ///
2485 /// ## Availability
2486 /// This function is available since SDL 3.2.0.
2487 ///
2488 /// ## See also
2489 /// - [`SDL_PeepEvents`]
2490 /// - [`SDL_PollEvent`]
2491 /// - [`SDL_RegisterEvents`]
2492 pub fn SDL_PushEvent(event: *mut SDL_Event) -> ::core::primitive::bool;
2493}
2494
2495/// A function pointer used for callbacks that watch the event queue.
2496///
2497/// ## Parameters
2498/// - `userdata`: what was passed as `userdata` to [`SDL_SetEventFilter()`] or
2499/// [`SDL_AddEventWatch`], etc.
2500/// - `event`: the event that triggered the callback.
2501///
2502/// ## Return value
2503/// Returns true to permit event to be added to the queue, and false to
2504/// disallow it. When used with [`SDL_AddEventWatch`], the return value is
2505/// ignored.
2506///
2507/// ## Thread safety
2508/// SDL may call this callback at any time from any thread; the
2509/// application is responsible for locking resources the callback
2510/// touches that need to be protected.
2511///
2512/// ## Availability
2513/// This datatype is available since SDL 3.2.0.
2514///
2515/// ## See also
2516/// - [`SDL_SetEventFilter`]
2517/// - [`SDL_AddEventWatch`]
2518pub type SDL_EventFilter = ::core::option::Option<
2519 unsafe extern "C" fn(
2520 userdata: *mut ::core::ffi::c_void,
2521 event: *mut SDL_Event,
2522 ) -> ::core::primitive::bool,
2523>;
2524
2525unsafe extern "C" {
2526 /// Set up a filter to process all events before they are added to the internal
2527 /// event queue.
2528 ///
2529 /// If you just want to see events without modifying them or preventing them
2530 /// from being queued, you should use [`SDL_AddEventWatch()`] instead.
2531 ///
2532 /// If the filter function returns true when called, then the event will be
2533 /// added to the internal queue. If it returns false, then the event will be
2534 /// dropped from the queue, but the internal state will still be updated. This
2535 /// allows selective filtering of dynamically arriving events.
2536 ///
2537 /// **WARNING**: Be very careful of what you do in the event filter function,
2538 /// as it may run in a different thread! The exception is handling of
2539 /// [`SDL_EVENT_WINDOW_EXPOSED`], which is guaranteed to be sent from the OS on the
2540 /// main thread and you are expected to redraw your window in response to this
2541 /// event.
2542 ///
2543 /// On platforms that support it, if the quit event is generated by an
2544 /// interrupt signal (e.g. pressing Ctrl-C), it will be delivered to the
2545 /// application at the next event poll.
2546 ///
2547 /// Note: Disabled events never make it to the event filter function; see
2548 /// [`SDL_SetEventEnabled()`].
2549 ///
2550 /// Note: Events pushed onto the queue with [`SDL_PushEvent()`] get passed through
2551 /// the event filter, but events pushed onto the queue with [`SDL_PeepEvents()`] do
2552 /// not.
2553 ///
2554 /// ## Parameters
2555 /// - `filter`: a function to call when an event happens.
2556 /// - `userdata`: a pointer that is passed to `filter`.
2557 ///
2558 /// ## Thread safety
2559 /// It is safe to call this function from any thread.
2560 ///
2561 /// ## Availability
2562 /// This function is available since SDL 3.2.0.
2563 ///
2564 /// ## See also
2565 /// - [`SDL_AddEventWatch`]
2566 /// - [`SDL_SetEventEnabled`]
2567 /// - [`SDL_GetEventFilter`]
2568 /// - [`SDL_PeepEvents`]
2569 /// - [`SDL_PushEvent`]
2570 pub fn SDL_SetEventFilter(filter: SDL_EventFilter, userdata: *mut ::core::ffi::c_void);
2571}
2572
2573unsafe extern "C" {
2574 /// Query the current event filter.
2575 ///
2576 /// This function can be used to "chain" filters, by saving the existing filter
2577 /// before replacing it with a function that will call that saved filter.
2578 ///
2579 /// ## Parameters
2580 /// - `filter`: the current callback function will be stored here.
2581 /// - `userdata`: the pointer that is passed to the current event filter will
2582 /// be stored here.
2583 ///
2584 /// ## Return value
2585 /// Returns true on success or false if there is no event filter set.
2586 ///
2587 /// ## Thread safety
2588 /// It is safe to call this function from any thread.
2589 ///
2590 /// ## Availability
2591 /// This function is available since SDL 3.2.0.
2592 ///
2593 /// ## See also
2594 /// - [`SDL_SetEventFilter`]
2595 pub fn SDL_GetEventFilter(
2596 filter: *mut SDL_EventFilter,
2597 userdata: *mut *mut ::core::ffi::c_void,
2598 ) -> ::core::primitive::bool;
2599}
2600
2601unsafe extern "C" {
2602 /// Add a callback to be triggered when an event is added to the event queue.
2603 ///
2604 /// `filter` will be called when an event happens, and its return value is
2605 /// ignored.
2606 ///
2607 /// **WARNING**: Be very careful of what you do in the event filter function,
2608 /// as it may run in a different thread!
2609 ///
2610 /// If the quit event is generated by a signal (e.g. SIGINT), it will bypass
2611 /// the internal queue and be delivered to the watch callback immediately, and
2612 /// arrive at the next event poll.
2613 ///
2614 /// Note: the callback is called for events posted by the user through
2615 /// [`SDL_PushEvent()`], but not for disabled events, nor for events by a filter
2616 /// callback set with [`SDL_SetEventFilter()`], nor for events posted by the user
2617 /// through [`SDL_PeepEvents()`].
2618 ///
2619 /// ## Parameters
2620 /// - `filter`: an [`SDL_EventFilter`] function to call when an event happens.
2621 /// - `userdata`: a pointer that is passed to `filter`.
2622 ///
2623 /// ## Return value
2624 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
2625 /// information.
2626 ///
2627 /// ## Thread safety
2628 /// It is safe to call this function from any thread.
2629 ///
2630 /// ## Availability
2631 /// This function is available since SDL 3.2.0.
2632 ///
2633 /// ## See also
2634 /// - [`SDL_RemoveEventWatch`]
2635 /// - [`SDL_SetEventFilter`]
2636 pub fn SDL_AddEventWatch(
2637 filter: SDL_EventFilter,
2638 userdata: *mut ::core::ffi::c_void,
2639 ) -> ::core::primitive::bool;
2640}
2641
2642unsafe extern "C" {
2643 /// Remove an event watch callback added with [`SDL_AddEventWatch()`].
2644 ///
2645 /// This function takes the same input as [`SDL_AddEventWatch()`] to identify and
2646 /// delete the corresponding callback.
2647 ///
2648 /// ## Parameters
2649 /// - `filter`: the function originally passed to [`SDL_AddEventWatch()`].
2650 /// - `userdata`: the pointer originally passed to [`SDL_AddEventWatch()`].
2651 ///
2652 /// ## Thread safety
2653 /// It is safe to call this function from any thread.
2654 ///
2655 /// ## Availability
2656 /// This function is available since SDL 3.2.0.
2657 ///
2658 /// ## See also
2659 /// - [`SDL_AddEventWatch`]
2660 pub fn SDL_RemoveEventWatch(filter: SDL_EventFilter, userdata: *mut ::core::ffi::c_void);
2661}
2662
2663unsafe extern "C" {
2664 /// Run a specific filter function on the current event queue, removing any
2665 /// events for which the filter returns false.
2666 ///
2667 /// See [`SDL_SetEventFilter()`] for more information. Unlike [`SDL_SetEventFilter()`],
2668 /// this function does not change the filter permanently, it only uses the
2669 /// supplied filter until this function returns.
2670 ///
2671 /// ## Parameters
2672 /// - `filter`: the [`SDL_EventFilter`] function to call when an event happens.
2673 /// - `userdata`: a pointer that is passed to `filter`.
2674 ///
2675 /// ## Thread safety
2676 /// It is safe to call this function from any thread.
2677 ///
2678 /// ## Availability
2679 /// This function is available since SDL 3.2.0.
2680 ///
2681 /// ## See also
2682 /// - [`SDL_GetEventFilter`]
2683 /// - [`SDL_SetEventFilter`]
2684 pub fn SDL_FilterEvents(filter: SDL_EventFilter, userdata: *mut ::core::ffi::c_void);
2685}
2686
2687unsafe extern "C" {
2688 /// Set the state of processing events by type.
2689 ///
2690 /// ## Parameters
2691 /// - `type`: the type of event; see [`SDL_EventType`] for details.
2692 /// - `enabled`: whether to process the event or not.
2693 ///
2694 /// ## Thread safety
2695 /// It is safe to call this function from any thread.
2696 ///
2697 /// ## Availability
2698 /// This function is available since SDL 3.2.0.
2699 ///
2700 /// ## See also
2701 /// - [`SDL_EventEnabled`]
2702 pub fn SDL_SetEventEnabled(r#type: Uint32, enabled: ::core::primitive::bool);
2703}
2704
2705unsafe extern "C" {
2706 /// Query the state of processing events by type.
2707 ///
2708 /// ## Parameters
2709 /// - `type`: the type of event; see [`SDL_EventType`] for details.
2710 ///
2711 /// ## Return value
2712 /// Returns true if the event is being processed, false otherwise.
2713 ///
2714 /// ## Thread safety
2715 /// It is safe to call this function from any thread.
2716 ///
2717 /// ## Availability
2718 /// This function is available since SDL 3.2.0.
2719 ///
2720 /// ## See also
2721 /// - [`SDL_SetEventEnabled`]
2722 pub fn SDL_EventEnabled(r#type: Uint32) -> ::core::primitive::bool;
2723}
2724
2725unsafe extern "C" {
2726 /// Allocate a set of user-defined events, and return the beginning event
2727 /// number for that set of events.
2728 ///
2729 /// ## Parameters
2730 /// - `numevents`: the number of events to be allocated.
2731 ///
2732 /// ## Return value
2733 /// Returns the beginning event number, or 0 if numevents is invalid or if
2734 /// there are not enough user-defined events left.
2735 ///
2736 /// ## Thread safety
2737 /// It is safe to call this function from any thread.
2738 ///
2739 /// ## Availability
2740 /// This function is available since SDL 3.2.0.
2741 ///
2742 /// ## See also
2743 /// - [`SDL_PushEvent`]
2744 pub fn SDL_RegisterEvents(numevents: ::core::ffi::c_int) -> Uint32;
2745}
2746
2747unsafe extern "C" {
2748 /// Get window associated with an event.
2749 ///
2750 /// ## Parameters
2751 /// - `event`: an event containing a `windowID`.
2752 ///
2753 /// ## Return value
2754 /// Returns the associated window on success or NULL if there is none.
2755 ///
2756 /// ## Thread safety
2757 /// It is safe to call this function from any thread.
2758 ///
2759 /// ## Availability
2760 /// This function is available since SDL 3.2.0.
2761 ///
2762 /// ## See also
2763 /// - [`SDL_PollEvent`]
2764 /// - [`SDL_WaitEvent`]
2765 /// - [`SDL_WaitEventTimeout`]
2766 pub fn SDL_GetWindowFromEvent(event: *const SDL_Event) -> *mut SDL_Window;
2767}
2768
2769unsafe extern "C" {
2770 /// Generate an English description of an event.
2771 ///
2772 /// This will fill `buf` with a null-terminated string that might look
2773 /// something like this:
2774 ///
2775 /// ```text
2776 /// SDL_EVENT_MOUSE_MOTION (timestamp=1140256324 windowid=2 which=0 state=0 x=492.99 y=139.09 xrel=52 yrel=6)
2777 /// ```
2778 ///
2779 /// The exact format of the string is not guaranteed; it is intended for
2780 /// logging purposes, to be read by a human, and not parsed by a computer.
2781 ///
2782 /// The returned value follows the same rules as [`SDL_snprintf()`]\: `buf` will
2783 /// always be NULL-terminated (unless `buflen` is zero), and will be truncated
2784 /// if `buflen` is too small. The return code is the number of bytes needed for
2785 /// the complete string, not counting the NULL-terminator, whether the string
2786 /// was truncated or not. Unlike [`SDL_snprintf()`], though, this function never
2787 /// returns -1.
2788 ///
2789 /// ## Parameters
2790 /// - `event`: an event to describe. May be NULL.
2791 /// - `buf`: the buffer to fill with the description string. May be NULL.
2792 /// - `buflen`: the maximum bytes that can be written to `buf`.
2793 ///
2794 /// ## Return value
2795 /// Returns number of bytes needed for the full string, not counting the
2796 /// null-terminator byte.
2797 ///
2798 /// ## Thread safety
2799 /// It is safe to call this function from any thread.
2800 ///
2801 /// ## Availability
2802 /// This function is available since SDL 3.4.0.
2803 pub fn SDL_GetEventDescription(
2804 event: *const SDL_Event,
2805 buf: *mut ::core::ffi::c_char,
2806 buflen: ::core::ffi::c_int,
2807 ) -> ::core::ffi::c_int;
2808}
2809
2810#[cfg(doc)]
2811use crate::everything::*;