sdl3_sys/generated/video.rs
1//! SDL's video subsystem is largely interested in abstracting window
2//! management from the underlying operating system. You can create windows,
3//! manage them in various ways, set them fullscreen, and get events when
4//! interesting things happen with them, such as the mouse or keyboard
5//! interacting with a window.
6//!
7//! The video subsystem is also interested in abstracting away some
8//! platform-specific differences in OpenGL: context creation, swapping
9//! buffers, etc. This may be crucial to your app, but also you are not
10//! required to use OpenGL at all. In fact, SDL can provide rendering to those
11//! windows as well, either with an easy-to-use
12//! [2D API](https://wiki.libsdl.org/SDL3/CategoryRender)
13//! or with a more-powerful
14//! [GPU API](https://wiki.libsdl.org/SDL3/CategoryGPU)
15//! . Of course, it can simply get out of your way and give you the window
16//! handles you need to use Vulkan, Direct3D, Metal, or whatever else you like
17//! directly, too.
18//!
19//! The video subsystem covers a lot of functionality, out of necessity, so it
20//! is worth perusing the list of functions just to see what's available, but
21//! most apps can get by with simply creating a window and listening for
22//! events, so start with [`SDL_CreateWindow()`] and [`SDL_PollEvent()`].
23
24use super::stdinc::*;
25
26use super::error::*;
27
28use super::pixels::*;
29
30use super::properties::*;
31
32use super::rect::*;
33
34use super::surface::*;
35
36/// This is a unique ID for a display for the time it is connected to the
37/// system, and is never reused for the lifetime of the application.
38///
39/// If the display is disconnected and reconnected, it will get a new ID.
40///
41/// The value 0 is an invalid ID.
42///
43/// ## Availability
44/// This datatype is available since SDL 3.2.0.
45#[repr(transparent)]
46#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
47#[cfg_attr(feature = "debug-impls", derive(Debug))]
48pub struct SDL_DisplayID(pub Uint32);
49
50impl ::core::cmp::PartialEq<Uint32> for SDL_DisplayID {
51 #[inline(always)]
52 fn eq(&self, other: &Uint32) -> bool {
53 &self.0 == other
54 }
55}
56
57impl ::core::cmp::PartialEq<SDL_DisplayID> for Uint32 {
58 #[inline(always)]
59 fn eq(&self, other: &SDL_DisplayID) -> bool {
60 self == &other.0
61 }
62}
63
64impl From<SDL_DisplayID> for Uint32 {
65 #[inline(always)]
66 fn from(value: SDL_DisplayID) -> Self {
67 value.0
68 }
69}
70
71#[cfg(feature = "metadata")]
72impl sdl3_sys::metadata::GroupMetadata for SDL_DisplayID {
73 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
74 &crate::metadata::video::METADATA_SDL_DisplayID;
75}
76
77/// This is a unique ID for a window.
78///
79/// The value 0 is an invalid ID.
80///
81/// ## Availability
82/// This datatype is available since SDL 3.2.0.
83#[repr(transparent)]
84#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
85#[cfg_attr(feature = "debug-impls", derive(Debug))]
86pub struct SDL_WindowID(pub Uint32);
87
88impl ::core::cmp::PartialEq<Uint32> for SDL_WindowID {
89 #[inline(always)]
90 fn eq(&self, other: &Uint32) -> bool {
91 &self.0 == other
92 }
93}
94
95impl ::core::cmp::PartialEq<SDL_WindowID> for Uint32 {
96 #[inline(always)]
97 fn eq(&self, other: &SDL_WindowID) -> bool {
98 self == &other.0
99 }
100}
101
102impl From<SDL_WindowID> for Uint32 {
103 #[inline(always)]
104 fn from(value: SDL_WindowID) -> Self {
105 value.0
106 }
107}
108
109#[cfg(feature = "metadata")]
110impl sdl3_sys::metadata::GroupMetadata for SDL_WindowID {
111 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
112 &crate::metadata::video::METADATA_SDL_WindowID;
113}
114
115/// The pointer to the global `wl_display` object used by the Wayland video
116/// backend.
117///
118/// Can be set before the video subsystem is initialized to import an external
119/// `wl_display` object from an application or toolkit for use in SDL, or read
120/// after initialization to export the `wl_display` used by the Wayland video
121/// backend. Setting this property after the video subsystem has been
122/// initialized has no effect, and reading it when the video subsystem is
123/// uninitialized will either return the user provided value, if one was set
124/// prior to initialization, or NULL. See docs/README-wayland.md for more
125/// information.
126///
127/// ## Availability
128/// This macro is available since SDL 3.2.0.
129pub const SDL_PROP_GLOBAL_VIDEO_WAYLAND_WL_DISPLAY_POINTER: *const ::core::ffi::c_char =
130 c"SDL.video.wayland.wl_display".as_ptr();
131
132/// System theme.
133///
134/// ## Availability
135/// This enum is available since SDL 3.2.0.
136///
137/// ## Known values (`sdl3-sys`)
138/// | Associated constant | Global constant | Description |
139/// | ------------------- | --------------- | ----------- |
140/// | [`UNKNOWN`](SDL_SystemTheme::UNKNOWN) | [`SDL_SYSTEM_THEME_UNKNOWN`] | Unknown system theme |
141/// | [`LIGHT`](SDL_SystemTheme::LIGHT) | [`SDL_SYSTEM_THEME_LIGHT`] | Light colored system theme |
142/// | [`DARK`](SDL_SystemTheme::DARK) | [`SDL_SYSTEM_THEME_DARK`] | Dark colored system theme |
143#[repr(transparent)]
144#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
145pub struct SDL_SystemTheme(pub ::core::ffi::c_int);
146
147impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_SystemTheme {
148 #[inline(always)]
149 fn eq(&self, other: &::core::ffi::c_int) -> bool {
150 &self.0 == other
151 }
152}
153
154impl ::core::cmp::PartialEq<SDL_SystemTheme> for ::core::ffi::c_int {
155 #[inline(always)]
156 fn eq(&self, other: &SDL_SystemTheme) -> bool {
157 self == &other.0
158 }
159}
160
161impl From<SDL_SystemTheme> for ::core::ffi::c_int {
162 #[inline(always)]
163 fn from(value: SDL_SystemTheme) -> Self {
164 value.0
165 }
166}
167
168#[cfg(feature = "debug-impls")]
169impl ::core::fmt::Debug for SDL_SystemTheme {
170 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
171 #[allow(unreachable_patterns)]
172 f.write_str(match *self {
173 Self::UNKNOWN => "SDL_SYSTEM_THEME_UNKNOWN",
174 Self::LIGHT => "SDL_SYSTEM_THEME_LIGHT",
175 Self::DARK => "SDL_SYSTEM_THEME_DARK",
176
177 _ => return write!(f, "SDL_SystemTheme({})", self.0),
178 })
179 }
180}
181
182impl SDL_SystemTheme {
183 /// Unknown system theme
184 pub const UNKNOWN: Self = Self((0 as ::core::ffi::c_int));
185 /// Light colored system theme
186 pub const LIGHT: Self = Self((1 as ::core::ffi::c_int));
187 /// Dark colored system theme
188 pub const DARK: Self = Self((2 as ::core::ffi::c_int));
189}
190
191/// Unknown system theme
192pub const SDL_SYSTEM_THEME_UNKNOWN: SDL_SystemTheme = SDL_SystemTheme::UNKNOWN;
193/// Light colored system theme
194pub const SDL_SYSTEM_THEME_LIGHT: SDL_SystemTheme = SDL_SystemTheme::LIGHT;
195/// Dark colored system theme
196pub const SDL_SYSTEM_THEME_DARK: SDL_SystemTheme = SDL_SystemTheme::DARK;
197
198#[cfg(feature = "metadata")]
199impl sdl3_sys::metadata::GroupMetadata for SDL_SystemTheme {
200 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
201 &crate::metadata::video::METADATA_SDL_SystemTheme;
202}
203
204/// The structure that defines a display mode.
205///
206/// ## Availability
207/// This struct is available since SDL 3.2.0.
208///
209/// ## See also
210/// - [`SDL_GetFullscreenDisplayModes`]
211/// - [`SDL_GetDesktopDisplayMode`]
212/// - [`SDL_GetCurrentDisplayMode`]
213/// - [`SDL_SetWindowFullscreenMode`]
214/// - [`SDL_GetWindowFullscreenMode`]
215///
216/// ## Notes for `sdl3-sys`
217/// This struct can't be created manually. Use the corresponding SDL functions.
218#[repr(C)]
219#[cfg_attr(feature = "debug-impls", derive(Debug))]
220pub struct SDL_DisplayMode {
221 /// the display this mode is associated with
222 pub displayID: SDL_DisplayID,
223 /// pixel format
224 pub format: SDL_PixelFormat,
225 /// width
226 pub w: ::core::ffi::c_int,
227 /// height
228 pub h: ::core::ffi::c_int,
229 /// scale converting size to pixels (e.g. a 1920x1080 mode with 2.0 scale would have 3840x2160 pixels)
230 pub pixel_density: ::core::ffi::c_float,
231 /// refresh rate (or 0.0f for unspecified)
232 pub refresh_rate: ::core::ffi::c_float,
233 /// precise refresh rate numerator (or 0 for unspecified)
234 pub refresh_rate_numerator: ::core::ffi::c_int,
235 /// precise refresh rate denominator
236 pub refresh_rate_denominator: ::core::ffi::c_int,
237 /// Private
238 pub internal: *mut SDL_DisplayModeData,
239 #[doc(hidden)]
240 __non_exhaustive: ::sdl3_sys::NonExhaustive,
241}
242
243/// Display orientation values; the way a display is rotated.
244///
245/// ## Availability
246/// This enum is available since SDL 3.2.0.
247///
248/// ## Known values (`sdl3-sys`)
249/// | Associated constant | Global constant | Description |
250/// | ------------------- | --------------- | ----------- |
251/// | [`UNKNOWN`](SDL_DisplayOrientation::UNKNOWN) | [`SDL_ORIENTATION_UNKNOWN`] | The display orientation can't be determined |
252/// | [`LANDSCAPE`](SDL_DisplayOrientation::LANDSCAPE) | [`SDL_ORIENTATION_LANDSCAPE`] | The display is in landscape mode, with the right side up, relative to portrait mode |
253/// | [`LANDSCAPE_FLIPPED`](SDL_DisplayOrientation::LANDSCAPE_FLIPPED) | [`SDL_ORIENTATION_LANDSCAPE_FLIPPED`] | The display is in landscape mode, with the left side up, relative to portrait mode |
254/// | [`PORTRAIT`](SDL_DisplayOrientation::PORTRAIT) | [`SDL_ORIENTATION_PORTRAIT`] | The display is in portrait mode |
255/// | [`PORTRAIT_FLIPPED`](SDL_DisplayOrientation::PORTRAIT_FLIPPED) | [`SDL_ORIENTATION_PORTRAIT_FLIPPED`] | The display is in portrait mode, upside down |
256#[repr(transparent)]
257#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
258pub struct SDL_DisplayOrientation(pub ::core::ffi::c_int);
259
260impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_DisplayOrientation {
261 #[inline(always)]
262 fn eq(&self, other: &::core::ffi::c_int) -> bool {
263 &self.0 == other
264 }
265}
266
267impl ::core::cmp::PartialEq<SDL_DisplayOrientation> for ::core::ffi::c_int {
268 #[inline(always)]
269 fn eq(&self, other: &SDL_DisplayOrientation) -> bool {
270 self == &other.0
271 }
272}
273
274impl From<SDL_DisplayOrientation> for ::core::ffi::c_int {
275 #[inline(always)]
276 fn from(value: SDL_DisplayOrientation) -> Self {
277 value.0
278 }
279}
280
281#[cfg(feature = "debug-impls")]
282impl ::core::fmt::Debug for SDL_DisplayOrientation {
283 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
284 #[allow(unreachable_patterns)]
285 f.write_str(match *self {
286 Self::UNKNOWN => "SDL_ORIENTATION_UNKNOWN",
287 Self::LANDSCAPE => "SDL_ORIENTATION_LANDSCAPE",
288 Self::LANDSCAPE_FLIPPED => "SDL_ORIENTATION_LANDSCAPE_FLIPPED",
289 Self::PORTRAIT => "SDL_ORIENTATION_PORTRAIT",
290 Self::PORTRAIT_FLIPPED => "SDL_ORIENTATION_PORTRAIT_FLIPPED",
291
292 _ => return write!(f, "SDL_DisplayOrientation({})", self.0),
293 })
294 }
295}
296
297impl SDL_DisplayOrientation {
298 /// The display orientation can't be determined
299 pub const UNKNOWN: Self = Self((0 as ::core::ffi::c_int));
300 /// The display is in landscape mode, with the right side up, relative to portrait mode
301 pub const LANDSCAPE: Self = Self((1 as ::core::ffi::c_int));
302 /// The display is in landscape mode, with the left side up, relative to portrait mode
303 pub const LANDSCAPE_FLIPPED: Self = Self((2 as ::core::ffi::c_int));
304 /// The display is in portrait mode
305 pub const PORTRAIT: Self = Self((3 as ::core::ffi::c_int));
306 /// The display is in portrait mode, upside down
307 pub const PORTRAIT_FLIPPED: Self = Self((4 as ::core::ffi::c_int));
308}
309
310/// The display orientation can't be determined
311pub const SDL_ORIENTATION_UNKNOWN: SDL_DisplayOrientation = SDL_DisplayOrientation::UNKNOWN;
312/// The display is in landscape mode, with the right side up, relative to portrait mode
313pub const SDL_ORIENTATION_LANDSCAPE: SDL_DisplayOrientation = SDL_DisplayOrientation::LANDSCAPE;
314/// The display is in landscape mode, with the left side up, relative to portrait mode
315pub const SDL_ORIENTATION_LANDSCAPE_FLIPPED: SDL_DisplayOrientation =
316 SDL_DisplayOrientation::LANDSCAPE_FLIPPED;
317/// The display is in portrait mode
318pub const SDL_ORIENTATION_PORTRAIT: SDL_DisplayOrientation = SDL_DisplayOrientation::PORTRAIT;
319/// The display is in portrait mode, upside down
320pub const SDL_ORIENTATION_PORTRAIT_FLIPPED: SDL_DisplayOrientation =
321 SDL_DisplayOrientation::PORTRAIT_FLIPPED;
322
323#[cfg(feature = "metadata")]
324impl sdl3_sys::metadata::GroupMetadata for SDL_DisplayOrientation {
325 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
326 &crate::metadata::video::METADATA_SDL_DisplayOrientation;
327}
328
329/// The flags on a window.
330///
331/// These cover a lot of true/false, or on/off, window state. Some of it is
332/// immutable after being set through [`SDL_CreateWindow()`], some of it can be
333/// changed on existing windows by the app, and some of it might be altered by
334/// the user or system outside of the app's control.
335///
336/// When creating windows with [`SDL_WINDOW_RESIZABLE`], SDL will constrain
337/// resizable windows to the dimensions recommended by the compositor to fit it
338/// within the usable desktop space, although some compositors will do this
339/// automatically without intervention as well. Use [`SDL_SetWindowResizable`]
340/// after creation instead if you wish to create a window with a specific size.
341///
342/// ## Availability
343/// This datatype is available since SDL 3.2.0.
344///
345/// ## See also
346/// - [`SDL_GetWindowFlags`]
347///
348/// ## Known values (`sdl3-sys`)
349/// | Associated constant | Global constant | Description |
350/// | ------------------- | --------------- | ----------- |
351/// | [`FULLSCREEN`](SDL_WindowFlags::FULLSCREEN) | [`SDL_WINDOW_FULLSCREEN`] | window is in fullscreen mode |
352/// | [`OPENGL`](SDL_WindowFlags::OPENGL) | [`SDL_WINDOW_OPENGL`] | window usable with OpenGL context |
353/// | [`OCCLUDED`](SDL_WindowFlags::OCCLUDED) | [`SDL_WINDOW_OCCLUDED`] | window is occluded |
354/// | [`HIDDEN`](SDL_WindowFlags::HIDDEN) | [`SDL_WINDOW_HIDDEN`] | window is neither mapped onto the desktop nor shown in the taskbar/dock/window list; [`SDL_ShowWindow()`] is required for it to become visible |
355/// | [`BORDERLESS`](SDL_WindowFlags::BORDERLESS) | [`SDL_WINDOW_BORDERLESS`] | no window decoration |
356/// | [`RESIZABLE`](SDL_WindowFlags::RESIZABLE) | [`SDL_WINDOW_RESIZABLE`] | window can be resized |
357/// | [`MINIMIZED`](SDL_WindowFlags::MINIMIZED) | [`SDL_WINDOW_MINIMIZED`] | window is minimized |
358/// | [`MAXIMIZED`](SDL_WindowFlags::MAXIMIZED) | [`SDL_WINDOW_MAXIMIZED`] | window is maximized |
359/// | [`MOUSE_GRABBED`](SDL_WindowFlags::MOUSE_GRABBED) | [`SDL_WINDOW_MOUSE_GRABBED`] | window has grabbed mouse input |
360/// | [`INPUT_FOCUS`](SDL_WindowFlags::INPUT_FOCUS) | [`SDL_WINDOW_INPUT_FOCUS`] | window has input focus |
361/// | [`MOUSE_FOCUS`](SDL_WindowFlags::MOUSE_FOCUS) | [`SDL_WINDOW_MOUSE_FOCUS`] | window has mouse focus |
362/// | [`EXTERNAL`](SDL_WindowFlags::EXTERNAL) | [`SDL_WINDOW_EXTERNAL`] | window not created by SDL |
363/// | [`MODAL`](SDL_WindowFlags::MODAL) | [`SDL_WINDOW_MODAL`] | window is modal |
364/// | [`HIGH_PIXEL_DENSITY`](SDL_WindowFlags::HIGH_PIXEL_DENSITY) | [`SDL_WINDOW_HIGH_PIXEL_DENSITY`] | window uses high pixel density back buffer if possible |
365/// | [`MOUSE_CAPTURE`](SDL_WindowFlags::MOUSE_CAPTURE) | [`SDL_WINDOW_MOUSE_CAPTURE`] | window has mouse captured (unrelated to MOUSE_GRABBED) |
366/// | [`MOUSE_RELATIVE_MODE`](SDL_WindowFlags::MOUSE_RELATIVE_MODE) | [`SDL_WINDOW_MOUSE_RELATIVE_MODE`] | window has relative mode enabled |
367/// | [`ALWAYS_ON_TOP`](SDL_WindowFlags::ALWAYS_ON_TOP) | [`SDL_WINDOW_ALWAYS_ON_TOP`] | window should always be above others |
368/// | [`UTILITY`](SDL_WindowFlags::UTILITY) | [`SDL_WINDOW_UTILITY`] | window should be treated as a utility window, not showing in the task bar and window list |
369/// | [`TOOLTIP`](SDL_WindowFlags::TOOLTIP) | [`SDL_WINDOW_TOOLTIP`] | window should be treated as a tooltip and does not get mouse or keyboard focus, requires a parent window |
370/// | [`POPUP_MENU`](SDL_WindowFlags::POPUP_MENU) | [`SDL_WINDOW_POPUP_MENU`] | window should be treated as a popup menu, requires a parent window |
371/// | [`KEYBOARD_GRABBED`](SDL_WindowFlags::KEYBOARD_GRABBED) | [`SDL_WINDOW_KEYBOARD_GRABBED`] | window has grabbed keyboard input |
372/// | [`FILL_DOCUMENT`](SDL_WindowFlags::FILL_DOCUMENT) | [`SDL_WINDOW_FILL_DOCUMENT`] | window is in fill-document mode (Emscripten only), since SDL 3.4.0 |
373/// | [`VULKAN`](SDL_WindowFlags::VULKAN) | [`SDL_WINDOW_VULKAN`] | window usable for Vulkan surface |
374/// | [`METAL`](SDL_WindowFlags::METAL) | [`SDL_WINDOW_METAL`] | window usable for Metal view |
375/// | [`TRANSPARENT`](SDL_WindowFlags::TRANSPARENT) | [`SDL_WINDOW_TRANSPARENT`] | window with transparent buffer |
376/// | [`NOT_FOCUSABLE`](SDL_WindowFlags::NOT_FOCUSABLE) | [`SDL_WINDOW_NOT_FOCUSABLE`] | window should not be focusable |
377#[repr(transparent)]
378#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
379pub struct SDL_WindowFlags(pub Uint64);
380
381impl ::core::cmp::PartialEq<Uint64> for SDL_WindowFlags {
382 #[inline(always)]
383 fn eq(&self, other: &Uint64) -> bool {
384 &self.0 == other
385 }
386}
387
388impl ::core::cmp::PartialEq<SDL_WindowFlags> for Uint64 {
389 #[inline(always)]
390 fn eq(&self, other: &SDL_WindowFlags) -> bool {
391 self == &other.0
392 }
393}
394
395impl From<SDL_WindowFlags> for Uint64 {
396 #[inline(always)]
397 fn from(value: SDL_WindowFlags) -> Self {
398 value.0
399 }
400}
401
402#[cfg(feature = "debug-impls")]
403impl ::core::fmt::Debug for SDL_WindowFlags {
404 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
405 let mut first = true;
406 let all_bits = 0;
407 write!(f, "SDL_WindowFlags(")?;
408 let all_bits = all_bits | Self::FULLSCREEN.0;
409 if (Self::FULLSCREEN != 0 || self.0 == 0) && *self & Self::FULLSCREEN == Self::FULLSCREEN {
410 if !first {
411 write!(f, " | ")?;
412 }
413 first = false;
414 write!(f, "FULLSCREEN")?;
415 }
416 let all_bits = all_bits | Self::OPENGL.0;
417 if (Self::OPENGL != 0 || self.0 == 0) && *self & Self::OPENGL == Self::OPENGL {
418 if !first {
419 write!(f, " | ")?;
420 }
421 first = false;
422 write!(f, "OPENGL")?;
423 }
424 let all_bits = all_bits | Self::OCCLUDED.0;
425 if (Self::OCCLUDED != 0 || self.0 == 0) && *self & Self::OCCLUDED == Self::OCCLUDED {
426 if !first {
427 write!(f, " | ")?;
428 }
429 first = false;
430 write!(f, "OCCLUDED")?;
431 }
432 let all_bits = all_bits | Self::HIDDEN.0;
433 if (Self::HIDDEN != 0 || self.0 == 0) && *self & Self::HIDDEN == Self::HIDDEN {
434 if !first {
435 write!(f, " | ")?;
436 }
437 first = false;
438 write!(f, "HIDDEN")?;
439 }
440 let all_bits = all_bits | Self::BORDERLESS.0;
441 if (Self::BORDERLESS != 0 || self.0 == 0) && *self & Self::BORDERLESS == Self::BORDERLESS {
442 if !first {
443 write!(f, " | ")?;
444 }
445 first = false;
446 write!(f, "BORDERLESS")?;
447 }
448 let all_bits = all_bits | Self::RESIZABLE.0;
449 if (Self::RESIZABLE != 0 || self.0 == 0) && *self & Self::RESIZABLE == Self::RESIZABLE {
450 if !first {
451 write!(f, " | ")?;
452 }
453 first = false;
454 write!(f, "RESIZABLE")?;
455 }
456 let all_bits = all_bits | Self::MINIMIZED.0;
457 if (Self::MINIMIZED != 0 || self.0 == 0) && *self & Self::MINIMIZED == Self::MINIMIZED {
458 if !first {
459 write!(f, " | ")?;
460 }
461 first = false;
462 write!(f, "MINIMIZED")?;
463 }
464 let all_bits = all_bits | Self::MAXIMIZED.0;
465 if (Self::MAXIMIZED != 0 || self.0 == 0) && *self & Self::MAXIMIZED == Self::MAXIMIZED {
466 if !first {
467 write!(f, " | ")?;
468 }
469 first = false;
470 write!(f, "MAXIMIZED")?;
471 }
472 let all_bits = all_bits | Self::MOUSE_GRABBED.0;
473 if (Self::MOUSE_GRABBED != 0 || self.0 == 0)
474 && *self & Self::MOUSE_GRABBED == Self::MOUSE_GRABBED
475 {
476 if !first {
477 write!(f, " | ")?;
478 }
479 first = false;
480 write!(f, "MOUSE_GRABBED")?;
481 }
482 let all_bits = all_bits | Self::INPUT_FOCUS.0;
483 if (Self::INPUT_FOCUS != 0 || self.0 == 0) && *self & Self::INPUT_FOCUS == Self::INPUT_FOCUS
484 {
485 if !first {
486 write!(f, " | ")?;
487 }
488 first = false;
489 write!(f, "INPUT_FOCUS")?;
490 }
491 let all_bits = all_bits | Self::MOUSE_FOCUS.0;
492 if (Self::MOUSE_FOCUS != 0 || self.0 == 0) && *self & Self::MOUSE_FOCUS == Self::MOUSE_FOCUS
493 {
494 if !first {
495 write!(f, " | ")?;
496 }
497 first = false;
498 write!(f, "MOUSE_FOCUS")?;
499 }
500 let all_bits = all_bits | Self::EXTERNAL.0;
501 if (Self::EXTERNAL != 0 || self.0 == 0) && *self & Self::EXTERNAL == Self::EXTERNAL {
502 if !first {
503 write!(f, " | ")?;
504 }
505 first = false;
506 write!(f, "EXTERNAL")?;
507 }
508 let all_bits = all_bits | Self::MODAL.0;
509 if (Self::MODAL != 0 || self.0 == 0) && *self & Self::MODAL == Self::MODAL {
510 if !first {
511 write!(f, " | ")?;
512 }
513 first = false;
514 write!(f, "MODAL")?;
515 }
516 let all_bits = all_bits | Self::HIGH_PIXEL_DENSITY.0;
517 if (Self::HIGH_PIXEL_DENSITY != 0 || self.0 == 0)
518 && *self & Self::HIGH_PIXEL_DENSITY == Self::HIGH_PIXEL_DENSITY
519 {
520 if !first {
521 write!(f, " | ")?;
522 }
523 first = false;
524 write!(f, "HIGH_PIXEL_DENSITY")?;
525 }
526 let all_bits = all_bits | Self::MOUSE_CAPTURE.0;
527 if (Self::MOUSE_CAPTURE != 0 || self.0 == 0)
528 && *self & Self::MOUSE_CAPTURE == Self::MOUSE_CAPTURE
529 {
530 if !first {
531 write!(f, " | ")?;
532 }
533 first = false;
534 write!(f, "MOUSE_CAPTURE")?;
535 }
536 let all_bits = all_bits | Self::MOUSE_RELATIVE_MODE.0;
537 if (Self::MOUSE_RELATIVE_MODE != 0 || self.0 == 0)
538 && *self & Self::MOUSE_RELATIVE_MODE == Self::MOUSE_RELATIVE_MODE
539 {
540 if !first {
541 write!(f, " | ")?;
542 }
543 first = false;
544 write!(f, "MOUSE_RELATIVE_MODE")?;
545 }
546 let all_bits = all_bits | Self::ALWAYS_ON_TOP.0;
547 if (Self::ALWAYS_ON_TOP != 0 || self.0 == 0)
548 && *self & Self::ALWAYS_ON_TOP == Self::ALWAYS_ON_TOP
549 {
550 if !first {
551 write!(f, " | ")?;
552 }
553 first = false;
554 write!(f, "ALWAYS_ON_TOP")?;
555 }
556 let all_bits = all_bits | Self::UTILITY.0;
557 if (Self::UTILITY != 0 || self.0 == 0) && *self & Self::UTILITY == Self::UTILITY {
558 if !first {
559 write!(f, " | ")?;
560 }
561 first = false;
562 write!(f, "UTILITY")?;
563 }
564 let all_bits = all_bits | Self::TOOLTIP.0;
565 if (Self::TOOLTIP != 0 || self.0 == 0) && *self & Self::TOOLTIP == Self::TOOLTIP {
566 if !first {
567 write!(f, " | ")?;
568 }
569 first = false;
570 write!(f, "TOOLTIP")?;
571 }
572 let all_bits = all_bits | Self::POPUP_MENU.0;
573 if (Self::POPUP_MENU != 0 || self.0 == 0) && *self & Self::POPUP_MENU == Self::POPUP_MENU {
574 if !first {
575 write!(f, " | ")?;
576 }
577 first = false;
578 write!(f, "POPUP_MENU")?;
579 }
580 let all_bits = all_bits | Self::KEYBOARD_GRABBED.0;
581 if (Self::KEYBOARD_GRABBED != 0 || self.0 == 0)
582 && *self & Self::KEYBOARD_GRABBED == Self::KEYBOARD_GRABBED
583 {
584 if !first {
585 write!(f, " | ")?;
586 }
587 first = false;
588 write!(f, "KEYBOARD_GRABBED")?;
589 }
590 let all_bits = all_bits | Self::FILL_DOCUMENT.0;
591 if (Self::FILL_DOCUMENT != 0 || self.0 == 0)
592 && *self & Self::FILL_DOCUMENT == Self::FILL_DOCUMENT
593 {
594 if !first {
595 write!(f, " | ")?;
596 }
597 first = false;
598 write!(f, "FILL_DOCUMENT")?;
599 }
600 let all_bits = all_bits | Self::VULKAN.0;
601 if (Self::VULKAN != 0 || self.0 == 0) && *self & Self::VULKAN == Self::VULKAN {
602 if !first {
603 write!(f, " | ")?;
604 }
605 first = false;
606 write!(f, "VULKAN")?;
607 }
608 let all_bits = all_bits | Self::METAL.0;
609 if (Self::METAL != 0 || self.0 == 0) && *self & Self::METAL == Self::METAL {
610 if !first {
611 write!(f, " | ")?;
612 }
613 first = false;
614 write!(f, "METAL")?;
615 }
616 let all_bits = all_bits | Self::TRANSPARENT.0;
617 if (Self::TRANSPARENT != 0 || self.0 == 0) && *self & Self::TRANSPARENT == Self::TRANSPARENT
618 {
619 if !first {
620 write!(f, " | ")?;
621 }
622 first = false;
623 write!(f, "TRANSPARENT")?;
624 }
625 let all_bits = all_bits | Self::NOT_FOCUSABLE.0;
626 if (Self::NOT_FOCUSABLE != 0 || self.0 == 0)
627 && *self & Self::NOT_FOCUSABLE == Self::NOT_FOCUSABLE
628 {
629 if !first {
630 write!(f, " | ")?;
631 }
632 first = false;
633 write!(f, "NOT_FOCUSABLE")?;
634 }
635
636 if self.0 & !all_bits != 0 {
637 if !first {
638 write!(f, " | ")?;
639 }
640 write!(f, "{:#x}", self.0)?;
641 } else if first {
642 write!(f, "0")?;
643 }
644 write!(f, ")")
645 }
646}
647
648impl ::core::ops::BitAnd for SDL_WindowFlags {
649 type Output = Self;
650
651 #[inline(always)]
652 fn bitand(self, rhs: Self) -> Self::Output {
653 Self(self.0 & rhs.0)
654 }
655}
656
657impl ::core::ops::BitAndAssign for SDL_WindowFlags {
658 #[inline(always)]
659 fn bitand_assign(&mut self, rhs: Self) {
660 self.0 &= rhs.0;
661 }
662}
663
664impl ::core::ops::BitOr for SDL_WindowFlags {
665 type Output = Self;
666
667 #[inline(always)]
668 fn bitor(self, rhs: Self) -> Self::Output {
669 Self(self.0 | rhs.0)
670 }
671}
672
673impl ::core::ops::BitOrAssign for SDL_WindowFlags {
674 #[inline(always)]
675 fn bitor_assign(&mut self, rhs: Self) {
676 self.0 |= rhs.0;
677 }
678}
679
680impl ::core::ops::BitXor for SDL_WindowFlags {
681 type Output = Self;
682
683 #[inline(always)]
684 fn bitxor(self, rhs: Self) -> Self::Output {
685 Self(self.0 ^ rhs.0)
686 }
687}
688
689impl ::core::ops::BitXorAssign for SDL_WindowFlags {
690 #[inline(always)]
691 fn bitxor_assign(&mut self, rhs: Self) {
692 self.0 ^= rhs.0;
693 }
694}
695
696impl ::core::ops::Not for SDL_WindowFlags {
697 type Output = Self;
698
699 #[inline(always)]
700 fn not(self) -> Self::Output {
701 Self(!self.0)
702 }
703}
704
705impl SDL_WindowFlags {
706 /// window is in fullscreen mode
707 pub const FULLSCREEN: Self = Self((1_u64 as Uint64));
708 /// window usable with OpenGL context
709 pub const OPENGL: Self = Self((2_u64 as Uint64));
710 /// window is occluded
711 pub const OCCLUDED: Self = Self((4_u64 as Uint64));
712 /// window is neither mapped onto the desktop nor shown in the taskbar/dock/window list; [`SDL_ShowWindow()`] is required for it to become visible
713 pub const HIDDEN: Self = Self((8_u64 as Uint64));
714 /// no window decoration
715 pub const BORDERLESS: Self = Self((16_u64 as Uint64));
716 /// window can be resized
717 pub const RESIZABLE: Self = Self((32_u64 as Uint64));
718 /// window is minimized
719 pub const MINIMIZED: Self = Self((64_u64 as Uint64));
720 /// window is maximized
721 pub const MAXIMIZED: Self = Self((128_u64 as Uint64));
722 /// window has grabbed mouse input
723 pub const MOUSE_GRABBED: Self = Self((256_u64 as Uint64));
724 /// window has input focus
725 pub const INPUT_FOCUS: Self = Self((512_u64 as Uint64));
726 /// window has mouse focus
727 pub const MOUSE_FOCUS: Self = Self((1024_u64 as Uint64));
728 /// window not created by SDL
729 pub const EXTERNAL: Self = Self((2048_u64 as Uint64));
730 /// window is modal
731 pub const MODAL: Self = Self((4096_u64 as Uint64));
732 /// window uses high pixel density back buffer if possible
733 pub const HIGH_PIXEL_DENSITY: Self = Self((8192_u64 as Uint64));
734 /// window has mouse captured (unrelated to MOUSE_GRABBED)
735 pub const MOUSE_CAPTURE: Self = Self((16384_u64 as Uint64));
736 /// window has relative mode enabled
737 pub const MOUSE_RELATIVE_MODE: Self = Self((32768_u64 as Uint64));
738 /// window should always be above others
739 pub const ALWAYS_ON_TOP: Self = Self((65536_u64 as Uint64));
740 /// window should be treated as a utility window, not showing in the task bar and window list
741 pub const UTILITY: Self = Self((131072_u64 as Uint64));
742 /// window should be treated as a tooltip and does not get mouse or keyboard focus, requires a parent window
743 pub const TOOLTIP: Self = Self((262144_u64 as Uint64));
744 /// window should be treated as a popup menu, requires a parent window
745 pub const POPUP_MENU: Self = Self((524288_u64 as Uint64));
746 /// window has grabbed keyboard input
747 pub const KEYBOARD_GRABBED: Self = Self((1048576_u64 as Uint64));
748 /// window is in fill-document mode (Emscripten only), since SDL 3.4.0
749 pub const FILL_DOCUMENT: Self = Self((2097152_u64 as Uint64));
750 /// window usable for Vulkan surface
751 pub const VULKAN: Self = Self((268435456_u64 as Uint64));
752 /// window usable for Metal view
753 pub const METAL: Self = Self((536870912_u64 as Uint64));
754 /// window with transparent buffer
755 pub const TRANSPARENT: Self = Self((1073741824_u64 as Uint64));
756 /// window should not be focusable
757 pub const NOT_FOCUSABLE: Self = Self((2147483648_u64 as Uint64));
758}
759
760/// window is in fullscreen mode
761pub const SDL_WINDOW_FULLSCREEN: SDL_WindowFlags = SDL_WindowFlags::FULLSCREEN;
762/// window usable with OpenGL context
763pub const SDL_WINDOW_OPENGL: SDL_WindowFlags = SDL_WindowFlags::OPENGL;
764/// window is occluded
765pub const SDL_WINDOW_OCCLUDED: SDL_WindowFlags = SDL_WindowFlags::OCCLUDED;
766/// window is neither mapped onto the desktop nor shown in the taskbar/dock/window list; [`SDL_ShowWindow()`] is required for it to become visible
767pub const SDL_WINDOW_HIDDEN: SDL_WindowFlags = SDL_WindowFlags::HIDDEN;
768/// no window decoration
769pub const SDL_WINDOW_BORDERLESS: SDL_WindowFlags = SDL_WindowFlags::BORDERLESS;
770/// window can be resized
771pub const SDL_WINDOW_RESIZABLE: SDL_WindowFlags = SDL_WindowFlags::RESIZABLE;
772/// window is minimized
773pub const SDL_WINDOW_MINIMIZED: SDL_WindowFlags = SDL_WindowFlags::MINIMIZED;
774/// window is maximized
775pub const SDL_WINDOW_MAXIMIZED: SDL_WindowFlags = SDL_WindowFlags::MAXIMIZED;
776/// window has grabbed mouse input
777pub const SDL_WINDOW_MOUSE_GRABBED: SDL_WindowFlags = SDL_WindowFlags::MOUSE_GRABBED;
778/// window has input focus
779pub const SDL_WINDOW_INPUT_FOCUS: SDL_WindowFlags = SDL_WindowFlags::INPUT_FOCUS;
780/// window has mouse focus
781pub const SDL_WINDOW_MOUSE_FOCUS: SDL_WindowFlags = SDL_WindowFlags::MOUSE_FOCUS;
782/// window not created by SDL
783pub const SDL_WINDOW_EXTERNAL: SDL_WindowFlags = SDL_WindowFlags::EXTERNAL;
784/// window is modal
785pub const SDL_WINDOW_MODAL: SDL_WindowFlags = SDL_WindowFlags::MODAL;
786/// window uses high pixel density back buffer if possible
787pub const SDL_WINDOW_HIGH_PIXEL_DENSITY: SDL_WindowFlags = SDL_WindowFlags::HIGH_PIXEL_DENSITY;
788/// window has mouse captured (unrelated to MOUSE_GRABBED)
789pub const SDL_WINDOW_MOUSE_CAPTURE: SDL_WindowFlags = SDL_WindowFlags::MOUSE_CAPTURE;
790/// window has relative mode enabled
791pub const SDL_WINDOW_MOUSE_RELATIVE_MODE: SDL_WindowFlags = SDL_WindowFlags::MOUSE_RELATIVE_MODE;
792/// window should always be above others
793pub const SDL_WINDOW_ALWAYS_ON_TOP: SDL_WindowFlags = SDL_WindowFlags::ALWAYS_ON_TOP;
794/// window should be treated as a utility window, not showing in the task bar and window list
795pub const SDL_WINDOW_UTILITY: SDL_WindowFlags = SDL_WindowFlags::UTILITY;
796/// window should be treated as a tooltip and does not get mouse or keyboard focus, requires a parent window
797pub const SDL_WINDOW_TOOLTIP: SDL_WindowFlags = SDL_WindowFlags::TOOLTIP;
798/// window should be treated as a popup menu, requires a parent window
799pub const SDL_WINDOW_POPUP_MENU: SDL_WindowFlags = SDL_WindowFlags::POPUP_MENU;
800/// window has grabbed keyboard input
801pub const SDL_WINDOW_KEYBOARD_GRABBED: SDL_WindowFlags = SDL_WindowFlags::KEYBOARD_GRABBED;
802/// window is in fill-document mode (Emscripten only), since SDL 3.4.0
803pub const SDL_WINDOW_FILL_DOCUMENT: SDL_WindowFlags = SDL_WindowFlags::FILL_DOCUMENT;
804/// window usable for Vulkan surface
805pub const SDL_WINDOW_VULKAN: SDL_WindowFlags = SDL_WindowFlags::VULKAN;
806/// window usable for Metal view
807pub const SDL_WINDOW_METAL: SDL_WindowFlags = SDL_WindowFlags::METAL;
808/// window with transparent buffer
809pub const SDL_WINDOW_TRANSPARENT: SDL_WindowFlags = SDL_WindowFlags::TRANSPARENT;
810/// window should not be focusable
811pub const SDL_WINDOW_NOT_FOCUSABLE: SDL_WindowFlags = SDL_WindowFlags::NOT_FOCUSABLE;
812
813#[cfg(feature = "metadata")]
814impl sdl3_sys::metadata::GroupMetadata for SDL_WindowFlags {
815 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
816 &crate::metadata::video::METADATA_SDL_WindowFlags;
817}
818
819/// A magic value used with [`SDL_WINDOWPOS_UNDEFINED`].
820///
821/// Generally this macro isn't used directly, but rather through
822/// [`SDL_WINDOWPOS_UNDEFINED`] or [`SDL_WINDOWPOS_UNDEFINED_DISPLAY`].
823///
824/// ## Availability
825/// This macro is available since SDL 3.2.0.
826///
827/// ## See also
828/// - [`SDL_SetWindowPosition`]
829pub const SDL_WINDOWPOS_UNDEFINED_MASK: ::core::primitive::u32 = 536805376_u32;
830
831/// Used to indicate that you don't care what the window position is.
832///
833/// If you _really_ don't care, [`SDL_WINDOWPOS_UNDEFINED`] is the same, but always
834/// uses the primary display instead of specifying one.
835///
836/// ## Parameters
837/// - `X`: the [`SDL_DisplayID`] of the display to use.
838///
839/// ## Availability
840/// This macro is available since SDL 3.2.0.
841///
842/// ## See also
843/// - [`SDL_SetWindowPosition`]
844#[inline(always)]
845pub const fn SDL_WINDOWPOS_UNDEFINED_DISPLAY(X: SDL_DisplayID) -> ::core::ffi::c_int {
846 ((SDL_WINDOWPOS_UNDEFINED_MASK | X.0) as ::core::ffi::c_int)
847}
848
849/// Used to indicate that you don't care what the window position/display is.
850///
851/// This always uses the primary display.
852///
853/// ## Availability
854/// This macro is available since SDL 3.2.0.
855///
856/// ## See also
857/// - [`SDL_SetWindowPosition`]
858pub const SDL_WINDOWPOS_UNDEFINED: ::core::ffi::c_int =
859 SDL_WINDOWPOS_UNDEFINED_DISPLAY(SDL_DisplayID((0 as Uint32)));
860
861/// A macro to test if the window position is marked as "undefined."
862///
863/// ## Parameters
864/// - `X`: the window position value.
865///
866/// ## Availability
867/// This macro is available since SDL 3.2.0.
868///
869/// ## See also
870/// - [`SDL_SetWindowPosition`]
871#[inline(always)]
872pub const fn SDL_WINDOWPOS_ISUNDEFINED(X: ::core::ffi::c_int) -> ::core::primitive::bool {
873 (((X as ::core::primitive::u32) & 4294901760_u32) == SDL_WINDOWPOS_UNDEFINED_MASK)
874}
875
876/// A magic value used with [`SDL_WINDOWPOS_CENTERED`].
877///
878/// Generally this macro isn't used directly, but rather through
879/// [`SDL_WINDOWPOS_CENTERED`] or [`SDL_WINDOWPOS_CENTERED_DISPLAY`].
880///
881/// ## Availability
882/// This macro is available since SDL 3.2.0.
883///
884/// ## See also
885/// - [`SDL_SetWindowPosition`]
886pub const SDL_WINDOWPOS_CENTERED_MASK: ::core::primitive::u32 = 805240832_u32;
887
888/// Used to indicate that the window position should be centered.
889///
890/// [`SDL_WINDOWPOS_CENTERED`] is the same, but always uses the primary display
891/// instead of specifying one.
892///
893/// ## Parameters
894/// - `X`: the [`SDL_DisplayID`] of the display to use.
895///
896/// ## Availability
897/// This macro is available since SDL 3.2.0.
898///
899/// ## See also
900/// - [`SDL_SetWindowPosition`]
901#[inline(always)]
902pub const fn SDL_WINDOWPOS_CENTERED_DISPLAY(X: SDL_DisplayID) -> ::core::ffi::c_int {
903 ((SDL_WINDOWPOS_CENTERED_MASK | X.0) as ::core::ffi::c_int)
904}
905
906/// Used to indicate that the window position should be centered.
907///
908/// This always uses the primary display.
909///
910/// ## Availability
911/// This macro is available since SDL 3.2.0.
912///
913/// ## See also
914/// - [`SDL_SetWindowPosition`]
915pub const SDL_WINDOWPOS_CENTERED: ::core::ffi::c_int =
916 SDL_WINDOWPOS_CENTERED_DISPLAY(SDL_DisplayID((0 as Uint32)));
917
918/// A macro to test if the window position is marked as "centered."
919///
920/// ## Parameters
921/// - `X`: the window position value.
922///
923/// ## Availability
924/// This macro is available since SDL 3.2.0.
925///
926/// ## See also
927/// - [`SDL_GetWindowPosition`]
928#[inline(always)]
929pub const fn SDL_WINDOWPOS_ISCENTERED(X: ::core::ffi::c_int) -> ::core::primitive::bool {
930 (((X as ::core::primitive::u32) & 4294901760_u32) == SDL_WINDOWPOS_CENTERED_MASK)
931}
932
933/// Window flash operation.
934///
935/// ## Availability
936/// This enum is available since SDL 3.2.0.
937///
938/// ## Known values (`sdl3-sys`)
939/// | Associated constant | Global constant | Description |
940/// | ------------------- | --------------- | ----------- |
941/// | [`CANCEL`](SDL_FlashOperation::CANCEL) | [`SDL_FLASH_CANCEL`] | Cancel any window flash state |
942/// | [`BRIEFLY`](SDL_FlashOperation::BRIEFLY) | [`SDL_FLASH_BRIEFLY`] | Flash the window briefly to get attention |
943/// | [`UNTIL_FOCUSED`](SDL_FlashOperation::UNTIL_FOCUSED) | [`SDL_FLASH_UNTIL_FOCUSED`] | Flash the window until it gets focus |
944#[repr(transparent)]
945#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
946pub struct SDL_FlashOperation(pub ::core::ffi::c_int);
947
948impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_FlashOperation {
949 #[inline(always)]
950 fn eq(&self, other: &::core::ffi::c_int) -> bool {
951 &self.0 == other
952 }
953}
954
955impl ::core::cmp::PartialEq<SDL_FlashOperation> for ::core::ffi::c_int {
956 #[inline(always)]
957 fn eq(&self, other: &SDL_FlashOperation) -> bool {
958 self == &other.0
959 }
960}
961
962impl From<SDL_FlashOperation> for ::core::ffi::c_int {
963 #[inline(always)]
964 fn from(value: SDL_FlashOperation) -> Self {
965 value.0
966 }
967}
968
969#[cfg(feature = "debug-impls")]
970impl ::core::fmt::Debug for SDL_FlashOperation {
971 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
972 #[allow(unreachable_patterns)]
973 f.write_str(match *self {
974 Self::CANCEL => "SDL_FLASH_CANCEL",
975 Self::BRIEFLY => "SDL_FLASH_BRIEFLY",
976 Self::UNTIL_FOCUSED => "SDL_FLASH_UNTIL_FOCUSED",
977
978 _ => return write!(f, "SDL_FlashOperation({})", self.0),
979 })
980 }
981}
982
983impl SDL_FlashOperation {
984 /// Cancel any window flash state
985 pub const CANCEL: Self = Self((0 as ::core::ffi::c_int));
986 /// Flash the window briefly to get attention
987 pub const BRIEFLY: Self = Self((1 as ::core::ffi::c_int));
988 /// Flash the window until it gets focus
989 pub const UNTIL_FOCUSED: Self = Self((2 as ::core::ffi::c_int));
990}
991
992/// Cancel any window flash state
993pub const SDL_FLASH_CANCEL: SDL_FlashOperation = SDL_FlashOperation::CANCEL;
994/// Flash the window briefly to get attention
995pub const SDL_FLASH_BRIEFLY: SDL_FlashOperation = SDL_FlashOperation::BRIEFLY;
996/// Flash the window until it gets focus
997pub const SDL_FLASH_UNTIL_FOCUSED: SDL_FlashOperation = SDL_FlashOperation::UNTIL_FOCUSED;
998
999#[cfg(feature = "metadata")]
1000impl sdl3_sys::metadata::GroupMetadata for SDL_FlashOperation {
1001 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
1002 &crate::metadata::video::METADATA_SDL_FlashOperation;
1003}
1004
1005/// Window progress state
1006///
1007/// ## Availability
1008/// This enum is available since SDL 3.2.8.
1009///
1010/// ## Known values (`sdl3-sys`)
1011/// | Associated constant | Global constant | Description |
1012/// | ------------------- | --------------- | ----------- |
1013/// | [`INVALID`](SDL_ProgressState::INVALID) | [`SDL_PROGRESS_STATE_INVALID`] | An invalid progress state indicating an error; check [`SDL_GetError()`] |
1014/// | [`NONE`](SDL_ProgressState::NONE) | [`SDL_PROGRESS_STATE_NONE`] | No progress bar is shown |
1015/// | [`INDETERMINATE`](SDL_ProgressState::INDETERMINATE) | [`SDL_PROGRESS_STATE_INDETERMINATE`] | The progress bar is shown in a indeterminate state |
1016/// | [`NORMAL`](SDL_ProgressState::NORMAL) | [`SDL_PROGRESS_STATE_NORMAL`] | The progress bar is shown in a normal state |
1017/// | [`PAUSED`](SDL_ProgressState::PAUSED) | [`SDL_PROGRESS_STATE_PAUSED`] | The progress bar is shown in a paused state |
1018/// | [`ERROR`](SDL_ProgressState::ERROR) | [`SDL_PROGRESS_STATE_ERROR`] | The progress bar is shown in a state indicating the application had an error |
1019#[repr(transparent)]
1020#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
1021pub struct SDL_ProgressState(pub ::core::ffi::c_int);
1022
1023impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_ProgressState {
1024 #[inline(always)]
1025 fn eq(&self, other: &::core::ffi::c_int) -> bool {
1026 &self.0 == other
1027 }
1028}
1029
1030impl ::core::cmp::PartialEq<SDL_ProgressState> for ::core::ffi::c_int {
1031 #[inline(always)]
1032 fn eq(&self, other: &SDL_ProgressState) -> bool {
1033 self == &other.0
1034 }
1035}
1036
1037impl From<SDL_ProgressState> for ::core::ffi::c_int {
1038 #[inline(always)]
1039 fn from(value: SDL_ProgressState) -> Self {
1040 value.0
1041 }
1042}
1043
1044#[cfg(feature = "debug-impls")]
1045impl ::core::fmt::Debug for SDL_ProgressState {
1046 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1047 #[allow(unreachable_patterns)]
1048 f.write_str(match *self {
1049 Self::INVALID => "SDL_PROGRESS_STATE_INVALID",
1050 Self::NONE => "SDL_PROGRESS_STATE_NONE",
1051 Self::INDETERMINATE => "SDL_PROGRESS_STATE_INDETERMINATE",
1052 Self::NORMAL => "SDL_PROGRESS_STATE_NORMAL",
1053 Self::PAUSED => "SDL_PROGRESS_STATE_PAUSED",
1054 Self::ERROR => "SDL_PROGRESS_STATE_ERROR",
1055
1056 _ => return write!(f, "SDL_ProgressState({})", self.0),
1057 })
1058 }
1059}
1060
1061impl SDL_ProgressState {
1062 /// An invalid progress state indicating an error; check [`SDL_GetError()`]
1063 pub const INVALID: Self = Self((-1_i32 as ::core::ffi::c_int));
1064 /// No progress bar is shown
1065 pub const NONE: Self = Self((0_i32 as ::core::ffi::c_int));
1066 /// The progress bar is shown in a indeterminate state
1067 pub const INDETERMINATE: Self = Self((1_i32 as ::core::ffi::c_int));
1068 /// The progress bar is shown in a normal state
1069 pub const NORMAL: Self = Self((2_i32 as ::core::ffi::c_int));
1070 /// The progress bar is shown in a paused state
1071 pub const PAUSED: Self = Self((3_i32 as ::core::ffi::c_int));
1072 /// The progress bar is shown in a state indicating the application had an error
1073 pub const ERROR: Self = Self((4_i32 as ::core::ffi::c_int));
1074}
1075
1076/// An invalid progress state indicating an error; check [`SDL_GetError()`]
1077pub const SDL_PROGRESS_STATE_INVALID: SDL_ProgressState = SDL_ProgressState::INVALID;
1078/// No progress bar is shown
1079pub const SDL_PROGRESS_STATE_NONE: SDL_ProgressState = SDL_ProgressState::NONE;
1080/// The progress bar is shown in a indeterminate state
1081pub const SDL_PROGRESS_STATE_INDETERMINATE: SDL_ProgressState = SDL_ProgressState::INDETERMINATE;
1082/// The progress bar is shown in a normal state
1083pub const SDL_PROGRESS_STATE_NORMAL: SDL_ProgressState = SDL_ProgressState::NORMAL;
1084/// The progress bar is shown in a paused state
1085pub const SDL_PROGRESS_STATE_PAUSED: SDL_ProgressState = SDL_ProgressState::PAUSED;
1086/// The progress bar is shown in a state indicating the application had an error
1087pub const SDL_PROGRESS_STATE_ERROR: SDL_ProgressState = SDL_ProgressState::ERROR;
1088
1089#[cfg(feature = "metadata")]
1090impl sdl3_sys::metadata::GroupMetadata for SDL_ProgressState {
1091 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
1092 &crate::metadata::video::METADATA_SDL_ProgressState;
1093}
1094
1095/// An opaque handle to an OpenGL context.
1096///
1097/// ## Availability
1098/// This datatype is available since SDL 3.2.0.
1099///
1100/// ## See also
1101/// - [`SDL_GL_CreateContext`]
1102/// - [`SDL_GL_SetAttribute`]
1103/// - [`SDL_GL_MakeCurrent`]
1104/// - [`SDL_GL_DestroyContext`]
1105pub type SDL_GLContext = *mut SDL_GLContextState;
1106
1107/// Opaque type for an EGL display.
1108///
1109/// ## Availability
1110/// This datatype is available since SDL 3.2.0.
1111pub type SDL_EGLDisplay = *mut ::core::ffi::c_void;
1112
1113/// Opaque type for an EGL config.
1114///
1115/// ## Availability
1116/// This datatype is available since SDL 3.2.0.
1117pub type SDL_EGLConfig = *mut ::core::ffi::c_void;
1118
1119/// Opaque type for an EGL surface.
1120///
1121/// ## Availability
1122/// This datatype is available since SDL 3.2.0.
1123pub type SDL_EGLSurface = *mut ::core::ffi::c_void;
1124
1125/// An EGL attribute, used when creating an EGL context.
1126///
1127/// ## Availability
1128/// This datatype is available since SDL 3.2.0.
1129pub type SDL_EGLAttrib = ::core::primitive::isize;
1130
1131/// An EGL integer attribute, used when creating an EGL surface.
1132///
1133/// ## Availability
1134/// This datatype is available since SDL 3.2.0.
1135pub type SDL_EGLint = ::core::ffi::c_int;
1136
1137/// EGL platform attribute initialization callback.
1138///
1139/// This is called when SDL is attempting to create an EGL context, to let the
1140/// app add extra attributes to its eglGetPlatformDisplay() call.
1141///
1142/// The callback should return a pointer to an EGL attribute array terminated
1143/// with `EGL_NONE`. If this function returns NULL, the [`SDL_CreateWindow`]
1144/// process will fail gracefully.
1145///
1146/// The returned pointer should be allocated with [`SDL_malloc()`] and will be
1147/// passed to [`SDL_free()`].
1148///
1149/// The arrays returned by each callback will be appended to the existing
1150/// attribute arrays defined by SDL.
1151///
1152/// ## Parameters
1153/// - `userdata`: an app-controlled pointer that is passed to the callback.
1154///
1155/// ## Return value
1156/// Returns a newly-allocated array of attributes, terminated with `EGL_NONE`.
1157///
1158/// ## Availability
1159/// This datatype is available since SDL 3.2.0.
1160///
1161/// ## See also
1162/// - [`SDL_EGL_SetAttributeCallbacks`]
1163pub type SDL_EGLAttribArrayCallback = ::core::option::Option<
1164 unsafe extern "C" fn(userdata: *mut ::core::ffi::c_void) -> *mut SDL_EGLAttrib,
1165>;
1166
1167/// EGL surface/context attribute initialization callback types.
1168///
1169/// This is called when SDL is attempting to create an EGL surface, to let the
1170/// app add extra attributes to its eglCreateWindowSurface() or
1171/// eglCreateContext calls.
1172///
1173/// For convenience, the EGLDisplay and EGLConfig to use are provided to the
1174/// callback.
1175///
1176/// The callback should return a pointer to an EGL attribute array terminated
1177/// with `EGL_NONE`. If this function returns NULL, the [`SDL_CreateWindow`]
1178/// process will fail gracefully.
1179///
1180/// The returned pointer should be allocated with [`SDL_malloc()`] and will be
1181/// passed to [`SDL_free()`].
1182///
1183/// The arrays returned by each callback will be appended to the existing
1184/// attribute arrays defined by SDL.
1185///
1186/// ## Parameters
1187/// - `userdata`: an app-controlled pointer that is passed to the callback.
1188/// - `display`: the EGL display to be used.
1189/// - `config`: the EGL config to be used.
1190///
1191/// ## Return value
1192/// Returns a newly-allocated array of attributes, terminated with `EGL_NONE`.
1193///
1194/// ## Availability
1195/// This datatype is available since SDL 3.2.0.
1196///
1197/// ## See also
1198/// - [`SDL_EGL_SetAttributeCallbacks`]
1199pub type SDL_EGLIntArrayCallback = ::core::option::Option<
1200 unsafe extern "C" fn(
1201 userdata: *mut ::core::ffi::c_void,
1202 display: SDL_EGLDisplay,
1203 config: SDL_EGLConfig,
1204 ) -> *mut SDL_EGLint,
1205>;
1206
1207/// An enumeration of OpenGL configuration attributes.
1208///
1209/// While you can set most OpenGL attributes normally, the attributes listed
1210/// above must be known before SDL creates the window that will be used with
1211/// the OpenGL context. These attributes are set and read with
1212/// [`SDL_GL_SetAttribute()`] and [`SDL_GL_GetAttribute()`].
1213///
1214/// In some cases, these attributes are minimum requests; the GL does not
1215/// promise to give you exactly what you asked for. It's possible to ask for a
1216/// 16-bit depth buffer and get a 24-bit one instead, for example, or to ask
1217/// for no stencil buffer and still have one available. Context creation should
1218/// fail if the GL can't provide your requested attributes at a minimum, but
1219/// you should check to see exactly what you got.
1220///
1221/// ## Availability
1222/// This enum is available since SDL 3.2.0.
1223///
1224/// ## Known values (`sdl3-sys`)
1225/// | Associated constant | Global constant | Description |
1226/// | ------------------- | --------------- | ----------- |
1227/// | [`RED_SIZE`](SDL_GLAttr::RED_SIZE) | [`SDL_GL_RED_SIZE`] | the minimum number of bits for the red channel of the color buffer; defaults to 8. |
1228/// | [`GREEN_SIZE`](SDL_GLAttr::GREEN_SIZE) | [`SDL_GL_GREEN_SIZE`] | the minimum number of bits for the green channel of the color buffer; defaults to 8. |
1229/// | [`BLUE_SIZE`](SDL_GLAttr::BLUE_SIZE) | [`SDL_GL_BLUE_SIZE`] | the minimum number of bits for the blue channel of the color buffer; defaults to 8. |
1230/// | [`ALPHA_SIZE`](SDL_GLAttr::ALPHA_SIZE) | [`SDL_GL_ALPHA_SIZE`] | the minimum number of bits for the alpha channel of the color buffer; defaults to 8. |
1231/// | [`BUFFER_SIZE`](SDL_GLAttr::BUFFER_SIZE) | [`SDL_GL_BUFFER_SIZE`] | the minimum number of bits for frame buffer size; defaults to 0. |
1232/// | [`DOUBLEBUFFER`](SDL_GLAttr::DOUBLEBUFFER) | [`SDL_GL_DOUBLEBUFFER`] | whether the output is single or double buffered; defaults to double buffering on. |
1233/// | [`DEPTH_SIZE`](SDL_GLAttr::DEPTH_SIZE) | [`SDL_GL_DEPTH_SIZE`] | the minimum number of bits in the depth buffer; defaults to 16. |
1234/// | [`STENCIL_SIZE`](SDL_GLAttr::STENCIL_SIZE) | [`SDL_GL_STENCIL_SIZE`] | the minimum number of bits in the stencil buffer; defaults to 0. |
1235/// | [`ACCUM_RED_SIZE`](SDL_GLAttr::ACCUM_RED_SIZE) | [`SDL_GL_ACCUM_RED_SIZE`] | the minimum number of bits for the red channel of the accumulation buffer; defaults to 0. |
1236/// | [`ACCUM_GREEN_SIZE`](SDL_GLAttr::ACCUM_GREEN_SIZE) | [`SDL_GL_ACCUM_GREEN_SIZE`] | the minimum number of bits for the green channel of the accumulation buffer; defaults to 0. |
1237/// | [`ACCUM_BLUE_SIZE`](SDL_GLAttr::ACCUM_BLUE_SIZE) | [`SDL_GL_ACCUM_BLUE_SIZE`] | the minimum number of bits for the blue channel of the accumulation buffer; defaults to 0. |
1238/// | [`ACCUM_ALPHA_SIZE`](SDL_GLAttr::ACCUM_ALPHA_SIZE) | [`SDL_GL_ACCUM_ALPHA_SIZE`] | the minimum number of bits for the alpha channel of the accumulation buffer; defaults to 0. |
1239/// | [`STEREO`](SDL_GLAttr::STEREO) | [`SDL_GL_STEREO`] | whether the output is stereo 3D; defaults to off. |
1240/// | [`MULTISAMPLEBUFFERS`](SDL_GLAttr::MULTISAMPLEBUFFERS) | [`SDL_GL_MULTISAMPLEBUFFERS`] | the number of buffers used for multisample anti-aliasing; defaults to 0. |
1241/// | [`MULTISAMPLESAMPLES`](SDL_GLAttr::MULTISAMPLESAMPLES) | [`SDL_GL_MULTISAMPLESAMPLES`] | the number of samples used around the current pixel used for multisample anti-aliasing. |
1242/// | [`ACCELERATED_VISUAL`](SDL_GLAttr::ACCELERATED_VISUAL) | [`SDL_GL_ACCELERATED_VISUAL`] | set to 1 to require hardware acceleration, set to 0 to force software rendering; defaults to allow either. |
1243/// | [`RETAINED_BACKING`](SDL_GLAttr::RETAINED_BACKING) | [`SDL_GL_RETAINED_BACKING`] | not used (deprecated). |
1244/// | [`CONTEXT_MAJOR_VERSION`](SDL_GLAttr::CONTEXT_MAJOR_VERSION) | [`SDL_GL_CONTEXT_MAJOR_VERSION`] | OpenGL context major version. |
1245/// | [`CONTEXT_MINOR_VERSION`](SDL_GLAttr::CONTEXT_MINOR_VERSION) | [`SDL_GL_CONTEXT_MINOR_VERSION`] | OpenGL context minor version. |
1246/// | [`CONTEXT_FLAGS`](SDL_GLAttr::CONTEXT_FLAGS) | [`SDL_GL_CONTEXT_FLAGS`] | some combination of 0 or more of elements of the [`SDL_GLContextFlag`] enumeration; defaults to 0. |
1247/// | [`CONTEXT_PROFILE_MASK`](SDL_GLAttr::CONTEXT_PROFILE_MASK) | [`SDL_GL_CONTEXT_PROFILE_MASK`] | type of GL context (Core, Compatibility, ES). See [`SDL_GLProfile`]; default value depends on platform. |
1248/// | [`SHARE_WITH_CURRENT_CONTEXT`](SDL_GLAttr::SHARE_WITH_CURRENT_CONTEXT) | [`SDL_GL_SHARE_WITH_CURRENT_CONTEXT`] | OpenGL context sharing; defaults to 0. |
1249/// | [`FRAMEBUFFER_SRGB_CAPABLE`](SDL_GLAttr::FRAMEBUFFER_SRGB_CAPABLE) | [`SDL_GL_FRAMEBUFFER_SRGB_CAPABLE`] | requests sRGB-capable visual if 1. Defaults to -1 ("don't care"). This is a request; GL drivers might not comply! |
1250/// | [`CONTEXT_RELEASE_BEHAVIOR`](SDL_GLAttr::CONTEXT_RELEASE_BEHAVIOR) | [`SDL_GL_CONTEXT_RELEASE_BEHAVIOR`] | sets context the release behavior. See [`SDL_GLContextReleaseFlag`]; defaults to FLUSH. |
1251/// | [`CONTEXT_RESET_NOTIFICATION`](SDL_GLAttr::CONTEXT_RESET_NOTIFICATION) | [`SDL_GL_CONTEXT_RESET_NOTIFICATION`] | set context reset notification. See [`SDL_GLContextResetNotification`]; defaults to NO_NOTIFICATION. |
1252/// | [`CONTEXT_NO_ERROR`](SDL_GLAttr::CONTEXT_NO_ERROR) | [`SDL_GL_CONTEXT_NO_ERROR`] | |
1253/// | [`FLOATBUFFERS`](SDL_GLAttr::FLOATBUFFERS) | [`SDL_GL_FLOATBUFFERS`] | |
1254/// | [`EGL_PLATFORM`](SDL_GLAttr::EGL_PLATFORM) | [`SDL_GL_EGL_PLATFORM`] | |
1255#[repr(transparent)]
1256#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
1257pub struct SDL_GLAttr(pub ::core::ffi::c_int);
1258
1259impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GLAttr {
1260 #[inline(always)]
1261 fn eq(&self, other: &::core::ffi::c_int) -> bool {
1262 &self.0 == other
1263 }
1264}
1265
1266impl ::core::cmp::PartialEq<SDL_GLAttr> for ::core::ffi::c_int {
1267 #[inline(always)]
1268 fn eq(&self, other: &SDL_GLAttr) -> bool {
1269 self == &other.0
1270 }
1271}
1272
1273impl From<SDL_GLAttr> for ::core::ffi::c_int {
1274 #[inline(always)]
1275 fn from(value: SDL_GLAttr) -> Self {
1276 value.0
1277 }
1278}
1279
1280#[cfg(feature = "debug-impls")]
1281impl ::core::fmt::Debug for SDL_GLAttr {
1282 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1283 #[allow(unreachable_patterns)]
1284 f.write_str(match *self {
1285 Self::RED_SIZE => "SDL_GL_RED_SIZE",
1286 Self::GREEN_SIZE => "SDL_GL_GREEN_SIZE",
1287 Self::BLUE_SIZE => "SDL_GL_BLUE_SIZE",
1288 Self::ALPHA_SIZE => "SDL_GL_ALPHA_SIZE",
1289 Self::BUFFER_SIZE => "SDL_GL_BUFFER_SIZE",
1290 Self::DOUBLEBUFFER => "SDL_GL_DOUBLEBUFFER",
1291 Self::DEPTH_SIZE => "SDL_GL_DEPTH_SIZE",
1292 Self::STENCIL_SIZE => "SDL_GL_STENCIL_SIZE",
1293 Self::ACCUM_RED_SIZE => "SDL_GL_ACCUM_RED_SIZE",
1294 Self::ACCUM_GREEN_SIZE => "SDL_GL_ACCUM_GREEN_SIZE",
1295 Self::ACCUM_BLUE_SIZE => "SDL_GL_ACCUM_BLUE_SIZE",
1296 Self::ACCUM_ALPHA_SIZE => "SDL_GL_ACCUM_ALPHA_SIZE",
1297 Self::STEREO => "SDL_GL_STEREO",
1298 Self::MULTISAMPLEBUFFERS => "SDL_GL_MULTISAMPLEBUFFERS",
1299 Self::MULTISAMPLESAMPLES => "SDL_GL_MULTISAMPLESAMPLES",
1300 Self::ACCELERATED_VISUAL => "SDL_GL_ACCELERATED_VISUAL",
1301 Self::RETAINED_BACKING => "SDL_GL_RETAINED_BACKING",
1302 Self::CONTEXT_MAJOR_VERSION => "SDL_GL_CONTEXT_MAJOR_VERSION",
1303 Self::CONTEXT_MINOR_VERSION => "SDL_GL_CONTEXT_MINOR_VERSION",
1304 Self::CONTEXT_FLAGS => "SDL_GL_CONTEXT_FLAGS",
1305 Self::CONTEXT_PROFILE_MASK => "SDL_GL_CONTEXT_PROFILE_MASK",
1306 Self::SHARE_WITH_CURRENT_CONTEXT => "SDL_GL_SHARE_WITH_CURRENT_CONTEXT",
1307 Self::FRAMEBUFFER_SRGB_CAPABLE => "SDL_GL_FRAMEBUFFER_SRGB_CAPABLE",
1308 Self::CONTEXT_RELEASE_BEHAVIOR => "SDL_GL_CONTEXT_RELEASE_BEHAVIOR",
1309 Self::CONTEXT_RESET_NOTIFICATION => "SDL_GL_CONTEXT_RESET_NOTIFICATION",
1310 Self::CONTEXT_NO_ERROR => "SDL_GL_CONTEXT_NO_ERROR",
1311 Self::FLOATBUFFERS => "SDL_GL_FLOATBUFFERS",
1312 Self::EGL_PLATFORM => "SDL_GL_EGL_PLATFORM",
1313
1314 _ => return write!(f, "SDL_GLAttr({})", self.0),
1315 })
1316 }
1317}
1318
1319impl SDL_GLAttr {
1320 /// the minimum number of bits for the red channel of the color buffer; defaults to 8.
1321 pub const RED_SIZE: Self = Self((0 as ::core::ffi::c_int));
1322 /// the minimum number of bits for the green channel of the color buffer; defaults to 8.
1323 pub const GREEN_SIZE: Self = Self((1 as ::core::ffi::c_int));
1324 /// the minimum number of bits for the blue channel of the color buffer; defaults to 8.
1325 pub const BLUE_SIZE: Self = Self((2 as ::core::ffi::c_int));
1326 /// the minimum number of bits for the alpha channel of the color buffer; defaults to 8.
1327 pub const ALPHA_SIZE: Self = Self((3 as ::core::ffi::c_int));
1328 /// the minimum number of bits for frame buffer size; defaults to 0.
1329 pub const BUFFER_SIZE: Self = Self((4 as ::core::ffi::c_int));
1330 /// whether the output is single or double buffered; defaults to double buffering on.
1331 pub const DOUBLEBUFFER: Self = Self((5 as ::core::ffi::c_int));
1332 /// the minimum number of bits in the depth buffer; defaults to 16.
1333 pub const DEPTH_SIZE: Self = Self((6 as ::core::ffi::c_int));
1334 /// the minimum number of bits in the stencil buffer; defaults to 0.
1335 pub const STENCIL_SIZE: Self = Self((7 as ::core::ffi::c_int));
1336 /// the minimum number of bits for the red channel of the accumulation buffer; defaults to 0.
1337 pub const ACCUM_RED_SIZE: Self = Self((8 as ::core::ffi::c_int));
1338 /// the minimum number of bits for the green channel of the accumulation buffer; defaults to 0.
1339 pub const ACCUM_GREEN_SIZE: Self = Self((9 as ::core::ffi::c_int));
1340 /// the minimum number of bits for the blue channel of the accumulation buffer; defaults to 0.
1341 pub const ACCUM_BLUE_SIZE: Self = Self((10 as ::core::ffi::c_int));
1342 /// the minimum number of bits for the alpha channel of the accumulation buffer; defaults to 0.
1343 pub const ACCUM_ALPHA_SIZE: Self = Self((11 as ::core::ffi::c_int));
1344 /// whether the output is stereo 3D; defaults to off.
1345 pub const STEREO: Self = Self((12 as ::core::ffi::c_int));
1346 /// the number of buffers used for multisample anti-aliasing; defaults to 0.
1347 pub const MULTISAMPLEBUFFERS: Self = Self((13 as ::core::ffi::c_int));
1348 /// the number of samples used around the current pixel used for multisample anti-aliasing.
1349 pub const MULTISAMPLESAMPLES: Self = Self((14 as ::core::ffi::c_int));
1350 /// set to 1 to require hardware acceleration, set to 0 to force software rendering; defaults to allow either.
1351 pub const ACCELERATED_VISUAL: Self = Self((15 as ::core::ffi::c_int));
1352 /// not used (deprecated).
1353 pub const RETAINED_BACKING: Self = Self((16 as ::core::ffi::c_int));
1354 /// OpenGL context major version.
1355 pub const CONTEXT_MAJOR_VERSION: Self = Self((17 as ::core::ffi::c_int));
1356 /// OpenGL context minor version.
1357 pub const CONTEXT_MINOR_VERSION: Self = Self((18 as ::core::ffi::c_int));
1358 /// some combination of 0 or more of elements of the [`SDL_GLContextFlag`] enumeration; defaults to 0.
1359 pub const CONTEXT_FLAGS: Self = Self((19 as ::core::ffi::c_int));
1360 /// type of GL context (Core, Compatibility, ES). See [`SDL_GLProfile`]; default value depends on platform.
1361 pub const CONTEXT_PROFILE_MASK: Self = Self((20 as ::core::ffi::c_int));
1362 /// OpenGL context sharing; defaults to 0.
1363 pub const SHARE_WITH_CURRENT_CONTEXT: Self = Self((21 as ::core::ffi::c_int));
1364 /// requests sRGB-capable visual if 1. Defaults to -1 ("don't care"). This is a request; GL drivers might not comply!
1365 pub const FRAMEBUFFER_SRGB_CAPABLE: Self = Self((22 as ::core::ffi::c_int));
1366 /// sets context the release behavior. See [`SDL_GLContextReleaseFlag`]; defaults to FLUSH.
1367 pub const CONTEXT_RELEASE_BEHAVIOR: Self = Self((23 as ::core::ffi::c_int));
1368 /// set context reset notification. See [`SDL_GLContextResetNotification`]; defaults to NO_NOTIFICATION.
1369 pub const CONTEXT_RESET_NOTIFICATION: Self = Self((24 as ::core::ffi::c_int));
1370 pub const CONTEXT_NO_ERROR: Self = Self((25 as ::core::ffi::c_int));
1371 pub const FLOATBUFFERS: Self = Self((26 as ::core::ffi::c_int));
1372 pub const EGL_PLATFORM: Self = Self((27 as ::core::ffi::c_int));
1373}
1374
1375/// the minimum number of bits for the red channel of the color buffer; defaults to 8.
1376pub const SDL_GL_RED_SIZE: SDL_GLAttr = SDL_GLAttr::RED_SIZE;
1377/// the minimum number of bits for the green channel of the color buffer; defaults to 8.
1378pub const SDL_GL_GREEN_SIZE: SDL_GLAttr = SDL_GLAttr::GREEN_SIZE;
1379/// the minimum number of bits for the blue channel of the color buffer; defaults to 8.
1380pub const SDL_GL_BLUE_SIZE: SDL_GLAttr = SDL_GLAttr::BLUE_SIZE;
1381/// the minimum number of bits for the alpha channel of the color buffer; defaults to 8.
1382pub const SDL_GL_ALPHA_SIZE: SDL_GLAttr = SDL_GLAttr::ALPHA_SIZE;
1383/// the minimum number of bits for frame buffer size; defaults to 0.
1384pub const SDL_GL_BUFFER_SIZE: SDL_GLAttr = SDL_GLAttr::BUFFER_SIZE;
1385/// whether the output is single or double buffered; defaults to double buffering on.
1386pub const SDL_GL_DOUBLEBUFFER: SDL_GLAttr = SDL_GLAttr::DOUBLEBUFFER;
1387/// the minimum number of bits in the depth buffer; defaults to 16.
1388pub const SDL_GL_DEPTH_SIZE: SDL_GLAttr = SDL_GLAttr::DEPTH_SIZE;
1389/// the minimum number of bits in the stencil buffer; defaults to 0.
1390pub const SDL_GL_STENCIL_SIZE: SDL_GLAttr = SDL_GLAttr::STENCIL_SIZE;
1391/// the minimum number of bits for the red channel of the accumulation buffer; defaults to 0.
1392pub const SDL_GL_ACCUM_RED_SIZE: SDL_GLAttr = SDL_GLAttr::ACCUM_RED_SIZE;
1393/// the minimum number of bits for the green channel of the accumulation buffer; defaults to 0.
1394pub const SDL_GL_ACCUM_GREEN_SIZE: SDL_GLAttr = SDL_GLAttr::ACCUM_GREEN_SIZE;
1395/// the minimum number of bits for the blue channel of the accumulation buffer; defaults to 0.
1396pub const SDL_GL_ACCUM_BLUE_SIZE: SDL_GLAttr = SDL_GLAttr::ACCUM_BLUE_SIZE;
1397/// the minimum number of bits for the alpha channel of the accumulation buffer; defaults to 0.
1398pub const SDL_GL_ACCUM_ALPHA_SIZE: SDL_GLAttr = SDL_GLAttr::ACCUM_ALPHA_SIZE;
1399/// whether the output is stereo 3D; defaults to off.
1400pub const SDL_GL_STEREO: SDL_GLAttr = SDL_GLAttr::STEREO;
1401/// the number of buffers used for multisample anti-aliasing; defaults to 0.
1402pub const SDL_GL_MULTISAMPLEBUFFERS: SDL_GLAttr = SDL_GLAttr::MULTISAMPLEBUFFERS;
1403/// the number of samples used around the current pixel used for multisample anti-aliasing.
1404pub const SDL_GL_MULTISAMPLESAMPLES: SDL_GLAttr = SDL_GLAttr::MULTISAMPLESAMPLES;
1405/// set to 1 to require hardware acceleration, set to 0 to force software rendering; defaults to allow either.
1406pub const SDL_GL_ACCELERATED_VISUAL: SDL_GLAttr = SDL_GLAttr::ACCELERATED_VISUAL;
1407/// not used (deprecated).
1408pub const SDL_GL_RETAINED_BACKING: SDL_GLAttr = SDL_GLAttr::RETAINED_BACKING;
1409/// OpenGL context major version.
1410pub const SDL_GL_CONTEXT_MAJOR_VERSION: SDL_GLAttr = SDL_GLAttr::CONTEXT_MAJOR_VERSION;
1411/// OpenGL context minor version.
1412pub const SDL_GL_CONTEXT_MINOR_VERSION: SDL_GLAttr = SDL_GLAttr::CONTEXT_MINOR_VERSION;
1413/// some combination of 0 or more of elements of the [`SDL_GLContextFlag`] enumeration; defaults to 0.
1414pub const SDL_GL_CONTEXT_FLAGS: SDL_GLAttr = SDL_GLAttr::CONTEXT_FLAGS;
1415/// type of GL context (Core, Compatibility, ES). See [`SDL_GLProfile`]; default value depends on platform.
1416pub const SDL_GL_CONTEXT_PROFILE_MASK: SDL_GLAttr = SDL_GLAttr::CONTEXT_PROFILE_MASK;
1417/// OpenGL context sharing; defaults to 0.
1418pub const SDL_GL_SHARE_WITH_CURRENT_CONTEXT: SDL_GLAttr = SDL_GLAttr::SHARE_WITH_CURRENT_CONTEXT;
1419/// requests sRGB-capable visual if 1. Defaults to -1 ("don't care"). This is a request; GL drivers might not comply!
1420pub const SDL_GL_FRAMEBUFFER_SRGB_CAPABLE: SDL_GLAttr = SDL_GLAttr::FRAMEBUFFER_SRGB_CAPABLE;
1421/// sets context the release behavior. See [`SDL_GLContextReleaseFlag`]; defaults to FLUSH.
1422pub const SDL_GL_CONTEXT_RELEASE_BEHAVIOR: SDL_GLAttr = SDL_GLAttr::CONTEXT_RELEASE_BEHAVIOR;
1423/// set context reset notification. See [`SDL_GLContextResetNotification`]; defaults to NO_NOTIFICATION.
1424pub const SDL_GL_CONTEXT_RESET_NOTIFICATION: SDL_GLAttr = SDL_GLAttr::CONTEXT_RESET_NOTIFICATION;
1425pub const SDL_GL_CONTEXT_NO_ERROR: SDL_GLAttr = SDL_GLAttr::CONTEXT_NO_ERROR;
1426pub const SDL_GL_FLOATBUFFERS: SDL_GLAttr = SDL_GLAttr::FLOATBUFFERS;
1427pub const SDL_GL_EGL_PLATFORM: SDL_GLAttr = SDL_GLAttr::EGL_PLATFORM;
1428
1429#[cfg(feature = "metadata")]
1430impl sdl3_sys::metadata::GroupMetadata for SDL_GLAttr {
1431 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
1432 &crate::metadata::video::METADATA_SDL_GLAttr;
1433}
1434
1435/// Possible values to be set for the [`SDL_GL_CONTEXT_PROFILE_MASK`] attribute.
1436///
1437/// ## Availability
1438/// This datatype is available since SDL 3.2.0.
1439///
1440/// ## Known values (`sdl3-sys`)
1441/// | Associated constant | Global constant | Description |
1442/// | ------------------- | --------------- | ----------- |
1443/// | [`CORE`](SDL_GLProfile::CORE) | [`SDL_GL_CONTEXT_PROFILE_CORE`] | OpenGL Core Profile context |
1444/// | [`COMPATIBILITY`](SDL_GLProfile::COMPATIBILITY) | [`SDL_GL_CONTEXT_PROFILE_COMPATIBILITY`] | OpenGL Compatibility Profile context |
1445/// | [`ES`](SDL_GLProfile::ES) | [`SDL_GL_CONTEXT_PROFILE_ES`] | GLX_CONTEXT_ES2_PROFILE_BIT_EXT |
1446#[repr(transparent)]
1447#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
1448pub struct SDL_GLProfile(pub Sint32);
1449
1450impl ::core::cmp::PartialEq<Sint32> for SDL_GLProfile {
1451 #[inline(always)]
1452 fn eq(&self, other: &Sint32) -> bool {
1453 &self.0 == other
1454 }
1455}
1456
1457impl ::core::cmp::PartialEq<SDL_GLProfile> for Sint32 {
1458 #[inline(always)]
1459 fn eq(&self, other: &SDL_GLProfile) -> bool {
1460 self == &other.0
1461 }
1462}
1463
1464impl From<SDL_GLProfile> for Sint32 {
1465 #[inline(always)]
1466 fn from(value: SDL_GLProfile) -> Self {
1467 value.0
1468 }
1469}
1470
1471#[cfg(feature = "debug-impls")]
1472impl ::core::fmt::Debug for SDL_GLProfile {
1473 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1474 let mut first = true;
1475 let all_bits = 0;
1476 write!(f, "SDL_GLProfile(")?;
1477 let all_bits = all_bits | Self::CORE.0;
1478 if (Self::CORE != 0 || self.0 == 0) && *self & Self::CORE == Self::CORE {
1479 if !first {
1480 write!(f, " | ")?;
1481 }
1482 first = false;
1483 write!(f, "CORE")?;
1484 }
1485 let all_bits = all_bits | Self::COMPATIBILITY.0;
1486 if (Self::COMPATIBILITY != 0 || self.0 == 0)
1487 && *self & Self::COMPATIBILITY == Self::COMPATIBILITY
1488 {
1489 if !first {
1490 write!(f, " | ")?;
1491 }
1492 first = false;
1493 write!(f, "COMPATIBILITY")?;
1494 }
1495 let all_bits = all_bits | Self::ES.0;
1496 if (Self::ES != 0 || self.0 == 0) && *self & Self::ES == Self::ES {
1497 if !first {
1498 write!(f, " | ")?;
1499 }
1500 first = false;
1501 write!(f, "ES")?;
1502 }
1503
1504 if self.0 & !all_bits != 0 {
1505 if !first {
1506 write!(f, " | ")?;
1507 }
1508 write!(f, "{:#x}", self.0)?;
1509 } else if first {
1510 write!(f, "0")?;
1511 }
1512 write!(f, ")")
1513 }
1514}
1515
1516impl ::core::ops::BitAnd for SDL_GLProfile {
1517 type Output = Self;
1518
1519 #[inline(always)]
1520 fn bitand(self, rhs: Self) -> Self::Output {
1521 Self(self.0 & rhs.0)
1522 }
1523}
1524
1525impl ::core::ops::BitAndAssign for SDL_GLProfile {
1526 #[inline(always)]
1527 fn bitand_assign(&mut self, rhs: Self) {
1528 self.0 &= rhs.0;
1529 }
1530}
1531
1532impl ::core::ops::BitOr for SDL_GLProfile {
1533 type Output = Self;
1534
1535 #[inline(always)]
1536 fn bitor(self, rhs: Self) -> Self::Output {
1537 Self(self.0 | rhs.0)
1538 }
1539}
1540
1541impl ::core::ops::BitOrAssign for SDL_GLProfile {
1542 #[inline(always)]
1543 fn bitor_assign(&mut self, rhs: Self) {
1544 self.0 |= rhs.0;
1545 }
1546}
1547
1548impl ::core::ops::BitXor for SDL_GLProfile {
1549 type Output = Self;
1550
1551 #[inline(always)]
1552 fn bitxor(self, rhs: Self) -> Self::Output {
1553 Self(self.0 ^ rhs.0)
1554 }
1555}
1556
1557impl ::core::ops::BitXorAssign for SDL_GLProfile {
1558 #[inline(always)]
1559 fn bitxor_assign(&mut self, rhs: Self) {
1560 self.0 ^= rhs.0;
1561 }
1562}
1563
1564impl ::core::ops::Not for SDL_GLProfile {
1565 type Output = Self;
1566
1567 #[inline(always)]
1568 fn not(self) -> Self::Output {
1569 Self(!self.0)
1570 }
1571}
1572
1573impl SDL_GLProfile {
1574 /// OpenGL Core Profile context
1575 pub const CORE: Self = Self((0x0001 as Sint32));
1576 /// OpenGL Compatibility Profile context
1577 pub const COMPATIBILITY: Self = Self((0x0002 as Sint32));
1578 /// GLX_CONTEXT_ES2_PROFILE_BIT_EXT
1579 pub const ES: Self = Self((0x0004 as Sint32));
1580}
1581
1582/// OpenGL Core Profile context
1583pub const SDL_GL_CONTEXT_PROFILE_CORE: SDL_GLProfile = SDL_GLProfile::CORE;
1584/// OpenGL Compatibility Profile context
1585pub const SDL_GL_CONTEXT_PROFILE_COMPATIBILITY: SDL_GLProfile = SDL_GLProfile::COMPATIBILITY;
1586/// GLX_CONTEXT_ES2_PROFILE_BIT_EXT
1587pub const SDL_GL_CONTEXT_PROFILE_ES: SDL_GLProfile = SDL_GLProfile::ES;
1588
1589#[cfg(feature = "metadata")]
1590impl sdl3_sys::metadata::GroupMetadata for SDL_GLProfile {
1591 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
1592 &crate::metadata::video::METADATA_SDL_GLProfile;
1593}
1594
1595/// Possible flags to be set for the [`SDL_GL_CONTEXT_FLAGS`] attribute.
1596///
1597/// ## Availability
1598/// This datatype is available since SDL 3.2.0.
1599///
1600/// ## Known values (`sdl3-sys`)
1601/// | Associated constant | Global constant | Description |
1602/// | ------------------- | --------------- | ----------- |
1603/// | [`DEBUG_FLAG`](SDL_GLContextFlag::DEBUG_FLAG) | [`SDL_GL_CONTEXT_DEBUG_FLAG`] | |
1604/// | [`FORWARD_COMPATIBLE_FLAG`](SDL_GLContextFlag::FORWARD_COMPATIBLE_FLAG) | [`SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG`] | |
1605/// | [`ROBUST_ACCESS_FLAG`](SDL_GLContextFlag::ROBUST_ACCESS_FLAG) | [`SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG`] | |
1606/// | [`RESET_ISOLATION_FLAG`](SDL_GLContextFlag::RESET_ISOLATION_FLAG) | [`SDL_GL_CONTEXT_RESET_ISOLATION_FLAG`] | |
1607#[repr(transparent)]
1608#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
1609pub struct SDL_GLContextFlag(pub Sint32);
1610
1611impl ::core::cmp::PartialEq<Sint32> for SDL_GLContextFlag {
1612 #[inline(always)]
1613 fn eq(&self, other: &Sint32) -> bool {
1614 &self.0 == other
1615 }
1616}
1617
1618impl ::core::cmp::PartialEq<SDL_GLContextFlag> for Sint32 {
1619 #[inline(always)]
1620 fn eq(&self, other: &SDL_GLContextFlag) -> bool {
1621 self == &other.0
1622 }
1623}
1624
1625impl From<SDL_GLContextFlag> for Sint32 {
1626 #[inline(always)]
1627 fn from(value: SDL_GLContextFlag) -> Self {
1628 value.0
1629 }
1630}
1631
1632#[cfg(feature = "debug-impls")]
1633impl ::core::fmt::Debug for SDL_GLContextFlag {
1634 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1635 let mut first = true;
1636 let all_bits = 0;
1637 write!(f, "SDL_GLContextFlag(")?;
1638 let all_bits = all_bits | Self::DEBUG_FLAG.0;
1639 if (Self::DEBUG_FLAG != 0 || self.0 == 0) && *self & Self::DEBUG_FLAG == Self::DEBUG_FLAG {
1640 if !first {
1641 write!(f, " | ")?;
1642 }
1643 first = false;
1644 write!(f, "DEBUG_FLAG")?;
1645 }
1646 let all_bits = all_bits | Self::FORWARD_COMPATIBLE_FLAG.0;
1647 if (Self::FORWARD_COMPATIBLE_FLAG != 0 || self.0 == 0)
1648 && *self & Self::FORWARD_COMPATIBLE_FLAG == Self::FORWARD_COMPATIBLE_FLAG
1649 {
1650 if !first {
1651 write!(f, " | ")?;
1652 }
1653 first = false;
1654 write!(f, "FORWARD_COMPATIBLE_FLAG")?;
1655 }
1656 let all_bits = all_bits | Self::ROBUST_ACCESS_FLAG.0;
1657 if (Self::ROBUST_ACCESS_FLAG != 0 || self.0 == 0)
1658 && *self & Self::ROBUST_ACCESS_FLAG == Self::ROBUST_ACCESS_FLAG
1659 {
1660 if !first {
1661 write!(f, " | ")?;
1662 }
1663 first = false;
1664 write!(f, "ROBUST_ACCESS_FLAG")?;
1665 }
1666 let all_bits = all_bits | Self::RESET_ISOLATION_FLAG.0;
1667 if (Self::RESET_ISOLATION_FLAG != 0 || self.0 == 0)
1668 && *self & Self::RESET_ISOLATION_FLAG == Self::RESET_ISOLATION_FLAG
1669 {
1670 if !first {
1671 write!(f, " | ")?;
1672 }
1673 first = false;
1674 write!(f, "RESET_ISOLATION_FLAG")?;
1675 }
1676
1677 if self.0 & !all_bits != 0 {
1678 if !first {
1679 write!(f, " | ")?;
1680 }
1681 write!(f, "{:#x}", self.0)?;
1682 } else if first {
1683 write!(f, "0")?;
1684 }
1685 write!(f, ")")
1686 }
1687}
1688
1689impl ::core::ops::BitAnd for SDL_GLContextFlag {
1690 type Output = Self;
1691
1692 #[inline(always)]
1693 fn bitand(self, rhs: Self) -> Self::Output {
1694 Self(self.0 & rhs.0)
1695 }
1696}
1697
1698impl ::core::ops::BitAndAssign for SDL_GLContextFlag {
1699 #[inline(always)]
1700 fn bitand_assign(&mut self, rhs: Self) {
1701 self.0 &= rhs.0;
1702 }
1703}
1704
1705impl ::core::ops::BitOr for SDL_GLContextFlag {
1706 type Output = Self;
1707
1708 #[inline(always)]
1709 fn bitor(self, rhs: Self) -> Self::Output {
1710 Self(self.0 | rhs.0)
1711 }
1712}
1713
1714impl ::core::ops::BitOrAssign for SDL_GLContextFlag {
1715 #[inline(always)]
1716 fn bitor_assign(&mut self, rhs: Self) {
1717 self.0 |= rhs.0;
1718 }
1719}
1720
1721impl ::core::ops::BitXor for SDL_GLContextFlag {
1722 type Output = Self;
1723
1724 #[inline(always)]
1725 fn bitxor(self, rhs: Self) -> Self::Output {
1726 Self(self.0 ^ rhs.0)
1727 }
1728}
1729
1730impl ::core::ops::BitXorAssign for SDL_GLContextFlag {
1731 #[inline(always)]
1732 fn bitxor_assign(&mut self, rhs: Self) {
1733 self.0 ^= rhs.0;
1734 }
1735}
1736
1737impl ::core::ops::Not for SDL_GLContextFlag {
1738 type Output = Self;
1739
1740 #[inline(always)]
1741 fn not(self) -> Self::Output {
1742 Self(!self.0)
1743 }
1744}
1745
1746impl SDL_GLContextFlag {
1747 pub const DEBUG_FLAG: Self = Self((0x0001 as Sint32));
1748 pub const FORWARD_COMPATIBLE_FLAG: Self = Self((0x0002 as Sint32));
1749 pub const ROBUST_ACCESS_FLAG: Self = Self((0x0004 as Sint32));
1750 pub const RESET_ISOLATION_FLAG: Self = Self((0x0008 as Sint32));
1751}
1752
1753pub const SDL_GL_CONTEXT_DEBUG_FLAG: SDL_GLContextFlag = SDL_GLContextFlag::DEBUG_FLAG;
1754pub const SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG: SDL_GLContextFlag =
1755 SDL_GLContextFlag::FORWARD_COMPATIBLE_FLAG;
1756pub const SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG: SDL_GLContextFlag =
1757 SDL_GLContextFlag::ROBUST_ACCESS_FLAG;
1758pub const SDL_GL_CONTEXT_RESET_ISOLATION_FLAG: SDL_GLContextFlag =
1759 SDL_GLContextFlag::RESET_ISOLATION_FLAG;
1760
1761#[cfg(feature = "metadata")]
1762impl sdl3_sys::metadata::GroupMetadata for SDL_GLContextFlag {
1763 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
1764 &crate::metadata::video::METADATA_SDL_GLContextFlag;
1765}
1766
1767/// Possible values to be set for the [`SDL_GL_CONTEXT_RELEASE_BEHAVIOR`]
1768/// attribute.
1769///
1770/// ## Availability
1771/// This datatype is available since SDL 3.2.0.
1772///
1773/// ## Known values (`sdl3-sys`)
1774/// | Associated constant | Global constant | Description |
1775/// | ------------------- | --------------- | ----------- |
1776/// | [`NONE`](SDL_GLContextReleaseFlag::NONE) | [`SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE`] | |
1777/// | [`FLUSH`](SDL_GLContextReleaseFlag::FLUSH) | [`SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH`] | |
1778#[repr(transparent)]
1779#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
1780pub struct SDL_GLContextReleaseFlag(pub Sint32);
1781
1782impl ::core::cmp::PartialEq<Sint32> for SDL_GLContextReleaseFlag {
1783 #[inline(always)]
1784 fn eq(&self, other: &Sint32) -> bool {
1785 &self.0 == other
1786 }
1787}
1788
1789impl ::core::cmp::PartialEq<SDL_GLContextReleaseFlag> for Sint32 {
1790 #[inline(always)]
1791 fn eq(&self, other: &SDL_GLContextReleaseFlag) -> bool {
1792 self == &other.0
1793 }
1794}
1795
1796impl From<SDL_GLContextReleaseFlag> for Sint32 {
1797 #[inline(always)]
1798 fn from(value: SDL_GLContextReleaseFlag) -> Self {
1799 value.0
1800 }
1801}
1802
1803#[cfg(feature = "debug-impls")]
1804impl ::core::fmt::Debug for SDL_GLContextReleaseFlag {
1805 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1806 let mut first = true;
1807 let all_bits = 0;
1808 write!(f, "SDL_GLContextReleaseFlag(")?;
1809 let all_bits = all_bits | Self::NONE.0;
1810 if (Self::NONE != 0 || self.0 == 0) && *self & Self::NONE == Self::NONE {
1811 if !first {
1812 write!(f, " | ")?;
1813 }
1814 first = false;
1815 write!(f, "NONE")?;
1816 }
1817 let all_bits = all_bits | Self::FLUSH.0;
1818 if (Self::FLUSH != 0 || self.0 == 0) && *self & Self::FLUSH == Self::FLUSH {
1819 if !first {
1820 write!(f, " | ")?;
1821 }
1822 first = false;
1823 write!(f, "FLUSH")?;
1824 }
1825
1826 if self.0 & !all_bits != 0 {
1827 if !first {
1828 write!(f, " | ")?;
1829 }
1830 write!(f, "{:#x}", self.0)?;
1831 } else if first {
1832 write!(f, "0")?;
1833 }
1834 write!(f, ")")
1835 }
1836}
1837
1838impl ::core::ops::BitAnd for SDL_GLContextReleaseFlag {
1839 type Output = Self;
1840
1841 #[inline(always)]
1842 fn bitand(self, rhs: Self) -> Self::Output {
1843 Self(self.0 & rhs.0)
1844 }
1845}
1846
1847impl ::core::ops::BitAndAssign for SDL_GLContextReleaseFlag {
1848 #[inline(always)]
1849 fn bitand_assign(&mut self, rhs: Self) {
1850 self.0 &= rhs.0;
1851 }
1852}
1853
1854impl ::core::ops::BitOr for SDL_GLContextReleaseFlag {
1855 type Output = Self;
1856
1857 #[inline(always)]
1858 fn bitor(self, rhs: Self) -> Self::Output {
1859 Self(self.0 | rhs.0)
1860 }
1861}
1862
1863impl ::core::ops::BitOrAssign for SDL_GLContextReleaseFlag {
1864 #[inline(always)]
1865 fn bitor_assign(&mut self, rhs: Self) {
1866 self.0 |= rhs.0;
1867 }
1868}
1869
1870impl ::core::ops::BitXor for SDL_GLContextReleaseFlag {
1871 type Output = Self;
1872
1873 #[inline(always)]
1874 fn bitxor(self, rhs: Self) -> Self::Output {
1875 Self(self.0 ^ rhs.0)
1876 }
1877}
1878
1879impl ::core::ops::BitXorAssign for SDL_GLContextReleaseFlag {
1880 #[inline(always)]
1881 fn bitxor_assign(&mut self, rhs: Self) {
1882 self.0 ^= rhs.0;
1883 }
1884}
1885
1886impl ::core::ops::Not for SDL_GLContextReleaseFlag {
1887 type Output = Self;
1888
1889 #[inline(always)]
1890 fn not(self) -> Self::Output {
1891 Self(!self.0)
1892 }
1893}
1894
1895impl SDL_GLContextReleaseFlag {
1896 pub const NONE: Self = Self((0x0000 as Sint32));
1897 pub const FLUSH: Self = Self((0x0001 as Sint32));
1898}
1899
1900pub const SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE: SDL_GLContextReleaseFlag =
1901 SDL_GLContextReleaseFlag::NONE;
1902pub const SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH: SDL_GLContextReleaseFlag =
1903 SDL_GLContextReleaseFlag::FLUSH;
1904
1905#[cfg(feature = "metadata")]
1906impl sdl3_sys::metadata::GroupMetadata for SDL_GLContextReleaseFlag {
1907 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
1908 &crate::metadata::video::METADATA_SDL_GLContextReleaseFlag;
1909}
1910
1911/// Possible values to be set [`SDL_GL_CONTEXT_RESET_NOTIFICATION`] attribute.
1912///
1913/// ## Availability
1914/// This datatype is available since SDL 3.2.0.
1915///
1916/// ## Known values (`sdl3-sys`)
1917/// | Associated constant | Global constant | Description |
1918/// | ------------------- | --------------- | ----------- |
1919/// | [`NO_NOTIFICATION`](SDL_GLContextResetNotification::NO_NOTIFICATION) | [`SDL_GL_CONTEXT_RESET_NO_NOTIFICATION`] | |
1920/// | [`LOSE_CONTEXT`](SDL_GLContextResetNotification::LOSE_CONTEXT) | [`SDL_GL_CONTEXT_RESET_LOSE_CONTEXT`] | |
1921#[repr(transparent)]
1922#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
1923pub struct SDL_GLContextResetNotification(pub Sint32);
1924
1925impl ::core::cmp::PartialEq<Sint32> for SDL_GLContextResetNotification {
1926 #[inline(always)]
1927 fn eq(&self, other: &Sint32) -> bool {
1928 &self.0 == other
1929 }
1930}
1931
1932impl ::core::cmp::PartialEq<SDL_GLContextResetNotification> for Sint32 {
1933 #[inline(always)]
1934 fn eq(&self, other: &SDL_GLContextResetNotification) -> bool {
1935 self == &other.0
1936 }
1937}
1938
1939impl From<SDL_GLContextResetNotification> for Sint32 {
1940 #[inline(always)]
1941 fn from(value: SDL_GLContextResetNotification) -> Self {
1942 value.0
1943 }
1944}
1945
1946#[cfg(feature = "debug-impls")]
1947impl ::core::fmt::Debug for SDL_GLContextResetNotification {
1948 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1949 let mut first = true;
1950 let all_bits = 0;
1951 write!(f, "SDL_GLContextResetNotification(")?;
1952 let all_bits = all_bits | Self::NO_NOTIFICATION.0;
1953 if (Self::NO_NOTIFICATION != 0 || self.0 == 0)
1954 && *self & Self::NO_NOTIFICATION == Self::NO_NOTIFICATION
1955 {
1956 if !first {
1957 write!(f, " | ")?;
1958 }
1959 first = false;
1960 write!(f, "NO_NOTIFICATION")?;
1961 }
1962 let all_bits = all_bits | Self::LOSE_CONTEXT.0;
1963 if (Self::LOSE_CONTEXT != 0 || self.0 == 0)
1964 && *self & Self::LOSE_CONTEXT == Self::LOSE_CONTEXT
1965 {
1966 if !first {
1967 write!(f, " | ")?;
1968 }
1969 first = false;
1970 write!(f, "LOSE_CONTEXT")?;
1971 }
1972
1973 if self.0 & !all_bits != 0 {
1974 if !first {
1975 write!(f, " | ")?;
1976 }
1977 write!(f, "{:#x}", self.0)?;
1978 } else if first {
1979 write!(f, "0")?;
1980 }
1981 write!(f, ")")
1982 }
1983}
1984
1985impl ::core::ops::BitAnd for SDL_GLContextResetNotification {
1986 type Output = Self;
1987
1988 #[inline(always)]
1989 fn bitand(self, rhs: Self) -> Self::Output {
1990 Self(self.0 & rhs.0)
1991 }
1992}
1993
1994impl ::core::ops::BitAndAssign for SDL_GLContextResetNotification {
1995 #[inline(always)]
1996 fn bitand_assign(&mut self, rhs: Self) {
1997 self.0 &= rhs.0;
1998 }
1999}
2000
2001impl ::core::ops::BitOr for SDL_GLContextResetNotification {
2002 type Output = Self;
2003
2004 #[inline(always)]
2005 fn bitor(self, rhs: Self) -> Self::Output {
2006 Self(self.0 | rhs.0)
2007 }
2008}
2009
2010impl ::core::ops::BitOrAssign for SDL_GLContextResetNotification {
2011 #[inline(always)]
2012 fn bitor_assign(&mut self, rhs: Self) {
2013 self.0 |= rhs.0;
2014 }
2015}
2016
2017impl ::core::ops::BitXor for SDL_GLContextResetNotification {
2018 type Output = Self;
2019
2020 #[inline(always)]
2021 fn bitxor(self, rhs: Self) -> Self::Output {
2022 Self(self.0 ^ rhs.0)
2023 }
2024}
2025
2026impl ::core::ops::BitXorAssign for SDL_GLContextResetNotification {
2027 #[inline(always)]
2028 fn bitxor_assign(&mut self, rhs: Self) {
2029 self.0 ^= rhs.0;
2030 }
2031}
2032
2033impl ::core::ops::Not for SDL_GLContextResetNotification {
2034 type Output = Self;
2035
2036 #[inline(always)]
2037 fn not(self) -> Self::Output {
2038 Self(!self.0)
2039 }
2040}
2041
2042impl SDL_GLContextResetNotification {
2043 pub const NO_NOTIFICATION: Self = Self((0x0000 as Sint32));
2044 pub const LOSE_CONTEXT: Self = Self((0x0001 as Sint32));
2045}
2046
2047pub const SDL_GL_CONTEXT_RESET_NO_NOTIFICATION: SDL_GLContextResetNotification =
2048 SDL_GLContextResetNotification::NO_NOTIFICATION;
2049pub const SDL_GL_CONTEXT_RESET_LOSE_CONTEXT: SDL_GLContextResetNotification =
2050 SDL_GLContextResetNotification::LOSE_CONTEXT;
2051
2052#[cfg(feature = "metadata")]
2053impl sdl3_sys::metadata::GroupMetadata for SDL_GLContextResetNotification {
2054 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
2055 &crate::metadata::video::METADATA_SDL_GLContextResetNotification;
2056}
2057
2058unsafe extern "C" {
2059 /// Get the number of video drivers compiled into SDL.
2060 ///
2061 /// ## Return value
2062 /// Returns the number of built in video drivers.
2063 ///
2064 /// ## Thread safety
2065 /// This function should only be called on the main thread.
2066 ///
2067 /// ## Availability
2068 /// This function is available since SDL 3.2.0.
2069 ///
2070 /// ## See also
2071 /// - [`SDL_GetVideoDriver`]
2072 pub fn SDL_GetNumVideoDrivers() -> ::core::ffi::c_int;
2073}
2074
2075unsafe extern "C" {
2076 /// Get the name of a built in video driver.
2077 ///
2078 /// The video drivers are presented in the order in which they are normally
2079 /// checked during initialization.
2080 ///
2081 /// The names of drivers are all simple, low-ASCII identifiers, like "cocoa",
2082 /// "x11" or "windows". These never have Unicode characters, and are not meant
2083 /// to be proper names.
2084 ///
2085 /// ## Parameters
2086 /// - `index`: the index of a video driver.
2087 ///
2088 /// ## Return value
2089 /// Returns the name of the video driver with the given **index**, or NULL if
2090 /// index is out of bounds.
2091 ///
2092 /// ## Thread safety
2093 /// This function should only be called on the main thread.
2094 ///
2095 /// ## Availability
2096 /// This function is available since SDL 3.2.0.
2097 ///
2098 /// ## See also
2099 /// - [`SDL_GetNumVideoDrivers`]
2100 pub fn SDL_GetVideoDriver(index: ::core::ffi::c_int) -> *const ::core::ffi::c_char;
2101}
2102
2103unsafe extern "C" {
2104 /// Get the name of the currently initialized video driver.
2105 ///
2106 /// The names of drivers are all simple, low-ASCII identifiers, like "cocoa",
2107 /// "x11" or "windows". These never have Unicode characters, and are not meant
2108 /// to be proper names.
2109 ///
2110 /// ## Return value
2111 /// Returns the name of the current video driver or NULL if no driver has been
2112 /// initialized.
2113 ///
2114 /// ## Thread safety
2115 /// This function should only be called on the main thread.
2116 ///
2117 /// ## Availability
2118 /// This function is available since SDL 3.2.0.
2119 ///
2120 /// ## See also
2121 /// - [`SDL_GetNumVideoDrivers`]
2122 /// - [`SDL_GetVideoDriver`]
2123 pub fn SDL_GetCurrentVideoDriver() -> *const ::core::ffi::c_char;
2124}
2125
2126unsafe extern "C" {
2127 /// Get the current system theme.
2128 ///
2129 /// ## Return value
2130 /// Returns the current system theme, light, dark, or unknown.
2131 ///
2132 /// ## Thread safety
2133 /// This function should only be called on the main thread.
2134 ///
2135 /// ## Availability
2136 /// This function is available since SDL 3.2.0.
2137 pub fn SDL_GetSystemTheme() -> SDL_SystemTheme;
2138}
2139
2140unsafe extern "C" {
2141 /// Get a list of currently connected displays.
2142 ///
2143 /// ## Parameters
2144 /// - `count`: a pointer filled in with the number of displays returned, may
2145 /// be NULL.
2146 ///
2147 /// ## Return value
2148 /// Returns a 0 terminated array of display instance IDs or NULL on failure;
2149 /// call [`SDL_GetError()`] for more information. This should be freed
2150 /// with [`SDL_free()`] when it is no longer needed.
2151 ///
2152 /// ## Thread safety
2153 /// This function should only be called on the main thread.
2154 ///
2155 /// ## Availability
2156 /// This function is available since SDL 3.2.0.
2157 pub fn SDL_GetDisplays(count: *mut ::core::ffi::c_int) -> *mut SDL_DisplayID;
2158}
2159
2160unsafe extern "C" {
2161 /// Return the primary display.
2162 ///
2163 /// ## Return value
2164 /// Returns the instance ID of the primary display on success or 0 on failure;
2165 /// call [`SDL_GetError()`] for more information.
2166 ///
2167 /// ## Thread safety
2168 /// This function should only be called on the main thread.
2169 ///
2170 /// ## Availability
2171 /// This function is available since SDL 3.2.0.
2172 ///
2173 /// ## See also
2174 /// - [`SDL_GetDisplays`]
2175 pub fn SDL_GetPrimaryDisplay() -> SDL_DisplayID;
2176}
2177
2178unsafe extern "C" {
2179 /// Get the properties associated with a display.
2180 ///
2181 /// The following read-only properties are provided by SDL:
2182 ///
2183 /// - [`SDL_PROP_DISPLAY_HDR_ENABLED_BOOLEAN`]\: true if the display has HDR
2184 /// headroom above the SDR white point. This is for informational and
2185 /// diagnostic purposes only, as not all platforms provide this information
2186 /// at the display level.
2187 ///
2188 /// On KMS/DRM:
2189 ///
2190 /// - [`SDL_PROP_DISPLAY_KMSDRM_PANEL_ORIENTATION_NUMBER`]\: the "panel
2191 /// orientation" property for the display in degrees of clockwise rotation.
2192 /// Note that this is provided only as a hint, and the application is
2193 /// responsible for any coordinate transformations needed to conform to the
2194 /// requested display orientation.
2195 ///
2196 /// On Wayland:
2197 ///
2198 /// - [`SDL_PROP_DISPLAY_WAYLAND_WL_OUTPUT_POINTER`]\: the wl_output associated
2199 /// with the display
2200 ///
2201 /// On Windows:
2202 ///
2203 /// - [`SDL_PROP_DISPLAY_WINDOWS_HMONITOR_POINTER`]\: the monitor handle
2204 /// (HMONITOR) associated with the display
2205 ///
2206 /// ## Parameters
2207 /// - `displayID`: the instance ID of the display to query.
2208 ///
2209 /// ## Return value
2210 /// Returns a valid property ID on success or 0 on failure; call
2211 /// [`SDL_GetError()`] for more information.
2212 ///
2213 /// ## Thread safety
2214 /// This function should only be called on the main thread.
2215 ///
2216 /// ## Availability
2217 /// This function is available since SDL 3.2.0.
2218 pub fn SDL_GetDisplayProperties(displayID: SDL_DisplayID) -> SDL_PropertiesID;
2219}
2220
2221pub const SDL_PROP_DISPLAY_HDR_ENABLED_BOOLEAN: *const ::core::ffi::c_char =
2222 c"SDL.display.HDR_enabled".as_ptr();
2223
2224pub const SDL_PROP_DISPLAY_KMSDRM_PANEL_ORIENTATION_NUMBER: *const ::core::ffi::c_char =
2225 c"SDL.display.KMSDRM.panel_orientation".as_ptr();
2226
2227pub const SDL_PROP_DISPLAY_WAYLAND_WL_OUTPUT_POINTER: *const ::core::ffi::c_char =
2228 c"SDL.display.wayland.wl_output".as_ptr();
2229
2230pub const SDL_PROP_DISPLAY_WINDOWS_HMONITOR_POINTER: *const ::core::ffi::c_char =
2231 c"SDL.display.windows.hmonitor".as_ptr();
2232
2233unsafe extern "C" {
2234 /// Get the name of a display in UTF-8 encoding.
2235 ///
2236 /// ## Parameters
2237 /// - `displayID`: the instance ID of the display to query.
2238 ///
2239 /// ## Return value
2240 /// Returns the name of a display or NULL on failure; call [`SDL_GetError()`] for
2241 /// more information.
2242 ///
2243 /// ## Thread safety
2244 /// This function should only be called on the main thread.
2245 ///
2246 /// ## Availability
2247 /// This function is available since SDL 3.2.0.
2248 ///
2249 /// ## See also
2250 /// - [`SDL_GetDisplays`]
2251 pub fn SDL_GetDisplayName(displayID: SDL_DisplayID) -> *const ::core::ffi::c_char;
2252}
2253
2254unsafe extern "C" {
2255 /// Get the desktop area represented by a display.
2256 ///
2257 /// The primary display is often located at (0,0), but may be placed at a
2258 /// different location depending on monitor layout.
2259 ///
2260 /// ## Parameters
2261 /// - `displayID`: the instance ID of the display to query.
2262 /// - `rect`: the [`SDL_Rect`] structure filled in with the display bounds.
2263 ///
2264 /// ## Return value
2265 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
2266 /// information.
2267 ///
2268 /// ## Thread safety
2269 /// This function should only be called on the main thread.
2270 ///
2271 /// ## Availability
2272 /// This function is available since SDL 3.2.0.
2273 ///
2274 /// ## See also
2275 /// - [`SDL_GetDisplayUsableBounds`]
2276 /// - [`SDL_GetDisplays`]
2277 pub fn SDL_GetDisplayBounds(
2278 displayID: SDL_DisplayID,
2279 rect: *mut SDL_Rect,
2280 ) -> ::core::primitive::bool;
2281}
2282
2283unsafe extern "C" {
2284 /// Get the usable desktop area represented by a display, in screen
2285 /// coordinates.
2286 ///
2287 /// This is the same area as [`SDL_GetDisplayBounds()`] reports, but with portions
2288 /// reserved by the system removed. For example, on Apple's macOS, this
2289 /// subtracts the area occupied by the menu bar and dock.
2290 ///
2291 /// Setting a window to be fullscreen generally bypasses these unusable areas,
2292 /// so these are good guidelines for the maximum space available to a
2293 /// non-fullscreen window.
2294 ///
2295 /// ## Parameters
2296 /// - `displayID`: the instance ID of the display to query.
2297 /// - `rect`: the [`SDL_Rect`] structure filled in with the display bounds.
2298 ///
2299 /// ## Return value
2300 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
2301 /// information.
2302 ///
2303 /// ## Thread safety
2304 /// This function should only be called on the main thread.
2305 ///
2306 /// ## Availability
2307 /// This function is available since SDL 3.2.0.
2308 ///
2309 /// ## See also
2310 /// - [`SDL_GetDisplayBounds`]
2311 /// - [`SDL_GetDisplays`]
2312 pub fn SDL_GetDisplayUsableBounds(
2313 displayID: SDL_DisplayID,
2314 rect: *mut SDL_Rect,
2315 ) -> ::core::primitive::bool;
2316}
2317
2318unsafe extern "C" {
2319 /// Get the orientation of a display when it is unrotated.
2320 ///
2321 /// ## Parameters
2322 /// - `displayID`: the instance ID of the display to query.
2323 ///
2324 /// ## Return value
2325 /// Returns the [`SDL_DisplayOrientation`] enum value of the display, or
2326 /// [`SDL_ORIENTATION_UNKNOWN`] if it isn't available.
2327 ///
2328 /// ## Thread safety
2329 /// This function should only be called on the main thread.
2330 ///
2331 /// ## Availability
2332 /// This function is available since SDL 3.2.0.
2333 ///
2334 /// ## See also
2335 /// - [`SDL_GetDisplays`]
2336 pub fn SDL_GetNaturalDisplayOrientation(displayID: SDL_DisplayID) -> SDL_DisplayOrientation;
2337}
2338
2339unsafe extern "C" {
2340 /// Get the orientation of a display.
2341 ///
2342 /// ## Parameters
2343 /// - `displayID`: the instance ID of the display to query.
2344 ///
2345 /// ## Return value
2346 /// Returns the [`SDL_DisplayOrientation`] enum value of the display, or
2347 /// [`SDL_ORIENTATION_UNKNOWN`] if it isn't available.
2348 ///
2349 /// ## Thread safety
2350 /// This function should only be called on the main thread.
2351 ///
2352 /// ## Availability
2353 /// This function is available since SDL 3.2.0.
2354 ///
2355 /// ## See also
2356 /// - [`SDL_GetDisplays`]
2357 pub fn SDL_GetCurrentDisplayOrientation(displayID: SDL_DisplayID) -> SDL_DisplayOrientation;
2358}
2359
2360unsafe extern "C" {
2361 /// Get the content scale of a display.
2362 ///
2363 /// The content scale is the expected scale for content based on the DPI
2364 /// settings of the display. For example, a 4K display might have a 2.0 (200%)
2365 /// display scale, which means that the user expects UI elements to be twice as
2366 /// big on this display, to aid in readability.
2367 ///
2368 /// After window creation, [`SDL_GetWindowDisplayScale()`] should be used to query
2369 /// the content scale factor for individual windows instead of querying the
2370 /// display for a window and calling this function, as the per-window content
2371 /// scale factor may differ from the base value of the display it is on,
2372 /// particularly on high-DPI and/or multi-monitor desktop configurations.
2373 ///
2374 /// ## Parameters
2375 /// - `displayID`: the instance ID of the display to query.
2376 ///
2377 /// ## Return value
2378 /// Returns the content scale of the display, or 0.0f on failure; call
2379 /// [`SDL_GetError()`] for more information.
2380 ///
2381 /// ## Thread safety
2382 /// This function should only be called on the main thread.
2383 ///
2384 /// ## Availability
2385 /// This function is available since SDL 3.2.0.
2386 ///
2387 /// ## See also
2388 /// - [`SDL_GetWindowDisplayScale`]
2389 /// - [`SDL_GetDisplays`]
2390 pub fn SDL_GetDisplayContentScale(displayID: SDL_DisplayID) -> ::core::ffi::c_float;
2391}
2392
2393unsafe extern "C" {
2394 /// Get a list of fullscreen display modes available on a display.
2395 ///
2396 /// The display modes are sorted in this priority:
2397 ///
2398 /// - w -> largest to smallest
2399 /// - h -> largest to smallest
2400 /// - bits per pixel -> more colors to fewer colors
2401 /// - packed pixel layout -> largest to smallest
2402 /// - refresh rate -> highest to lowest
2403 /// - pixel density -> lowest to highest
2404 ///
2405 /// ## Parameters
2406 /// - `displayID`: the instance ID of the display to query.
2407 /// - `count`: a pointer filled in with the number of display modes returned,
2408 /// may be NULL.
2409 ///
2410 /// ## Return value
2411 /// Returns a NULL terminated array of display mode pointers or NULL on
2412 /// failure; call [`SDL_GetError()`] for more information. This is a
2413 /// single allocation that should be freed with [`SDL_free()`] when it is
2414 /// no longer needed.
2415 ///
2416 /// ## Thread safety
2417 /// This function should only be called on the main thread.
2418 ///
2419 /// ## Availability
2420 /// This function is available since SDL 3.2.0.
2421 ///
2422 /// ## See also
2423 /// - [`SDL_GetDisplays`]
2424 pub fn SDL_GetFullscreenDisplayModes(
2425 displayID: SDL_DisplayID,
2426 count: *mut ::core::ffi::c_int,
2427 ) -> *mut *mut SDL_DisplayMode;
2428}
2429
2430unsafe extern "C" {
2431 /// Get the closest match to the requested display mode.
2432 ///
2433 /// The available display modes are scanned and `closest` is filled in with the
2434 /// closest mode matching the requested mode and returned. The mode format and
2435 /// refresh rate default to the desktop mode if they are set to 0. The modes
2436 /// are scanned with size being first priority, format being second priority,
2437 /// and finally checking the refresh rate. If all the available modes are too
2438 /// small, then false is returned.
2439 ///
2440 /// ## Parameters
2441 /// - `displayID`: the instance ID of the display to query.
2442 /// - `w`: the width in pixels of the desired display mode.
2443 /// - `h`: the height in pixels of the desired display mode.
2444 /// - `refresh_rate`: the refresh rate of the desired display mode, or 0.0f
2445 /// for the desktop refresh rate.
2446 /// - `include_high_density_modes`: boolean to include high density modes in
2447 /// the search.
2448 /// - `closest`: a pointer filled in with the closest display mode equal to
2449 /// or larger than the desired mode.
2450 ///
2451 /// ## Return value
2452 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
2453 /// information.
2454 ///
2455 /// ## Thread safety
2456 /// This function should only be called on the main thread.
2457 ///
2458 /// ## Availability
2459 /// This function is available since SDL 3.2.0.
2460 ///
2461 /// ## See also
2462 /// - [`SDL_GetDisplays`]
2463 /// - [`SDL_GetFullscreenDisplayModes`]
2464 pub fn SDL_GetClosestFullscreenDisplayMode(
2465 displayID: SDL_DisplayID,
2466 w: ::core::ffi::c_int,
2467 h: ::core::ffi::c_int,
2468 refresh_rate: ::core::ffi::c_float,
2469 include_high_density_modes: ::core::primitive::bool,
2470 closest: *mut SDL_DisplayMode,
2471 ) -> ::core::primitive::bool;
2472}
2473
2474unsafe extern "C" {
2475 /// Get information about the desktop's display mode.
2476 ///
2477 /// There's a difference between this function and [`SDL_GetCurrentDisplayMode()`]
2478 /// when SDL runs fullscreen and has changed the resolution. In that case this
2479 /// function will return the previous native display mode, and not the current
2480 /// display mode.
2481 ///
2482 /// ## Parameters
2483 /// - `displayID`: the instance ID of the display to query.
2484 ///
2485 /// ## Return value
2486 /// Returns a pointer to the desktop display mode or NULL on failure; call
2487 /// [`SDL_GetError()`] for more information.
2488 ///
2489 /// ## Thread safety
2490 /// This function should only be called on the main thread.
2491 ///
2492 /// ## Availability
2493 /// This function is available since SDL 3.2.0.
2494 ///
2495 /// ## See also
2496 /// - [`SDL_GetCurrentDisplayMode`]
2497 /// - [`SDL_GetDisplays`]
2498 pub fn SDL_GetDesktopDisplayMode(displayID: SDL_DisplayID) -> *const SDL_DisplayMode;
2499}
2500
2501unsafe extern "C" {
2502 /// Get information about the current display mode.
2503 ///
2504 /// There's a difference between this function and [`SDL_GetDesktopDisplayMode()`]
2505 /// when SDL runs fullscreen and has changed the resolution. In that case this
2506 /// function will return the current display mode, and not the previous native
2507 /// display mode.
2508 ///
2509 /// ## Parameters
2510 /// - `displayID`: the instance ID of the display to query.
2511 ///
2512 /// ## Return value
2513 /// Returns a pointer to the desktop display mode or NULL on failure; call
2514 /// [`SDL_GetError()`] for more information.
2515 ///
2516 /// ## Thread safety
2517 /// This function should only be called on the main thread.
2518 ///
2519 /// ## Availability
2520 /// This function is available since SDL 3.2.0.
2521 ///
2522 /// ## See also
2523 /// - [`SDL_GetDesktopDisplayMode`]
2524 /// - [`SDL_GetDisplays`]
2525 pub fn SDL_GetCurrentDisplayMode(displayID: SDL_DisplayID) -> *const SDL_DisplayMode;
2526}
2527
2528unsafe extern "C" {
2529 /// Get the display containing a point.
2530 ///
2531 /// ## Parameters
2532 /// - `point`: the point to query.
2533 ///
2534 /// ## Return value
2535 /// Returns the instance ID of the display containing the point or 0 on
2536 /// failure; call [`SDL_GetError()`] for more information.
2537 ///
2538 /// ## Thread safety
2539 /// This function should only be called on the main thread.
2540 ///
2541 /// ## Availability
2542 /// This function is available since SDL 3.2.0.
2543 ///
2544 /// ## See also
2545 /// - [`SDL_GetDisplayBounds`]
2546 /// - [`SDL_GetDisplays`]
2547 pub fn SDL_GetDisplayForPoint(point: *const SDL_Point) -> SDL_DisplayID;
2548}
2549
2550unsafe extern "C" {
2551 /// Get the display primarily containing a rect.
2552 ///
2553 /// ## Parameters
2554 /// - `rect`: the rect to query.
2555 ///
2556 /// ## Return value
2557 /// Returns the instance ID of the display entirely containing the rect or
2558 /// closest to the center of the rect on success or 0 on failure; call
2559 /// [`SDL_GetError()`] for more information.
2560 ///
2561 /// ## Thread safety
2562 /// This function should only be called on the main thread.
2563 ///
2564 /// ## Availability
2565 /// This function is available since SDL 3.2.0.
2566 ///
2567 /// ## See also
2568 /// - [`SDL_GetDisplayBounds`]
2569 /// - [`SDL_GetDisplays`]
2570 pub fn SDL_GetDisplayForRect(rect: *const SDL_Rect) -> SDL_DisplayID;
2571}
2572
2573unsafe extern "C" {
2574 /// Get the display associated with a window.
2575 ///
2576 /// ## Parameters
2577 /// - `window`: the window to query.
2578 ///
2579 /// ## Return value
2580 /// Returns the instance ID of the display containing the center of the window
2581 /// on success or 0 on failure; call [`SDL_GetError()`] for more
2582 /// information.
2583 ///
2584 /// ## Thread safety
2585 /// This function should only be called on the main thread.
2586 ///
2587 /// ## Availability
2588 /// This function is available since SDL 3.2.0.
2589 ///
2590 /// ## See also
2591 /// - [`SDL_GetDisplayBounds`]
2592 /// - [`SDL_GetDisplays`]
2593 pub fn SDL_GetDisplayForWindow(window: *mut SDL_Window) -> SDL_DisplayID;
2594}
2595
2596unsafe extern "C" {
2597 /// Get the pixel density of a window.
2598 ///
2599 /// This is a ratio of pixel size to window size. For example, if the window is
2600 /// 1920x1080 and it has a high density back buffer of 3840x2160 pixels, it
2601 /// would have a pixel density of 2.0.
2602 ///
2603 /// ## Parameters
2604 /// - `window`: the window to query.
2605 ///
2606 /// ## Return value
2607 /// Returns the pixel density or 0.0f on failure; call [`SDL_GetError()`] for more
2608 /// information.
2609 ///
2610 /// ## Thread safety
2611 /// This function should only be called on the main thread.
2612 ///
2613 /// ## Availability
2614 /// This function is available since SDL 3.2.0.
2615 ///
2616 /// ## See also
2617 /// - [`SDL_GetWindowDisplayScale`]
2618 pub fn SDL_GetWindowPixelDensity(window: *mut SDL_Window) -> ::core::ffi::c_float;
2619}
2620
2621unsafe extern "C" {
2622 /// Get the content display scale relative to a window's pixel size.
2623 ///
2624 /// This is a combination of the window pixel density and the display content
2625 /// scale, and is the expected scale for displaying content in this window. For
2626 /// example, if a 3840x2160 window had a display scale of 2.0, the user expects
2627 /// the content to take twice as many pixels and be the same physical size as
2628 /// if it were being displayed in a 1920x1080 window with a display scale of
2629 /// 1.0.
2630 ///
2631 /// Conceptually this value corresponds to the scale display setting, and is
2632 /// updated when that setting is changed, or the window moves to a display with
2633 /// a different scale setting.
2634 ///
2635 /// ## Parameters
2636 /// - `window`: the window to query.
2637 ///
2638 /// ## Return value
2639 /// Returns the display scale, or 0.0f on failure; call [`SDL_GetError()`] for
2640 /// more information.
2641 ///
2642 /// ## Thread safety
2643 /// This function should only be called on the main thread.
2644 ///
2645 /// ## Availability
2646 /// This function is available since SDL 3.2.0.
2647 pub fn SDL_GetWindowDisplayScale(window: *mut SDL_Window) -> ::core::ffi::c_float;
2648}
2649
2650unsafe extern "C" {
2651 /// Set the display mode to use when a window is visible and fullscreen.
2652 ///
2653 /// This only affects the display mode used when the window is fullscreen. To
2654 /// change the window size when the window is not fullscreen, use
2655 /// [`SDL_SetWindowSize()`].
2656 ///
2657 /// If the window is currently in the fullscreen state, this request is
2658 /// asynchronous on some windowing systems and the new mode dimensions may not
2659 /// be applied immediately upon the return of this function. If an immediate
2660 /// change is required, call [`SDL_SyncWindow()`] to block until the changes have
2661 /// taken effect.
2662 ///
2663 /// When the new mode takes effect, an [`SDL_EVENT_WINDOW_RESIZED`] and/or an
2664 /// [`SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED`] event will be emitted with the new mode
2665 /// dimensions.
2666 ///
2667 /// ## Parameters
2668 /// - `window`: the window to affect.
2669 /// - `mode`: a pointer to the display mode to use, which can be NULL for
2670 /// borderless fullscreen desktop mode, or one of the fullscreen
2671 /// modes returned by [`SDL_GetFullscreenDisplayModes()`] to set an
2672 /// exclusive fullscreen mode.
2673 ///
2674 /// ## Return value
2675 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
2676 /// information.
2677 ///
2678 /// ## Thread safety
2679 /// This function should only be called on the main thread.
2680 ///
2681 /// ## Availability
2682 /// This function is available since SDL 3.2.0.
2683 ///
2684 /// ## See also
2685 /// - [`SDL_GetWindowFullscreenMode`]
2686 /// - [`SDL_SetWindowFullscreen`]
2687 /// - [`SDL_SyncWindow`]
2688 pub fn SDL_SetWindowFullscreenMode(
2689 window: *mut SDL_Window,
2690 mode: *const SDL_DisplayMode,
2691 ) -> ::core::primitive::bool;
2692}
2693
2694unsafe extern "C" {
2695 /// Query the display mode to use when a window is visible at fullscreen.
2696 ///
2697 /// ## Parameters
2698 /// - `window`: the window to query.
2699 ///
2700 /// ## Return value
2701 /// Returns a pointer to the exclusive fullscreen mode to use or NULL for
2702 /// borderless fullscreen desktop mode.
2703 ///
2704 /// ## Thread safety
2705 /// This function should only be called on the main thread.
2706 ///
2707 /// ## Availability
2708 /// This function is available since SDL 3.2.0.
2709 ///
2710 /// ## See also
2711 /// - [`SDL_SetWindowFullscreenMode`]
2712 /// - [`SDL_SetWindowFullscreen`]
2713 pub fn SDL_GetWindowFullscreenMode(window: *mut SDL_Window) -> *const SDL_DisplayMode;
2714}
2715
2716unsafe extern "C" {
2717 /// Get the raw ICC profile data for the screen the window is currently on.
2718 ///
2719 /// ## Parameters
2720 /// - `window`: the window to query.
2721 /// - `size`: the size of the ICC profile.
2722 ///
2723 /// ## Return value
2724 /// Returns the raw ICC profile data on success or NULL on failure; call
2725 /// [`SDL_GetError()`] for more information. This should be freed with
2726 /// [`SDL_free()`] when it is no longer needed.
2727 ///
2728 /// ## Thread safety
2729 /// This function should only be called on the main thread.
2730 ///
2731 /// ## Availability
2732 /// This function is available since SDL 3.2.0.
2733 pub fn SDL_GetWindowICCProfile(
2734 window: *mut SDL_Window,
2735 size: *mut ::core::primitive::usize,
2736 ) -> *mut ::core::ffi::c_void;
2737}
2738
2739unsafe extern "C" {
2740 /// Get the pixel format associated with the window.
2741 ///
2742 /// ## Parameters
2743 /// - `window`: the window to query.
2744 ///
2745 /// ## Return value
2746 /// Returns the pixel format of the window on success or
2747 /// [`SDL_PIXELFORMAT_UNKNOWN`] on failure; call [`SDL_GetError()`] for more
2748 /// information.
2749 ///
2750 /// ## Thread safety
2751 /// This function should only be called on the main thread.
2752 ///
2753 /// ## Availability
2754 /// This function is available since SDL 3.2.0.
2755 pub fn SDL_GetWindowPixelFormat(window: *mut SDL_Window) -> SDL_PixelFormat;
2756}
2757
2758unsafe extern "C" {
2759 /// Get a list of valid windows.
2760 ///
2761 /// ## Parameters
2762 /// - `count`: a pointer filled in with the number of windows returned, may
2763 /// be NULL.
2764 ///
2765 /// ## Return value
2766 /// Returns a NULL terminated array of [`SDL_Window`] pointers or NULL on failure;
2767 /// call [`SDL_GetError()`] for more information. This is a single
2768 /// allocation that should be freed with [`SDL_free()`] when it is no
2769 /// longer needed.
2770 ///
2771 /// ## Thread safety
2772 /// This function should only be called on the main thread.
2773 ///
2774 /// ## Availability
2775 /// This function is available since SDL 3.2.0.
2776 pub fn SDL_GetWindows(count: *mut ::core::ffi::c_int) -> *mut *mut SDL_Window;
2777}
2778
2779unsafe extern "C" {
2780 /// Create a window with the specified dimensions and flags.
2781 ///
2782 /// The window size is a request and may be different than expected based on
2783 /// the desktop layout and window manager policies. Your application should be
2784 /// prepared to handle a window of any size.
2785 ///
2786 /// `flags` may be any of the following OR'd together:
2787 ///
2788 /// - [`SDL_WINDOW_FULLSCREEN`]\: fullscreen window at desktop resolution
2789 /// - [`SDL_WINDOW_OPENGL`]\: window usable with an OpenGL context
2790 /// - [`SDL_WINDOW_HIDDEN`]\: window is not visible
2791 /// - [`SDL_WINDOW_BORDERLESS`]\: no window decoration
2792 /// - [`SDL_WINDOW_RESIZABLE`]\: window can be resized
2793 /// - [`SDL_WINDOW_MINIMIZED`]\: window is minimized
2794 /// - [`SDL_WINDOW_MAXIMIZED`]\: window is maximized
2795 /// - [`SDL_WINDOW_MOUSE_GRABBED`]\: window has grabbed mouse focus
2796 /// - [`SDL_WINDOW_INPUT_FOCUS`]\: window has input focus
2797 /// - [`SDL_WINDOW_MOUSE_FOCUS`]\: window has mouse focus
2798 /// - [`SDL_WINDOW_EXTERNAL`]\: window not created by SDL
2799 /// - [`SDL_WINDOW_MODAL`]\: window is modal
2800 /// - [`SDL_WINDOW_HIGH_PIXEL_DENSITY`]\: window uses high pixel density back
2801 /// buffer if possible
2802 /// - [`SDL_WINDOW_MOUSE_CAPTURE`]\: window has mouse captured (unrelated to
2803 /// MOUSE_GRABBED)
2804 /// - [`SDL_WINDOW_ALWAYS_ON_TOP`]\: window should always be above others
2805 /// - [`SDL_WINDOW_UTILITY`]\: window should be treated as a utility window, not
2806 /// showing in the task bar and window list
2807 /// - [`SDL_WINDOW_TOOLTIP`]\: window should be treated as a tooltip and does not
2808 /// get mouse or keyboard focus, requires a parent window
2809 /// - [`SDL_WINDOW_POPUP_MENU`]\: window should be treated as a popup menu,
2810 /// requires a parent window
2811 /// - [`SDL_WINDOW_KEYBOARD_GRABBED`]\: window has grabbed keyboard input
2812 /// - [`SDL_WINDOW_VULKAN`]\: window usable with a Vulkan instance
2813 /// - [`SDL_WINDOW_METAL`]\: window usable with a Metal instance
2814 /// - [`SDL_WINDOW_TRANSPARENT`]\: window with transparent buffer
2815 /// - [`SDL_WINDOW_NOT_FOCUSABLE`]\: window should not be focusable
2816 ///
2817 /// The [`SDL_Window`] will be shown if [`SDL_WINDOW_HIDDEN`] is not set. If hidden at
2818 /// creation time, [`SDL_ShowWindow()`] can be used to show it later.
2819 ///
2820 /// On Apple's macOS, you **must** set the NSHighResolutionCapable Info.plist
2821 /// property to YES, otherwise you will not receive a High-DPI OpenGL canvas.
2822 ///
2823 /// The window pixel size may differ from its window coordinate size if the
2824 /// window is on a high pixel density display. Use [`SDL_GetWindowSize()`] to query
2825 /// the client area's size in window coordinates, and
2826 /// [`SDL_GetWindowSizeInPixels()`] or [`SDL_GetRenderOutputSize()`] to query the
2827 /// drawable size in pixels. Note that the drawable size can vary after the
2828 /// window is created and should be queried again if you get an
2829 /// [`SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED`] event.
2830 ///
2831 /// If the window is created with any of the [`SDL_WINDOW_OPENGL`] or
2832 /// [`SDL_WINDOW_VULKAN`] flags, then the corresponding LoadLibrary function
2833 /// ([`SDL_GL_LoadLibrary`] or [`SDL_Vulkan_LoadLibrary`]) is called and the
2834 /// corresponding UnloadLibrary function is called by [`SDL_DestroyWindow()`].
2835 ///
2836 /// If [`SDL_WINDOW_VULKAN`] is specified and there isn't a working Vulkan driver,
2837 /// [`SDL_CreateWindow()`] will fail, because [`SDL_Vulkan_LoadLibrary()`] will fail.
2838 ///
2839 /// If [`SDL_WINDOW_METAL`] is specified on an OS that does not support Metal,
2840 /// [`SDL_CreateWindow()`] will fail.
2841 ///
2842 /// If you intend to use this window with an [`SDL_Renderer`], you should use
2843 /// [`SDL_CreateWindowAndRenderer()`] instead of this function, to avoid window
2844 /// flicker.
2845 ///
2846 /// On non-Apple devices, SDL requires you to either not link to the Vulkan
2847 /// loader or link to a dynamic library version. This limitation may be removed
2848 /// in a future version of SDL.
2849 ///
2850 /// ## Parameters
2851 /// - `title`: the title of the window, in UTF-8 encoding.
2852 /// - `w`: the width of the window.
2853 /// - `h`: the height of the window.
2854 /// - `flags`: 0, or one or more [`SDL_WindowFlags`] OR'd together.
2855 ///
2856 /// ## Return value
2857 /// Returns the window that was created or NULL on failure; call
2858 /// [`SDL_GetError()`] for more information.
2859 ///
2860 /// ## Thread safety
2861 /// This function should only be called on the main thread.
2862 ///
2863 /// ## Availability
2864 /// This function is available since SDL 3.2.0.
2865 ///
2866 /// ## See also
2867 /// - [`SDL_CreateWindowAndRenderer`]
2868 /// - [`SDL_CreatePopupWindow`]
2869 /// - [`SDL_CreateWindowWithProperties`]
2870 /// - [`SDL_DestroyWindow`]
2871 pub fn SDL_CreateWindow(
2872 title: *const ::core::ffi::c_char,
2873 w: ::core::ffi::c_int,
2874 h: ::core::ffi::c_int,
2875 flags: SDL_WindowFlags,
2876 ) -> *mut SDL_Window;
2877}
2878
2879unsafe extern "C" {
2880 /// Create a child popup window of the specified parent window.
2881 ///
2882 /// The window size is a request and may be different than expected based on
2883 /// the desktop layout and window manager policies. Your application should be
2884 /// prepared to handle a window of any size.
2885 ///
2886 /// The flags parameter **must** contain at least one of the following:
2887 ///
2888 /// - [`SDL_WINDOW_TOOLTIP`]\: The popup window is a tooltip and will not pass any
2889 /// input events.
2890 /// - [`SDL_WINDOW_POPUP_MENU`]\: The popup window is a popup menu. The topmost
2891 /// popup menu will implicitly gain the keyboard focus.
2892 ///
2893 /// The following flags are not relevant to popup window creation and will be
2894 /// ignored:
2895 ///
2896 /// - [`SDL_WINDOW_MINIMIZED`]
2897 /// - [`SDL_WINDOW_MAXIMIZED`]
2898 /// - [`SDL_WINDOW_FULLSCREEN`]
2899 /// - [`SDL_WINDOW_BORDERLESS`]
2900 ///
2901 /// The following flags are incompatible with popup window creation and will
2902 /// cause it to fail:
2903 ///
2904 /// - [`SDL_WINDOW_UTILITY`]
2905 /// - [`SDL_WINDOW_MODAL`]
2906 ///
2907 /// The parent parameter **must** be non-null and a valid window. The parent of
2908 /// a popup window can be either a regular, toplevel window, or another popup
2909 /// window.
2910 ///
2911 /// Popup windows cannot be minimized, maximized, made fullscreen, raised,
2912 /// flash, be made a modal window, be the parent of a toplevel window, or grab
2913 /// the mouse and/or keyboard. Attempts to do so will fail.
2914 ///
2915 /// Popup windows implicitly do not have a border/decorations and do not appear
2916 /// on the taskbar/dock or in lists of windows such as alt-tab menus.
2917 ///
2918 /// By default, popup window positions will automatically be constrained to
2919 /// keep the entire window within display bounds. This can be overridden with
2920 /// the [`SDL_PROP_WINDOW_CREATE_CONSTRAIN_POPUP_BOOLEAN`] property.
2921 ///
2922 /// By default, popup menus will automatically grab keyboard focus from the
2923 /// parent when shown. This behavior can be overridden by setting the
2924 /// [`SDL_WINDOW_NOT_FOCUSABLE`] flag, setting the
2925 /// [`SDL_PROP_WINDOW_CREATE_FOCUSABLE_BOOLEAN`] property to false, or toggling
2926 /// it after creation via the `SDL_SetWindowFocusable()` function.
2927 ///
2928 /// If a parent window is hidden or destroyed, any child popup windows will be
2929 /// recursively hidden or destroyed as well. Child popup windows not explicitly
2930 /// hidden will be restored when the parent is shown.
2931 ///
2932 /// ## Parameters
2933 /// - `parent`: the parent of the window, must not be NULL.
2934 /// - `offset_x`: the x position of the popup window relative to the origin
2935 /// of the parent.
2936 /// - `offset_y`: the y position of the popup window relative to the origin
2937 /// of the parent window.
2938 /// - `w`: the width of the window.
2939 /// - `h`: the height of the window.
2940 /// - `flags`: [`SDL_WINDOW_TOOLTIP`] or [`SDL_WINDOW_POPUP_MENU`], and zero or more
2941 /// additional [`SDL_WindowFlags`] OR'd together.
2942 ///
2943 /// ## Return value
2944 /// Returns the window that was created or NULL on failure; call
2945 /// [`SDL_GetError()`] for more information.
2946 ///
2947 /// ## Thread safety
2948 /// This function should only be called on the main thread.
2949 ///
2950 /// ## Availability
2951 /// This function is available since SDL 3.2.0.
2952 ///
2953 /// ## See also
2954 /// - [`SDL_CreateWindow`]
2955 /// - [`SDL_CreateWindowWithProperties`]
2956 /// - [`SDL_DestroyWindow`]
2957 /// - [`SDL_GetWindowParent`]
2958 pub fn SDL_CreatePopupWindow(
2959 parent: *mut SDL_Window,
2960 offset_x: ::core::ffi::c_int,
2961 offset_y: ::core::ffi::c_int,
2962 w: ::core::ffi::c_int,
2963 h: ::core::ffi::c_int,
2964 flags: SDL_WindowFlags,
2965 ) -> *mut SDL_Window;
2966}
2967
2968unsafe extern "C" {
2969 /// Create a window with the specified properties.
2970 ///
2971 /// The window size is a request and may be different than expected based on
2972 /// the desktop layout and window manager policies. Your application should be
2973 /// prepared to handle a window of any size.
2974 ///
2975 /// These are the supported properties:
2976 ///
2977 /// - [`SDL_PROP_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN`]\: true if the window should
2978 /// be always on top
2979 /// - [`SDL_PROP_WINDOW_CREATE_BORDERLESS_BOOLEAN`]\: true if the window has no
2980 /// window decoration
2981 /// - [`SDL_PROP_WINDOW_CREATE_CONSTRAIN_POPUP_BOOLEAN`]\: true if the "tooltip"
2982 /// and "menu" window types should be automatically constrained to be
2983 /// entirely within display bounds (default), false if no constraints on the
2984 /// position are desired.
2985 /// - [`SDL_PROP_WINDOW_CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN`]\: true if the
2986 /// window will be used with an externally managed graphics context.
2987 /// - [`SDL_PROP_WINDOW_CREATE_FOCUSABLE_BOOLEAN`]\: true if the window should
2988 /// accept keyboard input (defaults true)
2989 /// - [`SDL_PROP_WINDOW_CREATE_FULLSCREEN_BOOLEAN`]\: true if the window should
2990 /// start in fullscreen mode at desktop resolution
2991 /// - [`SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER`]\: the height of the window
2992 /// - [`SDL_PROP_WINDOW_CREATE_HIDDEN_BOOLEAN`]\: true if the window should start
2993 /// hidden
2994 /// - [`SDL_PROP_WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN`]\: true if the window
2995 /// uses a high pixel density buffer if possible
2996 /// - [`SDL_PROP_WINDOW_CREATE_MAXIMIZED_BOOLEAN`]\: true if the window should
2997 /// start maximized
2998 /// - [`SDL_PROP_WINDOW_CREATE_MENU_BOOLEAN`]\: true if the window is a popup menu
2999 /// - [`SDL_PROP_WINDOW_CREATE_METAL_BOOLEAN`]\: true if the window will be used
3000 /// with Metal rendering
3001 /// - [`SDL_PROP_WINDOW_CREATE_MINIMIZED_BOOLEAN`]\: true if the window should
3002 /// start minimized
3003 /// - [`SDL_PROP_WINDOW_CREATE_MODAL_BOOLEAN`]\: true if the window is modal to
3004 /// its parent
3005 /// - [`SDL_PROP_WINDOW_CREATE_MOUSE_GRABBED_BOOLEAN`]\: true if the window starts
3006 /// with grabbed mouse focus
3007 /// - [`SDL_PROP_WINDOW_CREATE_OPENGL_BOOLEAN`]\: true if the window will be used
3008 /// with OpenGL rendering
3009 /// - [`SDL_PROP_WINDOW_CREATE_PARENT_POINTER`]\: an [`SDL_Window`] that will be the
3010 /// parent of this window, required for windows with the "tooltip", "menu",
3011 /// and "modal" properties
3012 /// - [`SDL_PROP_WINDOW_CREATE_RESIZABLE_BOOLEAN`]\: true if the window should be
3013 /// resizable
3014 /// - [`SDL_PROP_WINDOW_CREATE_TITLE_STRING`]\: the title of the window, in UTF-8
3015 /// encoding
3016 /// - [`SDL_PROP_WINDOW_CREATE_TRANSPARENT_BOOLEAN`]\: true if the window show
3017 /// transparent in the areas with alpha of 0
3018 /// - [`SDL_PROP_WINDOW_CREATE_TOOLTIP_BOOLEAN`]\: true if the window is a tooltip
3019 /// - [`SDL_PROP_WINDOW_CREATE_UTILITY_BOOLEAN`]\: true if the window is a utility
3020 /// window, not showing in the task bar and window list
3021 /// - [`SDL_PROP_WINDOW_CREATE_VULKAN_BOOLEAN`]\: true if the window will be used
3022 /// with Vulkan rendering
3023 /// - [`SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER`]\: the width of the window
3024 /// - [`SDL_PROP_WINDOW_CREATE_X_NUMBER`]\: the x position of the window, or
3025 /// [`SDL_WINDOWPOS_CENTERED`], defaults to [`SDL_WINDOWPOS_UNDEFINED`]. This is
3026 /// relative to the parent for windows with the "tooltip" or "menu" property
3027 /// set.
3028 /// - [`SDL_PROP_WINDOW_CREATE_Y_NUMBER`]\: the y position of the window, or
3029 /// [`SDL_WINDOWPOS_CENTERED`], defaults to [`SDL_WINDOWPOS_UNDEFINED`]. This is
3030 /// relative to the parent for windows with the "tooltip" or "menu" property
3031 /// set.
3032 ///
3033 /// These are additional supported properties on macOS:
3034 ///
3035 /// - [`SDL_PROP_WINDOW_CREATE_COCOA_WINDOW_POINTER`]\: the
3036 /// `(__unsafe_unretained)` NSWindow associated with the window, if you want
3037 /// to wrap an existing window.
3038 /// - [`SDL_PROP_WINDOW_CREATE_COCOA_VIEW_POINTER`]\: the `(__unsafe_unretained)`
3039 /// NSView associated with the window, defaults to `[window contentView]`
3040 ///
3041 /// These are additional supported properties on iOS, tvOS, and visionOS:
3042 ///
3043 /// - [`SDL_PROP_WINDOW_CREATE_WINDOWSCENE_POINTER`]\: the `(__unsafe_unretained)`
3044 /// UIWindowScene associated with the window, defaults to the active window
3045 /// scene.
3046 ///
3047 /// These are additional supported properties on Wayland:
3048 ///
3049 /// - [`SDL_PROP_WINDOW_CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN`] - true if
3050 /// the application wants to use the Wayland surface for a custom role and
3051 /// does not want it attached to an XDG toplevel window. See
3052 /// [README-wayland](README-wayland) for more information on using custom
3053 /// surfaces.
3054 /// - [`SDL_PROP_WINDOW_CREATE_WAYLAND_CREATE_EGL_WINDOW_BOOLEAN`] - true if the
3055 /// application wants an associated `wl_egl_window` object to be created and
3056 /// attached to the window, even if the window does not have the OpenGL
3057 /// property or [`SDL_WINDOW_OPENGL`] flag set.
3058 /// - [`SDL_PROP_WINDOW_CREATE_WAYLAND_WL_SURFACE_POINTER`] - the wl_surface
3059 /// associated with the window, if you want to wrap an existing window. See
3060 /// [README-wayland](README-wayland) for more information.
3061 ///
3062 /// These are additional supported properties on Windows:
3063 ///
3064 /// - [`SDL_PROP_WINDOW_CREATE_WIN32_HWND_POINTER`]\: the HWND associated with the
3065 /// window, if you want to wrap an existing window.
3066 /// - [`SDL_PROP_WINDOW_CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER`]\: optional,
3067 /// another window to share pixel format with, useful for OpenGL windows
3068 ///
3069 /// These are additional supported properties with X11:
3070 ///
3071 /// - [`SDL_PROP_WINDOW_CREATE_X11_WINDOW_NUMBER`]\: the X11 Window associated
3072 /// with the window, if you want to wrap an existing window.
3073 ///
3074 /// The window is implicitly shown if the "hidden" property is not set.
3075 ///
3076 /// These are additional supported properties with Emscripten:
3077 ///
3078 /// - [`SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_CANVAS_ID_STRING`]\: the id given to the
3079 /// canvas element. This should start with a '#' sign
3080 /// - [`SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING`]\: override the
3081 /// binding element for keyboard inputs for this canvas. The variable can be
3082 /// one of:
3083 /// - "#window": the javascript window object (default)
3084 /// - "#document": the javascript document object
3085 /// - "#screen": the javascript window.screen object
3086 /// - "#canvas": the WebGL canvas element
3087 /// - "#none": Don't bind anything at all
3088 /// - any other string without a leading # sign applies to the element on the
3089 /// page with that ID. Windows with the "tooltip" and "menu" properties are
3090 /// popup windows and have the behaviors and guidelines outlined in
3091 /// [`SDL_CreatePopupWindow()`].
3092 ///
3093 /// If this window is being created to be used with an [`SDL_Renderer`], you should
3094 /// not add a graphics API specific property
3095 /// ([`SDL_PROP_WINDOW_CREATE_OPENGL_BOOLEAN`], etc), as SDL will handle that
3096 /// internally when it chooses a renderer. However, SDL might need to recreate
3097 /// your window at that point, which may cause the window to appear briefly,
3098 /// and then flicker as it is recreated. The correct approach to this is to
3099 /// create the window with the [`SDL_PROP_WINDOW_CREATE_HIDDEN_BOOLEAN`] property
3100 /// set to true, then create the renderer, then show the window with
3101 /// [`SDL_ShowWindow()`].
3102 ///
3103 /// ## Parameters
3104 /// - `props`: the properties to use.
3105 ///
3106 /// ## Return value
3107 /// Returns the window that was created or NULL on failure; call
3108 /// [`SDL_GetError()`] for more information.
3109 ///
3110 /// ## Thread safety
3111 /// This function should only be called on the main thread.
3112 ///
3113 /// ## Availability
3114 /// This function is available since SDL 3.2.0.
3115 ///
3116 /// ## See also
3117 /// - [`SDL_CreateProperties`]
3118 /// - [`SDL_CreateWindow`]
3119 /// - [`SDL_DestroyWindow`]
3120 pub fn SDL_CreateWindowWithProperties(props: SDL_PropertiesID) -> *mut SDL_Window;
3121}
3122
3123pub const SDL_PROP_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN: *const ::core::ffi::c_char =
3124 c"SDL.window.create.always_on_top".as_ptr();
3125
3126pub const SDL_PROP_WINDOW_CREATE_BORDERLESS_BOOLEAN: *const ::core::ffi::c_char =
3127 c"SDL.window.create.borderless".as_ptr();
3128
3129pub const SDL_PROP_WINDOW_CREATE_CONSTRAIN_POPUP_BOOLEAN: *const ::core::ffi::c_char =
3130 c"SDL.window.create.constrain_popup".as_ptr();
3131
3132pub const SDL_PROP_WINDOW_CREATE_FOCUSABLE_BOOLEAN: *const ::core::ffi::c_char =
3133 c"SDL.window.create.focusable".as_ptr();
3134
3135pub const SDL_PROP_WINDOW_CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN: *const ::core::ffi::c_char =
3136 c"SDL.window.create.external_graphics_context".as_ptr();
3137
3138pub const SDL_PROP_WINDOW_CREATE_FLAGS_NUMBER: *const ::core::ffi::c_char =
3139 c"SDL.window.create.flags".as_ptr();
3140
3141pub const SDL_PROP_WINDOW_CREATE_FULLSCREEN_BOOLEAN: *const ::core::ffi::c_char =
3142 c"SDL.window.create.fullscreen".as_ptr();
3143
3144pub const SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER: *const ::core::ffi::c_char =
3145 c"SDL.window.create.height".as_ptr();
3146
3147pub const SDL_PROP_WINDOW_CREATE_HIDDEN_BOOLEAN: *const ::core::ffi::c_char =
3148 c"SDL.window.create.hidden".as_ptr();
3149
3150pub const SDL_PROP_WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN: *const ::core::ffi::c_char =
3151 c"SDL.window.create.high_pixel_density".as_ptr();
3152
3153pub const SDL_PROP_WINDOW_CREATE_MAXIMIZED_BOOLEAN: *const ::core::ffi::c_char =
3154 c"SDL.window.create.maximized".as_ptr();
3155
3156pub const SDL_PROP_WINDOW_CREATE_MENU_BOOLEAN: *const ::core::ffi::c_char =
3157 c"SDL.window.create.menu".as_ptr();
3158
3159pub const SDL_PROP_WINDOW_CREATE_METAL_BOOLEAN: *const ::core::ffi::c_char =
3160 c"SDL.window.create.metal".as_ptr();
3161
3162pub const SDL_PROP_WINDOW_CREATE_MINIMIZED_BOOLEAN: *const ::core::ffi::c_char =
3163 c"SDL.window.create.minimized".as_ptr();
3164
3165pub const SDL_PROP_WINDOW_CREATE_MODAL_BOOLEAN: *const ::core::ffi::c_char =
3166 c"SDL.window.create.modal".as_ptr();
3167
3168pub const SDL_PROP_WINDOW_CREATE_MOUSE_GRABBED_BOOLEAN: *const ::core::ffi::c_char =
3169 c"SDL.window.create.mouse_grabbed".as_ptr();
3170
3171pub const SDL_PROP_WINDOW_CREATE_OPENGL_BOOLEAN: *const ::core::ffi::c_char =
3172 c"SDL.window.create.opengl".as_ptr();
3173
3174pub const SDL_PROP_WINDOW_CREATE_PARENT_POINTER: *const ::core::ffi::c_char =
3175 c"SDL.window.create.parent".as_ptr();
3176
3177pub const SDL_PROP_WINDOW_CREATE_RESIZABLE_BOOLEAN: *const ::core::ffi::c_char =
3178 c"SDL.window.create.resizable".as_ptr();
3179
3180pub const SDL_PROP_WINDOW_CREATE_TITLE_STRING: *const ::core::ffi::c_char =
3181 c"SDL.window.create.title".as_ptr();
3182
3183pub const SDL_PROP_WINDOW_CREATE_TRANSPARENT_BOOLEAN: *const ::core::ffi::c_char =
3184 c"SDL.window.create.transparent".as_ptr();
3185
3186pub const SDL_PROP_WINDOW_CREATE_TOOLTIP_BOOLEAN: *const ::core::ffi::c_char =
3187 c"SDL.window.create.tooltip".as_ptr();
3188
3189pub const SDL_PROP_WINDOW_CREATE_UTILITY_BOOLEAN: *const ::core::ffi::c_char =
3190 c"SDL.window.create.utility".as_ptr();
3191
3192pub const SDL_PROP_WINDOW_CREATE_VULKAN_BOOLEAN: *const ::core::ffi::c_char =
3193 c"SDL.window.create.vulkan".as_ptr();
3194
3195pub const SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER: *const ::core::ffi::c_char =
3196 c"SDL.window.create.width".as_ptr();
3197
3198pub const SDL_PROP_WINDOW_CREATE_X_NUMBER: *const ::core::ffi::c_char =
3199 c"SDL.window.create.x".as_ptr();
3200
3201pub const SDL_PROP_WINDOW_CREATE_Y_NUMBER: *const ::core::ffi::c_char =
3202 c"SDL.window.create.y".as_ptr();
3203
3204pub const SDL_PROP_WINDOW_CREATE_COCOA_WINDOW_POINTER: *const ::core::ffi::c_char =
3205 c"SDL.window.create.cocoa.window".as_ptr();
3206
3207pub const SDL_PROP_WINDOW_CREATE_COCOA_VIEW_POINTER: *const ::core::ffi::c_char =
3208 c"SDL.window.create.cocoa.view".as_ptr();
3209
3210pub const SDL_PROP_WINDOW_CREATE_WINDOWSCENE_POINTER: *const ::core::ffi::c_char =
3211 c"SDL.window.create.uikit.windowscene".as_ptr();
3212
3213pub const SDL_PROP_WINDOW_CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN: *const ::core::ffi::c_char =
3214 c"SDL.window.create.wayland.surface_role_custom".as_ptr();
3215
3216pub const SDL_PROP_WINDOW_CREATE_WAYLAND_CREATE_EGL_WINDOW_BOOLEAN: *const ::core::ffi::c_char =
3217 c"SDL.window.create.wayland.create_egl_window".as_ptr();
3218
3219pub const SDL_PROP_WINDOW_CREATE_WAYLAND_WL_SURFACE_POINTER: *const ::core::ffi::c_char =
3220 c"SDL.window.create.wayland.wl_surface".as_ptr();
3221
3222pub const SDL_PROP_WINDOW_CREATE_WIN32_HWND_POINTER: *const ::core::ffi::c_char =
3223 c"SDL.window.create.win32.hwnd".as_ptr();
3224
3225pub const SDL_PROP_WINDOW_CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER: *const ::core::ffi::c_char =
3226 c"SDL.window.create.win32.pixel_format_hwnd".as_ptr();
3227
3228pub const SDL_PROP_WINDOW_CREATE_X11_WINDOW_NUMBER: *const ::core::ffi::c_char =
3229 c"SDL.window.create.x11.window".as_ptr();
3230
3231pub const SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_CANVAS_ID_STRING: *const ::core::ffi::c_char =
3232 c"SDL.window.create.emscripten.canvas_id".as_ptr();
3233
3234pub const SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING: *const ::core::ffi::c_char =
3235 c"SDL.window.create.emscripten.keyboard_element".as_ptr();
3236
3237unsafe extern "C" {
3238 /// Get the numeric ID of a window.
3239 ///
3240 /// The numeric ID is what [`SDL_WindowEvent`] references, and is necessary to map
3241 /// these events to specific [`SDL_Window`] objects.
3242 ///
3243 /// ## Parameters
3244 /// - `window`: the window to query.
3245 ///
3246 /// ## Return value
3247 /// Returns the ID of the window on success or 0 on failure; call
3248 /// [`SDL_GetError()`] for more information.
3249 ///
3250 /// ## Thread safety
3251 /// This function should only be called on the main thread.
3252 ///
3253 /// ## Availability
3254 /// This function is available since SDL 3.2.0.
3255 ///
3256 /// ## See also
3257 /// - [`SDL_GetWindowFromID`]
3258 pub fn SDL_GetWindowID(window: *mut SDL_Window) -> SDL_WindowID;
3259}
3260
3261unsafe extern "C" {
3262 /// Get a window from a stored ID.
3263 ///
3264 /// The numeric ID is what [`SDL_WindowEvent`] references, and is necessary to map
3265 /// these events to specific [`SDL_Window`] objects.
3266 ///
3267 /// ## Parameters
3268 /// - `id`: the ID of the window.
3269 ///
3270 /// ## Return value
3271 /// Returns the window associated with `id` or NULL if it doesn't exist; call
3272 /// [`SDL_GetError()`] for more information.
3273 ///
3274 /// ## Thread safety
3275 /// This function should only be called on the main thread.
3276 ///
3277 /// ## Availability
3278 /// This function is available since SDL 3.2.0.
3279 ///
3280 /// ## See also
3281 /// - [`SDL_GetWindowID`]
3282 pub fn SDL_GetWindowFromID(id: SDL_WindowID) -> *mut SDL_Window;
3283}
3284
3285unsafe extern "C" {
3286 /// Get parent of a window.
3287 ///
3288 /// ## Parameters
3289 /// - `window`: the window to query.
3290 ///
3291 /// ## Return value
3292 /// Returns the parent of the window on success or NULL if the window has no
3293 /// parent.
3294 ///
3295 /// ## Thread safety
3296 /// This function should only be called on the main thread.
3297 ///
3298 /// ## Availability
3299 /// This function is available since SDL 3.2.0.
3300 ///
3301 /// ## See also
3302 /// - [`SDL_CreatePopupWindow`]
3303 pub fn SDL_GetWindowParent(window: *mut SDL_Window) -> *mut SDL_Window;
3304}
3305
3306unsafe extern "C" {
3307 /// Get the properties associated with a window.
3308 ///
3309 /// The following read-only properties are provided by SDL:
3310 ///
3311 /// - [`SDL_PROP_WINDOW_SHAPE_POINTER`]\: the surface associated with a shaped
3312 /// window
3313 /// - [`SDL_PROP_WINDOW_HDR_ENABLED_BOOLEAN`]\: true if the window has HDR
3314 /// headroom above the SDR white point. This property can change dynamically
3315 /// when [`SDL_EVENT_WINDOW_HDR_STATE_CHANGED`] is sent.
3316 /// - [`SDL_PROP_WINDOW_SDR_WHITE_LEVEL_FLOAT`]\: the value of SDR white in the
3317 /// [`SDL_COLORSPACE_SRGB_LINEAR`] colorspace. On Windows this corresponds to the
3318 /// SDR white level in scRGB colorspace, and on Apple platforms this is
3319 /// always 1.0 for EDR content. This property can change dynamically when
3320 /// [`SDL_EVENT_WINDOW_HDR_STATE_CHANGED`] is sent.
3321 /// - [`SDL_PROP_WINDOW_HDR_HEADROOM_FLOAT`]\: the additional high dynamic range
3322 /// that can be displayed, in terms of the SDR white point. When HDR is not
3323 /// enabled, this will be 1.0. This property can change dynamically when
3324 /// [`SDL_EVENT_WINDOW_HDR_STATE_CHANGED`] is sent.
3325 ///
3326 /// On Android:
3327 ///
3328 /// - [`SDL_PROP_WINDOW_ANDROID_WINDOW_POINTER`]\: the ANativeWindow associated
3329 /// with the window
3330 /// - [`SDL_PROP_WINDOW_ANDROID_SURFACE_POINTER`]\: the EGLSurface associated with
3331 /// the window
3332 ///
3333 /// On iOS:
3334 ///
3335 /// - [`SDL_PROP_WINDOW_UIKIT_WINDOW_POINTER`]\: the `(__unsafe_unretained)`
3336 /// UIWindow associated with the window
3337 /// - [`SDL_PROP_WINDOW_UIKIT_METAL_VIEW_TAG_NUMBER`]\: the NSInteger tag
3338 /// associated with metal views on the window
3339 /// - [`SDL_PROP_WINDOW_UIKIT_OPENGL_FRAMEBUFFER_NUMBER`]\: the OpenGL view's
3340 /// framebuffer object. It must be bound when rendering to the screen using
3341 /// OpenGL.
3342 /// - [`SDL_PROP_WINDOW_UIKIT_OPENGL_RENDERBUFFER_NUMBER`]\: the OpenGL view's
3343 /// renderbuffer object. It must be bound when [`SDL_GL_SwapWindow`] is called.
3344 /// - [`SDL_PROP_WINDOW_UIKIT_OPENGL_RESOLVE_FRAMEBUFFER_NUMBER`]\: the OpenGL
3345 /// view's resolve framebuffer, when MSAA is used.
3346 ///
3347 /// On KMS/DRM:
3348 ///
3349 /// - [`SDL_PROP_WINDOW_KMSDRM_DEVICE_INDEX_NUMBER`]\: the device index associated
3350 /// with the window (e.g. the X in /dev/dri/cardX)
3351 /// - [`SDL_PROP_WINDOW_KMSDRM_DRM_FD_NUMBER`]\: the DRM FD associated with the
3352 /// window
3353 /// - [`SDL_PROP_WINDOW_KMSDRM_GBM_DEVICE_POINTER`]\: the GBM device associated
3354 /// with the window
3355 ///
3356 /// On macOS:
3357 ///
3358 /// - [`SDL_PROP_WINDOW_COCOA_WINDOW_POINTER`]\: the `(__unsafe_unretained)`
3359 /// NSWindow associated with the window
3360 /// - [`SDL_PROP_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER`]\: the NSInteger tag
3361 /// associated with metal views on the window
3362 ///
3363 /// On OpenVR:
3364 ///
3365 /// - [`SDL_PROP_WINDOW_OPENVR_OVERLAY_ID_NUMBER`]\: the OpenVR Overlay Handle ID
3366 /// for the associated overlay window.
3367 ///
3368 /// On Vivante:
3369 ///
3370 /// - [`SDL_PROP_WINDOW_VIVANTE_DISPLAY_POINTER`]\: the EGLNativeDisplayType
3371 /// associated with the window
3372 /// - [`SDL_PROP_WINDOW_VIVANTE_WINDOW_POINTER`]\: the EGLNativeWindowType
3373 /// associated with the window
3374 /// - [`SDL_PROP_WINDOW_VIVANTE_SURFACE_POINTER`]\: the EGLSurface associated with
3375 /// the window
3376 ///
3377 /// On Windows:
3378 ///
3379 /// - [`SDL_PROP_WINDOW_WIN32_HWND_POINTER`]\: the HWND associated with the window
3380 /// - [`SDL_PROP_WINDOW_WIN32_HDC_POINTER`]\: the HDC associated with the window
3381 /// - [`SDL_PROP_WINDOW_WIN32_INSTANCE_POINTER`]\: the HINSTANCE associated with
3382 /// the window
3383 ///
3384 /// On Wayland:
3385 ///
3386 /// Note: The `xdg_*` window objects do not internally persist across window
3387 /// show/hide calls. They will be null if the window is hidden and must be
3388 /// queried each time it is shown.
3389 ///
3390 /// - [`SDL_PROP_WINDOW_WAYLAND_DISPLAY_POINTER`]\: the wl_display associated with
3391 /// the window
3392 /// - [`SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER`]\: the wl_surface associated with
3393 /// the window
3394 /// - [`SDL_PROP_WINDOW_WAYLAND_VIEWPORT_POINTER`]\: the wp_viewport associated
3395 /// with the window
3396 /// - [`SDL_PROP_WINDOW_WAYLAND_EGL_WINDOW_POINTER`]\: the wl_egl_window
3397 /// associated with the window
3398 /// - [`SDL_PROP_WINDOW_WAYLAND_XDG_SURFACE_POINTER`]\: the xdg_surface associated
3399 /// with the window
3400 /// - [`SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER`]\: the xdg_toplevel role
3401 /// associated with the window
3402 /// - 'SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING': the export
3403 /// handle associated with the window
3404 /// - [`SDL_PROP_WINDOW_WAYLAND_XDG_POPUP_POINTER`]\: the xdg_popup role
3405 /// associated with the window
3406 /// - [`SDL_PROP_WINDOW_WAYLAND_XDG_POSITIONER_POINTER`]\: the xdg_positioner
3407 /// associated with the window, in popup mode
3408 ///
3409 /// On X11:
3410 ///
3411 /// - [`SDL_PROP_WINDOW_X11_DISPLAY_POINTER`]\: the X11 Display associated with
3412 /// the window
3413 /// - [`SDL_PROP_WINDOW_X11_SCREEN_NUMBER`]\: the screen number associated with
3414 /// the window
3415 /// - [`SDL_PROP_WINDOW_X11_WINDOW_NUMBER`]\: the X11 Window associated with the
3416 /// window
3417 ///
3418 /// On Emscripten:
3419 ///
3420 /// - [`SDL_PROP_WINDOW_EMSCRIPTEN_CANVAS_ID_STRING`]\: the id the canvas element
3421 /// will have
3422 /// - [`SDL_PROP_WINDOW_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING`]\: the keyboard
3423 /// element that associates keyboard events to this window
3424 ///
3425 /// ## Parameters
3426 /// - `window`: the window to query.
3427 ///
3428 /// ## Return value
3429 /// Returns a valid property ID on success or 0 on failure; call
3430 /// [`SDL_GetError()`] for more information.
3431 ///
3432 /// ## Thread safety
3433 /// This function should only be called on the main thread.
3434 ///
3435 /// ## Availability
3436 /// This function is available since SDL 3.2.0.
3437 pub fn SDL_GetWindowProperties(window: *mut SDL_Window) -> SDL_PropertiesID;
3438}
3439
3440pub const SDL_PROP_WINDOW_SHAPE_POINTER: *const ::core::ffi::c_char = c"SDL.window.shape".as_ptr();
3441
3442pub const SDL_PROP_WINDOW_HDR_ENABLED_BOOLEAN: *const ::core::ffi::c_char =
3443 c"SDL.window.HDR_enabled".as_ptr();
3444
3445pub const SDL_PROP_WINDOW_SDR_WHITE_LEVEL_FLOAT: *const ::core::ffi::c_char =
3446 c"SDL.window.SDR_white_level".as_ptr();
3447
3448pub const SDL_PROP_WINDOW_HDR_HEADROOM_FLOAT: *const ::core::ffi::c_char =
3449 c"SDL.window.HDR_headroom".as_ptr();
3450
3451pub const SDL_PROP_WINDOW_ANDROID_WINDOW_POINTER: *const ::core::ffi::c_char =
3452 c"SDL.window.android.window".as_ptr();
3453
3454pub const SDL_PROP_WINDOW_ANDROID_SURFACE_POINTER: *const ::core::ffi::c_char =
3455 c"SDL.window.android.surface".as_ptr();
3456
3457pub const SDL_PROP_WINDOW_UIKIT_WINDOW_POINTER: *const ::core::ffi::c_char =
3458 c"SDL.window.uikit.window".as_ptr();
3459
3460pub const SDL_PROP_WINDOW_UIKIT_METAL_VIEW_TAG_NUMBER: *const ::core::ffi::c_char =
3461 c"SDL.window.uikit.metal_view_tag".as_ptr();
3462
3463pub const SDL_PROP_WINDOW_UIKIT_OPENGL_FRAMEBUFFER_NUMBER: *const ::core::ffi::c_char =
3464 c"SDL.window.uikit.opengl.framebuffer".as_ptr();
3465
3466pub const SDL_PROP_WINDOW_UIKIT_OPENGL_RENDERBUFFER_NUMBER: *const ::core::ffi::c_char =
3467 c"SDL.window.uikit.opengl.renderbuffer".as_ptr();
3468
3469pub const SDL_PROP_WINDOW_UIKIT_OPENGL_RESOLVE_FRAMEBUFFER_NUMBER: *const ::core::ffi::c_char =
3470 c"SDL.window.uikit.opengl.resolve_framebuffer".as_ptr();
3471
3472pub const SDL_PROP_WINDOW_KMSDRM_DEVICE_INDEX_NUMBER: *const ::core::ffi::c_char =
3473 c"SDL.window.kmsdrm.dev_index".as_ptr();
3474
3475pub const SDL_PROP_WINDOW_KMSDRM_DRM_FD_NUMBER: *const ::core::ffi::c_char =
3476 c"SDL.window.kmsdrm.drm_fd".as_ptr();
3477
3478pub const SDL_PROP_WINDOW_KMSDRM_GBM_DEVICE_POINTER: *const ::core::ffi::c_char =
3479 c"SDL.window.kmsdrm.gbm_dev".as_ptr();
3480
3481pub const SDL_PROP_WINDOW_COCOA_WINDOW_POINTER: *const ::core::ffi::c_char =
3482 c"SDL.window.cocoa.window".as_ptr();
3483
3484pub const SDL_PROP_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER: *const ::core::ffi::c_char =
3485 c"SDL.window.cocoa.metal_view_tag".as_ptr();
3486
3487pub const SDL_PROP_WINDOW_OPENVR_OVERLAY_ID_NUMBER: *const ::core::ffi::c_char =
3488 c"SDL.window.openvr.overlay_id".as_ptr();
3489
3490pub const SDL_PROP_WINDOW_VIVANTE_DISPLAY_POINTER: *const ::core::ffi::c_char =
3491 c"SDL.window.vivante.display".as_ptr();
3492
3493pub const SDL_PROP_WINDOW_VIVANTE_WINDOW_POINTER: *const ::core::ffi::c_char =
3494 c"SDL.window.vivante.window".as_ptr();
3495
3496pub const SDL_PROP_WINDOW_VIVANTE_SURFACE_POINTER: *const ::core::ffi::c_char =
3497 c"SDL.window.vivante.surface".as_ptr();
3498
3499pub const SDL_PROP_WINDOW_WIN32_HWND_POINTER: *const ::core::ffi::c_char =
3500 c"SDL.window.win32.hwnd".as_ptr();
3501
3502pub const SDL_PROP_WINDOW_WIN32_HDC_POINTER: *const ::core::ffi::c_char =
3503 c"SDL.window.win32.hdc".as_ptr();
3504
3505pub const SDL_PROP_WINDOW_WIN32_INSTANCE_POINTER: *const ::core::ffi::c_char =
3506 c"SDL.window.win32.instance".as_ptr();
3507
3508pub const SDL_PROP_WINDOW_WAYLAND_DISPLAY_POINTER: *const ::core::ffi::c_char =
3509 c"SDL.window.wayland.display".as_ptr();
3510
3511pub const SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER: *const ::core::ffi::c_char =
3512 c"SDL.window.wayland.surface".as_ptr();
3513
3514pub const SDL_PROP_WINDOW_WAYLAND_VIEWPORT_POINTER: *const ::core::ffi::c_char =
3515 c"SDL.window.wayland.viewport".as_ptr();
3516
3517pub const SDL_PROP_WINDOW_WAYLAND_EGL_WINDOW_POINTER: *const ::core::ffi::c_char =
3518 c"SDL.window.wayland.egl_window".as_ptr();
3519
3520pub const SDL_PROP_WINDOW_WAYLAND_XDG_SURFACE_POINTER: *const ::core::ffi::c_char =
3521 c"SDL.window.wayland.xdg_surface".as_ptr();
3522
3523pub const SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER: *const ::core::ffi::c_char =
3524 c"SDL.window.wayland.xdg_toplevel".as_ptr();
3525
3526pub const SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING: *const ::core::ffi::c_char =
3527 c"SDL.window.wayland.xdg_toplevel_export_handle".as_ptr();
3528
3529pub const SDL_PROP_WINDOW_WAYLAND_XDG_POPUP_POINTER: *const ::core::ffi::c_char =
3530 c"SDL.window.wayland.xdg_popup".as_ptr();
3531
3532pub const SDL_PROP_WINDOW_WAYLAND_XDG_POSITIONER_POINTER: *const ::core::ffi::c_char =
3533 c"SDL.window.wayland.xdg_positioner".as_ptr();
3534
3535pub const SDL_PROP_WINDOW_X11_DISPLAY_POINTER: *const ::core::ffi::c_char =
3536 c"SDL.window.x11.display".as_ptr();
3537
3538pub const SDL_PROP_WINDOW_X11_SCREEN_NUMBER: *const ::core::ffi::c_char =
3539 c"SDL.window.x11.screen".as_ptr();
3540
3541pub const SDL_PROP_WINDOW_X11_WINDOW_NUMBER: *const ::core::ffi::c_char =
3542 c"SDL.window.x11.window".as_ptr();
3543
3544pub const SDL_PROP_WINDOW_EMSCRIPTEN_CANVAS_ID_STRING: *const ::core::ffi::c_char =
3545 c"SDL.window.emscripten.canvas_id".as_ptr();
3546
3547pub const SDL_PROP_WINDOW_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING: *const ::core::ffi::c_char =
3548 c"SDL.window.emscripten.keyboard_element".as_ptr();
3549
3550unsafe extern "C" {
3551 /// Get the window flags.
3552 ///
3553 /// ## Parameters
3554 /// - `window`: the window to query.
3555 ///
3556 /// ## Return value
3557 /// Returns a mask of the [`SDL_WindowFlags`] associated with `window`.
3558 ///
3559 /// ## Thread safety
3560 /// This function should only be called on the main thread.
3561 ///
3562 /// ## Availability
3563 /// This function is available since SDL 3.2.0.
3564 ///
3565 /// ## See also
3566 /// - [`SDL_CreateWindow`]
3567 /// - [`SDL_HideWindow`]
3568 /// - [`SDL_MaximizeWindow`]
3569 /// - [`SDL_MinimizeWindow`]
3570 /// - [`SDL_SetWindowFullscreen`]
3571 /// - [`SDL_SetWindowMouseGrab`]
3572 /// - [`SDL_SetWindowFillDocument`]
3573 /// - [`SDL_ShowWindow`]
3574 pub fn SDL_GetWindowFlags(window: *mut SDL_Window) -> SDL_WindowFlags;
3575}
3576
3577unsafe extern "C" {
3578 /// Set the title of a window.
3579 ///
3580 /// This string is expected to be in UTF-8 encoding.
3581 ///
3582 /// ## Parameters
3583 /// - `window`: the window to change.
3584 /// - `title`: the desired window title in UTF-8 format.
3585 ///
3586 /// ## Return value
3587 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3588 /// information.
3589 ///
3590 /// ## Thread safety
3591 /// This function should only be called on the main thread.
3592 ///
3593 /// ## Availability
3594 /// This function is available since SDL 3.2.0.
3595 ///
3596 /// ## See also
3597 /// - [`SDL_GetWindowTitle`]
3598 pub fn SDL_SetWindowTitle(
3599 window: *mut SDL_Window,
3600 title: *const ::core::ffi::c_char,
3601 ) -> ::core::primitive::bool;
3602}
3603
3604unsafe extern "C" {
3605 /// Get the title of a window.
3606 ///
3607 /// ## Parameters
3608 /// - `window`: the window to query.
3609 ///
3610 /// ## Return value
3611 /// Returns the title of the window in UTF-8 format or "" if there is no
3612 /// title.
3613 ///
3614 /// ## Thread safety
3615 /// This function should only be called on the main thread.
3616 ///
3617 /// ## Availability
3618 /// This function is available since SDL 3.2.0.
3619 ///
3620 /// ## See also
3621 /// - [`SDL_SetWindowTitle`]
3622 pub fn SDL_GetWindowTitle(window: *mut SDL_Window) -> *const ::core::ffi::c_char;
3623}
3624
3625unsafe extern "C" {
3626 /// Set the icon for a window.
3627 ///
3628 /// If this function is passed a surface with alternate representations added
3629 /// using [`SDL_AddSurfaceAlternateImage()`], the surface will be interpreted as
3630 /// the content to be used for 100% display scale, and the alternate
3631 /// representations will be used for high DPI situations. For example, if the
3632 /// original surface is 32x32, then on a 2x macOS display or 200% display scale
3633 /// on Windows, a 64x64 version of the image will be used, if available. If a
3634 /// matching version of the image isn't available, the closest larger size
3635 /// image will be downscaled to the appropriate size and be used instead, if
3636 /// available. Otherwise, the closest smaller image will be upscaled and be
3637 /// used instead.
3638 ///
3639 /// ## Parameters
3640 /// - `window`: the window to change.
3641 /// - `icon`: an [`SDL_Surface`] structure containing the icon for the window.
3642 ///
3643 /// ## Return value
3644 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3645 /// information.
3646 ///
3647 /// ## Thread safety
3648 /// This function should only be called on the main thread.
3649 ///
3650 /// ## Availability
3651 /// This function is available since SDL 3.2.0.
3652 ///
3653 /// ## See also
3654 /// - [`SDL_AddSurfaceAlternateImage`]
3655 pub fn SDL_SetWindowIcon(
3656 window: *mut SDL_Window,
3657 icon: *mut SDL_Surface,
3658 ) -> ::core::primitive::bool;
3659}
3660
3661unsafe extern "C" {
3662 /// Request that the window's position be set.
3663 ///
3664 /// If the window is in an exclusive fullscreen or maximized state, this
3665 /// request has no effect.
3666 ///
3667 /// This can be used to reposition fullscreen-desktop windows onto a different
3668 /// display, however, as exclusive fullscreen windows are locked to a specific
3669 /// display, they can only be repositioned programmatically via
3670 /// [`SDL_SetWindowFullscreenMode()`].
3671 ///
3672 /// On some windowing systems this request is asynchronous and the new
3673 /// coordinates may not have have been applied immediately upon the return of
3674 /// this function. If an immediate change is required, call [`SDL_SyncWindow()`] to
3675 /// block until the changes have taken effect.
3676 ///
3677 /// When the window position changes, an [`SDL_EVENT_WINDOW_MOVED`] event will be
3678 /// emitted with the window's new coordinates. Note that the new coordinates
3679 /// may not match the exact coordinates requested, as some windowing systems
3680 /// can restrict the position of the window in certain scenarios (e.g.
3681 /// constraining the position so the window is always within desktop bounds).
3682 /// Additionally, as this is just a request, it can be denied by the windowing
3683 /// system.
3684 ///
3685 /// ## Parameters
3686 /// - `window`: the window to reposition.
3687 /// - `x`: the x coordinate of the window, or [`SDL_WINDOWPOS_CENTERED`] or
3688 /// [`SDL_WINDOWPOS_UNDEFINED`].
3689 /// - `y`: the y coordinate of the window, or [`SDL_WINDOWPOS_CENTERED`] or
3690 /// [`SDL_WINDOWPOS_UNDEFINED`].
3691 ///
3692 /// ## Return value
3693 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3694 /// information.
3695 ///
3696 /// ## Thread safety
3697 /// This function should only be called on the main thread.
3698 ///
3699 /// ## Availability
3700 /// This function is available since SDL 3.2.0.
3701 ///
3702 /// ## See also
3703 /// - [`SDL_GetWindowPosition`]
3704 /// - [`SDL_SyncWindow`]
3705 pub fn SDL_SetWindowPosition(
3706 window: *mut SDL_Window,
3707 x: ::core::ffi::c_int,
3708 y: ::core::ffi::c_int,
3709 ) -> ::core::primitive::bool;
3710}
3711
3712unsafe extern "C" {
3713 /// Get the position of a window.
3714 ///
3715 /// This is the current position of the window as last reported by the
3716 /// windowing system.
3717 ///
3718 /// If you do not need the value for one of the positions a NULL may be passed
3719 /// in the `x` or `y` parameter.
3720 ///
3721 /// ## Parameters
3722 /// - `window`: the window to query.
3723 /// - `x`: a pointer filled in with the x position of the window, may be
3724 /// NULL.
3725 /// - `y`: a pointer filled in with the y position of the window, may be
3726 /// NULL.
3727 ///
3728 /// ## Return value
3729 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3730 /// information.
3731 ///
3732 /// ## Thread safety
3733 /// This function should only be called on the main thread.
3734 ///
3735 /// ## Availability
3736 /// This function is available since SDL 3.2.0.
3737 ///
3738 /// ## See also
3739 /// - [`SDL_SetWindowPosition`]
3740 pub fn SDL_GetWindowPosition(
3741 window: *mut SDL_Window,
3742 x: *mut ::core::ffi::c_int,
3743 y: *mut ::core::ffi::c_int,
3744 ) -> ::core::primitive::bool;
3745}
3746
3747unsafe extern "C" {
3748 /// Request that the size of a window's client area be set.
3749 ///
3750 /// If the window is in a fullscreen or maximized state, this request has no
3751 /// effect.
3752 ///
3753 /// To change the exclusive fullscreen mode of a window, use
3754 /// [`SDL_SetWindowFullscreenMode()`].
3755 ///
3756 /// On some windowing systems, this request is asynchronous and the new window
3757 /// size may not have have been applied immediately upon the return of this
3758 /// function. If an immediate change is required, call [`SDL_SyncWindow()`] to
3759 /// block until the changes have taken effect.
3760 ///
3761 /// When the window size changes, an [`SDL_EVENT_WINDOW_RESIZED`] event will be
3762 /// emitted with the new window dimensions. Note that the new dimensions may
3763 /// not match the exact size requested, as some windowing systems can restrict
3764 /// the window size in certain scenarios (e.g. constraining the size of the
3765 /// content area to remain within the usable desktop bounds). Additionally, as
3766 /// this is just a request, it can be denied by the windowing system.
3767 ///
3768 /// ## Parameters
3769 /// - `window`: the window to change.
3770 /// - `w`: the width of the window, must be > 0.
3771 /// - `h`: the height of the window, must be > 0.
3772 ///
3773 /// ## Return value
3774 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3775 /// information.
3776 ///
3777 /// ## Thread safety
3778 /// This function should only be called on the main thread.
3779 ///
3780 /// ## Availability
3781 /// This function is available since SDL 3.2.0.
3782 ///
3783 /// ## See also
3784 /// - [`SDL_GetWindowSize`]
3785 /// - [`SDL_SetWindowFullscreenMode`]
3786 /// - [`SDL_SyncWindow`]
3787 pub fn SDL_SetWindowSize(
3788 window: *mut SDL_Window,
3789 w: ::core::ffi::c_int,
3790 h: ::core::ffi::c_int,
3791 ) -> ::core::primitive::bool;
3792}
3793
3794unsafe extern "C" {
3795 /// Get the size of a window's client area.
3796 ///
3797 /// The window pixel size may differ from its window coordinate size if the
3798 /// window is on a high pixel density display. Use [`SDL_GetWindowSizeInPixels()`]
3799 /// or [`SDL_GetRenderOutputSize()`] to get the real client area size in pixels.
3800 ///
3801 /// ## Parameters
3802 /// - `window`: the window to query the width and height from.
3803 /// - `w`: a pointer filled in with the width of the window, may be NULL.
3804 /// - `h`: a pointer filled in with the height of the window, may be NULL.
3805 ///
3806 /// ## Return value
3807 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3808 /// information.
3809 ///
3810 /// ## Thread safety
3811 /// This function should only be called on the main thread.
3812 ///
3813 /// ## Availability
3814 /// This function is available since SDL 3.2.0.
3815 ///
3816 /// ## See also
3817 /// - [`SDL_GetRenderOutputSize`]
3818 /// - [`SDL_GetWindowSizeInPixels`]
3819 /// - [`SDL_SetWindowSize`]
3820 /// - [`SDL_EVENT_WINDOW_RESIZED`]
3821 pub fn SDL_GetWindowSize(
3822 window: *mut SDL_Window,
3823 w: *mut ::core::ffi::c_int,
3824 h: *mut ::core::ffi::c_int,
3825 ) -> ::core::primitive::bool;
3826}
3827
3828unsafe extern "C" {
3829 /// Get the safe area for this window.
3830 ///
3831 /// Some devices have portions of the screen which are partially obscured or
3832 /// not interactive, possibly due to on-screen controls, curved edges, camera
3833 /// notches, TV overscan, etc. This function provides the area of the window
3834 /// which is safe to have interactable content. You should continue rendering
3835 /// into the rest of the window, but it should not contain visually important
3836 /// or interactable content.
3837 ///
3838 /// ## Parameters
3839 /// - `window`: the window to query.
3840 /// - `rect`: a pointer filled in with the client area that is safe for
3841 /// interactive content.
3842 ///
3843 /// ## Return value
3844 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3845 /// information.
3846 ///
3847 /// ## Thread safety
3848 /// This function should only be called on the main thread.
3849 ///
3850 /// ## Availability
3851 /// This function is available since SDL 3.2.0.
3852 pub fn SDL_GetWindowSafeArea(
3853 window: *mut SDL_Window,
3854 rect: *mut SDL_Rect,
3855 ) -> ::core::primitive::bool;
3856}
3857
3858unsafe extern "C" {
3859 /// Request that the aspect ratio of a window's client area be set.
3860 ///
3861 /// The aspect ratio is the ratio of width divided by height, e.g. 2560x1600
3862 /// would be 1.6. Larger aspect ratios are wider and smaller aspect ratios are
3863 /// narrower.
3864 ///
3865 /// If, at the time of this request, the window in a fixed-size state, such as
3866 /// maximized or fullscreen, the request will be deferred until the window
3867 /// exits this state and becomes resizable again.
3868 ///
3869 /// On some windowing systems, this request is asynchronous and the new window
3870 /// aspect ratio may not have have been applied immediately upon the return of
3871 /// this function. If an immediate change is required, call [`SDL_SyncWindow()`] to
3872 /// block until the changes have taken effect.
3873 ///
3874 /// When the window size changes, an [`SDL_EVENT_WINDOW_RESIZED`] event will be
3875 /// emitted with the new window dimensions. Note that the new dimensions may
3876 /// not match the exact aspect ratio requested, as some windowing systems can
3877 /// restrict the window size in certain scenarios (e.g. constraining the size
3878 /// of the content area to remain within the usable desktop bounds).
3879 /// Additionally, as this is just a request, it can be denied by the windowing
3880 /// system.
3881 ///
3882 /// ## Parameters
3883 /// - `window`: the window to change.
3884 /// - `min_aspect`: the minimum aspect ratio of the window, or 0.0f for no
3885 /// limit.
3886 /// - `max_aspect`: the maximum aspect ratio of the window, or 0.0f for no
3887 /// limit.
3888 ///
3889 /// ## Return value
3890 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3891 /// information.
3892 ///
3893 /// ## Thread safety
3894 /// This function should only be called on the main thread.
3895 ///
3896 /// ## Availability
3897 /// This function is available since SDL 3.2.0.
3898 ///
3899 /// ## See also
3900 /// - [`SDL_GetWindowAspectRatio`]
3901 /// - [`SDL_SyncWindow`]
3902 pub fn SDL_SetWindowAspectRatio(
3903 window: *mut SDL_Window,
3904 min_aspect: ::core::ffi::c_float,
3905 max_aspect: ::core::ffi::c_float,
3906 ) -> ::core::primitive::bool;
3907}
3908
3909unsafe extern "C" {
3910 /// Get the aspect ratio of a window's client area.
3911 ///
3912 /// ## Parameters
3913 /// - `window`: the window to query the width and height from.
3914 /// - `min_aspect`: a pointer filled in with the minimum aspect ratio of the
3915 /// window, may be NULL.
3916 /// - `max_aspect`: a pointer filled in with the maximum aspect ratio of the
3917 /// window, may be NULL.
3918 ///
3919 /// ## Return value
3920 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3921 /// information.
3922 ///
3923 /// ## Thread safety
3924 /// This function should only be called on the main thread.
3925 ///
3926 /// ## Availability
3927 /// This function is available since SDL 3.2.0.
3928 ///
3929 /// ## See also
3930 /// - [`SDL_SetWindowAspectRatio`]
3931 pub fn SDL_GetWindowAspectRatio(
3932 window: *mut SDL_Window,
3933 min_aspect: *mut ::core::ffi::c_float,
3934 max_aspect: *mut ::core::ffi::c_float,
3935 ) -> ::core::primitive::bool;
3936}
3937
3938unsafe extern "C" {
3939 /// Get the size of a window's borders (decorations) around the client area.
3940 ///
3941 /// Note: If this function fails (returns false), the size values will be
3942 /// initialized to 0, 0, 0, 0 (if a non-NULL pointer is provided), as if the
3943 /// window in question was borderless.
3944 ///
3945 /// Note: This function may fail on systems where the window has not yet been
3946 /// decorated by the display server (for example, immediately after calling
3947 /// [`SDL_CreateWindow`]). It is recommended that you wait at least until the
3948 /// window has been presented and composited, so that the window system has a
3949 /// chance to decorate the window and provide the border dimensions to SDL.
3950 ///
3951 /// This function also returns false if getting the information is not
3952 /// supported.
3953 ///
3954 /// ## Parameters
3955 /// - `window`: the window to query the size values of the border
3956 /// (decorations) from.
3957 /// - `top`: pointer to variable for storing the size of the top border; NULL
3958 /// is permitted.
3959 /// - `left`: pointer to variable for storing the size of the left border;
3960 /// NULL is permitted.
3961 /// - `bottom`: pointer to variable for storing the size of the bottom
3962 /// border; NULL is permitted.
3963 /// - `right`: pointer to variable for storing the size of the right border;
3964 /// NULL is permitted.
3965 ///
3966 /// ## Return value
3967 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3968 /// information.
3969 ///
3970 /// ## Thread safety
3971 /// This function should only be called on the main thread.
3972 ///
3973 /// ## Availability
3974 /// This function is available since SDL 3.2.0.
3975 ///
3976 /// ## See also
3977 /// - [`SDL_GetWindowSize`]
3978 pub fn SDL_GetWindowBordersSize(
3979 window: *mut SDL_Window,
3980 top: *mut ::core::ffi::c_int,
3981 left: *mut ::core::ffi::c_int,
3982 bottom: *mut ::core::ffi::c_int,
3983 right: *mut ::core::ffi::c_int,
3984 ) -> ::core::primitive::bool;
3985}
3986
3987unsafe extern "C" {
3988 /// Get the size of a window's client area, in pixels.
3989 ///
3990 /// ## Parameters
3991 /// - `window`: the window from which the drawable size should be queried.
3992 /// - `w`: a pointer to variable for storing the width in pixels, may be
3993 /// NULL.
3994 /// - `h`: a pointer to variable for storing the height in pixels, may be
3995 /// NULL.
3996 ///
3997 /// ## Return value
3998 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
3999 /// information.
4000 ///
4001 /// ## Thread safety
4002 /// This function should only be called on the main thread.
4003 ///
4004 /// ## Availability
4005 /// This function is available since SDL 3.2.0.
4006 ///
4007 /// ## See also
4008 /// - [`SDL_CreateWindow`]
4009 /// - [`SDL_GetWindowSize`]
4010 pub fn SDL_GetWindowSizeInPixels(
4011 window: *mut SDL_Window,
4012 w: *mut ::core::ffi::c_int,
4013 h: *mut ::core::ffi::c_int,
4014 ) -> ::core::primitive::bool;
4015}
4016
4017unsafe extern "C" {
4018 /// Set the minimum size of a window's client area.
4019 ///
4020 /// ## Parameters
4021 /// - `window`: the window to change.
4022 /// - `min_w`: the minimum width of the window, or 0 for no limit.
4023 /// - `min_h`: the minimum height of the window, or 0 for no limit.
4024 ///
4025 /// ## Return value
4026 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
4027 /// information.
4028 ///
4029 /// ## Thread safety
4030 /// This function should only be called on the main thread.
4031 ///
4032 /// ## Availability
4033 /// This function is available since SDL 3.2.0.
4034 ///
4035 /// ## See also
4036 /// - [`SDL_GetWindowMinimumSize`]
4037 /// - [`SDL_SetWindowMaximumSize`]
4038 pub fn SDL_SetWindowMinimumSize(
4039 window: *mut SDL_Window,
4040 min_w: ::core::ffi::c_int,
4041 min_h: ::core::ffi::c_int,
4042 ) -> ::core::primitive::bool;
4043}
4044
4045unsafe extern "C" {
4046 /// Get the minimum size of a window's client area.
4047 ///
4048 /// ## Parameters
4049 /// - `window`: the window to query.
4050 /// - `w`: a pointer filled in with the minimum width of the window, may be
4051 /// NULL.
4052 /// - `h`: a pointer filled in with the minimum height of the window, may be
4053 /// NULL.
4054 ///
4055 /// ## Return value
4056 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
4057 /// information.
4058 ///
4059 /// ## Thread safety
4060 /// This function should only be called on the main thread.
4061 ///
4062 /// ## Availability
4063 /// This function is available since SDL 3.2.0.
4064 ///
4065 /// ## See also
4066 /// - [`SDL_GetWindowMaximumSize`]
4067 /// - [`SDL_SetWindowMinimumSize`]
4068 pub fn SDL_GetWindowMinimumSize(
4069 window: *mut SDL_Window,
4070 w: *mut ::core::ffi::c_int,
4071 h: *mut ::core::ffi::c_int,
4072 ) -> ::core::primitive::bool;
4073}
4074
4075unsafe extern "C" {
4076 /// Set the maximum size of a window's client area.
4077 ///
4078 /// ## Parameters
4079 /// - `window`: the window to change.
4080 /// - `max_w`: the maximum width of the window, or 0 for no limit.
4081 /// - `max_h`: the maximum height of the window, or 0 for no limit.
4082 ///
4083 /// ## Return value
4084 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
4085 /// information.
4086 ///
4087 /// ## Thread safety
4088 /// This function should only be called on the main thread.
4089 ///
4090 /// ## Availability
4091 /// This function is available since SDL 3.2.0.
4092 ///
4093 /// ## See also
4094 /// - [`SDL_GetWindowMaximumSize`]
4095 /// - [`SDL_SetWindowMinimumSize`]
4096 pub fn SDL_SetWindowMaximumSize(
4097 window: *mut SDL_Window,
4098 max_w: ::core::ffi::c_int,
4099 max_h: ::core::ffi::c_int,
4100 ) -> ::core::primitive::bool;
4101}
4102
4103unsafe extern "C" {
4104 /// Get the maximum size of a window's client area.
4105 ///
4106 /// ## Parameters
4107 /// - `window`: the window to query.
4108 /// - `w`: a pointer filled in with the maximum width of the window, may be
4109 /// NULL.
4110 /// - `h`: a pointer filled in with the maximum height of the window, may be
4111 /// NULL.
4112 ///
4113 /// ## Return value
4114 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
4115 /// information.
4116 ///
4117 /// ## Thread safety
4118 /// This function should only be called on the main thread.
4119 ///
4120 /// ## Availability
4121 /// This function is available since SDL 3.2.0.
4122 ///
4123 /// ## See also
4124 /// - [`SDL_GetWindowMinimumSize`]
4125 /// - [`SDL_SetWindowMaximumSize`]
4126 pub fn SDL_GetWindowMaximumSize(
4127 window: *mut SDL_Window,
4128 w: *mut ::core::ffi::c_int,
4129 h: *mut ::core::ffi::c_int,
4130 ) -> ::core::primitive::bool;
4131}
4132
4133unsafe extern "C" {
4134 /// Set the border state of a window.
4135 ///
4136 /// This will add or remove the window's [`SDL_WINDOW_BORDERLESS`] flag and add
4137 /// or remove the border from the actual window. This is a no-op if the
4138 /// window's border already matches the requested state.
4139 ///
4140 /// You can't change the border state of a fullscreen window.
4141 ///
4142 /// ## Parameters
4143 /// - `window`: the window of which to change the border state.
4144 /// - `bordered`: false to remove border, true to add border.
4145 ///
4146 /// ## Return value
4147 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
4148 /// information.
4149 ///
4150 /// ## Thread safety
4151 /// This function should only be called on the main thread.
4152 ///
4153 /// ## Availability
4154 /// This function is available since SDL 3.2.0.
4155 ///
4156 /// ## See also
4157 /// - [`SDL_GetWindowFlags`]
4158 pub fn SDL_SetWindowBordered(
4159 window: *mut SDL_Window,
4160 bordered: ::core::primitive::bool,
4161 ) -> ::core::primitive::bool;
4162}
4163
4164unsafe extern "C" {
4165 /// Set the user-resizable state of a window.
4166 ///
4167 /// This will add or remove the window's [`SDL_WINDOW_RESIZABLE`] flag and
4168 /// allow/disallow user resizing of the window. This is a no-op if the window's
4169 /// resizable state already matches the requested state.
4170 ///
4171 /// You can't change the resizable state of a fullscreen window.
4172 ///
4173 /// ## Parameters
4174 /// - `window`: the window of which to change the resizable state.
4175 /// - `resizable`: true to allow resizing, false to disallow.
4176 ///
4177 /// ## Return value
4178 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
4179 /// information.
4180 ///
4181 /// ## Thread safety
4182 /// This function should only be called on the main thread.
4183 ///
4184 /// ## Availability
4185 /// This function is available since SDL 3.2.0.
4186 ///
4187 /// ## See also
4188 /// - [`SDL_GetWindowFlags`]
4189 pub fn SDL_SetWindowResizable(
4190 window: *mut SDL_Window,
4191 resizable: ::core::primitive::bool,
4192 ) -> ::core::primitive::bool;
4193}
4194
4195unsafe extern "C" {
4196 /// Set the window to always be above the others.
4197 ///
4198 /// This will add or remove the window's [`SDL_WINDOW_ALWAYS_ON_TOP`] flag. This
4199 /// will bring the window to the front and keep the window above the rest.
4200 ///
4201 /// ## Parameters
4202 /// - `window`: the window of which to change the always on top state.
4203 /// - `on_top`: true to set the window always on top, false to disable.
4204 ///
4205 /// ## Return value
4206 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
4207 /// information.
4208 ///
4209 /// ## Thread safety
4210 /// This function should only be called on the main thread.
4211 ///
4212 /// ## Availability
4213 /// This function is available since SDL 3.2.0.
4214 ///
4215 /// ## See also
4216 /// - [`SDL_GetWindowFlags`]
4217 pub fn SDL_SetWindowAlwaysOnTop(
4218 window: *mut SDL_Window,
4219 on_top: ::core::primitive::bool,
4220 ) -> ::core::primitive::bool;
4221}
4222
4223unsafe extern "C" {
4224 /// Set the window to fill the current document space (Emscripten only).
4225 ///
4226 /// This will add or remove the window's [`SDL_WINDOW_FILL_DOCUMENT`] flag.
4227 ///
4228 /// Currently this flag only applies to the Emscripten target.
4229 ///
4230 /// When enabled, the canvas element fills the entire document. Resize events
4231 /// will be generated as the browser window is resized, as that will adjust the
4232 /// canvas size as well. The canvas will cover anything else on the page,
4233 /// including any controls provided by Emscripten in its generated HTML file
4234 /// (in fact, any elements on the page that aren't the canvas will be moved
4235 /// into a hidden `div` element).
4236 ///
4237 /// Often times this is desirable for a browser-based game, but it means
4238 /// several things that we expect of an SDL window on other platforms might not
4239 /// work as expected, such as minimum window sizes and aspect ratios.
4240 ///
4241 /// ## Parameters
4242 /// - `window`: the window of which to change the fill-document state.
4243 /// - `fill`: true to set the window to fill the document, false to disable.
4244 ///
4245 /// ## Return value
4246 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
4247 /// information.
4248 ///
4249 /// ## Thread safety
4250 /// This function should only be called on the main thread.
4251 ///
4252 /// ## Availability
4253 /// This function is available since SDL 3.4.0.
4254 ///
4255 /// ## See also
4256 /// - [`SDL_GetWindowFlags`]
4257 pub fn SDL_SetWindowFillDocument(
4258 window: *mut SDL_Window,
4259 fill: ::core::primitive::bool,
4260 ) -> ::core::primitive::bool;
4261}
4262
4263unsafe extern "C" {
4264 /// Show a window.
4265 ///
4266 /// ## Parameters
4267 /// - `window`: the window to show.
4268 ///
4269 /// ## Return value
4270 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
4271 /// information.
4272 ///
4273 /// ## Thread safety
4274 /// This function should only be called on the main thread.
4275 ///
4276 /// ## Availability
4277 /// This function is available since SDL 3.2.0.
4278 ///
4279 /// ## See also
4280 /// - [`SDL_HideWindow`]
4281 /// - [`SDL_RaiseWindow`]
4282 pub fn SDL_ShowWindow(window: *mut SDL_Window) -> ::core::primitive::bool;
4283}
4284
4285unsafe extern "C" {
4286 /// Hide a window.
4287 ///
4288 /// ## Parameters
4289 /// - `window`: the window to hide.
4290 ///
4291 /// ## Return value
4292 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
4293 /// information.
4294 ///
4295 /// ## Thread safety
4296 /// This function should only be called on the main thread.
4297 ///
4298 /// ## Availability
4299 /// This function is available since SDL 3.2.0.
4300 ///
4301 /// ## See also
4302 /// - [`SDL_ShowWindow`]
4303 /// - [`SDL_WINDOW_HIDDEN`]
4304 pub fn SDL_HideWindow(window: *mut SDL_Window) -> ::core::primitive::bool;
4305}
4306
4307unsafe extern "C" {
4308 /// Request that a window be raised above other windows and gain the input
4309 /// focus.
4310 ///
4311 /// The result of this request is subject to desktop window manager policy,
4312 /// particularly if raising the requested window would result in stealing focus
4313 /// from another application. If the window is successfully raised and gains
4314 /// input focus, an [`SDL_EVENT_WINDOW_FOCUS_GAINED`] event will be emitted, and
4315 /// the window will have the [`SDL_WINDOW_INPUT_FOCUS`] flag set.
4316 ///
4317 /// ## Parameters
4318 /// - `window`: the window to raise.
4319 ///
4320 /// ## Return value
4321 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
4322 /// information.
4323 ///
4324 /// ## Thread safety
4325 /// This function should only be called on the main thread.
4326 ///
4327 /// ## Availability
4328 /// This function is available since SDL 3.2.0.
4329 pub fn SDL_RaiseWindow(window: *mut SDL_Window) -> ::core::primitive::bool;
4330}
4331
4332unsafe extern "C" {
4333 /// Request that the window be made as large as possible.
4334 ///
4335 /// Non-resizable windows can't be maximized. The window must have the
4336 /// [`SDL_WINDOW_RESIZABLE`] flag set, or this will have no effect.
4337 ///
4338 /// On some windowing systems this request is asynchronous and the new window
4339 /// state may not have have been applied immediately upon the return of this
4340 /// function. If an immediate change is required, call [`SDL_SyncWindow()`] to
4341 /// block until the changes have taken effect.
4342 ///
4343 /// When the window state changes, an [`SDL_EVENT_WINDOW_MAXIMIZED`] event will be
4344 /// emitted. Note that, as this is just a request, the windowing system can
4345 /// deny the state change.
4346 ///
4347 /// When maximizing a window, whether the constraints set via
4348 /// [`SDL_SetWindowMaximumSize()`] are honored depends on the policy of the window
4349 /// manager. Win32 and macOS enforce the constraints when maximizing, while X11
4350 /// and Wayland window managers may vary.
4351 ///
4352 /// ## Parameters
4353 /// - `window`: the window to maximize.
4354 ///
4355 /// ## Return value
4356 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
4357 /// information.
4358 ///
4359 /// ## Thread safety
4360 /// This function should only be called on the main thread.
4361 ///
4362 /// ## Availability
4363 /// This function is available since SDL 3.2.0.
4364 ///
4365 /// ## See also
4366 /// - [`SDL_MinimizeWindow`]
4367 /// - [`SDL_RestoreWindow`]
4368 /// - [`SDL_SyncWindow`]
4369 pub fn SDL_MaximizeWindow(window: *mut SDL_Window) -> ::core::primitive::bool;
4370}
4371
4372unsafe extern "C" {
4373 /// Request that the window be minimized to an iconic representation.
4374 ///
4375 /// If the window is in a fullscreen state, this request has no direct effect.
4376 /// It may alter the state the window is returned to when leaving fullscreen.
4377 ///
4378 /// On some windowing systems this request is asynchronous and the new window
4379 /// state may not have been applied immediately upon the return of this
4380 /// function. If an immediate change is required, call [`SDL_SyncWindow()`] to
4381 /// block until the changes have taken effect.
4382 ///
4383 /// When the window state changes, an [`SDL_EVENT_WINDOW_MINIMIZED`] event will be
4384 /// emitted. Note that, as this is just a request, the windowing system can
4385 /// deny the state change.
4386 ///
4387 /// ## Parameters
4388 /// - `window`: the window to minimize.
4389 ///
4390 /// ## Return value
4391 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
4392 /// information.
4393 ///
4394 /// ## Thread safety
4395 /// This function should only be called on the main thread.
4396 ///
4397 /// ## Availability
4398 /// This function is available since SDL 3.2.0.
4399 ///
4400 /// ## See also
4401 /// - [`SDL_MaximizeWindow`]
4402 /// - [`SDL_RestoreWindow`]
4403 /// - [`SDL_SyncWindow`]
4404 pub fn SDL_MinimizeWindow(window: *mut SDL_Window) -> ::core::primitive::bool;
4405}
4406
4407unsafe extern "C" {
4408 /// Request that the size and position of a minimized or maximized window be
4409 /// restored.
4410 ///
4411 /// If the window is in a fullscreen state, this request has no direct effect.
4412 /// It may alter the state the window is returned to when leaving fullscreen.
4413 ///
4414 /// On some windowing systems this request is asynchronous and the new window
4415 /// state may not have have been applied immediately upon the return of this
4416 /// function. If an immediate change is required, call [`SDL_SyncWindow()`] to
4417 /// block until the changes have taken effect.
4418 ///
4419 /// When the window state changes, an [`SDL_EVENT_WINDOW_RESTORED`] event will be
4420 /// emitted. Note that, as this is just a request, the windowing system can
4421 /// deny the state change.
4422 ///
4423 /// ## Parameters
4424 /// - `window`: the window to restore.
4425 ///
4426 /// ## Return value
4427 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
4428 /// information.
4429 ///
4430 /// ## Thread safety
4431 /// This function should only be called on the main thread.
4432 ///
4433 /// ## Availability
4434 /// This function is available since SDL 3.2.0.
4435 ///
4436 /// ## See also
4437 /// - [`SDL_MaximizeWindow`]
4438 /// - [`SDL_MinimizeWindow`]
4439 /// - [`SDL_SyncWindow`]
4440 pub fn SDL_RestoreWindow(window: *mut SDL_Window) -> ::core::primitive::bool;
4441}
4442
4443unsafe extern "C" {
4444 /// Request that the window's fullscreen state be changed.
4445 ///
4446 /// By default a window in fullscreen state uses borderless fullscreen desktop
4447 /// mode, but a specific exclusive display mode can be set using
4448 /// [`SDL_SetWindowFullscreenMode()`].
4449 ///
4450 /// On some windowing systems this request is asynchronous and the new
4451 /// fullscreen state may not have have been applied immediately upon the return
4452 /// of this function. If an immediate change is required, call [`SDL_SyncWindow()`]
4453 /// to block until the changes have taken effect.
4454 ///
4455 /// When the window state changes, an [`SDL_EVENT_WINDOW_ENTER_FULLSCREEN`] or
4456 /// [`SDL_EVENT_WINDOW_LEAVE_FULLSCREEN`] event will be emitted. Note that, as this
4457 /// is just a request, it can be denied by the windowing system.
4458 ///
4459 /// ## Parameters
4460 /// - `window`: the window to change.
4461 /// - `fullscreen`: true for fullscreen mode, false for windowed mode.
4462 ///
4463 /// ## Return value
4464 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
4465 /// information.
4466 ///
4467 /// ## Thread safety
4468 /// This function should only be called on the main thread.
4469 ///
4470 /// ## Availability
4471 /// This function is available since SDL 3.2.0.
4472 ///
4473 /// ## See also
4474 /// - [`SDL_GetWindowFullscreenMode`]
4475 /// - [`SDL_SetWindowFullscreenMode`]
4476 /// - [`SDL_SyncWindow`]
4477 /// - [`SDL_WINDOW_FULLSCREEN`]
4478 pub fn SDL_SetWindowFullscreen(
4479 window: *mut SDL_Window,
4480 fullscreen: ::core::primitive::bool,
4481 ) -> ::core::primitive::bool;
4482}
4483
4484unsafe extern "C" {
4485 /// Block until any pending window state is finalized.
4486 ///
4487 /// On asynchronous windowing systems, this acts as a synchronization barrier
4488 /// for pending window state. It will attempt to wait until any pending window
4489 /// state has been applied and is guaranteed to return within finite time. Note
4490 /// that for how long it can potentially block depends on the underlying window
4491 /// system, as window state changes may involve somewhat lengthy animations
4492 /// that must complete before the window is in its final requested state.
4493 ///
4494 /// On windowing systems where changes are immediate, this does nothing.
4495 ///
4496 /// ## Parameters
4497 /// - `window`: the window for which to wait for the pending state to be
4498 /// applied.
4499 ///
4500 /// ## Return value
4501 /// Returns true on success or false if the operation timed out before the
4502 /// window was in the requested state.
4503 ///
4504 /// ## Thread safety
4505 /// This function should only be called on the main thread.
4506 ///
4507 /// ## Availability
4508 /// This function is available since SDL 3.2.0.
4509 ///
4510 /// ## See also
4511 /// - [`SDL_SetWindowSize`]
4512 /// - [`SDL_SetWindowPosition`]
4513 /// - [`SDL_SetWindowFullscreen`]
4514 /// - [`SDL_MinimizeWindow`]
4515 /// - [`SDL_MaximizeWindow`]
4516 /// - [`SDL_RestoreWindow`]
4517 /// - [`SDL_HINT_VIDEO_SYNC_WINDOW_OPERATIONS`]
4518 pub fn SDL_SyncWindow(window: *mut SDL_Window) -> ::core::primitive::bool;
4519}
4520
4521unsafe extern "C" {
4522 /// Return whether the window has a surface associated with it.
4523 ///
4524 /// ## Parameters
4525 /// - `window`: the window to query.
4526 ///
4527 /// ## Return value
4528 /// Returns true if there is a surface associated with the window, or false
4529 /// otherwise.
4530 ///
4531 /// ## Thread safety
4532 /// This function should only be called on the main thread.
4533 ///
4534 /// ## Availability
4535 /// This function is available since SDL 3.2.0.
4536 ///
4537 /// ## See also
4538 /// - [`SDL_GetWindowSurface`]
4539 pub fn SDL_WindowHasSurface(window: *mut SDL_Window) -> ::core::primitive::bool;
4540}
4541
4542unsafe extern "C" {
4543 /// Get the SDL surface associated with the window.
4544 ///
4545 /// A new surface will be created with the optimal format for the window, if
4546 /// necessary. This surface will be freed when the window is destroyed. Do not
4547 /// free this surface.
4548 ///
4549 /// This surface will be invalidated if the window is resized. After resizing a
4550 /// window this function must be called again to return a valid surface.
4551 ///
4552 /// You may not combine this with 3D or the rendering API on this window.
4553 ///
4554 /// This function is affected by [`SDL_HINT_FRAMEBUFFER_ACCELERATION`].
4555 ///
4556 /// ## Parameters
4557 /// - `window`: the window to query.
4558 ///
4559 /// ## Return value
4560 /// Returns the surface associated with the window, or NULL on failure; call
4561 /// [`SDL_GetError()`] for more information.
4562 ///
4563 /// ## Thread safety
4564 /// This function should only be called on the main thread.
4565 ///
4566 /// ## Availability
4567 /// This function is available since SDL 3.2.0.
4568 ///
4569 /// ## See also
4570 /// - [`SDL_DestroyWindowSurface`]
4571 /// - [`SDL_WindowHasSurface`]
4572 /// - [`SDL_UpdateWindowSurface`]
4573 /// - [`SDL_UpdateWindowSurfaceRects`]
4574 pub fn SDL_GetWindowSurface(window: *mut SDL_Window) -> *mut SDL_Surface;
4575}
4576
4577unsafe extern "C" {
4578 /// Toggle VSync for the window surface.
4579 ///
4580 /// When a window surface is created, vsync defaults to
4581 /// [`SDL_WINDOW_SURFACE_VSYNC_DISABLED`].
4582 ///
4583 /// The `vsync` parameter can be 1 to synchronize present with every vertical
4584 /// refresh, 2 to synchronize present with every second vertical refresh, etc.,
4585 /// [`SDL_WINDOW_SURFACE_VSYNC_ADAPTIVE`] for late swap tearing (adaptive vsync),
4586 /// or [`SDL_WINDOW_SURFACE_VSYNC_DISABLED`] to disable. Not every value is
4587 /// supported by every driver, so you should check the return value to see
4588 /// whether the requested setting is supported.
4589 ///
4590 /// ## Parameters
4591 /// - `window`: the window.
4592 /// - `vsync`: the vertical refresh sync interval.
4593 ///
4594 /// ## Return value
4595 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
4596 /// information.
4597 ///
4598 /// ## Thread safety
4599 /// This function should only be called on the main thread.
4600 ///
4601 /// ## Availability
4602 /// This function is available since SDL 3.2.0.
4603 ///
4604 /// ## See also
4605 /// - [`SDL_GetWindowSurfaceVSync`]
4606 pub fn SDL_SetWindowSurfaceVSync(
4607 window: *mut SDL_Window,
4608 vsync: ::core::ffi::c_int,
4609 ) -> ::core::primitive::bool;
4610}
4611
4612pub const SDL_WINDOW_SURFACE_VSYNC_DISABLED: ::core::primitive::i32 = 0;
4613
4614pub const SDL_WINDOW_SURFACE_VSYNC_ADAPTIVE: ::core::primitive::i32 = -1_i32;
4615
4616unsafe extern "C" {
4617 /// Get VSync for the window surface.
4618 ///
4619 /// ## Parameters
4620 /// - `window`: the window to query.
4621 /// - `vsync`: an int filled with the current vertical refresh sync interval.
4622 /// See [`SDL_SetWindowSurfaceVSync()`] for the meaning of the value.
4623 ///
4624 /// ## Return value
4625 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
4626 /// information.
4627 ///
4628 /// ## Thread safety
4629 /// This function should only be called on the main thread.
4630 ///
4631 /// ## Availability
4632 /// This function is available since SDL 3.2.0.
4633 ///
4634 /// ## See also
4635 /// - [`SDL_SetWindowSurfaceVSync`]
4636 pub fn SDL_GetWindowSurfaceVSync(
4637 window: *mut SDL_Window,
4638 vsync: *mut ::core::ffi::c_int,
4639 ) -> ::core::primitive::bool;
4640}
4641
4642unsafe extern "C" {
4643 /// Copy the window surface to the screen.
4644 ///
4645 /// This is the function you use to reflect any changes to the surface on the
4646 /// screen.
4647 ///
4648 /// This function is equivalent to the SDL 1.2 API SDL_Flip().
4649 ///
4650 /// ## Parameters
4651 /// - `window`: the window to update.
4652 ///
4653 /// ## Return value
4654 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
4655 /// information.
4656 ///
4657 /// ## Thread safety
4658 /// This function should only be called on the main thread.
4659 ///
4660 /// ## Availability
4661 /// This function is available since SDL 3.2.0.
4662 ///
4663 /// ## See also
4664 /// - [`SDL_GetWindowSurface`]
4665 /// - [`SDL_UpdateWindowSurfaceRects`]
4666 pub fn SDL_UpdateWindowSurface(window: *mut SDL_Window) -> ::core::primitive::bool;
4667}
4668
4669unsafe extern "C" {
4670 /// Copy areas of the window surface to the screen.
4671 ///
4672 /// This is the function you use to reflect changes to portions of the surface
4673 /// on the screen.
4674 ///
4675 /// This function is equivalent to the SDL 1.2 API SDL_UpdateRects().
4676 ///
4677 /// Note that this function will update _at least_ the rectangles specified,
4678 /// but this is only intended as an optimization; in practice, this might
4679 /// update more of the screen (or all of the screen!), depending on what method
4680 /// SDL uses to send pixels to the system.
4681 ///
4682 /// ## Parameters
4683 /// - `window`: the window to update.
4684 /// - `rects`: an array of [`SDL_Rect`] structures representing areas of the
4685 /// surface to copy, in pixels.
4686 /// - `numrects`: the number of rectangles.
4687 ///
4688 /// ## Return value
4689 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
4690 /// information.
4691 ///
4692 /// ## Thread safety
4693 /// This function should only be called on the main thread.
4694 ///
4695 /// ## Availability
4696 /// This function is available since SDL 3.2.0.
4697 ///
4698 /// ## See also
4699 /// - [`SDL_GetWindowSurface`]
4700 /// - [`SDL_UpdateWindowSurface`]
4701 pub fn SDL_UpdateWindowSurfaceRects(
4702 window: *mut SDL_Window,
4703 rects: *const SDL_Rect,
4704 numrects: ::core::ffi::c_int,
4705 ) -> ::core::primitive::bool;
4706}
4707
4708unsafe extern "C" {
4709 /// Destroy the surface associated with the window.
4710 ///
4711 /// ## Parameters
4712 /// - `window`: the window to update.
4713 ///
4714 /// ## Return value
4715 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
4716 /// information.
4717 ///
4718 /// ## Thread safety
4719 /// This function should only be called on the main thread.
4720 ///
4721 /// ## Availability
4722 /// This function is available since SDL 3.2.0.
4723 ///
4724 /// ## See also
4725 /// - [`SDL_GetWindowSurface`]
4726 /// - [`SDL_WindowHasSurface`]
4727 pub fn SDL_DestroyWindowSurface(window: *mut SDL_Window) -> ::core::primitive::bool;
4728}
4729
4730unsafe extern "C" {
4731 /// Set a window's keyboard grab mode.
4732 ///
4733 /// Keyboard grab enables capture of system keyboard shortcuts like Alt+Tab or
4734 /// the Meta/Super key. Note that not all system keyboard shortcuts can be
4735 /// captured by applications (one example is Ctrl+Alt+Del on Windows).
4736 ///
4737 /// This is primarily intended for specialized applications such as VNC clients
4738 /// or VM frontends. Normal games should not use keyboard grab.
4739 ///
4740 /// When keyboard grab is enabled, SDL will continue to handle Alt+Tab when the
4741 /// window is full-screen to ensure the user is not trapped in your
4742 /// application. If you have a custom keyboard shortcut to exit fullscreen
4743 /// mode, you may suppress this behavior with
4744 /// [`SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED`].
4745 ///
4746 /// If the caller enables a grab while another window is currently grabbed, the
4747 /// other window loses its grab in favor of the caller's window.
4748 ///
4749 /// ## Parameters
4750 /// - `window`: the window for which the keyboard grab mode should be set.
4751 /// - `grabbed`: this is true to grab keyboard, and false to release.
4752 ///
4753 /// ## Return value
4754 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
4755 /// information.
4756 ///
4757 /// ## Thread safety
4758 /// This function should only be called on the main thread.
4759 ///
4760 /// ## Availability
4761 /// This function is available since SDL 3.2.0.
4762 ///
4763 /// ## See also
4764 /// - [`SDL_GetWindowKeyboardGrab`]
4765 /// - [`SDL_SetWindowMouseGrab`]
4766 pub fn SDL_SetWindowKeyboardGrab(
4767 window: *mut SDL_Window,
4768 grabbed: ::core::primitive::bool,
4769 ) -> ::core::primitive::bool;
4770}
4771
4772unsafe extern "C" {
4773 /// Set a window's mouse grab mode.
4774 ///
4775 /// Mouse grab confines the mouse cursor to the window.
4776 ///
4777 /// ## Parameters
4778 /// - `window`: the window for which the mouse grab mode should be set.
4779 /// - `grabbed`: this is true to grab mouse, and false to release.
4780 ///
4781 /// ## Return value
4782 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
4783 /// information.
4784 ///
4785 /// ## Thread safety
4786 /// This function should only be called on the main thread.
4787 ///
4788 /// ## Availability
4789 /// This function is available since SDL 3.2.0.
4790 ///
4791 /// ## See also
4792 /// - [`SDL_GetWindowMouseRect`]
4793 /// - [`SDL_SetWindowMouseRect`]
4794 /// - [`SDL_SetWindowKeyboardGrab`]
4795 pub fn SDL_SetWindowMouseGrab(
4796 window: *mut SDL_Window,
4797 grabbed: ::core::primitive::bool,
4798 ) -> ::core::primitive::bool;
4799}
4800
4801unsafe extern "C" {
4802 /// Get a window's keyboard grab mode.
4803 ///
4804 /// ## Parameters
4805 /// - `window`: the window to query.
4806 ///
4807 /// ## Return value
4808 /// Returns true if keyboard is grabbed, and false otherwise.
4809 ///
4810 /// ## Thread safety
4811 /// This function should only be called on the main thread.
4812 ///
4813 /// ## Availability
4814 /// This function is available since SDL 3.2.0.
4815 ///
4816 /// ## See also
4817 /// - [`SDL_SetWindowKeyboardGrab`]
4818 pub fn SDL_GetWindowKeyboardGrab(window: *mut SDL_Window) -> ::core::primitive::bool;
4819}
4820
4821unsafe extern "C" {
4822 /// Get a window's mouse grab mode.
4823 ///
4824 /// ## Parameters
4825 /// - `window`: the window to query.
4826 ///
4827 /// ## Return value
4828 /// Returns true if mouse is grabbed, and false otherwise.
4829 ///
4830 /// ## Thread safety
4831 /// This function should only be called on the main thread.
4832 ///
4833 /// ## Availability
4834 /// This function is available since SDL 3.2.0.
4835 ///
4836 /// ## See also
4837 /// - [`SDL_GetWindowMouseRect`]
4838 /// - [`SDL_SetWindowMouseRect`]
4839 /// - [`SDL_SetWindowMouseGrab`]
4840 /// - [`SDL_SetWindowKeyboardGrab`]
4841 pub fn SDL_GetWindowMouseGrab(window: *mut SDL_Window) -> ::core::primitive::bool;
4842}
4843
4844unsafe extern "C" {
4845 /// Get the window that currently has an input grab enabled.
4846 ///
4847 /// ## Return value
4848 /// Returns the window if input is grabbed or NULL otherwise.
4849 ///
4850 /// ## Thread safety
4851 /// This function should only be called on the main thread.
4852 ///
4853 /// ## Availability
4854 /// This function is available since SDL 3.2.0.
4855 ///
4856 /// ## See also
4857 /// - [`SDL_SetWindowMouseGrab`]
4858 /// - [`SDL_SetWindowKeyboardGrab`]
4859 pub fn SDL_GetGrabbedWindow() -> *mut SDL_Window;
4860}
4861
4862unsafe extern "C" {
4863 /// Confines the cursor to the specified area of a window.
4864 ///
4865 /// Note that this does NOT grab the cursor, it only defines the area a cursor
4866 /// is restricted to when the window has mouse focus.
4867 ///
4868 /// ## Parameters
4869 /// - `window`: the window that will be associated with the barrier.
4870 /// - `rect`: a rectangle area in window-relative coordinates. If NULL the
4871 /// barrier for the specified window will be destroyed.
4872 ///
4873 /// ## Return value
4874 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
4875 /// information.
4876 ///
4877 /// ## Thread safety
4878 /// This function should only be called on the main thread.
4879 ///
4880 /// ## Availability
4881 /// This function is available since SDL 3.2.0.
4882 ///
4883 /// ## See also
4884 /// - [`SDL_GetWindowMouseRect`]
4885 /// - [`SDL_GetWindowMouseGrab`]
4886 /// - [`SDL_SetWindowMouseGrab`]
4887 pub fn SDL_SetWindowMouseRect(
4888 window: *mut SDL_Window,
4889 rect: *const SDL_Rect,
4890 ) -> ::core::primitive::bool;
4891}
4892
4893unsafe extern "C" {
4894 /// Get the mouse confinement rectangle of a window.
4895 ///
4896 /// ## Parameters
4897 /// - `window`: the window to query.
4898 ///
4899 /// ## Return value
4900 /// Returns a pointer to the mouse confinement rectangle of a window, or NULL
4901 /// if there isn't one.
4902 ///
4903 /// ## Thread safety
4904 /// This function should only be called on the main thread.
4905 ///
4906 /// ## Availability
4907 /// This function is available since SDL 3.2.0.
4908 ///
4909 /// ## See also
4910 /// - [`SDL_SetWindowMouseRect`]
4911 /// - [`SDL_GetWindowMouseGrab`]
4912 /// - [`SDL_SetWindowMouseGrab`]
4913 pub fn SDL_GetWindowMouseRect(window: *mut SDL_Window) -> *const SDL_Rect;
4914}
4915
4916unsafe extern "C" {
4917 /// Set the opacity for a window.
4918 ///
4919 /// The parameter `opacity` will be clamped internally between 0.0f
4920 /// (transparent) and 1.0f (opaque).
4921 ///
4922 /// This function also returns false if setting the opacity isn't supported.
4923 ///
4924 /// ## Parameters
4925 /// - `window`: the window which will be made transparent or opaque.
4926 /// - `opacity`: the opacity value (0.0f - transparent, 1.0f - opaque).
4927 ///
4928 /// ## Return value
4929 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
4930 /// information.
4931 ///
4932 /// ## Thread safety
4933 /// This function should only be called on the main thread.
4934 ///
4935 /// ## Availability
4936 /// This function is available since SDL 3.2.0.
4937 ///
4938 /// ## See also
4939 /// - [`SDL_GetWindowOpacity`]
4940 pub fn SDL_SetWindowOpacity(
4941 window: *mut SDL_Window,
4942 opacity: ::core::ffi::c_float,
4943 ) -> ::core::primitive::bool;
4944}
4945
4946unsafe extern "C" {
4947 /// Get the opacity of a window.
4948 ///
4949 /// If transparency isn't supported on this platform, opacity will be returned
4950 /// as 1.0f without error.
4951 ///
4952 /// ## Parameters
4953 /// - `window`: the window to get the current opacity value from.
4954 ///
4955 /// ## Return value
4956 /// Returns the opacity, (0.0f - transparent, 1.0f - opaque), or -1.0f on
4957 /// failure; call [`SDL_GetError()`] for more information.
4958 ///
4959 /// ## Thread safety
4960 /// This function should only be called on the main thread.
4961 ///
4962 /// ## Availability
4963 /// This function is available since SDL 3.2.0.
4964 ///
4965 /// ## See also
4966 /// - [`SDL_SetWindowOpacity`]
4967 pub fn SDL_GetWindowOpacity(window: *mut SDL_Window) -> ::core::ffi::c_float;
4968}
4969
4970unsafe extern "C" {
4971 /// Set the window as a child of a parent window.
4972 ///
4973 /// If the window is already the child of an existing window, it will be
4974 /// reparented to the new owner. Setting the parent window to NULL unparents
4975 /// the window and removes child window status.
4976 ///
4977 /// If a parent window is hidden or destroyed, the operation will be
4978 /// recursively applied to child windows. Child windows hidden with the parent
4979 /// that did not have their hidden status explicitly set will be restored when
4980 /// the parent is shown.
4981 ///
4982 /// Attempting to set the parent of a window that is currently in the modal
4983 /// state will fail. Use [`SDL_SetWindowModal()`] to cancel the modal status before
4984 /// attempting to change the parent.
4985 ///
4986 /// Popup windows cannot change parents and attempts to do so will fail.
4987 ///
4988 /// Setting a parent window that is currently the sibling or descendent of the
4989 /// child window results in undefined behavior.
4990 ///
4991 /// ## Parameters
4992 /// - `window`: the window that should become the child of a parent.
4993 /// - `parent`: the new parent window for the child window.
4994 ///
4995 /// ## Return value
4996 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
4997 /// information.
4998 ///
4999 /// ## Thread safety
5000 /// This function should only be called on the main thread.
5001 ///
5002 /// ## Availability
5003 /// This function is available since SDL 3.2.0.
5004 ///
5005 /// ## See also
5006 /// - [`SDL_SetWindowModal`]
5007 pub fn SDL_SetWindowParent(
5008 window: *mut SDL_Window,
5009 parent: *mut SDL_Window,
5010 ) -> ::core::primitive::bool;
5011}
5012
5013unsafe extern "C" {
5014 /// Toggle the state of the window as modal.
5015 ///
5016 /// To enable modal status on a window, the window must currently be the child
5017 /// window of a parent, or toggling modal status on will fail.
5018 ///
5019 /// ## Parameters
5020 /// - `window`: the window on which to set the modal state.
5021 /// - `modal`: true to toggle modal status on, false to toggle it off.
5022 ///
5023 /// ## Return value
5024 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
5025 /// information.
5026 ///
5027 /// ## Thread safety
5028 /// This function should only be called on the main thread.
5029 ///
5030 /// ## Availability
5031 /// This function is available since SDL 3.2.0.
5032 ///
5033 /// ## See also
5034 /// - [`SDL_SetWindowParent`]
5035 /// - [`SDL_WINDOW_MODAL`]
5036 pub fn SDL_SetWindowModal(
5037 window: *mut SDL_Window,
5038 modal: ::core::primitive::bool,
5039 ) -> ::core::primitive::bool;
5040}
5041
5042unsafe extern "C" {
5043 /// Set whether the window may have input focus.
5044 ///
5045 /// ## Parameters
5046 /// - `window`: the window to set focusable state.
5047 /// - `focusable`: true to allow input focus, false to not allow input focus.
5048 ///
5049 /// ## Return value
5050 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
5051 /// information.
5052 ///
5053 /// ## Thread safety
5054 /// This function should only be called on the main thread.
5055 ///
5056 /// ## Availability
5057 /// This function is available since SDL 3.2.0.
5058 pub fn SDL_SetWindowFocusable(
5059 window: *mut SDL_Window,
5060 focusable: ::core::primitive::bool,
5061 ) -> ::core::primitive::bool;
5062}
5063
5064unsafe extern "C" {
5065 /// Display the system-level window menu.
5066 ///
5067 /// This default window menu is provided by the system and on some platforms
5068 /// provides functionality for setting or changing privileged state on the
5069 /// window, such as moving it between workspaces or displays, or toggling the
5070 /// always-on-top property.
5071 ///
5072 /// On platforms or desktops where this is unsupported, this function does
5073 /// nothing.
5074 ///
5075 /// ## Parameters
5076 /// - `window`: the window for which the menu will be displayed.
5077 /// - `x`: the x coordinate of the menu, relative to the origin (top-left) of
5078 /// the client area.
5079 /// - `y`: the y coordinate of the menu, relative to the origin (top-left) of
5080 /// the client area.
5081 ///
5082 /// ## Return value
5083 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
5084 /// information.
5085 ///
5086 /// ## Thread safety
5087 /// This function should only be called on the main thread.
5088 ///
5089 /// ## Availability
5090 /// This function is available since SDL 3.2.0.
5091 pub fn SDL_ShowWindowSystemMenu(
5092 window: *mut SDL_Window,
5093 x: ::core::ffi::c_int,
5094 y: ::core::ffi::c_int,
5095 ) -> ::core::primitive::bool;
5096}
5097
5098/// Possible return values from the [`SDL_HitTest`] callback.
5099///
5100/// ## Thread safety
5101/// This function should only be called on the main thread.
5102///
5103/// ## Availability
5104/// This enum is available since SDL 3.2.0.
5105///
5106/// ## See also
5107/// - [`SDL_HitTest`]
5108///
5109/// ## Known values (`sdl3-sys`)
5110/// | Associated constant | Global constant | Description |
5111/// | ------------------- | --------------- | ----------- |
5112/// | [`NORMAL`](SDL_HitTestResult::NORMAL) | [`SDL_HITTEST_NORMAL`] | Region is normal. No special properties. |
5113/// | [`DRAGGABLE`](SDL_HitTestResult::DRAGGABLE) | [`SDL_HITTEST_DRAGGABLE`] | Region can drag entire window. |
5114/// | [`RESIZE_TOPLEFT`](SDL_HitTestResult::RESIZE_TOPLEFT) | [`SDL_HITTEST_RESIZE_TOPLEFT`] | Region is the resizable top-left corner border. |
5115/// | [`RESIZE_TOP`](SDL_HitTestResult::RESIZE_TOP) | [`SDL_HITTEST_RESIZE_TOP`] | Region is the resizable top border. |
5116/// | [`RESIZE_TOPRIGHT`](SDL_HitTestResult::RESIZE_TOPRIGHT) | [`SDL_HITTEST_RESIZE_TOPRIGHT`] | Region is the resizable top-right corner border. |
5117/// | [`RESIZE_RIGHT`](SDL_HitTestResult::RESIZE_RIGHT) | [`SDL_HITTEST_RESIZE_RIGHT`] | Region is the resizable right border. |
5118/// | [`RESIZE_BOTTOMRIGHT`](SDL_HitTestResult::RESIZE_BOTTOMRIGHT) | [`SDL_HITTEST_RESIZE_BOTTOMRIGHT`] | Region is the resizable bottom-right corner border. |
5119/// | [`RESIZE_BOTTOM`](SDL_HitTestResult::RESIZE_BOTTOM) | [`SDL_HITTEST_RESIZE_BOTTOM`] | Region is the resizable bottom border. |
5120/// | [`RESIZE_BOTTOMLEFT`](SDL_HitTestResult::RESIZE_BOTTOMLEFT) | [`SDL_HITTEST_RESIZE_BOTTOMLEFT`] | Region is the resizable bottom-left corner border. |
5121/// | [`RESIZE_LEFT`](SDL_HitTestResult::RESIZE_LEFT) | [`SDL_HITTEST_RESIZE_LEFT`] | Region is the resizable left border. |
5122#[repr(transparent)]
5123#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
5124pub struct SDL_HitTestResult(pub ::core::ffi::c_int);
5125
5126impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_HitTestResult {
5127 #[inline(always)]
5128 fn eq(&self, other: &::core::ffi::c_int) -> bool {
5129 &self.0 == other
5130 }
5131}
5132
5133impl ::core::cmp::PartialEq<SDL_HitTestResult> for ::core::ffi::c_int {
5134 #[inline(always)]
5135 fn eq(&self, other: &SDL_HitTestResult) -> bool {
5136 self == &other.0
5137 }
5138}
5139
5140impl From<SDL_HitTestResult> for ::core::ffi::c_int {
5141 #[inline(always)]
5142 fn from(value: SDL_HitTestResult) -> Self {
5143 value.0
5144 }
5145}
5146
5147#[cfg(feature = "debug-impls")]
5148impl ::core::fmt::Debug for SDL_HitTestResult {
5149 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
5150 #[allow(unreachable_patterns)]
5151 f.write_str(match *self {
5152 Self::NORMAL => "SDL_HITTEST_NORMAL",
5153 Self::DRAGGABLE => "SDL_HITTEST_DRAGGABLE",
5154 Self::RESIZE_TOPLEFT => "SDL_HITTEST_RESIZE_TOPLEFT",
5155 Self::RESIZE_TOP => "SDL_HITTEST_RESIZE_TOP",
5156 Self::RESIZE_TOPRIGHT => "SDL_HITTEST_RESIZE_TOPRIGHT",
5157 Self::RESIZE_RIGHT => "SDL_HITTEST_RESIZE_RIGHT",
5158 Self::RESIZE_BOTTOMRIGHT => "SDL_HITTEST_RESIZE_BOTTOMRIGHT",
5159 Self::RESIZE_BOTTOM => "SDL_HITTEST_RESIZE_BOTTOM",
5160 Self::RESIZE_BOTTOMLEFT => "SDL_HITTEST_RESIZE_BOTTOMLEFT",
5161 Self::RESIZE_LEFT => "SDL_HITTEST_RESIZE_LEFT",
5162
5163 _ => return write!(f, "SDL_HitTestResult({})", self.0),
5164 })
5165 }
5166}
5167
5168impl SDL_HitTestResult {
5169 /// Region is normal. No special properties.
5170 pub const NORMAL: Self = Self((0 as ::core::ffi::c_int));
5171 /// Region can drag entire window.
5172 pub const DRAGGABLE: Self = Self((1 as ::core::ffi::c_int));
5173 /// Region is the resizable top-left corner border.
5174 pub const RESIZE_TOPLEFT: Self = Self((2 as ::core::ffi::c_int));
5175 /// Region is the resizable top border.
5176 pub const RESIZE_TOP: Self = Self((3 as ::core::ffi::c_int));
5177 /// Region is the resizable top-right corner border.
5178 pub const RESIZE_TOPRIGHT: Self = Self((4 as ::core::ffi::c_int));
5179 /// Region is the resizable right border.
5180 pub const RESIZE_RIGHT: Self = Self((5 as ::core::ffi::c_int));
5181 /// Region is the resizable bottom-right corner border.
5182 pub const RESIZE_BOTTOMRIGHT: Self = Self((6 as ::core::ffi::c_int));
5183 /// Region is the resizable bottom border.
5184 pub const RESIZE_BOTTOM: Self = Self((7 as ::core::ffi::c_int));
5185 /// Region is the resizable bottom-left corner border.
5186 pub const RESIZE_BOTTOMLEFT: Self = Self((8 as ::core::ffi::c_int));
5187 /// Region is the resizable left border.
5188 pub const RESIZE_LEFT: Self = Self((9 as ::core::ffi::c_int));
5189}
5190
5191/// Region is normal. No special properties.
5192pub const SDL_HITTEST_NORMAL: SDL_HitTestResult = SDL_HitTestResult::NORMAL;
5193/// Region can drag entire window.
5194pub const SDL_HITTEST_DRAGGABLE: SDL_HitTestResult = SDL_HitTestResult::DRAGGABLE;
5195/// Region is the resizable top-left corner border.
5196pub const SDL_HITTEST_RESIZE_TOPLEFT: SDL_HitTestResult = SDL_HitTestResult::RESIZE_TOPLEFT;
5197/// Region is the resizable top border.
5198pub const SDL_HITTEST_RESIZE_TOP: SDL_HitTestResult = SDL_HitTestResult::RESIZE_TOP;
5199/// Region is the resizable top-right corner border.
5200pub const SDL_HITTEST_RESIZE_TOPRIGHT: SDL_HitTestResult = SDL_HitTestResult::RESIZE_TOPRIGHT;
5201/// Region is the resizable right border.
5202pub const SDL_HITTEST_RESIZE_RIGHT: SDL_HitTestResult = SDL_HitTestResult::RESIZE_RIGHT;
5203/// Region is the resizable bottom-right corner border.
5204pub const SDL_HITTEST_RESIZE_BOTTOMRIGHT: SDL_HitTestResult = SDL_HitTestResult::RESIZE_BOTTOMRIGHT;
5205/// Region is the resizable bottom border.
5206pub const SDL_HITTEST_RESIZE_BOTTOM: SDL_HitTestResult = SDL_HitTestResult::RESIZE_BOTTOM;
5207/// Region is the resizable bottom-left corner border.
5208pub const SDL_HITTEST_RESIZE_BOTTOMLEFT: SDL_HitTestResult = SDL_HitTestResult::RESIZE_BOTTOMLEFT;
5209/// Region is the resizable left border.
5210pub const SDL_HITTEST_RESIZE_LEFT: SDL_HitTestResult = SDL_HitTestResult::RESIZE_LEFT;
5211
5212#[cfg(feature = "metadata")]
5213impl sdl3_sys::metadata::GroupMetadata for SDL_HitTestResult {
5214 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
5215 &crate::metadata::video::METADATA_SDL_HitTestResult;
5216}
5217
5218/// Callback used for hit-testing.
5219///
5220/// ## Parameters
5221/// - `win`: the [`SDL_Window`] where hit-testing was set on.
5222/// - `area`: an [`SDL_Point`] which should be hit-tested.
5223/// - `data`: what was passed as `callback_data` to [`SDL_SetWindowHitTest()`].
5224///
5225/// ## Return value
5226/// Returns an [`SDL_HitTestResult`] value.
5227///
5228/// ## See also
5229/// - [`SDL_SetWindowHitTest`]
5230pub type SDL_HitTest = ::core::option::Option<
5231 unsafe extern "C" fn(
5232 win: *mut SDL_Window,
5233 area: *const SDL_Point,
5234 data: *mut ::core::ffi::c_void,
5235 ) -> SDL_HitTestResult,
5236>;
5237
5238unsafe extern "C" {
5239 /// Provide a callback that decides if a window region has special properties.
5240 ///
5241 /// Normally windows are dragged and resized by decorations provided by the
5242 /// system window manager (a title bar, borders, etc), but for some apps, it
5243 /// makes sense to drag them from somewhere else inside the window itself; for
5244 /// example, one might have a borderless window that wants to be draggable from
5245 /// any part, or simulate its own title bar, etc.
5246 ///
5247 /// This function lets the app provide a callback that designates pieces of a
5248 /// given window as special. This callback is run during event processing if we
5249 /// need to tell the OS to treat a region of the window specially; the use of
5250 /// this callback is known as "hit testing."
5251 ///
5252 /// Mouse input may not be delivered to your application if it is within a
5253 /// special area; the OS will often apply that input to moving the window or
5254 /// resizing the window and not deliver it to the application.
5255 ///
5256 /// Specifying NULL for a callback disables hit-testing. Hit-testing is
5257 /// disabled by default.
5258 ///
5259 /// Platforms that don't support this functionality will return false
5260 /// unconditionally, even if you're attempting to disable hit-testing.
5261 ///
5262 /// Your callback may fire at any time, and its firing does not indicate any
5263 /// specific behavior (for example, on Windows, this certainly might fire when
5264 /// the OS is deciding whether to drag your window, but it fires for lots of
5265 /// other reasons, too, some unrelated to anything you probably care about _and
5266 /// when the mouse isn't actually at the location it is testing_). Since this
5267 /// can fire at any time, you should try to keep your callback efficient,
5268 /// devoid of allocations, etc.
5269 ///
5270 /// ## Parameters
5271 /// - `window`: the window to set hit-testing on.
5272 /// - `callback`: the function to call when doing a hit-test.
5273 /// - `callback_data`: an app-defined void pointer passed to **callback**.
5274 ///
5275 /// ## Return value
5276 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
5277 /// information.
5278 ///
5279 /// ## Thread safety
5280 /// This function should only be called on the main thread.
5281 ///
5282 /// ## Availability
5283 /// This function is available since SDL 3.2.0.
5284 pub fn SDL_SetWindowHitTest(
5285 window: *mut SDL_Window,
5286 callback: SDL_HitTest,
5287 callback_data: *mut ::core::ffi::c_void,
5288 ) -> ::core::primitive::bool;
5289}
5290
5291unsafe extern "C" {
5292 /// Set the shape of a transparent window.
5293 ///
5294 /// This sets the alpha channel of a transparent window and any fully
5295 /// transparent areas are also transparent to mouse clicks. If you are using
5296 /// something besides the SDL render API, then you are responsible for drawing
5297 /// the alpha channel of the window to match the shape alpha channel to get
5298 /// consistent cross-platform results.
5299 ///
5300 /// The shape is copied inside this function, so you can free it afterwards. If
5301 /// your shape surface changes, you should call [`SDL_SetWindowShape()`] again to
5302 /// update the window. This is an expensive operation, so should be done
5303 /// sparingly.
5304 ///
5305 /// The window must have been created with the [`SDL_WINDOW_TRANSPARENT`] flag.
5306 ///
5307 /// ## Parameters
5308 /// - `window`: the window.
5309 /// - `shape`: the surface representing the shape of the window, or NULL to
5310 /// remove any current shape.
5311 ///
5312 /// ## Return value
5313 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
5314 /// information.
5315 ///
5316 /// ## Thread safety
5317 /// This function should only be called on the main thread.
5318 ///
5319 /// ## Availability
5320 /// This function is available since SDL 3.2.0.
5321 pub fn SDL_SetWindowShape(
5322 window: *mut SDL_Window,
5323 shape: *mut SDL_Surface,
5324 ) -> ::core::primitive::bool;
5325}
5326
5327unsafe extern "C" {
5328 /// Request a window to demand attention from the user.
5329 ///
5330 /// ## Parameters
5331 /// - `window`: the window to be flashed.
5332 /// - `operation`: the operation to perform.
5333 ///
5334 /// ## Return value
5335 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
5336 /// information.
5337 ///
5338 /// ## Thread safety
5339 /// This function should only be called on the main thread.
5340 ///
5341 /// ## Availability
5342 /// This function is available since SDL 3.2.0.
5343 pub fn SDL_FlashWindow(
5344 window: *mut SDL_Window,
5345 operation: SDL_FlashOperation,
5346 ) -> ::core::primitive::bool;
5347}
5348
5349unsafe extern "C" {
5350 /// Sets the state of the progress bar for the given window’s taskbar icon.
5351 ///
5352 /// ## Parameters
5353 /// - `window`: the window whose progress state is to be modified.
5354 /// - `state`: the progress state. [`SDL_PROGRESS_STATE_NONE`] stops displaying
5355 /// the progress bar.
5356 ///
5357 /// ## Return value
5358 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
5359 /// information.
5360 ///
5361 /// ## Thread safety
5362 /// This function should only be called on the main thread.
5363 ///
5364 /// ## Availability
5365 /// This function is available since SDL 3.4.0.
5366 pub fn SDL_SetWindowProgressState(
5367 window: *mut SDL_Window,
5368 state: SDL_ProgressState,
5369 ) -> ::core::primitive::bool;
5370}
5371
5372unsafe extern "C" {
5373 /// Get the state of the progress bar for the given window’s taskbar icon.
5374 ///
5375 /// ## Parameters
5376 /// - `window`: the window to get the current progress state from.
5377 ///
5378 /// ## Return value
5379 /// Returns the progress state, or [`SDL_PROGRESS_STATE_INVALID`] on failure;
5380 /// call [`SDL_GetError()`] for more information.
5381 ///
5382 /// ## Thread safety
5383 /// This function should only be called on the main thread.
5384 ///
5385 /// ## Availability
5386 /// This function is available since SDL 3.4.0.
5387 pub fn SDL_GetWindowProgressState(window: *mut SDL_Window) -> SDL_ProgressState;
5388}
5389
5390unsafe extern "C" {
5391 /// Sets the value of the progress bar for the given window’s taskbar icon.
5392 ///
5393 /// ## Parameters
5394 /// - `window`: the window whose progress value is to be modified.
5395 /// - `value`: the progress value in the range of \[0.0f - 1.0f\]. If the value
5396 /// is outside the valid range, it gets clamped.
5397 ///
5398 /// ## Return value
5399 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
5400 /// information.
5401 ///
5402 /// ## Thread safety
5403 /// This function should only be called on the main thread.
5404 ///
5405 /// ## Availability
5406 /// This function is available since SDL 3.4.0.
5407 pub fn SDL_SetWindowProgressValue(
5408 window: *mut SDL_Window,
5409 value: ::core::ffi::c_float,
5410 ) -> ::core::primitive::bool;
5411}
5412
5413unsafe extern "C" {
5414 /// Get the value of the progress bar for the given window’s taskbar icon.
5415 ///
5416 /// ## Parameters
5417 /// - `window`: the window to get the current progress value from.
5418 ///
5419 /// ## Return value
5420 /// Returns the progress value in the range of \[0.0f - 1.0f\], or -1.0f on
5421 /// failure; call [`SDL_GetError()`] for more information.
5422 ///
5423 /// ## Thread safety
5424 /// This function should only be called on the main thread.
5425 ///
5426 /// ## Availability
5427 /// This function is available since SDL 3.4.0.
5428 pub fn SDL_GetWindowProgressValue(window: *mut SDL_Window) -> ::core::ffi::c_float;
5429}
5430
5431unsafe extern "C" {
5432 /// Destroy a window.
5433 ///
5434 /// Any child windows owned by the window will be recursively destroyed as
5435 /// well.
5436 ///
5437 /// Note that on some platforms, the visible window may not actually be removed
5438 /// from the screen until the SDL event loop is pumped again, even though the
5439 /// [`SDL_Window`] is no longer valid after this call.
5440 ///
5441 /// ## Parameters
5442 /// - `window`: the window to destroy.
5443 ///
5444 /// ## Thread safety
5445 /// This function should only be called on the main thread.
5446 ///
5447 /// ## Availability
5448 /// This function is available since SDL 3.2.0.
5449 ///
5450 /// ## See also
5451 /// - [`SDL_CreatePopupWindow`]
5452 /// - [`SDL_CreateWindow`]
5453 /// - [`SDL_CreateWindowWithProperties`]
5454 pub fn SDL_DestroyWindow(window: *mut SDL_Window);
5455}
5456
5457unsafe extern "C" {
5458 /// Check whether the screensaver is currently enabled.
5459 ///
5460 /// The screensaver is disabled by default.
5461 ///
5462 /// The default can also be changed using [`SDL_HINT_VIDEO_ALLOW_SCREENSAVER`].
5463 ///
5464 /// ## Return value
5465 /// Returns true if the screensaver is enabled, false if it is disabled.
5466 ///
5467 /// ## Thread safety
5468 /// This function should only be called on the main thread.
5469 ///
5470 /// ## Availability
5471 /// This function is available since SDL 3.2.0.
5472 ///
5473 /// ## See also
5474 /// - [`SDL_DisableScreenSaver`]
5475 /// - [`SDL_EnableScreenSaver`]
5476 pub fn SDL_ScreenSaverEnabled() -> ::core::primitive::bool;
5477}
5478
5479unsafe extern "C" {
5480 /// Allow the screen to be blanked by a screen saver.
5481 ///
5482 /// ## Return value
5483 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
5484 /// information.
5485 ///
5486 /// ## Thread safety
5487 /// This function should only be called on the main thread.
5488 ///
5489 /// ## Availability
5490 /// This function is available since SDL 3.2.0.
5491 ///
5492 /// ## See also
5493 /// - [`SDL_DisableScreenSaver`]
5494 /// - [`SDL_ScreenSaverEnabled`]
5495 pub fn SDL_EnableScreenSaver() -> ::core::primitive::bool;
5496}
5497
5498unsafe extern "C" {
5499 /// Prevent the screen from being blanked by a screen saver.
5500 ///
5501 /// If you disable the screensaver, it is automatically re-enabled when SDL
5502 /// quits.
5503 ///
5504 /// The screensaver is disabled by default, but this may by changed by
5505 /// [`SDL_HINT_VIDEO_ALLOW_SCREENSAVER`].
5506 ///
5507 /// ## Return value
5508 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
5509 /// information.
5510 ///
5511 /// ## Thread safety
5512 /// This function should only be called on the main thread.
5513 ///
5514 /// ## Availability
5515 /// This function is available since SDL 3.2.0.
5516 ///
5517 /// ## See also
5518 /// - [`SDL_EnableScreenSaver`]
5519 /// - [`SDL_ScreenSaverEnabled`]
5520 pub fn SDL_DisableScreenSaver() -> ::core::primitive::bool;
5521}
5522
5523unsafe extern "C" {
5524 /// Dynamically load an OpenGL library.
5525 ///
5526 /// This should be done after initializing the video driver, but before
5527 /// creating any OpenGL windows. If no OpenGL library is loaded, the default
5528 /// library will be loaded upon creation of the first OpenGL window.
5529 ///
5530 /// If you do this, you need to retrieve all of the GL functions used in your
5531 /// program from the dynamic library using [`SDL_GL_GetProcAddress()`].
5532 ///
5533 /// ## Parameters
5534 /// - `path`: the platform dependent OpenGL library name, or NULL to open the
5535 /// default OpenGL library.
5536 ///
5537 /// ## Return value
5538 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
5539 /// information.
5540 ///
5541 /// ## Thread safety
5542 /// This function should only be called on the main thread.
5543 ///
5544 /// ## Availability
5545 /// This function is available since SDL 3.2.0.
5546 ///
5547 /// ## See also
5548 /// - [`SDL_GL_GetProcAddress`]
5549 /// - [`SDL_GL_UnloadLibrary`]
5550 pub fn SDL_GL_LoadLibrary(path: *const ::core::ffi::c_char) -> ::core::primitive::bool;
5551}
5552
5553unsafe extern "C" {
5554 /// Get an OpenGL function by name.
5555 ///
5556 /// If the GL library is loaded at runtime with [`SDL_GL_LoadLibrary()`], then all
5557 /// GL functions must be retrieved this way. Usually this is used to retrieve
5558 /// function pointers to OpenGL extensions.
5559 ///
5560 /// There are some quirks to looking up OpenGL functions that require some
5561 /// extra care from the application. If you code carefully, you can handle
5562 /// these quirks without any platform-specific code, though:
5563 ///
5564 /// - On Windows, function pointers are specific to the current GL context;
5565 /// this means you need to have created a GL context and made it current
5566 /// before calling [`SDL_GL_GetProcAddress()`]. If you recreate your context or
5567 /// create a second context, you should assume that any existing function
5568 /// pointers aren't valid to use with it. This is (currently) a
5569 /// Windows-specific limitation, and in practice lots of drivers don't suffer
5570 /// this limitation, but it is still the way the wgl API is documented to
5571 /// work and you should expect crashes if you don't respect it. Store a copy
5572 /// of the function pointers that comes and goes with context lifespan.
5573 /// - On X11, function pointers returned by this function are valid for any
5574 /// context, and can even be looked up before a context is created at all.
5575 /// This means that, for at least some common OpenGL implementations, if you
5576 /// look up a function that doesn't exist, you'll get a non-NULL result that
5577 /// is _NOT_ safe to call. You must always make sure the function is actually
5578 /// available for a given GL context before calling it, by checking for the
5579 /// existence of the appropriate extension with [`SDL_GL_ExtensionSupported()`],
5580 /// or verifying that the version of OpenGL you're using offers the function
5581 /// as core functionality.
5582 /// - Some OpenGL drivers, on all platforms, *will* return NULL if a function
5583 /// isn't supported, but you can't count on this behavior. Check for
5584 /// extensions you use, and if you get a NULL anyway, act as if that
5585 /// extension wasn't available. This is probably a bug in the driver, but you
5586 /// can code defensively for this scenario anyhow.
5587 /// - Just because you're on Linux/Unix, don't assume you'll be using X11.
5588 /// Next-gen display servers are waiting to replace it, and may or may not
5589 /// make the same promises about function pointers.
5590 /// - OpenGL function pointers must be declared `APIENTRY` as in the example
5591 /// code. This will ensure the proper calling convention is followed on
5592 /// platforms where this matters (Win32) thereby avoiding stack corruption.
5593 ///
5594 /// ## Parameters
5595 /// - `proc`: the name of an OpenGL function.
5596 ///
5597 /// ## Return value
5598 /// Returns a pointer to the named OpenGL function. The returned pointer
5599 /// should be cast to the appropriate function signature.
5600 ///
5601 /// ## Thread safety
5602 /// This function should only be called on the main thread.
5603 ///
5604 /// ## Availability
5605 /// This function is available since SDL 3.2.0.
5606 ///
5607 /// ## See also
5608 /// - [`SDL_GL_ExtensionSupported`]
5609 /// - [`SDL_GL_LoadLibrary`]
5610 /// - [`SDL_GL_UnloadLibrary`]
5611 pub fn SDL_GL_GetProcAddress(proc: *const ::core::ffi::c_char) -> SDL_FunctionPointer;
5612}
5613
5614unsafe extern "C" {
5615 /// Get an EGL library function by name.
5616 ///
5617 /// If an EGL library is loaded, this function allows applications to get entry
5618 /// points for EGL functions. This is useful to provide to an EGL API and
5619 /// extension loader.
5620 ///
5621 /// ## Parameters
5622 /// - `proc`: the name of an EGL function.
5623 ///
5624 /// ## Return value
5625 /// Returns a pointer to the named EGL function. The returned pointer should
5626 /// be cast to the appropriate function signature.
5627 ///
5628 /// ## Thread safety
5629 /// This function should only be called on the main thread.
5630 ///
5631 /// ## Availability
5632 /// This function is available since SDL 3.2.0.
5633 ///
5634 /// ## See also
5635 /// - [`SDL_EGL_GetCurrentDisplay`]
5636 pub fn SDL_EGL_GetProcAddress(proc: *const ::core::ffi::c_char) -> SDL_FunctionPointer;
5637}
5638
5639unsafe extern "C" {
5640 /// Unload the OpenGL library previously loaded by [`SDL_GL_LoadLibrary()`].
5641 ///
5642 /// ## Thread safety
5643 /// This function should only be called on the main thread.
5644 ///
5645 /// ## Availability
5646 /// This function is available since SDL 3.2.0.
5647 ///
5648 /// ## See also
5649 /// - [`SDL_GL_LoadLibrary`]
5650 pub fn SDL_GL_UnloadLibrary();
5651}
5652
5653unsafe extern "C" {
5654 /// Check if an OpenGL extension is supported for the current context.
5655 ///
5656 /// This function operates on the current GL context; you must have created a
5657 /// context and it must be current before calling this function. Do not assume
5658 /// that all contexts you create will have the same set of extensions
5659 /// available, or that recreating an existing context will offer the same
5660 /// extensions again.
5661 ///
5662 /// While it's probably not a massive overhead, this function is not an O(1)
5663 /// operation. Check the extensions you care about after creating the GL
5664 /// context and save that information somewhere instead of calling the function
5665 /// every time you need to know.
5666 ///
5667 /// ## Parameters
5668 /// - `extension`: the name of the extension to check.
5669 ///
5670 /// ## Return value
5671 /// Returns true if the extension is supported, false otherwise.
5672 ///
5673 /// ## Thread safety
5674 /// This function should only be called on the main thread.
5675 ///
5676 /// ## Availability
5677 /// This function is available since SDL 3.2.0.
5678 pub fn SDL_GL_ExtensionSupported(
5679 extension: *const ::core::ffi::c_char,
5680 ) -> ::core::primitive::bool;
5681}
5682
5683unsafe extern "C" {
5684 /// Reset all previously set OpenGL context attributes to their default values.
5685 ///
5686 /// ## Thread safety
5687 /// This function should only be called on the main thread.
5688 ///
5689 /// ## Availability
5690 /// This function is available since SDL 3.2.0.
5691 ///
5692 /// ## See also
5693 /// - [`SDL_GL_GetAttribute`]
5694 /// - [`SDL_GL_SetAttribute`]
5695 pub fn SDL_GL_ResetAttributes();
5696}
5697
5698unsafe extern "C" {
5699 /// Set an OpenGL window attribute before window creation.
5700 ///
5701 /// This function sets the OpenGL attribute `attr` to `value`. The requested
5702 /// attributes should be set before creating an OpenGL window. You should use
5703 /// [`SDL_GL_GetAttribute()`] to check the values after creating the OpenGL
5704 /// context, since the values obtained can differ from the requested ones.
5705 ///
5706 /// ## Parameters
5707 /// - `attr`: an enum value specifying the OpenGL attribute to set.
5708 /// - `value`: the desired value for the attribute.
5709 ///
5710 /// ## Return value
5711 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
5712 /// information.
5713 ///
5714 /// ## Thread safety
5715 /// This function should only be called on the main thread.
5716 ///
5717 /// ## Availability
5718 /// This function is available since SDL 3.2.0.
5719 ///
5720 /// ## See also
5721 /// - [`SDL_GL_CreateContext`]
5722 /// - [`SDL_GL_GetAttribute`]
5723 /// - [`SDL_GL_ResetAttributes`]
5724 pub fn SDL_GL_SetAttribute(
5725 attr: SDL_GLAttr,
5726 value: ::core::ffi::c_int,
5727 ) -> ::core::primitive::bool;
5728}
5729
5730unsafe extern "C" {
5731 /// Get the actual value for an attribute from the current context.
5732 ///
5733 /// ## Parameters
5734 /// - `attr`: an [`SDL_GLAttr`] enum value specifying the OpenGL attribute to
5735 /// get.
5736 /// - `value`: a pointer filled in with the current value of `attr`.
5737 ///
5738 /// ## Return value
5739 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
5740 /// information.
5741 ///
5742 /// ## Thread safety
5743 /// This function should only be called on the main thread.
5744 ///
5745 /// ## Availability
5746 /// This function is available since SDL 3.2.0.
5747 ///
5748 /// ## See also
5749 /// - [`SDL_GL_ResetAttributes`]
5750 /// - [`SDL_GL_SetAttribute`]
5751 pub fn SDL_GL_GetAttribute(
5752 attr: SDL_GLAttr,
5753 value: *mut ::core::ffi::c_int,
5754 ) -> ::core::primitive::bool;
5755}
5756
5757unsafe extern "C" {
5758 /// Create an OpenGL context for an OpenGL window, and make it current.
5759 ///
5760 /// The OpenGL context will be created with the current states set through
5761 /// [`SDL_GL_SetAttribute()`].
5762 ///
5763 /// The [`SDL_Window`] specified must have been created with the [`SDL_WINDOW_OPENGL`]
5764 /// flag, or context creation will fail.
5765 ///
5766 /// Windows users new to OpenGL should note that, for historical reasons, GL
5767 /// functions added after OpenGL version 1.1 are not available by default.
5768 /// Those functions must be loaded at run-time, either with an OpenGL
5769 /// extension-handling library or with [`SDL_GL_GetProcAddress()`] and its related
5770 /// functions.
5771 ///
5772 /// [`SDL_GLContext`] is opaque to the application.
5773 ///
5774 /// ## Parameters
5775 /// - `window`: the window to associate with the context.
5776 ///
5777 /// ## Return value
5778 /// Returns the OpenGL context associated with `window` or NULL on failure;
5779 /// call [`SDL_GetError()`] for more information.
5780 ///
5781 /// ## Thread safety
5782 /// This function should only be called on the main thread.
5783 ///
5784 /// ## Availability
5785 /// This function is available since SDL 3.2.0.
5786 ///
5787 /// ## See also
5788 /// - [`SDL_GL_DestroyContext`]
5789 /// - [`SDL_GL_MakeCurrent`]
5790 pub fn SDL_GL_CreateContext(window: *mut SDL_Window) -> SDL_GLContext;
5791}
5792
5793unsafe extern "C" {
5794 /// Set up an OpenGL context for rendering into an OpenGL window.
5795 ///
5796 /// The context must have been created with a compatible window.
5797 ///
5798 /// ## Parameters
5799 /// - `window`: the window to associate with the context.
5800 /// - `context`: the OpenGL context to associate with the window.
5801 ///
5802 /// ## Return value
5803 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
5804 /// information.
5805 ///
5806 /// ## Thread safety
5807 /// This function should only be called on the main thread.
5808 ///
5809 /// ## Availability
5810 /// This function is available since SDL 3.2.0.
5811 ///
5812 /// ## See also
5813 /// - [`SDL_GL_CreateContext`]
5814 pub fn SDL_GL_MakeCurrent(
5815 window: *mut SDL_Window,
5816 context: SDL_GLContext,
5817 ) -> ::core::primitive::bool;
5818}
5819
5820unsafe extern "C" {
5821 /// Get the currently active OpenGL window.
5822 ///
5823 /// ## Return value
5824 /// Returns the currently active OpenGL window on success or NULL on failure;
5825 /// call [`SDL_GetError()`] for more information.
5826 ///
5827 /// ## Thread safety
5828 /// This function should only be called on the main thread.
5829 ///
5830 /// ## Availability
5831 /// This function is available since SDL 3.2.0.
5832 pub fn SDL_GL_GetCurrentWindow() -> *mut SDL_Window;
5833}
5834
5835unsafe extern "C" {
5836 /// Get the currently active OpenGL context.
5837 ///
5838 /// ## Return value
5839 /// Returns the currently active OpenGL context or NULL on failure; call
5840 /// [`SDL_GetError()`] for more information.
5841 ///
5842 /// ## Thread safety
5843 /// This function should only be called on the main thread.
5844 ///
5845 /// ## Availability
5846 /// This function is available since SDL 3.2.0.
5847 ///
5848 /// ## See also
5849 /// - [`SDL_GL_MakeCurrent`]
5850 pub fn SDL_GL_GetCurrentContext() -> SDL_GLContext;
5851}
5852
5853unsafe extern "C" {
5854 /// Get the currently active EGL display.
5855 ///
5856 /// ## Return value
5857 /// Returns the currently active EGL display or NULL on failure; call
5858 /// [`SDL_GetError()`] for more information.
5859 ///
5860 /// ## Thread safety
5861 /// This function should only be called on the main thread.
5862 ///
5863 /// ## Availability
5864 /// This function is available since SDL 3.2.0.
5865 pub fn SDL_EGL_GetCurrentDisplay() -> SDL_EGLDisplay;
5866}
5867
5868unsafe extern "C" {
5869 /// Get the currently active EGL config.
5870 ///
5871 /// ## Return value
5872 /// Returns the currently active EGL config or NULL on failure; call
5873 /// [`SDL_GetError()`] for more information.
5874 ///
5875 /// ## Thread safety
5876 /// This function should only be called on the main thread.
5877 ///
5878 /// ## Availability
5879 /// This function is available since SDL 3.2.0.
5880 pub fn SDL_EGL_GetCurrentConfig() -> SDL_EGLConfig;
5881}
5882
5883unsafe extern "C" {
5884 /// Get the EGL surface associated with the window.
5885 ///
5886 /// ## Parameters
5887 /// - `window`: the window to query.
5888 ///
5889 /// ## Return value
5890 /// Returns the EGLSurface pointer associated with the window, or NULL on
5891 /// failure.
5892 ///
5893 /// ## Thread safety
5894 /// This function should only be called on the main thread.
5895 ///
5896 /// ## Availability
5897 /// This function is available since SDL 3.2.0.
5898 pub fn SDL_EGL_GetWindowSurface(window: *mut SDL_Window) -> SDL_EGLSurface;
5899}
5900
5901unsafe extern "C" {
5902 /// Sets the callbacks for defining custom EGLAttrib arrays for EGL
5903 /// initialization.
5904 ///
5905 /// Callbacks that aren't needed can be set to NULL.
5906 ///
5907 /// NOTE: These callback pointers will be reset after [`SDL_GL_ResetAttributes`].
5908 ///
5909 /// ## Parameters
5910 /// - `platformAttribCallback`: callback for attributes to pass to
5911 /// eglGetPlatformDisplay. May be NULL.
5912 /// - `surfaceAttribCallback`: callback for attributes to pass to
5913 /// eglCreateSurface. May be NULL.
5914 /// - `contextAttribCallback`: callback for attributes to pass to
5915 /// eglCreateContext. May be NULL.
5916 /// - `userdata`: a pointer that is passed to the callbacks.
5917 ///
5918 /// ## Thread safety
5919 /// This function should only be called on the main thread.
5920 ///
5921 /// ## Availability
5922 /// This function is available since SDL 3.2.0.
5923 pub fn SDL_EGL_SetAttributeCallbacks(
5924 platformAttribCallback: SDL_EGLAttribArrayCallback,
5925 surfaceAttribCallback: SDL_EGLIntArrayCallback,
5926 contextAttribCallback: SDL_EGLIntArrayCallback,
5927 userdata: *mut ::core::ffi::c_void,
5928 );
5929}
5930
5931unsafe extern "C" {
5932 /// Set the swap interval for the current OpenGL context.
5933 ///
5934 /// Some systems allow specifying -1 for the interval, to enable adaptive
5935 /// vsync. Adaptive vsync works the same as vsync, but if you've already missed
5936 /// the vertical retrace for a given frame, it swaps buffers immediately, which
5937 /// might be less jarring for the user during occasional framerate drops. If an
5938 /// application requests adaptive vsync and the system does not support it,
5939 /// this function will fail and return false. In such a case, you should
5940 /// probably retry the call with 1 for the interval.
5941 ///
5942 /// Adaptive vsync is implemented for some glX drivers with
5943 /// GLX_EXT_swap_control_tear, and for some Windows drivers with
5944 /// WGL_EXT_swap_control_tear.
5945 ///
5946 /// Read more on the Khronos wiki:
5947 /// <https://www.khronos.org/opengl/wiki/Swap_Interval#Adaptive_Vsync>
5948 ///
5949 /// ## Parameters
5950 /// - `interval`: 0 for immediate updates, 1 for updates synchronized with
5951 /// the vertical retrace, -1 for adaptive vsync.
5952 ///
5953 /// ## Return value
5954 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
5955 /// information.
5956 ///
5957 /// ## Thread safety
5958 /// This function should only be called on the main thread.
5959 ///
5960 /// ## Availability
5961 /// This function is available since SDL 3.2.0.
5962 ///
5963 /// ## See also
5964 /// - [`SDL_GL_GetSwapInterval`]
5965 pub fn SDL_GL_SetSwapInterval(interval: ::core::ffi::c_int) -> ::core::primitive::bool;
5966}
5967
5968unsafe extern "C" {
5969 /// Get the swap interval for the current OpenGL context.
5970 ///
5971 /// If the system can't determine the swap interval, or there isn't a valid
5972 /// current context, this function will set *interval to 0 as a safe default.
5973 ///
5974 /// ## Parameters
5975 /// - `interval`: output interval value. 0 if there is no vertical retrace
5976 /// synchronization, 1 if the buffer swap is synchronized with
5977 /// the vertical retrace, and -1 if late swaps happen
5978 /// immediately instead of waiting for the next retrace.
5979 ///
5980 /// ## Return value
5981 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
5982 /// information.
5983 ///
5984 /// ## Thread safety
5985 /// This function should only be called on the main thread.
5986 ///
5987 /// ## Availability
5988 /// This function is available since SDL 3.2.0.
5989 ///
5990 /// ## See also
5991 /// - [`SDL_GL_SetSwapInterval`]
5992 pub fn SDL_GL_GetSwapInterval(interval: *mut ::core::ffi::c_int) -> ::core::primitive::bool;
5993}
5994
5995unsafe extern "C" {
5996 /// Update a window with OpenGL rendering.
5997 ///
5998 /// This is used with double-buffered OpenGL contexts, which are the default.
5999 ///
6000 /// On macOS, make sure you bind 0 to the draw framebuffer before swapping the
6001 /// window, otherwise nothing will happen. If you aren't using
6002 /// glBindFramebuffer(), this is the default and you won't have to do anything
6003 /// extra.
6004 ///
6005 /// ## Parameters
6006 /// - `window`: the window to change.
6007 ///
6008 /// ## Return value
6009 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
6010 /// information.
6011 ///
6012 /// ## Thread safety
6013 /// This function should only be called on the main thread.
6014 ///
6015 /// ## Availability
6016 /// This function is available since SDL 3.2.0.
6017 pub fn SDL_GL_SwapWindow(window: *mut SDL_Window) -> ::core::primitive::bool;
6018}
6019
6020unsafe extern "C" {
6021 /// Delete an OpenGL context.
6022 ///
6023 /// ## Parameters
6024 /// - `context`: the OpenGL context to be deleted.
6025 ///
6026 /// ## Return value
6027 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
6028 /// information.
6029 ///
6030 /// ## Thread safety
6031 /// This function should only be called on the main thread.
6032 ///
6033 /// ## Availability
6034 /// This function is available since SDL 3.2.0.
6035 ///
6036 /// ## See also
6037 /// - [`SDL_GL_CreateContext`]
6038 pub fn SDL_GL_DestroyContext(context: SDL_GLContext) -> ::core::primitive::bool;
6039}
6040
6041/// Internal display mode data.
6042///
6043/// This lives as a field in [`SDL_DisplayMode`], as opaque data.
6044///
6045/// ## Availability
6046/// This struct is available since SDL 3.2.0.
6047///
6048/// ## See also
6049/// - [`SDL_DisplayMode`]
6050#[repr(C)]
6051pub struct SDL_DisplayModeData {
6052 _opaque: [::core::primitive::u8; 0],
6053}
6054
6055#[repr(C)]
6056pub struct SDL_GLContextState {
6057 _opaque: [::core::primitive::u8; 0],
6058}
6059
6060/// The struct used as an opaque handle to a window.
6061///
6062/// ## Availability
6063/// This struct is available since SDL 3.2.0.
6064///
6065/// ## See also
6066/// - [`SDL_CreateWindow`]
6067#[repr(C)]
6068pub struct SDL_Window {
6069 _opaque: [::core::primitive::u8; 0],
6070}
6071
6072#[cfg(doc)]
6073use crate::everything::*;