SDL 3.0
SDL_video.h
Go to the documentation of this file.
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20*/
21
22/**
23 * # CategoryVideo
24 *
25 * SDL video functions.
26 */
27
28#ifndef SDL_video_h_
29#define SDL_video_h_
30
31#include <SDL3/SDL_stdinc.h>
32#include <SDL3/SDL_error.h>
33#include <SDL3/SDL_pixels.h>
34#include <SDL3/SDL_properties.h>
35#include <SDL3/SDL_rect.h>
36#include <SDL3/SDL_surface.h>
37
38#include <SDL3/SDL_begin_code.h>
39/* Set up for C function definitions, even when using C++ */
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44/**
45 * This is a unique ID for a display for the time it is connected to the
46 * system, and is never reused for the lifetime of the application.
47 *
48 * If the display is disconnected and reconnected, it will get a new ID.
49 *
50 * The value 0 is an invalid ID.
51 *
52 * \since This datatype is available since SDL 3.0.0.
53 */
55
56/**
57 * This is a unique ID for a window.
58 *
59 * The value 0 is an invalid ID.
60 *
61 * \since This datatype is available since SDL 3.0.0.
62 */
64
65/* Global video properties... */
66
67/**
68 * The pointer to the global `wl_display` object used by the Wayland video
69 * backend.
70 *
71 * Can be set before the video subsystem is initialized to import an external
72 * `wl_display` object from an application or toolkit for use in SDL, or read
73 * after initialization to export the `wl_display` used by the Wayland video
74 * backend. Setting this property after the video subsystem has been
75 * initialized has no effect, and reading it when the video subsystem is
76 * uninitialized will either return the user provided value, if one was set
77 * prior to initialization, or NULL. See docs/README-wayland.md for more
78 * information.
79 */
80#define SDL_PROP_GLOBAL_VIDEO_WAYLAND_WL_DISPLAY_POINTER "SDL.video.wayland.wl_display"
81
82/**
83 * System theme.
84 *
85 * \since This enum is available since SDL 3.0.0.
86 */
87typedef enum SDL_SystemTheme
88{
89 SDL_SYSTEM_THEME_UNKNOWN, /**< Unknown system theme */
90 SDL_SYSTEM_THEME_LIGHT, /**< Light colored system theme */
91 SDL_SYSTEM_THEME_DARK /**< Dark colored system theme */
93
94/* Internal display mode data */
96
97/**
98 * The structure that defines a display mode.
99 *
100 * \since This struct is available since SDL 3.0.0.
101 *
102 * \sa SDL_GetFullscreenDisplayModes
103 * \sa SDL_GetDesktopDisplayMode
104 * \sa SDL_GetCurrentDisplayMode
105 * \sa SDL_SetWindowFullscreenMode
106 * \sa SDL_GetWindowFullscreenMode
107 */
108typedef struct SDL_DisplayMode
109{
110 SDL_DisplayID displayID; /**< the display this mode is associated with */
111 SDL_PixelFormat format; /**< pixel format */
112 int w; /**< width */
113 int h; /**< height */
114 float pixel_density; /**< scale converting size to pixels (e.g. a 1920x1080 mode with 2.0 scale would have 3840x2160 pixels) */
115 float refresh_rate; /**< refresh rate (or 0.0f for unspecified) */
116 int refresh_rate_numerator; /**< precise refresh rate numerator (or 0 for unspecified) */
117 int refresh_rate_denominator; /**< precise refresh rate denominator */
118
120
122
123/**
124 * Display orientation values; the way a display is rotated.
125 *
126 * \since This enum is available since SDL 3.0.0.
127 */
129{
130 SDL_ORIENTATION_UNKNOWN, /**< The display orientation can't be determined */
131 SDL_ORIENTATION_LANDSCAPE, /**< The display is in landscape mode, with the right side up, relative to portrait mode */
132 SDL_ORIENTATION_LANDSCAPE_FLIPPED, /**< The display is in landscape mode, with the left side up, relative to portrait mode */
133 SDL_ORIENTATION_PORTRAIT, /**< The display is in portrait mode */
134 SDL_ORIENTATION_PORTRAIT_FLIPPED /**< The display is in portrait mode, upside down */
136
137/**
138 * The struct used as an opaque handle to a window.
139 *
140 * \since This struct is available since SDL 3.0.0.
141 *
142 * \sa SDL_CreateWindow
143 */
144typedef struct SDL_Window SDL_Window;
145
146/**
147 * The flags on a window.
148 *
149 * These cover a lot of true/false, or on/off, window state. Some of it is
150 * immutable after being set through SDL_CreateWindow(), some of it can be
151 * changed on existing windows by the app, and some of it might be altered by
152 * the user or system outside of the app's control.
153 *
154 * \since This datatype is available since SDL 3.0.0.
155 *
156 * \sa SDL_GetWindowFlags
157 */
159
160#define SDL_WINDOW_FULLSCREEN SDL_UINT64_C(0x0000000000000001) /**< window is in fullscreen mode */
161#define SDL_WINDOW_OPENGL SDL_UINT64_C(0x0000000000000002) /**< window usable with OpenGL context */
162#define SDL_WINDOW_OCCLUDED SDL_UINT64_C(0x0000000000000004) /**< window is occluded */
163#define SDL_WINDOW_HIDDEN SDL_UINT64_C(0x0000000000000008) /**< window is neither mapped onto the desktop nor shown in the taskbar/dock/window list; SDL_ShowWindow() is required for it to become visible */
164#define SDL_WINDOW_BORDERLESS SDL_UINT64_C(0x0000000000000010) /**< no window decoration */
165#define SDL_WINDOW_RESIZABLE SDL_UINT64_C(0x0000000000000020) /**< window can be resized */
166#define SDL_WINDOW_MINIMIZED SDL_UINT64_C(0x0000000000000040) /**< window is minimized */
167#define SDL_WINDOW_MAXIMIZED SDL_UINT64_C(0x0000000000000080) /**< window is maximized */
168#define SDL_WINDOW_MOUSE_GRABBED SDL_UINT64_C(0x0000000000000100) /**< window has grabbed mouse input */
169#define SDL_WINDOW_INPUT_FOCUS SDL_UINT64_C(0x0000000000000200) /**< window has input focus */
170#define SDL_WINDOW_MOUSE_FOCUS SDL_UINT64_C(0x0000000000000400) /**< window has mouse focus */
171#define SDL_WINDOW_EXTERNAL SDL_UINT64_C(0x0000000000000800) /**< window not created by SDL */
172#define SDL_WINDOW_MODAL SDL_UINT64_C(0x0000000000001000) /**< window is modal */
173#define SDL_WINDOW_HIGH_PIXEL_DENSITY SDL_UINT64_C(0x0000000000002000) /**< window uses high pixel density back buffer if possible */
174#define SDL_WINDOW_MOUSE_CAPTURE SDL_UINT64_C(0x0000000000004000) /**< window has mouse captured (unrelated to MOUSE_GRABBED) */
175#define SDL_WINDOW_MOUSE_RELATIVE_MODE SDL_UINT64_C(0x0000000000008000) /**< window has relative mode enabled */
176#define SDL_WINDOW_ALWAYS_ON_TOP SDL_UINT64_C(0x0000000000010000) /**< window should always be above others */
177#define SDL_WINDOW_UTILITY SDL_UINT64_C(0x0000000000020000) /**< window should be treated as a utility window, not showing in the task bar and window list */
178#define SDL_WINDOW_TOOLTIP SDL_UINT64_C(0x0000000000040000) /**< window should be treated as a tooltip and does not get mouse or keyboard focus, requires a parent window */
179#define SDL_WINDOW_POPUP_MENU SDL_UINT64_C(0x0000000000080000) /**< window should be treated as a popup menu, requires a parent window */
180#define SDL_WINDOW_KEYBOARD_GRABBED SDL_UINT64_C(0x0000000000100000) /**< window has grabbed keyboard input */
181#define SDL_WINDOW_VULKAN SDL_UINT64_C(0x0000000010000000) /**< window usable for Vulkan surface */
182#define SDL_WINDOW_METAL SDL_UINT64_C(0x0000000020000000) /**< window usable for Metal view */
183#define SDL_WINDOW_TRANSPARENT SDL_UINT64_C(0x0000000040000000) /**< window with transparent buffer */
184#define SDL_WINDOW_NOT_FOCUSABLE SDL_UINT64_C(0x0000000080000000) /**< window should not be focusable */
185
186
187/**
188 * Used to indicate that you don't care what the window position is.
189 *
190 * \since This macro is available since SDL 3.0.0.
191 */
192#define SDL_WINDOWPOS_UNDEFINED_MASK 0x1FFF0000u
193#define SDL_WINDOWPOS_UNDEFINED_DISPLAY(X) (SDL_WINDOWPOS_UNDEFINED_MASK|(X))
194#define SDL_WINDOWPOS_UNDEFINED SDL_WINDOWPOS_UNDEFINED_DISPLAY(0)
195#define SDL_WINDOWPOS_ISUNDEFINED(X) \
196 (((X)&0xFFFF0000) == SDL_WINDOWPOS_UNDEFINED_MASK)
197
198/**
199 * Used to indicate that the window position should be centered.
200 *
201 * \since This macro is available since SDL 3.0.0.
202 */
203#define SDL_WINDOWPOS_CENTERED_MASK 0x2FFF0000u
204#define SDL_WINDOWPOS_CENTERED_DISPLAY(X) (SDL_WINDOWPOS_CENTERED_MASK|(X))
205#define SDL_WINDOWPOS_CENTERED SDL_WINDOWPOS_CENTERED_DISPLAY(0)
206#define SDL_WINDOWPOS_ISCENTERED(X) \
207 (((X)&0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK)
208
209/**
210 * Window flash operation.
211 *
212 * \since This enum is available since SDL 3.0.0.
213 */
215{
216 SDL_FLASH_CANCEL, /**< Cancel any window flash state */
217 SDL_FLASH_BRIEFLY, /**< Flash the window briefly to get attention */
218 SDL_FLASH_UNTIL_FOCUSED /**< Flash the window until it gets focus */
220
221/**
222 * An opaque handle to an OpenGL context.
223 *
224 * \since This datatype is available since SDL 3.0.0.
225 *
226 * \sa SDL_GL_CreateContext
227 */
228typedef struct SDL_GLContextState *SDL_GLContext;
229
230/**
231 * Opaque EGL types.
232 *
233 * \since This datatype is available since SDL 3.0.0.
234 */
235typedef void *SDL_EGLDisplay;
236typedef void *SDL_EGLConfig;
237typedef void *SDL_EGLSurface;
238typedef intptr_t SDL_EGLAttrib;
239typedef int SDL_EGLint;
240
241/**
242 * EGL platform attribute initialization callback.
243 *
244 * This is called when SDL is attempting to create an EGL context, to let the
245 * app add extra attributes to its eglGetPlatformDisplay() call.
246 *
247 * The callback should return a pointer to an EGL attribute array terminated
248 * with `EGL_NONE`. If this function returns NULL, the SDL_CreateWindow
249 * process will fail gracefully.
250 *
251 * The returned pointer should be allocated with SDL_malloc() and will be
252 * passed to SDL_free().
253 *
254 * The arrays returned by each callback will be appended to the existing
255 * attribute arrays defined by SDL.
256 *
257 * \param userdata an app-controlled pointer that is passed to the callback.
258 * \returns a newly-allocated array of attributes, terminated with `EGL_NONE`.
259 *
260 * \since This datatype is available since SDL 3.0.0.
261 *
262 * \sa SDL_EGL_SetAttributeCallbacks
263 */
264typedef SDL_EGLAttrib *(SDLCALL *SDL_EGLAttribArrayCallback)(void *userdata);
265
266/**
267 * EGL surface/context attribute initialization callback types.
268 *
269 * This is called when SDL is attempting to create an EGL surface, to let the
270 * app add extra attributes to its eglCreateWindowSurface() or
271 * eglCreateContext calls.
272 *
273 * For convenience, the EGLDisplay and EGLConfig to use are provided to the
274 * callback.
275 *
276 * The callback should return a pointer to an EGL attribute array terminated
277 * with `EGL_NONE`. If this function returns NULL, the SDL_CreateWindow
278 * process will fail gracefully.
279 *
280 * The returned pointer should be allocated with SDL_malloc() and will be
281 * passed to SDL_free().
282 *
283 * The arrays returned by each callback will be appended to the existing
284 * attribute arrays defined by SDL.
285 *
286 * \param userdata an app-controlled pointer that is passed to the callback.
287 * \param display the EGL display to be used.
288 * \param config the EGL config to be used.
289 * \returns a newly-allocated array of attributes, terminated with `EGL_NONE`.
290 *
291 * \since This datatype is available since SDL 3.0.0.
292 *
293 * \sa SDL_EGL_SetAttributeCallbacks
294 */
295typedef SDL_EGLint *(SDLCALL *SDL_EGLIntArrayCallback)(void *userdata, SDL_EGLDisplay display, SDL_EGLConfig config);
296
297/**
298 * An enumeration of OpenGL configuration attributes.
299 *
300 * While you can set most OpenGL attributes normally, the attributes listed
301 * above must be known before SDL creates the window that will be used with
302 * the OpenGL context. These attributes are set and read with
303 * SDL_GL_SetAttribute() and SDL_GL_GetAttribute().
304 *
305 * In some cases, these attributes are minimum requests; the GL does not
306 * promise to give you exactly what you asked for. It's possible to ask for a
307 * 16-bit depth buffer and get a 24-bit one instead, for example, or to ask
308 * for no stencil buffer and still have one available. Context creation should
309 * fail if the GL can't provide your requested attributes at a minimum, but
310 * you should check to see exactly what you got.
311 *
312 * \since This enum is available since SDL 3.0.0.
313 */
314typedef enum SDL_GLattr
315{
316 SDL_GL_RED_SIZE, /**< the minimum number of bits for the red channel of the color buffer; defaults to 3. */
317 SDL_GL_GREEN_SIZE, /**< the minimum number of bits for the green channel of the color buffer; defaults to 3. */
318 SDL_GL_BLUE_SIZE, /**< the minimum number of bits for the blue channel of the color buffer; defaults to 2. */
319 SDL_GL_ALPHA_SIZE, /**< the minimum number of bits for the alpha channel of the color buffer; defaults to 0. */
320 SDL_GL_BUFFER_SIZE, /**< the minimum number of bits for frame buffer size; defaults to 0. */
321 SDL_GL_DOUBLEBUFFER, /**< whether the output is single or double buffered; defaults to double buffering on. */
322 SDL_GL_DEPTH_SIZE, /**< the minimum number of bits in the depth buffer; defaults to 16. */
323 SDL_GL_STENCIL_SIZE, /**< the minimum number of bits in the stencil buffer; defaults to 0. */
324 SDL_GL_ACCUM_RED_SIZE, /**< the minimum number of bits for the red channel of the accumulation buffer; defaults to 0. */
325 SDL_GL_ACCUM_GREEN_SIZE, /**< the minimum number of bits for the green channel of the accumulation buffer; defaults to 0. */
326 SDL_GL_ACCUM_BLUE_SIZE, /**< the minimum number of bits for the blue channel of the accumulation buffer; defaults to 0. */
327 SDL_GL_ACCUM_ALPHA_SIZE, /**< the minimum number of bits for the alpha channel of the accumulation buffer; defaults to 0. */
328 SDL_GL_STEREO, /**< whether the output is stereo 3D; defaults to off. */
329 SDL_GL_MULTISAMPLEBUFFERS, /**< the number of buffers used for multisample anti-aliasing; defaults to 0. */
330 SDL_GL_MULTISAMPLESAMPLES, /**< the number of samples used around the current pixel used for multisample anti-aliasing. */
331 SDL_GL_ACCELERATED_VISUAL, /**< set to 1 to require hardware acceleration, set to 0 to force software rendering; defaults to allow either. */
332 SDL_GL_RETAINED_BACKING, /**< not used (deprecated). */
333 SDL_GL_CONTEXT_MAJOR_VERSION, /**< OpenGL context major version. */
334 SDL_GL_CONTEXT_MINOR_VERSION, /**< OpenGL context minor version. */
335 SDL_GL_CONTEXT_FLAGS, /**< some combination of 0 or more of elements of the SDL_GLcontextFlag enumeration; defaults to 0. */
336 SDL_GL_CONTEXT_PROFILE_MASK, /**< type of GL context (Core, Compatibility, ES). See SDL_GLprofile; default value depends on platform. */
337 SDL_GL_SHARE_WITH_CURRENT_CONTEXT, /**< OpenGL context sharing; defaults to 0. */
338 SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, /**< requests sRGB capable visual; defaults to 0. */
339 SDL_GL_CONTEXT_RELEASE_BEHAVIOR, /**< sets context the release behavior. See SDL_GLcontextReleaseFlag; defaults to FLUSH. */
340 SDL_GL_CONTEXT_RESET_NOTIFICATION, /**< set context reset notification. See SDL_GLContextResetNotification; defaults to NO_NOTIFICATION. */
345
346/**
347 * Possible values to be set for the SDL_GL_CONTEXT_PROFILE_MASK attribute.
348 *
349 * \since This enum is available since SDL 3.0.0.
350 */
351typedef enum SDL_GLprofile
352{
355 SDL_GL_CONTEXT_PROFILE_ES = 0x0004 /**< GLX_CONTEXT_ES2_PROFILE_BIT_EXT */
357
358/**
359 * Possible values to be set for the SDL_GL_CONTEXT_FLAGS attribute.
360 *
361 * \since This enum is available since SDL 3.0.0.
362 */
370
371/**
372 * Possible values to be set for the SDL_GL_CONTEXT_RELEASE_BEHAVIOR
373 * attribute.
374 *
375 * \since This enum is available since SDL 3.0.0.
376 */
382
383/**
384 * Possible values to be set SDL_GL_CONTEXT_RESET_NOTIFICATION attribute.
385 *
386 * \since This enum is available since SDL 3.0.0.
387 */
393
394/* Function prototypes */
395
396/**
397 * Get the number of video drivers compiled into SDL.
398 *
399 * \returns the number of built in video drivers.
400 *
401 * \since This function is available since SDL 3.0.0.
402 *
403 * \sa SDL_GetVideoDriver
404 */
405extern SDL_DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void);
406
407/**
408 * Get the name of a built in video driver.
409 *
410 * The video drivers are presented in the order in which they are normally
411 * checked during initialization.
412 *
413 * The names of drivers are all simple, low-ASCII identifiers, like "cocoa",
414 * "x11" or "windows". These never have Unicode characters, and are not meant
415 * to be proper names.
416 *
417 * \param index the index of a video driver.
418 * \returns the name of the video driver with the given **index**.
419 *
420 * \since This function is available since SDL 3.0.0.
421 *
422 * \sa SDL_GetNumVideoDrivers
423 */
424extern SDL_DECLSPEC const char * SDLCALL SDL_GetVideoDriver(int index);
425
426/**
427 * Get the name of the currently initialized video driver.
428 *
429 * The names of drivers are all simple, low-ASCII identifiers, like "cocoa",
430 * "x11" or "windows". These never have Unicode characters, and are not meant
431 * to be proper names.
432 *
433 * \returns the name of the current video driver or NULL if no driver has been
434 * initialized.
435 *
436 * \since This function is available since SDL 3.0.0.
437 *
438 * \sa SDL_GetNumVideoDrivers
439 * \sa SDL_GetVideoDriver
440 */
441extern SDL_DECLSPEC const char * SDLCALL SDL_GetCurrentVideoDriver(void);
442
443/**
444 * Get the current system theme.
445 *
446 * \returns the current system theme, light, dark, or unknown.
447 *
448 * \since This function is available since SDL 3.0.0.
449 */
450extern SDL_DECLSPEC SDL_SystemTheme SDLCALL SDL_GetSystemTheme(void);
451
452/**
453 * Get a list of currently connected displays.
454 *
455 * \param count a pointer filled in with the number of displays returned, may
456 * be NULL.
457 * \returns a 0 terminated array of display instance IDs or NULL on failure;
458 * call SDL_GetError() for more information. This should be freed
459 * with SDL_free() when it is no longer needed.
460 *
461 * \since This function is available since SDL 3.0.0.
462 */
463extern SDL_DECLSPEC SDL_DisplayID * SDLCALL SDL_GetDisplays(int *count);
464
465/**
466 * Return the primary display.
467 *
468 * \returns the instance ID of the primary display on success or 0 on failure;
469 * call SDL_GetError() for more information.
470 *
471 * \since This function is available since SDL 3.0.0.
472 *
473 * \sa SDL_GetDisplays
474 */
475extern SDL_DECLSPEC SDL_DisplayID SDLCALL SDL_GetPrimaryDisplay(void);
476
477/**
478 * Get the properties associated with a display.
479 *
480 * The following read-only properties are provided by SDL:
481 *
482 * - `SDL_PROP_DISPLAY_HDR_ENABLED_BOOLEAN`: true if the display has HDR
483 * headroom above the SDR white point. This is for informational and
484 * diagnostic purposes only, as not all platforms provide this information
485 * at the display level.
486 *
487 * On KMS/DRM:
488 *
489 * - `SDL_PROP_DISPLAY_KMSDRM_PANEL_ORIENTATION_NUMBER`: the "panel
490 * orientation" property for the display in degrees of clockwise rotation.
491 * Note that this is provided only as a hint, and the application is
492 * responsible for any coordinate transformations needed to conform to the
493 * requested display orientation.
494 *
495 * \param displayID the instance ID of the display to query.
496 * \returns a valid property ID on success or 0 on failure; call
497 * SDL_GetError() for more information.
498 *
499 * \since This function is available since SDL 3.0.0.
500 */
501extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetDisplayProperties(SDL_DisplayID displayID);
502
503#define SDL_PROP_DISPLAY_HDR_ENABLED_BOOLEAN "SDL.display.HDR_enabled"
504#define SDL_PROP_DISPLAY_KMSDRM_PANEL_ORIENTATION_NUMBER "SDL.display.KMSDRM.panel_orientation"
505
506/**
507 * Get the name of a display in UTF-8 encoding.
508 *
509 * \param displayID the instance ID of the display to query.
510 * \returns the name of a display or NULL on failure; call SDL_GetError() for
511 * more information.
512 *
513 * \since This function is available since SDL 3.0.0.
514 *
515 * \sa SDL_GetDisplays
516 */
517extern SDL_DECLSPEC const char * SDLCALL SDL_GetDisplayName(SDL_DisplayID displayID);
518
519/**
520 * Get the desktop area represented by a display.
521 *
522 * The primary display is always located at (0,0).
523 *
524 * \param displayID the instance ID of the display to query.
525 * \param rect the SDL_Rect structure filled in with the display bounds.
526 * \returns true on success or false on failure; call SDL_GetError() for more
527 * information.
528 *
529 * \since This function is available since SDL 3.0.0.
530 *
531 * \sa SDL_GetDisplayUsableBounds
532 * \sa SDL_GetDisplays
533 */
534extern SDL_DECLSPEC bool SDLCALL SDL_GetDisplayBounds(SDL_DisplayID displayID, SDL_Rect *rect);
535
536/**
537 * Get the usable desktop area represented by a display, in screen
538 * coordinates.
539 *
540 * This is the same area as SDL_GetDisplayBounds() reports, but with portions
541 * reserved by the system removed. For example, on Apple's macOS, this
542 * subtracts the area occupied by the menu bar and dock.
543 *
544 * Setting a window to be fullscreen generally bypasses these unusable areas,
545 * so these are good guidelines for the maximum space available to a
546 * non-fullscreen window.
547 *
548 * \param displayID the instance ID of the display to query.
549 * \param rect the SDL_Rect structure filled in with the display bounds.
550 * \returns true on success or false on failure; call SDL_GetError() for more
551 * information.
552 *
553 * \since This function is available since SDL 3.0.0.
554 *
555 * \sa SDL_GetDisplayBounds
556 * \sa SDL_GetDisplays
557 */
558extern SDL_DECLSPEC bool SDLCALL SDL_GetDisplayUsableBounds(SDL_DisplayID displayID, SDL_Rect *rect);
559
560/**
561 * Get the orientation of a display when it is unrotated.
562 *
563 * \param displayID the instance ID of the display to query.
564 * \returns the SDL_DisplayOrientation enum value of the display, or
565 * `SDL_ORIENTATION_UNKNOWN` if it isn't available.
566 *
567 * \since This function is available since SDL 3.0.0.
568 *
569 * \sa SDL_GetDisplays
570 */
572
573/**
574 * Get the orientation of a display.
575 *
576 * \param displayID the instance ID of the display to query.
577 * \returns the SDL_DisplayOrientation enum value of the display, or
578 * `SDL_ORIENTATION_UNKNOWN` if it isn't available.
579 *
580 * \since This function is available since SDL 3.0.0.
581 *
582 * \sa SDL_GetDisplays
583 */
585
586/**
587 * Get the content scale of a display.
588 *
589 * The content scale is the expected scale for content based on the DPI
590 * settings of the display. For example, a 4K display might have a 2.0 (200%)
591 * display scale, which means that the user expects UI elements to be twice as
592 * big on this display, to aid in readability.
593 *
594 * \param displayID the instance ID of the display to query.
595 * \returns the content scale of the display, or 0.0f on failure; call
596 * SDL_GetError() for more information.
597 *
598 * \since This function is available since SDL 3.0.0.
599 *
600 * \sa SDL_GetDisplays
601 */
602extern SDL_DECLSPEC float SDLCALL SDL_GetDisplayContentScale(SDL_DisplayID displayID);
603
604/**
605 * Get a list of fullscreen display modes available on a display.
606 *
607 * The display modes are sorted in this priority:
608 *
609 * - w -> largest to smallest
610 * - h -> largest to smallest
611 * - bits per pixel -> more colors to fewer colors
612 * - packed pixel layout -> largest to smallest
613 * - refresh rate -> highest to lowest
614 * - pixel density -> lowest to highest
615 *
616 * \param displayID the instance ID of the display to query.
617 * \param count a pointer filled in with the number of display modes returned,
618 * may be NULL.
619 * \returns a NULL terminated array of display mode pointers or NULL on
620 * failure; call SDL_GetError() for more information. This is a
621 * single allocation that should be freed with SDL_free() when it is
622 * no longer needed.
623 *
624 * \since This function is available since SDL 3.0.0.
625 *
626 * \sa SDL_GetDisplays
627 */
628extern SDL_DECLSPEC SDL_DisplayMode ** SDLCALL SDL_GetFullscreenDisplayModes(SDL_DisplayID displayID, int *count);
629
630/**
631 * Get the closest match to the requested display mode.
632 *
633 * The available display modes are scanned and `closest` is filled in with the
634 * closest mode matching the requested mode and returned. The mode format and
635 * refresh rate default to the desktop mode if they are set to 0. The modes
636 * are scanned with size being first priority, format being second priority,
637 * and finally checking the refresh rate. If all the available modes are too
638 * small, then NULL is returned.
639 *
640 * \param displayID the instance ID of the display to query.
641 * \param w the width in pixels of the desired display mode.
642 * \param h the height in pixels of the desired display mode.
643 * \param refresh_rate the refresh rate of the desired display mode, or 0.0f
644 * for the desktop refresh rate.
645 * \param include_high_density_modes boolean to include high density modes in
646 * the search.
647 * \param mode a pointer filled in with the closest display mode equal to or
648 * larger than the desired mode.
649 * \returns true on success or false on failure; call SDL_GetError() for more
650 * information.
651 *
652 * \since This function is available since SDL 3.0.0.
653 *
654 * \sa SDL_GetDisplays
655 * \sa SDL_GetFullscreenDisplayModes
656 */
657extern SDL_DECLSPEC bool SDLCALL SDL_GetClosestFullscreenDisplayMode(SDL_DisplayID displayID, int w, int h, float refresh_rate, bool include_high_density_modes, SDL_DisplayMode *mode);
658
659/**
660 * Get information about the desktop's display mode.
661 *
662 * There's a difference between this function and SDL_GetCurrentDisplayMode()
663 * when SDL runs fullscreen and has changed the resolution. In that case this
664 * function will return the previous native display mode, and not the current
665 * display mode.
666 *
667 * \param displayID the instance ID of the display to query.
668 * \returns a pointer to the desktop display mode or NULL on failure; call
669 * SDL_GetError() for more information.
670 *
671 * \since This function is available since SDL 3.0.0.
672 *
673 * \sa SDL_GetCurrentDisplayMode
674 * \sa SDL_GetDisplays
675 */
676extern SDL_DECLSPEC const SDL_DisplayMode * SDLCALL SDL_GetDesktopDisplayMode(SDL_DisplayID displayID);
677
678/**
679 * Get information about the current display mode.
680 *
681 * There's a difference between this function and SDL_GetDesktopDisplayMode()
682 * when SDL runs fullscreen and has changed the resolution. In that case this
683 * function will return the current display mode, and not the previous native
684 * display mode.
685 *
686 * \param displayID the instance ID of the display to query.
687 * \returns a pointer to the desktop display mode or NULL on failure; call
688 * SDL_GetError() for more information.
689 *
690 * \since This function is available since SDL 3.0.0.
691 *
692 * \sa SDL_GetDesktopDisplayMode
693 * \sa SDL_GetDisplays
694 */
695extern SDL_DECLSPEC const SDL_DisplayMode * SDLCALL SDL_GetCurrentDisplayMode(SDL_DisplayID displayID);
696
697/**
698 * Get the display containing a point.
699 *
700 * \param point the point to query.
701 * \returns the instance ID of the display containing the point or 0 on
702 * failure; call SDL_GetError() for more information.
703 *
704 * \since This function is available since SDL 3.0.0.
705 *
706 * \sa SDL_GetDisplayBounds
707 * \sa SDL_GetDisplays
708 */
709extern SDL_DECLSPEC SDL_DisplayID SDLCALL SDL_GetDisplayForPoint(const SDL_Point *point);
710
711/**
712 * Get the display primarily containing a rect.
713 *
714 * \param rect the rect to query.
715 * \returns the instance ID of the display entirely containing the rect or
716 * closest to the center of the rect on success or 0 on failure; call
717 * SDL_GetError() for more information.
718 *
719 * \since This function is available since SDL 3.0.0.
720 *
721 * \sa SDL_GetDisplayBounds
722 * \sa SDL_GetDisplays
723 */
724extern SDL_DECLSPEC SDL_DisplayID SDLCALL SDL_GetDisplayForRect(const SDL_Rect *rect);
725
726/**
727 * Get the display associated with a window.
728 *
729 * \param window the window to query.
730 * \returns the instance ID of the display containing the center of the window
731 * on success or 0 on failure; call SDL_GetError() for more
732 * information.
733 *
734 * \since This function is available since SDL 3.0.0.
735 *
736 * \sa SDL_GetDisplayBounds
737 * \sa SDL_GetDisplays
738 */
739extern SDL_DECLSPEC SDL_DisplayID SDLCALL SDL_GetDisplayForWindow(SDL_Window *window);
740
741/**
742 * Get the pixel density of a window.
743 *
744 * This is a ratio of pixel size to window size. For example, if the window is
745 * 1920x1080 and it has a high density back buffer of 3840x2160 pixels, it
746 * would have a pixel density of 2.0.
747 *
748 * \param window the window to query.
749 * \returns the pixel density or 0.0f on failure; call SDL_GetError() for more
750 * information.
751 *
752 * \since This function is available since SDL 3.0.0.
753 *
754 * \sa SDL_GetWindowDisplayScale
755 */
756extern SDL_DECLSPEC float SDLCALL SDL_GetWindowPixelDensity(SDL_Window *window);
757
758/**
759 * Get the content display scale relative to a window's pixel size.
760 *
761 * This is a combination of the window pixel density and the display content
762 * scale, and is the expected scale for displaying content in this window. For
763 * example, if a 3840x2160 window had a display scale of 2.0, the user expects
764 * the content to take twice as many pixels and be the same physical size as
765 * if it were being displayed in a 1920x1080 window with a display scale of
766 * 1.0.
767 *
768 * Conceptually this value corresponds to the scale display setting, and is
769 * updated when that setting is changed, or the window moves to a display with
770 * a different scale setting.
771 *
772 * \param window the window to query.
773 * \returns the display scale, or 0.0f on failure; call SDL_GetError() for
774 * more information.
775 *
776 * \since This function is available since SDL 3.0.0.
777 */
778extern SDL_DECLSPEC float SDLCALL SDL_GetWindowDisplayScale(SDL_Window *window);
779
780/**
781 * Set the display mode to use when a window is visible and fullscreen.
782 *
783 * This only affects the display mode used when the window is fullscreen. To
784 * change the window size when the window is not fullscreen, use
785 * SDL_SetWindowSize().
786 *
787 * If the window is currently in the fullscreen state, this request is
788 * asynchronous on some windowing systems and the new mode dimensions may not
789 * be applied immediately upon the return of this function. If an immediate
790 * change is required, call SDL_SyncWindow() to block until the changes have
791 * taken effect.
792 *
793 * When the new mode takes effect, an SDL_EVENT_WINDOW_RESIZED and/or an
794 * SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED event will be emitted with the new mode
795 * dimensions.
796 *
797 * \param window the window to affect.
798 * \param mode a pointer to the display mode to use, which can be NULL for
799 * borderless fullscreen desktop mode, or one of the fullscreen
800 * modes returned by SDL_GetFullscreenDisplayModes() to set an
801 * exclusive fullscreen mode.
802 * \returns true on success or false on failure; call SDL_GetError() for more
803 * information.
804 *
805 * \since This function is available since SDL 3.0.0.
806 *
807 * \sa SDL_GetWindowFullscreenMode
808 * \sa SDL_SetWindowFullscreen
809 * \sa SDL_SyncWindow
810 */
811extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowFullscreenMode(SDL_Window *window, const SDL_DisplayMode *mode);
812
813/**
814 * Query the display mode to use when a window is visible at fullscreen.
815 *
816 * \param window the window to query.
817 * \returns a pointer to the exclusive fullscreen mode to use or NULL for
818 * borderless fullscreen desktop mode.
819 *
820 * \since This function is available since SDL 3.0.0.
821 *
822 * \sa SDL_SetWindowFullscreenMode
823 * \sa SDL_SetWindowFullscreen
824 */
825extern SDL_DECLSPEC const SDL_DisplayMode * SDLCALL SDL_GetWindowFullscreenMode(SDL_Window *window);
826
827/**
828 * Get the raw ICC profile data for the screen the window is currently on.
829 *
830 * \param window the window to query.
831 * \param size the size of the ICC profile.
832 * \returns the raw ICC profile data on success or NULL on failure; call
833 * SDL_GetError() for more information. This should be freed with
834 * SDL_free() when it is no longer needed.
835 *
836 * \since This function is available since SDL 3.0.0.
837 */
838extern SDL_DECLSPEC void * SDLCALL SDL_GetWindowICCProfile(SDL_Window *window, size_t *size);
839
840/**
841 * Get the pixel format associated with the window.
842 *
843 * \param window the window to query.
844 * \returns the pixel format of the window on success or
845 * SDL_PIXELFORMAT_UNKNOWN on failure; call SDL_GetError() for more
846 * information.
847 *
848 * \since This function is available since SDL 3.0.0.
849 */
850extern SDL_DECLSPEC SDL_PixelFormat SDLCALL SDL_GetWindowPixelFormat(SDL_Window *window);
851
852/**
853 * Get a list of valid windows.
854 *
855 * \param count a pointer filled in with the number of windows returned, may
856 * be NULL.
857 * \returns a NULL terminated array of SDL_Window pointers or NULL on failure;
858 * call SDL_GetError() for more information. This is a single
859 * allocation that should be freed with SDL_free() when it is no
860 * longer needed.
861 *
862 * \since This function is available since SDL 3.0.0.
863 */
864extern SDL_DECLSPEC SDL_Window ** SDLCALL SDL_GetWindows(int *count);
865
866/**
867 * Create a window with the specified dimensions and flags.
868 *
869 * `flags` may be any of the following OR'd together:
870 *
871 * - `SDL_WINDOW_FULLSCREEN`: fullscreen window at desktop resolution
872 * - `SDL_WINDOW_OPENGL`: window usable with an OpenGL context
873 * - `SDL_WINDOW_OCCLUDED`: window partially or completely obscured by another
874 * window
875 * - `SDL_WINDOW_HIDDEN`: window is not visible
876 * - `SDL_WINDOW_BORDERLESS`: no window decoration
877 * - `SDL_WINDOW_RESIZABLE`: window can be resized
878 * - `SDL_WINDOW_MINIMIZED`: window is minimized
879 * - `SDL_WINDOW_MAXIMIZED`: window is maximized
880 * - `SDL_WINDOW_MOUSE_GRABBED`: window has grabbed mouse focus
881 * - `SDL_WINDOW_INPUT_FOCUS`: window has input focus
882 * - `SDL_WINDOW_MOUSE_FOCUS`: window has mouse focus
883 * - `SDL_WINDOW_EXTERNAL`: window not created by SDL
884 * - `SDL_WINDOW_MODAL`: window is modal
885 * - `SDL_WINDOW_HIGH_PIXEL_DENSITY`: window uses high pixel density back
886 * buffer if possible
887 * - `SDL_WINDOW_MOUSE_CAPTURE`: window has mouse captured (unrelated to
888 * MOUSE_GRABBED)
889 * - `SDL_WINDOW_ALWAYS_ON_TOP`: window should always be above others
890 * - `SDL_WINDOW_UTILITY`: window should be treated as a utility window, not
891 * showing in the task bar and window list
892 * - `SDL_WINDOW_TOOLTIP`: window should be treated as a tooltip and does not
893 * get mouse or keyboard focus, requires a parent window
894 * - `SDL_WINDOW_POPUP_MENU`: window should be treated as a popup menu,
895 * requires a parent window
896 * - `SDL_WINDOW_KEYBOARD_GRABBED`: window has grabbed keyboard input
897 * - `SDL_WINDOW_VULKAN`: window usable with a Vulkan instance
898 * - `SDL_WINDOW_METAL`: window usable with a Metal instance
899 * - `SDL_WINDOW_TRANSPARENT`: window with transparent buffer
900 * - `SDL_WINDOW_NOT_FOCUSABLE`: window should not be focusable
901 *
902 * The SDL_Window is implicitly shown if SDL_WINDOW_HIDDEN is not set.
903 *
904 * On Apple's macOS, you **must** set the NSHighResolutionCapable Info.plist
905 * property to YES, otherwise you will not receive a High-DPI OpenGL canvas.
906 *
907 * The window pixel size may differ from its window coordinate size if the
908 * window is on a high pixel density display. Use SDL_GetWindowSize() to query
909 * the client area's size in window coordinates, and
910 * SDL_GetWindowSizeInPixels() or SDL_GetRenderOutputSize() to query the
911 * drawable size in pixels. Note that the drawable size can vary after the
912 * window is created and should be queried again if you get an
913 * SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED event.
914 *
915 * If the window is created with any of the SDL_WINDOW_OPENGL or
916 * SDL_WINDOW_VULKAN flags, then the corresponding LoadLibrary function
917 * (SDL_GL_LoadLibrary or SDL_Vulkan_LoadLibrary) is called and the
918 * corresponding UnloadLibrary function is called by SDL_DestroyWindow().
919 *
920 * If SDL_WINDOW_VULKAN is specified and there isn't a working Vulkan driver,
921 * SDL_CreateWindow() will fail because SDL_Vulkan_LoadLibrary() will fail.
922 *
923 * If SDL_WINDOW_METAL is specified on an OS that does not support Metal,
924 * SDL_CreateWindow() will fail.
925 *
926 * If you intend to use this window with an SDL_Renderer, you should use
927 * SDL_CreateWindowAndRenderer() instead of this function, to avoid window
928 * flicker.
929 *
930 * On non-Apple devices, SDL requires you to either not link to the Vulkan
931 * loader or link to a dynamic library version. This limitation may be removed
932 * in a future version of SDL.
933 *
934 * \param title the title of the window, in UTF-8 encoding.
935 * \param w the width of the window.
936 * \param h the height of the window.
937 * \param flags 0, or one or more SDL_WindowFlags OR'd together.
938 * \returns the window that was created or NULL on failure; call
939 * SDL_GetError() for more information.
940 *
941 * \since This function is available since SDL 3.0.0.
942 *
943 * \sa SDL_CreatePopupWindow
944 * \sa SDL_CreateWindowWithProperties
945 * \sa SDL_DestroyWindow
946 */
947extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title, int w, int h, SDL_WindowFlags flags);
948
949/**
950 * Create a child popup window of the specified parent window.
951 *
952 * 'flags' **must** contain exactly one of the following: -
953 * 'SDL_WINDOW_TOOLTIP': The popup window is a tooltip and will not pass any
954 * input events. - 'SDL_WINDOW_POPUP_MENU': The popup window is a popup menu.
955 * The topmost popup menu will implicitly gain the keyboard focus.
956 *
957 * The following flags are not relevant to popup window creation and will be
958 * ignored:
959 *
960 * - 'SDL_WINDOW_MINIMIZED'
961 * - 'SDL_WINDOW_MAXIMIZED'
962 * - 'SDL_WINDOW_FULLSCREEN'
963 * - 'SDL_WINDOW_BORDERLESS'
964 *
965 * The parent parameter **must** be non-null and a valid window. The parent of
966 * a popup window can be either a regular, toplevel window, or another popup
967 * window.
968 *
969 * Popup windows cannot be minimized, maximized, made fullscreen, raised,
970 * flash, be made a modal window, be the parent of a modal window, or grab the
971 * mouse and/or keyboard. Attempts to do so will fail.
972 *
973 * Popup windows implicitly do not have a border/decorations and do not appear
974 * on the taskbar/dock or in lists of windows such as alt-tab menus.
975 *
976 * If a parent window is hidden, any child popup windows will be recursively
977 * hidden as well. Child popup windows not explicitly hidden will be restored
978 * when the parent is shown.
979 *
980 * If the parent window is destroyed, any child popup windows will be
981 * recursively destroyed as well.
982 *
983 * \param parent the parent of the window, must not be NULL.
984 * \param offset_x the x position of the popup window relative to the origin
985 * of the parent.
986 * \param offset_y the y position of the popup window relative to the origin
987 * of the parent window.
988 * \param w the width of the window.
989 * \param h the height of the window.
990 * \param flags SDL_WINDOW_TOOLTIP or SDL_WINDOW_POPUP_MENU, and zero or more
991 * additional SDL_WindowFlags OR'd together.
992 * \returns the window that was created or NULL on failure; call
993 * SDL_GetError() for more information.
994 *
995 * \since This function is available since SDL 3.0.0.
996 *
997 * \sa SDL_CreateWindow
998 * \sa SDL_CreateWindowWithProperties
999 * \sa SDL_DestroyWindow
1000 * \sa SDL_GetWindowParent
1001 */
1002extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_CreatePopupWindow(SDL_Window *parent, int offset_x, int offset_y, int w, int h, SDL_WindowFlags flags);
1003
1004/**
1005 * Create a window with the specified properties.
1006 *
1007 * These are the supported properties:
1008 *
1009 * - `SDL_PROP_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN`: true if the window should
1010 * be always on top
1011 * - `SDL_PROP_WINDOW_CREATE_BORDERLESS_BOOLEAN`: true if the window has no
1012 * window decoration
1013 * - `SDL_PROP_WINDOW_CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN`: true if the
1014 * window will be used with an externally managed graphics context.
1015 * - `SDL_PROP_WINDOW_CREATE_FOCUSABLE_BOOLEAN`: true if the window should
1016 * accept keyboard input (defaults true)
1017 * - `SDL_PROP_WINDOW_CREATE_FULLSCREEN_BOOLEAN`: true if the window should
1018 * start in fullscreen mode at desktop resolution
1019 * - `SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER`: the height of the window
1020 * - `SDL_PROP_WINDOW_CREATE_HIDDEN_BOOLEAN`: true if the window should start
1021 * hidden
1022 * - `SDL_PROP_WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN`: true if the window
1023 * uses a high pixel density buffer if possible
1024 * - `SDL_PROP_WINDOW_CREATE_MAXIMIZED_BOOLEAN`: true if the window should
1025 * start maximized
1026 * - `SDL_PROP_WINDOW_CREATE_MENU_BOOLEAN`: true if the window is a popup menu
1027 * - `SDL_PROP_WINDOW_CREATE_METAL_BOOLEAN`: true if the window will be used
1028 * with Metal rendering
1029 * - `SDL_PROP_WINDOW_CREATE_MINIMIZED_BOOLEAN`: true if the window should
1030 * start minimized
1031 * - `SDL_PROP_WINDOW_CREATE_MODAL_BOOLEAN`: true if the window is modal to
1032 * its parent
1033 * - `SDL_PROP_WINDOW_CREATE_MOUSE_GRABBED_BOOLEAN`: true if the window starts
1034 * with grabbed mouse focus
1035 * - `SDL_PROP_WINDOW_CREATE_OPENGL_BOOLEAN`: true if the window will be used
1036 * with OpenGL rendering
1037 * - `SDL_PROP_WINDOW_CREATE_PARENT_POINTER`: an SDL_Window that will be the
1038 * parent of this window, required for windows with the "toolip", "menu",
1039 * and "modal" properties
1040 * - `SDL_PROP_WINDOW_CREATE_RESIZABLE_BOOLEAN`: true if the window should be
1041 * resizable
1042 * - `SDL_PROP_WINDOW_CREATE_TITLE_STRING`: the title of the window, in UTF-8
1043 * encoding
1044 * - `SDL_PROP_WINDOW_CREATE_TRANSPARENT_BOOLEAN`: true if the window show
1045 * transparent in the areas with alpha of 0
1046 * - `SDL_PROP_WINDOW_CREATE_TOOLTIP_BOOLEAN`: true if the window is a tooltip
1047 * - `SDL_PROP_WINDOW_CREATE_UTILITY_BOOLEAN`: true if the window is a utility
1048 * window, not showing in the task bar and window list
1049 * - `SDL_PROP_WINDOW_CREATE_VULKAN_BOOLEAN`: true if the window will be used
1050 * with Vulkan rendering
1051 * - `SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER`: the width of the window
1052 * - `SDL_PROP_WINDOW_CREATE_X_NUMBER`: the x position of the window, or
1053 * `SDL_WINDOWPOS_CENTERED`, defaults to `SDL_WINDOWPOS_UNDEFINED`. This is
1054 * relative to the parent for windows with the "parent" property set.
1055 * - `SDL_PROP_WINDOW_CREATE_Y_NUMBER`: the y position of the window, or
1056 * `SDL_WINDOWPOS_CENTERED`, defaults to `SDL_WINDOWPOS_UNDEFINED`. This is
1057 * relative to the parent for windows with the "parent" property set.
1058 *
1059 * These are additional supported properties on macOS:
1060 *
1061 * - `SDL_PROP_WINDOW_CREATE_COCOA_WINDOW_POINTER`: the
1062 * `(__unsafe_unretained)` NSWindow associated with the window, if you want
1063 * to wrap an existing window.
1064 * - `SDL_PROP_WINDOW_CREATE_COCOA_VIEW_POINTER`: the `(__unsafe_unretained)`
1065 * NSView associated with the window, defaults to `[window contentView]`
1066 *
1067 * These are additional supported properties on Wayland:
1068 *
1069 * - `SDL_PROP_WINDOW_CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN` - true if
1070 * the application wants to use the Wayland surface for a custom role and
1071 * does not want it attached to an XDG toplevel window. See
1072 * [README/wayland](README/wayland) for more information on using custom
1073 * surfaces.
1074 * - `SDL_PROP_WINDOW_CREATE_WAYLAND_CREATE_EGL_WINDOW_BOOLEAN` - true if the
1075 * application wants an associated `wl_egl_window` object to be created,
1076 * even if the window does not have the OpenGL property or flag set.
1077 * - `SDL_PROP_WINDOW_CREATE_WAYLAND_WL_SURFACE_POINTER` - the wl_surface
1078 * associated with the window, if you want to wrap an existing window. See
1079 * [README/wayland](README/wayland) for more information.
1080 *
1081 * These are additional supported properties on Windows:
1082 *
1083 * - `SDL_PROP_WINDOW_CREATE_WIN32_HWND_POINTER`: the HWND associated with the
1084 * window, if you want to wrap an existing window.
1085 * - `SDL_PROP_WINDOW_CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER`: optional,
1086 * another window to share pixel format with, useful for OpenGL windows
1087 *
1088 * These are additional supported properties with X11:
1089 *
1090 * - `SDL_PROP_WINDOW_CREATE_X11_WINDOW_NUMBER`: the X11 Window associated
1091 * with the window, if you want to wrap an existing window.
1092 *
1093 * The window is implicitly shown if the "hidden" property is not set.
1094 *
1095 * Windows with the "tooltip" and "menu" properties are popup windows and have
1096 * the behaviors and guidelines outlined in SDL_CreatePopupWindow().
1097 *
1098 * If this window is being created to be used with an SDL_Renderer, you should
1099 * not add a graphics API specific property
1100 * (`SDL_PROP_WINDOW_CREATE_OPENGL_BOOLEAN`, etc), as SDL will handle that
1101 * internally when it chooses a renderer. However, SDL might need to recreate
1102 * your window at that point, which may cause the window to appear briefly,
1103 * and then flicker as it is recreated. The correct approach to this is to
1104 * create the window with the `SDL_PROP_WINDOW_CREATE_HIDDEN_BOOLEAN` property
1105 * set to true, then create the renderer, then show the window with
1106 * SDL_ShowWindow().
1107 *
1108 * \param props the properties to use.
1109 * \returns the window that was created or NULL on failure; call
1110 * SDL_GetError() for more information.
1111 *
1112 * \since This function is available since SDL 3.0.0.
1113 *
1114 * \sa SDL_CreateProperties
1115 * \sa SDL_CreateWindow
1116 * \sa SDL_DestroyWindow
1117 */
1119
1120#define SDL_PROP_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN "SDL.window.create.always_on_top"
1121#define SDL_PROP_WINDOW_CREATE_BORDERLESS_BOOLEAN "SDL.window.create.borderless"
1122#define SDL_PROP_WINDOW_CREATE_FOCUSABLE_BOOLEAN "SDL.window.create.focusable"
1123#define SDL_PROP_WINDOW_CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN "SDL.window.create.external_graphics_context"
1124#define SDL_PROP_WINDOW_CREATE_FLAGS_NUMBER "SDL.window.create.flags"
1125#define SDL_PROP_WINDOW_CREATE_FULLSCREEN_BOOLEAN "SDL.window.create.fullscreen"
1126#define SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER "SDL.window.create.height"
1127#define SDL_PROP_WINDOW_CREATE_HIDDEN_BOOLEAN "SDL.window.create.hidden"
1128#define SDL_PROP_WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN "SDL.window.create.high_pixel_density"
1129#define SDL_PROP_WINDOW_CREATE_MAXIMIZED_BOOLEAN "SDL.window.create.maximized"
1130#define SDL_PROP_WINDOW_CREATE_MENU_BOOLEAN "SDL.window.create.menu"
1131#define SDL_PROP_WINDOW_CREATE_METAL_BOOLEAN "SDL.window.create.metal"
1132#define SDL_PROP_WINDOW_CREATE_MINIMIZED_BOOLEAN "SDL.window.create.minimized"
1133#define SDL_PROP_WINDOW_CREATE_MODAL_BOOLEAN "SDL.window.create.modal"
1134#define SDL_PROP_WINDOW_CREATE_MOUSE_GRABBED_BOOLEAN "SDL.window.create.mouse_grabbed"
1135#define SDL_PROP_WINDOW_CREATE_OPENGL_BOOLEAN "SDL.window.create.opengl"
1136#define SDL_PROP_WINDOW_CREATE_PARENT_POINTER "SDL.window.create.parent"
1137#define SDL_PROP_WINDOW_CREATE_RESIZABLE_BOOLEAN "SDL.window.create.resizable"
1138#define SDL_PROP_WINDOW_CREATE_TITLE_STRING "SDL.window.create.title"
1139#define SDL_PROP_WINDOW_CREATE_TRANSPARENT_BOOLEAN "SDL.window.create.transparent"
1140#define SDL_PROP_WINDOW_CREATE_TOOLTIP_BOOLEAN "SDL.window.create.tooltip"
1141#define SDL_PROP_WINDOW_CREATE_UTILITY_BOOLEAN "SDL.window.create.utility"
1142#define SDL_PROP_WINDOW_CREATE_VULKAN_BOOLEAN "SDL.window.create.vulkan"
1143#define SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER "SDL.window.create.width"
1144#define SDL_PROP_WINDOW_CREATE_X_NUMBER "SDL.window.create.x"
1145#define SDL_PROP_WINDOW_CREATE_Y_NUMBER "SDL.window.create.y"
1146#define SDL_PROP_WINDOW_CREATE_COCOA_WINDOW_POINTER "SDL.window.create.cocoa.window"
1147#define SDL_PROP_WINDOW_CREATE_COCOA_VIEW_POINTER "SDL.window.create.cocoa.view"
1148#define SDL_PROP_WINDOW_CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN "SDL.window.create.wayland.surface_role_custom"
1149#define SDL_PROP_WINDOW_CREATE_WAYLAND_CREATE_EGL_WINDOW_BOOLEAN "SDL.window.create.wayland.create_egl_window"
1150#define SDL_PROP_WINDOW_CREATE_WAYLAND_WL_SURFACE_POINTER "SDL.window.create.wayland.wl_surface"
1151#define SDL_PROP_WINDOW_CREATE_WIN32_HWND_POINTER "SDL.window.create.win32.hwnd"
1152#define SDL_PROP_WINDOW_CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER "SDL.window.create.win32.pixel_format_hwnd"
1153#define SDL_PROP_WINDOW_CREATE_X11_WINDOW_NUMBER "SDL.window.create.x11.window"
1154
1155/**
1156 * Get the numeric ID of a window.
1157 *
1158 * The numeric ID is what SDL_WindowEvent references, and is necessary to map
1159 * these events to specific SDL_Window objects.
1160 *
1161 * \param window the window to query.
1162 * \returns the ID of the window on success or 0 on failure; call
1163 * SDL_GetError() for more information.
1164 *
1165 * \since This function is available since SDL 3.0.0.
1166 *
1167 * \sa SDL_GetWindowFromID
1168 */
1169extern SDL_DECLSPEC SDL_WindowID SDLCALL SDL_GetWindowID(SDL_Window *window);
1170
1171/**
1172 * Get a window from a stored ID.
1173 *
1174 * The numeric ID is what SDL_WindowEvent references, and is necessary to map
1175 * these events to specific SDL_Window objects.
1176 *
1177 * \param id the ID of the window.
1178 * \returns the window associated with `id` or NULL if it doesn't exist; call
1179 * SDL_GetError() for more information.
1180 *
1181 * \since This function is available since SDL 3.0.0.
1182 *
1183 * \sa SDL_GetWindowID
1184 */
1185extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetWindowFromID(SDL_WindowID id);
1186
1187/**
1188 * Get parent of a window.
1189 *
1190 * \param window the window to query.
1191 * \returns the parent of the window on success or NULL if the window has no
1192 * parent.
1193 *
1194 * \since This function is available since SDL 3.0.0.
1195 *
1196 * \sa SDL_CreatePopupWindow
1197 */
1198extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetWindowParent(SDL_Window *window);
1199
1200/**
1201 * Get the properties associated with a window.
1202 *
1203 * The following read-only properties are provided by SDL:
1204 *
1205 * - `SDL_PROP_WINDOW_SHAPE_POINTER`: the surface associated with a shaped
1206 * window
1207 * - `SDL_PROP_WINDOW_HDR_ENABLED_BOOLEAN`: true if the window has HDR
1208 * headroom above the SDR white point. This property can change dynamically
1209 * when SDL_EVENT_WINDOW_HDR_STATE_CHANGED is sent.
1210 * - `SDL_PROP_WINDOW_SDR_WHITE_LEVEL_FLOAT`: the value of SDR white in the
1211 * SDL_COLORSPACE_SRGB_LINEAR colorspace. On Windows this corresponds to the
1212 * SDR white level in scRGB colorspace, and on Apple platforms this is
1213 * always 1.0 for EDR content. This property can change dynamically when
1214 * SDL_EVENT_WINDOW_HDR_STATE_CHANGED is sent.
1215 * - `SDL_PROP_WINDOW_HDR_HEADROOM_FLOAT`: the additional high dynamic range
1216 * that can be displayed, in terms of the SDR white point. When HDR is not
1217 * enabled, this will be 1.0. This property can change dynamically when
1218 * SDL_EVENT_WINDOW_HDR_STATE_CHANGED is sent.
1219 *
1220 * On Android:
1221 *
1222 * - `SDL_PROP_WINDOW_ANDROID_WINDOW_POINTER`: the ANativeWindow associated
1223 * with the window
1224 * - `SDL_PROP_WINDOW_ANDROID_SURFACE_POINTER`: the EGLSurface associated with
1225 * the window
1226 *
1227 * On iOS:
1228 *
1229 * - `SDL_PROP_WINDOW_UIKIT_WINDOW_POINTER`: the `(__unsafe_unretained)`
1230 * UIWindow associated with the window
1231 * - `SDL_PROP_WINDOW_UIKIT_METAL_VIEW_TAG_NUMBER`: the NSInteger tag
1232 * assocated with metal views on the window
1233 * - `SDL_PROP_WINDOW_UIKIT_OPENGL_FRAMEBUFFER_NUMBER`: the OpenGL view's
1234 * framebuffer object. It must be bound when rendering to the screen using
1235 * OpenGL.
1236 * - `SDL_PROP_WINDOW_UIKIT_OPENGL_RENDERBUFFER_NUMBER`: the OpenGL view's
1237 * renderbuffer object. It must be bound when SDL_GL_SwapWindow is called.
1238 * - `SDL_PROP_WINDOW_UIKIT_OPENGL_RESOLVE_FRAMEBUFFER_NUMBER`: the OpenGL
1239 * view's resolve framebuffer, when MSAA is used.
1240 *
1241 * On KMS/DRM:
1242 *
1243 * - `SDL_PROP_WINDOW_KMSDRM_DEVICE_INDEX_NUMBER`: the device index associated
1244 * with the window (e.g. the X in /dev/dri/cardX)
1245 * - `SDL_PROP_WINDOW_KMSDRM_DRM_FD_NUMBER`: the DRM FD associated with the
1246 * window
1247 * - `SDL_PROP_WINDOW_KMSDRM_GBM_DEVICE_POINTER`: the GBM device associated
1248 * with the window
1249 *
1250 * On macOS:
1251 *
1252 * - `SDL_PROP_WINDOW_COCOA_WINDOW_POINTER`: the `(__unsafe_unretained)`
1253 * NSWindow associated with the window
1254 * - `SDL_PROP_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER`: the NSInteger tag
1255 * assocated with metal views on the window
1256 *
1257 * On Vivante:
1258 *
1259 * - `SDL_PROP_WINDOW_VIVANTE_DISPLAY_POINTER`: the EGLNativeDisplayType
1260 * associated with the window
1261 * - `SDL_PROP_WINDOW_VIVANTE_WINDOW_POINTER`: the EGLNativeWindowType
1262 * associated with the window
1263 * - `SDL_PROP_WINDOW_VIVANTE_SURFACE_POINTER`: the EGLSurface associated with
1264 * the window
1265 *
1266 * On Windows:
1267 *
1268 * - `SDL_PROP_WINDOW_WIN32_HWND_POINTER`: the HWND associated with the window
1269 * - `SDL_PROP_WINDOW_WIN32_HDC_POINTER`: the HDC associated with the window
1270 * - `SDL_PROP_WINDOW_WIN32_INSTANCE_POINTER`: the HINSTANCE associated with
1271 * the window
1272 *
1273 * On Wayland:
1274 *
1275 * Note: The `xdg_*` window objects do not internally persist across window
1276 * show/hide calls. They will be null if the window is hidden and must be
1277 * queried each time it is shown.
1278 *
1279 * - `SDL_PROP_WINDOW_WAYLAND_DISPLAY_POINTER`: the wl_display associated with
1280 * the window
1281 * - `SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER`: the wl_surface associated with
1282 * the window
1283 * - `SDL_PROP_WINDOW_WAYLAND_EGL_WINDOW_POINTER`: the wl_egl_window
1284 * associated with the window
1285 * - `SDL_PROP_WINDOW_WAYLAND_XDG_SURFACE_POINTER`: the xdg_surface associated
1286 * with the window
1287 * - `SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER`: the xdg_toplevel role
1288 * associated with the window
1289 * - 'SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING': the export
1290 * handle associated with the window
1291 * - `SDL_PROP_WINDOW_WAYLAND_XDG_POPUP_POINTER`: the xdg_popup role
1292 * associated with the window
1293 * - `SDL_PROP_WINDOW_WAYLAND_XDG_POSITIONER_POINTER`: the xdg_positioner
1294 * associated with the window, in popup mode
1295 *
1296 * On X11:
1297 *
1298 * - `SDL_PROP_WINDOW_X11_DISPLAY_POINTER`: the X11 Display associated with
1299 * the window
1300 * - `SDL_PROP_WINDOW_X11_SCREEN_NUMBER`: the screen number associated with
1301 * the window
1302 * - `SDL_PROP_WINDOW_X11_WINDOW_NUMBER`: the X11 Window associated with the
1303 * window
1304 *
1305 * \param window the window to query.
1306 * \returns a valid property ID on success or 0 on failure; call
1307 * SDL_GetError() for more information.
1308 *
1309 * \since This function is available since SDL 3.0.0.
1310 */
1311extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetWindowProperties(SDL_Window *window);
1312
1313#define SDL_PROP_WINDOW_SHAPE_POINTER "SDL.window.shape"
1314#define SDL_PROP_WINDOW_HDR_ENABLED_BOOLEAN "SDL.window.HDR_enabled"
1315#define SDL_PROP_WINDOW_SDR_WHITE_LEVEL_FLOAT "SDL.window.SDR_white_level"
1316#define SDL_PROP_WINDOW_HDR_HEADROOM_FLOAT "SDL.window.HDR_headroom"
1317#define SDL_PROP_WINDOW_ANDROID_WINDOW_POINTER "SDL.window.android.window"
1318#define SDL_PROP_WINDOW_ANDROID_SURFACE_POINTER "SDL.window.android.surface"
1319#define SDL_PROP_WINDOW_UIKIT_WINDOW_POINTER "SDL.window.uikit.window"
1320#define SDL_PROP_WINDOW_UIKIT_METAL_VIEW_TAG_NUMBER "SDL.window.uikit.metal_view_tag"
1321#define SDL_PROP_WINDOW_UIKIT_OPENGL_FRAMEBUFFER_NUMBER "SDL.window.uikit.opengl.framebuffer"
1322#define SDL_PROP_WINDOW_UIKIT_OPENGL_RENDERBUFFER_NUMBER "SDL.window.uikit.opengl.renderbuffer"
1323#define SDL_PROP_WINDOW_UIKIT_OPENGL_RESOLVE_FRAMEBUFFER_NUMBER "SDL.window.uikit.opengl.resolve_framebuffer"
1324#define SDL_PROP_WINDOW_KMSDRM_DEVICE_INDEX_NUMBER "SDL.window.kmsdrm.dev_index"
1325#define SDL_PROP_WINDOW_KMSDRM_DRM_FD_NUMBER "SDL.window.kmsdrm.drm_fd"
1326#define SDL_PROP_WINDOW_KMSDRM_GBM_DEVICE_POINTER "SDL.window.kmsdrm.gbm_dev"
1327#define SDL_PROP_WINDOW_COCOA_WINDOW_POINTER "SDL.window.cocoa.window"
1328#define SDL_PROP_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER "SDL.window.cocoa.metal_view_tag"
1329#define SDL_PROP_WINDOW_VIVANTE_DISPLAY_POINTER "SDL.window.vivante.display"
1330#define SDL_PROP_WINDOW_VIVANTE_WINDOW_POINTER "SDL.window.vivante.window"
1331#define SDL_PROP_WINDOW_VIVANTE_SURFACE_POINTER "SDL.window.vivante.surface"
1332#define SDL_PROP_WINDOW_WIN32_HWND_POINTER "SDL.window.win32.hwnd"
1333#define SDL_PROP_WINDOW_WIN32_HDC_POINTER "SDL.window.win32.hdc"
1334#define SDL_PROP_WINDOW_WIN32_INSTANCE_POINTER "SDL.window.win32.instance"
1335#define SDL_PROP_WINDOW_WAYLAND_DISPLAY_POINTER "SDL.window.wayland.display"
1336#define SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER "SDL.window.wayland.surface"
1337#define SDL_PROP_WINDOW_WAYLAND_EGL_WINDOW_POINTER "SDL.window.wayland.egl_window"
1338#define SDL_PROP_WINDOW_WAYLAND_XDG_SURFACE_POINTER "SDL.window.wayland.xdg_surface"
1339#define SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER "SDL.window.wayland.xdg_toplevel"
1340#define SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING "SDL.window.wayland.xdg_toplevel_export_handle"
1341#define SDL_PROP_WINDOW_WAYLAND_XDG_POPUP_POINTER "SDL.window.wayland.xdg_popup"
1342#define SDL_PROP_WINDOW_WAYLAND_XDG_POSITIONER_POINTER "SDL.window.wayland.xdg_positioner"
1343#define SDL_PROP_WINDOW_X11_DISPLAY_POINTER "SDL.window.x11.display"
1344#define SDL_PROP_WINDOW_X11_SCREEN_NUMBER "SDL.window.x11.screen"
1345#define SDL_PROP_WINDOW_X11_WINDOW_NUMBER "SDL.window.x11.window"
1346
1347/**
1348 * Get the window flags.
1349 *
1350 * \param window the window to query.
1351 * \returns a mask of the SDL_WindowFlags associated with `window`.
1352 *
1353 * \since This function is available since SDL 3.0.0.
1354 *
1355 * \sa SDL_CreateWindow
1356 * \sa SDL_HideWindow
1357 * \sa SDL_MaximizeWindow
1358 * \sa SDL_MinimizeWindow
1359 * \sa SDL_SetWindowFullscreen
1360 * \sa SDL_SetWindowMouseGrab
1361 * \sa SDL_ShowWindow
1362 */
1363extern SDL_DECLSPEC SDL_WindowFlags SDLCALL SDL_GetWindowFlags(SDL_Window *window);
1364
1365/**
1366 * Set the title of a window.
1367 *
1368 * This string is expected to be in UTF-8 encoding.
1369 *
1370 * \param window the window to change.
1371 * \param title the desired window title in UTF-8 format.
1372 * \returns true on success or false on failure; call SDL_GetError() for more
1373 * information.
1374 *
1375 * \since This function is available since SDL 3.0.0.
1376 *
1377 * \sa SDL_GetWindowTitle
1378 */
1379extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowTitle(SDL_Window *window, const char *title);
1380
1381/**
1382 * Get the title of a window.
1383 *
1384 * \param window the window to query.
1385 * \returns the title of the window in UTF-8 format or "" if there is no
1386 * title.
1387 *
1388 * \since This function is available since SDL 3.0.0.
1389 *
1390 * \sa SDL_SetWindowTitle
1391 */
1392extern SDL_DECLSPEC const char * SDLCALL SDL_GetWindowTitle(SDL_Window *window);
1393
1394/**
1395 * Set the icon for a window.
1396 *
1397 * If this function is passed a surface with alternate representations, the
1398 * surface will be interpreted as the content to be used for 100% display
1399 * scale, and the alternate representations will be used for high DPI
1400 * situations. For example, if the original surface is 32x32, then on a 2x
1401 * macOS display or 200% display scale on Windows, a 64x64 version of the
1402 * image will be used, if available. If a matching version of the image isn't
1403 * available, the closest larger size image will be downscaled to the
1404 * appropriate size and be used instead, if available. Otherwise, the closest
1405 * smaller image will be upscaled and be used instead.
1406 *
1407 * \param window the window to change.
1408 * \param icon an SDL_Surface structure containing the icon for the window.
1409 * \returns true on success or false on failure; call SDL_GetError() for more
1410 * information.
1411 *
1412 * \since This function is available since SDL 3.0.0.
1413 */
1414extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowIcon(SDL_Window *window, SDL_Surface *icon);
1415
1416/**
1417 * Request that the window's position be set.
1418 *
1419 * If, at the time of this request, the window is in a fixed-size state such
1420 * as maximized, this request may be deferred until the window returns to a
1421 * resizable state.
1422 *
1423 * This can be used to reposition fullscreen-desktop windows onto a different
1424 * display, however, exclusive fullscreen windows are locked to a specific
1425 * display and can only be repositioned programmatically via
1426 * SDL_SetWindowFullscreenMode().
1427 *
1428 * On some windowing systems this request is asynchronous and the new
1429 * coordinates may not have have been applied immediately upon the return of
1430 * this function. If an immediate change is required, call SDL_SyncWindow() to
1431 * block until the changes have taken effect.
1432 *
1433 * When the window position changes, an SDL_EVENT_WINDOW_MOVED event will be
1434 * emitted with the window's new coordinates. Note that the new coordinates
1435 * may not match the exact coordinates requested, as some windowing systems
1436 * can restrict the position of the window in certain scenarios (e.g.
1437 * constraining the position so the window is always within desktop bounds).
1438 * Additionally, as this is just a request, it can be denied by the windowing
1439 * system.
1440 *
1441 * \param window the window to reposition.
1442 * \param x the x coordinate of the window, or `SDL_WINDOWPOS_CENTERED` or
1443 * `SDL_WINDOWPOS_UNDEFINED`.
1444 * \param y the y coordinate of the window, or `SDL_WINDOWPOS_CENTERED` or
1445 * `SDL_WINDOWPOS_UNDEFINED`.
1446 * \returns true on success or false on failure; call SDL_GetError() for more
1447 * information.
1448 *
1449 * \since This function is available since SDL 3.0.0.
1450 *
1451 * \sa SDL_GetWindowPosition
1452 * \sa SDL_SyncWindow
1453 */
1454extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowPosition(SDL_Window *window, int x, int y);
1455
1456/**
1457 * Get the position of a window.
1458 *
1459 * This is the current position of the window as last reported by the
1460 * windowing system.
1461 *
1462 * If you do not need the value for one of the positions a NULL may be passed
1463 * in the `x` or `y` parameter.
1464 *
1465 * \param window the window to query.
1466 * \param x a pointer filled in with the x position of the window, may be
1467 * NULL.
1468 * \param y a pointer filled in with the y position of the window, may be
1469 * NULL.
1470 * \returns true on success or false on failure; call SDL_GetError() for more
1471 * information.
1472 *
1473 * \since This function is available since SDL 3.0.0.
1474 *
1475 * \sa SDL_SetWindowPosition
1476 */
1477extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowPosition(SDL_Window *window, int *x, int *y);
1478
1479/**
1480 * Request that the size of a window's client area be set.
1481 *
1482 * If, at the time of this request, the window in a fixed-size state, such as
1483 * maximized or fullscreen, the request will be deferred until the window
1484 * exits this state and becomes resizable again.
1485 *
1486 * To change the fullscreen mode of a window, use
1487 * SDL_SetWindowFullscreenMode()
1488 *
1489 * On some windowing systems, this request is asynchronous and the new window
1490 * size may not have have been applied immediately upon the return of this
1491 * function. If an immediate change is required, call SDL_SyncWindow() to
1492 * block until the changes have taken effect.
1493 *
1494 * When the window size changes, an SDL_EVENT_WINDOW_RESIZED event will be
1495 * emitted with the new window dimensions. Note that the new dimensions may
1496 * not match the exact size requested, as some windowing systems can restrict
1497 * the window size in certain scenarios (e.g. constraining the size of the
1498 * content area to remain within the usable desktop bounds). Additionally, as
1499 * this is just a request, it can be denied by the windowing system.
1500 *
1501 * \param window the window to change.
1502 * \param w the width of the window, must be > 0.
1503 * \param h the height of the window, must be > 0.
1504 * \returns true on success or false on failure; call SDL_GetError() for more
1505 * information.
1506 *
1507 * \since This function is available since SDL 3.0.0.
1508 *
1509 * \sa SDL_GetWindowSize
1510 * \sa SDL_SetWindowFullscreenMode
1511 * \sa SDL_SyncWindow
1512 */
1513extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowSize(SDL_Window *window, int w, int h);
1514
1515/**
1516 * Get the size of a window's client area.
1517 *
1518 * The window pixel size may differ from its window coordinate size if the
1519 * window is on a high pixel density display. Use SDL_GetWindowSizeInPixels()
1520 * or SDL_GetRenderOutputSize() to get the real client area size in pixels.
1521 *
1522 * \param window the window to query the width and height from.
1523 * \param w a pointer filled in with the width of the window, may be NULL.
1524 * \param h a pointer filled in with the height of the window, may be NULL.
1525 * \returns true on success or false on failure; call SDL_GetError() for more
1526 * information.
1527 *
1528 * \since This function is available since SDL 3.0.0.
1529 *
1530 * \sa SDL_GetRenderOutputSize
1531 * \sa SDL_GetWindowSizeInPixels
1532 * \sa SDL_SetWindowSize
1533 */
1534extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowSize(SDL_Window *window, int *w, int *h);
1535
1536/**
1537 * Get the safe area for this window.
1538 *
1539 * Some devices have portions of the screen which are partially obscured or
1540 * not interactive, possibly due to on-screen controls, curved edges, camera
1541 * notches, TV overscan, etc. This function provides the area of the window
1542 * which is safe to have interactible content. You should continue rendering
1543 * into the rest of the window, but it should not contain visually important
1544 * or interactible content.
1545 *
1546 * \param window the window to query.
1547 * \param rect a pointer filled in with the client area that is safe for
1548 * interactive content.
1549 * \returns true on success or false on failure; call SDL_GetError() for more
1550 * information.
1551 *
1552 * \since This function is available since SDL 3.0.0.
1553 */
1554extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowSafeArea(SDL_Window *window, SDL_Rect *rect);
1555
1556/**
1557 * Request that the aspect ratio of a window's client area be set.
1558 *
1559 * The aspect ratio is the ratio of width divided by height, e.g. 2560x1600
1560 * would be 1.6. Larger aspect ratios are wider and smaller aspect ratios are
1561 * narrower.
1562 *
1563 * If, at the time of this request, the window in a fixed-size state, such as
1564 * maximized or fullscreen, the request will be deferred until the window
1565 * exits this state and becomes resizable again.
1566 *
1567 * On some windowing systems, this request is asynchronous and the new window
1568 * aspect ratio may not have have been applied immediately upon the return of
1569 * this function. If an immediate change is required, call SDL_SyncWindow() to
1570 * block until the changes have taken effect.
1571 *
1572 * When the window size changes, an SDL_EVENT_WINDOW_RESIZED event will be
1573 * emitted with the new window dimensions. Note that the new dimensions may
1574 * not match the exact aspect ratio requested, as some windowing systems can
1575 * restrict the window size in certain scenarios (e.g. constraining the size
1576 * of the content area to remain within the usable desktop bounds).
1577 * Additionally, as this is just a request, it can be denied by the windowing
1578 * system.
1579 *
1580 * \param window the window to change.
1581 * \param min_aspect the minimum aspect ratio of the window, or 0.0f for no
1582 * limit.
1583 * \param max_aspect the maximum aspect ratio of the window, or 0.0f for no
1584 * limit.
1585 * \returns true on success or false on failure; call SDL_GetError() for more
1586 * information.
1587 *
1588 * \since This function is available since SDL 3.0.0.
1589 *
1590 * \sa SDL_GetWindowAspectRatio
1591 * \sa SDL_SyncWindow
1592 */
1593extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowAspectRatio(SDL_Window *window, float min_aspect, float max_aspect);
1594
1595/**
1596 * Get the size of a window's client area.
1597 *
1598 * \param window the window to query the width and height from.
1599 * \param min_aspect a pointer filled in with the minimum aspect ratio of the
1600 * window, may be NULL.
1601 * \param max_aspect a pointer filled in with the maximum aspect ratio of the
1602 * window, may be NULL.
1603 * \returns true on success or false on failure; call SDL_GetError() for more
1604 * information.
1605 *
1606 * \since This function is available since SDL 3.0.0.
1607 *
1608 * \sa SDL_SetWindowAspectRatio
1609 */
1610extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowAspectRatio(SDL_Window *window, float *min_aspect, float *max_aspect);
1611
1612/**
1613 * Get the size of a window's borders (decorations) around the client area.
1614 *
1615 * Note: If this function fails (returns false), the size values will be
1616 * initialized to 0, 0, 0, 0 (if a non-NULL pointer is provided), as if the
1617 * window in question was borderless.
1618 *
1619 * Note: This function may fail on systems where the window has not yet been
1620 * decorated by the display server (for example, immediately after calling
1621 * SDL_CreateWindow). It is recommended that you wait at least until the
1622 * window has been presented and composited, so that the window system has a
1623 * chance to decorate the window and provide the border dimensions to SDL.
1624 *
1625 * This function also returns false if getting the information is not
1626 * supported.
1627 *
1628 * \param window the window to query the size values of the border
1629 * (decorations) from.
1630 * \param top pointer to variable for storing the size of the top border; NULL
1631 * is permitted.
1632 * \param left pointer to variable for storing the size of the left border;
1633 * NULL is permitted.
1634 * \param bottom pointer to variable for storing the size of the bottom
1635 * border; NULL is permitted.
1636 * \param right pointer to variable for storing the size of the right border;
1637 * NULL is permitted.
1638 * \returns true on success or false on failure; call SDL_GetError() for more
1639 * information.
1640 *
1641 * \since This function is available since SDL 3.0.0.
1642 *
1643 * \sa SDL_GetWindowSize
1644 */
1645extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowBordersSize(SDL_Window *window, int *top, int *left, int *bottom, int *right);
1646
1647/**
1648 * Get the size of a window's client area, in pixels.
1649 *
1650 * \param window the window from which the drawable size should be queried.
1651 * \param w a pointer to variable for storing the width in pixels, may be
1652 * NULL.
1653 * \param h a pointer to variable for storing the height in pixels, may be
1654 * NULL.
1655 * \returns true on success or false on failure; call SDL_GetError() for more
1656 * information.
1657 *
1658 * \since This function is available since SDL 3.0.0.
1659 *
1660 * \sa SDL_CreateWindow
1661 * \sa SDL_GetWindowSize
1662 */
1663extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowSizeInPixels(SDL_Window *window, int *w, int *h);
1664
1665/**
1666 * Set the minimum size of a window's client area.
1667 *
1668 * \param window the window to change.
1669 * \param min_w the minimum width of the window, or 0 for no limit.
1670 * \param min_h the minimum height of the window, or 0 for no limit.
1671 * \returns true on success or false on failure; call SDL_GetError() for more
1672 * information.
1673 *
1674 * \since This function is available since SDL 3.0.0.
1675 *
1676 * \sa SDL_GetWindowMinimumSize
1677 * \sa SDL_SetWindowMaximumSize
1678 */
1679extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowMinimumSize(SDL_Window *window, int min_w, int min_h);
1680
1681/**
1682 * Get the minimum size of a window's client area.
1683 *
1684 * \param window the window to query.
1685 * \param w a pointer filled in with the minimum width of the window, may be
1686 * NULL.
1687 * \param h a pointer filled in with the minimum height of the window, may be
1688 * NULL.
1689 * \returns true on success or false on failure; call SDL_GetError() for more
1690 * information.
1691 *
1692 * \since This function is available since SDL 3.0.0.
1693 *
1694 * \sa SDL_GetWindowMaximumSize
1695 * \sa SDL_SetWindowMinimumSize
1696 */
1697extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowMinimumSize(SDL_Window *window, int *w, int *h);
1698
1699/**
1700 * Set the maximum size of a window's client area.
1701 *
1702 * \param window the window to change.
1703 * \param max_w the maximum width of the window, or 0 for no limit.
1704 * \param max_h the maximum height of the window, or 0 for no limit.
1705 * \returns true on success or false on failure; call SDL_GetError() for more
1706 * information.
1707 *
1708 * \since This function is available since SDL 3.0.0.
1709 *
1710 * \sa SDL_GetWindowMaximumSize
1711 * \sa SDL_SetWindowMinimumSize
1712 */
1713extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowMaximumSize(SDL_Window *window, int max_w, int max_h);
1714
1715/**
1716 * Get the maximum size of a window's client area.
1717 *
1718 * \param window the window to query.
1719 * \param w a pointer filled in with the maximum width of the window, may be
1720 * NULL.
1721 * \param h a pointer filled in with the maximum height of the window, may be
1722 * NULL.
1723 * \returns true on success or false on failure; call SDL_GetError() for more
1724 * information.
1725 *
1726 * \since This function is available since SDL 3.0.0.
1727 *
1728 * \sa SDL_GetWindowMinimumSize
1729 * \sa SDL_SetWindowMaximumSize
1730 */
1731extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowMaximumSize(SDL_Window *window, int *w, int *h);
1732
1733/**
1734 * Set the border state of a window.
1735 *
1736 * This will add or remove the window's `SDL_WINDOW_BORDERLESS` flag and add
1737 * or remove the border from the actual window. This is a no-op if the
1738 * window's border already matches the requested state.
1739 *
1740 * You can't change the border state of a fullscreen window.
1741 *
1742 * \param window the window of which to change the border state.
1743 * \param bordered false to remove border, true to add border.
1744 * \returns true on success or false on failure; call SDL_GetError() for more
1745 * information.
1746 *
1747 * \since This function is available since SDL 3.0.0.
1748 *
1749 * \sa SDL_GetWindowFlags
1750 */
1751extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowBordered(SDL_Window *window, bool bordered);
1752
1753/**
1754 * Set the user-resizable state of a window.
1755 *
1756 * This will add or remove the window's `SDL_WINDOW_RESIZABLE` flag and
1757 * allow/disallow user resizing of the window. This is a no-op if the window's
1758 * resizable state already matches the requested state.
1759 *
1760 * You can't change the resizable state of a fullscreen window.
1761 *
1762 * \param window the window of which to change the resizable state.
1763 * \param resizable true to allow resizing, false to disallow.
1764 * \returns true on success or false on failure; call SDL_GetError() for more
1765 * information.
1766 *
1767 * \since This function is available since SDL 3.0.0.
1768 *
1769 * \sa SDL_GetWindowFlags
1770 */
1771extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowResizable(SDL_Window *window, bool resizable);
1772
1773/**
1774 * Set the window to always be above the others.
1775 *
1776 * This will add or remove the window's `SDL_WINDOW_ALWAYS_ON_TOP` flag. This
1777 * will bring the window to the front and keep the window above the rest.
1778 *
1779 * \param window the window of which to change the always on top state.
1780 * \param on_top true to set the window always on top, false to disable.
1781 * \returns true on success or false on failure; call SDL_GetError() for more
1782 * information.
1783 *
1784 * \since This function is available since SDL 3.0.0.
1785 *
1786 * \sa SDL_GetWindowFlags
1787 */
1788extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowAlwaysOnTop(SDL_Window *window, bool on_top);
1789
1790/**
1791 * Show a window.
1792 *
1793 * \param window the window to show.
1794 * \returns true on success or false on failure; call SDL_GetError() for more
1795 * information.
1796 *
1797 * \since This function is available since SDL 3.0.0.
1798 *
1799 * \sa SDL_HideWindow
1800 * \sa SDL_RaiseWindow
1801 */
1802extern SDL_DECLSPEC bool SDLCALL SDL_ShowWindow(SDL_Window *window);
1803
1804/**
1805 * Hide a window.
1806 *
1807 * \param window the window to hide.
1808 * \returns true on success or false on failure; call SDL_GetError() for more
1809 * information.
1810 *
1811 * \since This function is available since SDL 3.0.0.
1812 *
1813 * \sa SDL_ShowWindow
1814 */
1815extern SDL_DECLSPEC bool SDLCALL SDL_HideWindow(SDL_Window *window);
1816
1817/**
1818 * Request that a window be raised above other windows and gain the input
1819 * focus.
1820 *
1821 * The result of this request is subject to desktop window manager policy,
1822 * particularly if raising the requested window would result in stealing focus
1823 * from another application. If the window is successfully raised and gains
1824 * input focus, an SDL_EVENT_WINDOW_FOCUS_GAINED event will be emitted, and
1825 * the window will have the SDL_WINDOW_INPUT_FOCUS flag set.
1826 *
1827 * \param window the window to raise.
1828 * \returns true on success or false on failure; call SDL_GetError() for more
1829 * information.
1830 *
1831 * \since This function is available since SDL 3.0.0.
1832 */
1833extern SDL_DECLSPEC bool SDLCALL SDL_RaiseWindow(SDL_Window *window);
1834
1835/**
1836 * Request that the window be made as large as possible.
1837 *
1838 * Non-resizable windows can't be maximized. The window must have the
1839 * SDL_WINDOW_RESIZABLE flag set, or this will have no effect.
1840 *
1841 * On some windowing systems this request is asynchronous and the new window
1842 * state may not have have been applied immediately upon the return of this
1843 * function. If an immediate change is required, call SDL_SyncWindow() to
1844 * block until the changes have taken effect.
1845 *
1846 * When the window state changes, an SDL_EVENT_WINDOW_MAXIMIZED event will be
1847 * emitted. Note that, as this is just a request, the windowing system can
1848 * deny the state change.
1849 *
1850 * When maximizing a window, whether the constraints set via
1851 * SDL_SetWindowMaximumSize() are honored depends on the policy of the window
1852 * manager. Win32 and macOS enforce the constraints when maximizing, while X11
1853 * and Wayland window managers may vary.
1854 *
1855 * \param window the window to maximize.
1856 * \returns true on success or false on failure; call SDL_GetError() for more
1857 * information.
1858 *
1859 * \since This function is available since SDL 3.0.0.
1860 *
1861 * \sa SDL_MinimizeWindow
1862 * \sa SDL_RestoreWindow
1863 * \sa SDL_SyncWindow
1864 */
1865extern SDL_DECLSPEC bool SDLCALL SDL_MaximizeWindow(SDL_Window *window);
1866
1867/**
1868 * Request that the window be minimized to an iconic representation.
1869 *
1870 * On some windowing systems this request is asynchronous and the new window
1871 * state may not have have been applied immediately upon the return of this
1872 * function. If an immediate change is required, call SDL_SyncWindow() to
1873 * block until the changes have taken effect.
1874 *
1875 * When the window state changes, an SDL_EVENT_WINDOW_MINIMIZED event will be
1876 * emitted. Note that, as this is just a request, the windowing system can
1877 * deny the state change.
1878 *
1879 * \param window the window to minimize.
1880 * \returns true on success or false on failure; call SDL_GetError() for more
1881 * information.
1882 *
1883 * \since This function is available since SDL 3.0.0.
1884 *
1885 * \sa SDL_MaximizeWindow
1886 * \sa SDL_RestoreWindow
1887 * \sa SDL_SyncWindow
1888 */
1889extern SDL_DECLSPEC bool SDLCALL SDL_MinimizeWindow(SDL_Window *window);
1890
1891/**
1892 * Request that the size and position of a minimized or maximized window be
1893 * restored.
1894 *
1895 * On some windowing systems this request is asynchronous and the new window
1896 * state may not have have been applied immediately upon the return of this
1897 * function. If an immediate change is required, call SDL_SyncWindow() to
1898 * block until the changes have taken effect.
1899 *
1900 * When the window state changes, an SDL_EVENT_WINDOW_RESTORED event will be
1901 * emitted. Note that, as this is just a request, the windowing system can
1902 * deny the state change.
1903 *
1904 * \param window the window to restore.
1905 * \returns true on success or false on failure; call SDL_GetError() for more
1906 * information.
1907 *
1908 * \since This function is available since SDL 3.0.0.
1909 *
1910 * \sa SDL_MaximizeWindow
1911 * \sa SDL_MinimizeWindow
1912 * \sa SDL_SyncWindow
1913 */
1914extern SDL_DECLSPEC bool SDLCALL SDL_RestoreWindow(SDL_Window *window);
1915
1916/**
1917 * Request that the window's fullscreen state be changed.
1918 *
1919 * By default a window in fullscreen state uses borderless fullscreen desktop
1920 * mode, but a specific exclusive display mode can be set using
1921 * SDL_SetWindowFullscreenMode().
1922 *
1923 * On some windowing systems this request is asynchronous and the new
1924 * fullscreen state may not have have been applied immediately upon the return
1925 * of this function. If an immediate change is required, call SDL_SyncWindow()
1926 * to block until the changes have taken effect.
1927 *
1928 * When the window state changes, an SDL_EVENT_WINDOW_ENTER_FULLSCREEN or
1929 * SDL_EVENT_WINDOW_LEAVE_FULLSCREEN event will be emitted. Note that, as this
1930 * is just a request, it can be denied by the windowing system.
1931 *
1932 * \param window the window to change.
1933 * \param fullscreen true for fullscreen mode, false for windowed mode.
1934 * \returns true on success or false on failure; call SDL_GetError() for more
1935 * information.
1936 *
1937 * \since This function is available since SDL 3.0.0.
1938 *
1939 * \sa SDL_GetWindowFullscreenMode
1940 * \sa SDL_SetWindowFullscreenMode
1941 * \sa SDL_SyncWindow
1942 */
1943extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowFullscreen(SDL_Window *window, bool fullscreen);
1944
1945/**
1946 * Block until any pending window state is finalized.
1947 *
1948 * On asynchronous windowing systems, this acts as a synchronization barrier
1949 * for pending window state. It will attempt to wait until any pending window
1950 * state has been applied and is guaranteed to return within finite time. Note
1951 * that for how long it can potentially block depends on the underlying window
1952 * system, as window state changes may involve somewhat lengthy animations
1953 * that must complete before the window is in its final requested state.
1954 *
1955 * On windowing systems where changes are immediate, this does nothing.
1956 *
1957 * \param window the window for which to wait for the pending state to be
1958 * applied.
1959 * \returns true on success or false if the operation timed out before the
1960 * window was in the requested state.
1961 *
1962 * \since This function is available since SDL 3.0.0.
1963 *
1964 * \sa SDL_SetWindowSize
1965 * \sa SDL_SetWindowPosition
1966 * \sa SDL_SetWindowFullscreen
1967 * \sa SDL_MinimizeWindow
1968 * \sa SDL_MaximizeWindow
1969 * \sa SDL_RestoreWindow
1970 * \sa SDL_HINT_VIDEO_SYNC_WINDOW_OPERATIONS
1971 */
1972extern SDL_DECLSPEC bool SDLCALL SDL_SyncWindow(SDL_Window *window);
1973
1974/**
1975 * Return whether the window has a surface associated with it.
1976 *
1977 * \param window the window to query.
1978 * \returns true if there is a surface associated with the window, or false
1979 * otherwise.
1980 *
1981 * \since This function is available since SDL 3.0.0.
1982 *
1983 * \sa SDL_GetWindowSurface
1984 */
1985extern SDL_DECLSPEC bool SDLCALL SDL_WindowHasSurface(SDL_Window *window);
1986
1987/**
1988 * Get the SDL surface associated with the window.
1989 *
1990 * A new surface will be created with the optimal format for the window, if
1991 * necessary. This surface will be freed when the window is destroyed. Do not
1992 * free this surface.
1993 *
1994 * This surface will be invalidated if the window is resized. After resizing a
1995 * window this function must be called again to return a valid surface.
1996 *
1997 * You may not combine this with 3D or the rendering API on this window.
1998 *
1999 * This function is affected by `SDL_HINT_FRAMEBUFFER_ACCELERATION`.
2000 *
2001 * \param window the window to query.
2002 * \returns the surface associated with the window, or NULL on failure; call
2003 * SDL_GetError() for more information.
2004 *
2005 * \since This function is available since SDL 3.0.0.
2006 *
2007 * \sa SDL_DestroyWindowSurface
2008 * \sa SDL_WindowHasSurface
2009 * \sa SDL_UpdateWindowSurface
2010 * \sa SDL_UpdateWindowSurfaceRects
2011 */
2012extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_GetWindowSurface(SDL_Window *window);
2013
2014/**
2015 * Toggle VSync for the window surface.
2016 *
2017 * When a window surface is created, vsync defaults to
2018 * SDL_WINDOW_SURFACE_VSYNC_DISABLED.
2019 *
2020 * The `vsync` parameter can be 1 to synchronize present with every vertical
2021 * refresh, 2 to synchronize present with every second vertical refresh, etc.,
2022 * SDL_WINDOW_SURFACE_VSYNC_ADAPTIVE for late swap tearing (adaptive vsync),
2023 * or SDL_WINDOW_SURFACE_VSYNC_DISABLED to disable. Not every value is
2024 * supported by every driver, so you should check the return value to see
2025 * whether the requested setting is supported.
2026 *
2027 * \param window the window.
2028 * \param vsync the vertical refresh sync interval.
2029 * \returns true on success or false on failure; call SDL_GetError() for more
2030 * information.
2031 *
2032 * \since This function is available since SDL 3.0.0.
2033 *
2034 * \sa SDL_GetWindowSurfaceVSync
2035 */
2036extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowSurfaceVSync(SDL_Window *window, int vsync);
2037
2038#define SDL_WINDOW_SURFACE_VSYNC_DISABLED 0
2039#define SDL_WINDOW_SURFACE_VSYNC_ADAPTIVE (-1)
2040
2041/**
2042 * Get VSync for the window surface.
2043 *
2044 * \param window the window to query.
2045 * \param vsync an int filled with the current vertical refresh sync interval.
2046 * See SDL_SetWindowSurfaceVSync() for the meaning of the value.
2047 * \returns true on success or false on failure; call SDL_GetError() for more
2048 * information.
2049 *
2050 * \since This function is available since SDL 3.0.0.
2051 *
2052 * \sa SDL_SetWindowSurfaceVSync
2053 */
2054extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowSurfaceVSync(SDL_Window *window, int *vsync);
2055
2056/**
2057 * Copy the window surface to the screen.
2058 *
2059 * This is the function you use to reflect any changes to the surface on the
2060 * screen.
2061 *
2062 * This function is equivalent to the SDL 1.2 API SDL_Flip().
2063 *
2064 * \param window the window to update.
2065 * \returns true on success or false on failure; call SDL_GetError() for more
2066 * information.
2067 *
2068 * \since This function is available since SDL 3.0.0.
2069 *
2070 * \sa SDL_GetWindowSurface
2071 * \sa SDL_UpdateWindowSurfaceRects
2072 */
2073extern SDL_DECLSPEC bool SDLCALL SDL_UpdateWindowSurface(SDL_Window *window);
2074
2075/**
2076 * Copy areas of the window surface to the screen.
2077 *
2078 * This is the function you use to reflect changes to portions of the surface
2079 * on the screen.
2080 *
2081 * This function is equivalent to the SDL 1.2 API SDL_UpdateRects().
2082 *
2083 * Note that this function will update _at least_ the rectangles specified,
2084 * but this is only intended as an optimization; in practice, this might
2085 * update more of the screen (or all of the screen!), depending on what method
2086 * SDL uses to send pixels to the system.
2087 *
2088 * \param window the window to update.
2089 * \param rects an array of SDL_Rect structures representing areas of the
2090 * surface to copy, in pixels.
2091 * \param numrects the number of rectangles.
2092 * \returns true on success or false on failure; call SDL_GetError() for more
2093 * information.
2094 *
2095 * \since This function is available since SDL 3.0.0.
2096 *
2097 * \sa SDL_GetWindowSurface
2098 * \sa SDL_UpdateWindowSurface
2099 */
2100extern SDL_DECLSPEC bool SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window *window, const SDL_Rect *rects, int numrects);
2101
2102/**
2103 * Destroy the surface associated with the window.
2104 *
2105 * \param window the window to update.
2106 * \returns true on success or false on failure; call SDL_GetError() for more
2107 * information.
2108 *
2109 * \since This function is available since SDL 3.0.0.
2110 *
2111 * \sa SDL_GetWindowSurface
2112 * \sa SDL_WindowHasSurface
2113 */
2114extern SDL_DECLSPEC bool SDLCALL SDL_DestroyWindowSurface(SDL_Window *window);
2115
2116/**
2117 * Set a window's keyboard grab mode.
2118 *
2119 * Keyboard grab enables capture of system keyboard shortcuts like Alt+Tab or
2120 * the Meta/Super key. Note that not all system keyboard shortcuts can be
2121 * captured by applications (one example is Ctrl+Alt+Del on Windows).
2122 *
2123 * This is primarily intended for specialized applications such as VNC clients
2124 * or VM frontends. Normal games should not use keyboard grab.
2125 *
2126 * When keyboard grab is enabled, SDL will continue to handle Alt+Tab when the
2127 * window is full-screen to ensure the user is not trapped in your
2128 * application. If you have a custom keyboard shortcut to exit fullscreen
2129 * mode, you may suppress this behavior with
2130 * `SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED`.
2131 *
2132 * If the caller enables a grab while another window is currently grabbed, the
2133 * other window loses its grab in favor of the caller's window.
2134 *
2135 * \param window the window for which the keyboard grab mode should be set.
2136 * \param grabbed this is true to grab keyboard, and false to release.
2137 * \returns true on success or false on failure; call SDL_GetError() for more
2138 * information.
2139 *
2140 * \since This function is available since SDL 3.0.0.
2141 *
2142 * \sa SDL_GetWindowKeyboardGrab
2143 * \sa SDL_SetWindowMouseGrab
2144 */
2145extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowKeyboardGrab(SDL_Window *window, bool grabbed);
2146
2147/**
2148 * Set a window's mouse grab mode.
2149 *
2150 * Mouse grab confines the mouse cursor to the window.
2151 *
2152 * \param window the window for which the mouse grab mode should be set.
2153 * \param grabbed this is true to grab mouse, and false to release.
2154 * \returns true on success or false on failure; call SDL_GetError() for more
2155 * information.
2156 *
2157 * \since This function is available since SDL 3.0.0.
2158 *
2159 * \sa SDL_GetWindowMouseGrab
2160 * \sa SDL_SetWindowKeyboardGrab
2161 */
2162extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowMouseGrab(SDL_Window *window, bool grabbed);
2163
2164/**
2165 * Get a window's keyboard grab mode.
2166 *
2167 * \param window the window to query.
2168 * \returns true if keyboard is grabbed, and false otherwise.
2169 *
2170 * \since This function is available since SDL 3.0.0.
2171 *
2172 * \sa SDL_SetWindowKeyboardGrab
2173 */
2174extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowKeyboardGrab(SDL_Window *window);
2175
2176/**
2177 * Get a window's mouse grab mode.
2178 *
2179 * \param window the window to query.
2180 * \returns true if mouse is grabbed, and false otherwise.
2181 *
2182 * \since This function is available since SDL 3.0.0.
2183 *
2184 * \sa SDL_SetWindowKeyboardGrab
2185 */
2186extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowMouseGrab(SDL_Window *window);
2187
2188/**
2189 * Get the window that currently has an input grab enabled.
2190 *
2191 * \returns the window if input is grabbed or NULL otherwise.
2192 *
2193 * \since This function is available since SDL 3.0.0.
2194 *
2195 * \sa SDL_SetWindowMouseGrab
2196 * \sa SDL_SetWindowKeyboardGrab
2197 */
2198extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetGrabbedWindow(void);
2199
2200/**
2201 * Confines the cursor to the specified area of a window.
2202 *
2203 * Note that this does NOT grab the cursor, it only defines the area a cursor
2204 * is restricted to when the window has mouse focus.
2205 *
2206 * \param window the window that will be associated with the barrier.
2207 * \param rect a rectangle area in window-relative coordinates. If NULL the
2208 * barrier for the specified window will be destroyed.
2209 * \returns true on success or false on failure; call SDL_GetError() for more
2210 * information.
2211 *
2212 * \since This function is available since SDL 3.0.0.
2213 *
2214 * \sa SDL_GetWindowMouseRect
2215 * \sa SDL_SetWindowMouseGrab
2216 */
2217extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowMouseRect(SDL_Window *window, const SDL_Rect *rect);
2218
2219/**
2220 * Get the mouse confinement rectangle of a window.
2221 *
2222 * \param window the window to query.
2223 * \returns a pointer to the mouse confinement rectangle of a window, or NULL
2224 * if there isn't one.
2225 *
2226 * \since This function is available since SDL 3.0.0.
2227 *
2228 * \sa SDL_SetWindowMouseRect
2229 */
2230extern SDL_DECLSPEC const SDL_Rect * SDLCALL SDL_GetWindowMouseRect(SDL_Window *window);
2231
2232/**
2233 * Set the opacity for a window.
2234 *
2235 * The parameter `opacity` will be clamped internally between 0.0f
2236 * (transparent) and 1.0f (opaque).
2237 *
2238 * This function also returns false if setting the opacity isn't supported.
2239 *
2240 * \param window the window which will be made transparent or opaque.
2241 * \param opacity the opacity value (0.0f - transparent, 1.0f - opaque).
2242 * \returns true on success or false on failure; call SDL_GetError() for more
2243 * information.
2244 *
2245 * \since This function is available since SDL 3.0.0.
2246 *
2247 * \sa SDL_GetWindowOpacity
2248 */
2249extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowOpacity(SDL_Window *window, float opacity);
2250
2251/**
2252 * Get the opacity of a window.
2253 *
2254 * If transparency isn't supported on this platform, opacity will be returned
2255 * as 1.0f without error.
2256 *
2257 * \param window the window to get the current opacity value from.
2258 * \returns the opacity, (0.0f - transparent, 1.0f - opaque), or -1.0f on
2259 * failure; call SDL_GetError() for more information.
2260 *
2261 * \since This function is available since SDL 3.0.0.
2262 *
2263 * \sa SDL_SetWindowOpacity
2264 */
2265extern SDL_DECLSPEC float SDLCALL SDL_GetWindowOpacity(SDL_Window *window);
2266
2267/**
2268 * Set the window as a child of a parent window.
2269 *
2270 * If the window is already the child of an existing window, it will be
2271 * reparented to the new owner. Setting the parent window to NULL unparents
2272 * the window and removes child window status.
2273 *
2274 * Attempting to set the parent of a window that is currently in the modal
2275 * state will fail. Use SDL_SetWindowModalFor() to cancel the modal status
2276 * before attempting to change the parent.
2277 *
2278 * Setting a parent window that is currently the sibling or descendent of the
2279 * child window results in undefined behavior.
2280 *
2281 * \param window the window that should become the child of a parent.
2282 * \param parent the new parent window for the child window.
2283 * \returns true on success or false on failure; call SDL_GetError() for more
2284 * information.
2285 *
2286 * \since This function is available since SDL 3.0.0.
2287 *
2288 * \sa SDL_SetWindowModal
2289 */
2290extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowParent(SDL_Window *window, SDL_Window *parent);
2291
2292/**
2293 * Toggle the state of the window as modal.
2294 *
2295 * To enable modal status on a window, the window must currently be the child
2296 * window of a parent, or toggling modal status on will fail.
2297 *
2298 * \param window the window on which to set the modal state.
2299 * \param modal true to toggle modal status on, false to toggle it off.
2300 * \returns true on success or false on failure; call SDL_GetError() for more
2301 * information.
2302 *
2303 * \since This function is available since SDL 3.0.0.
2304 *
2305 * \sa SDL_SetWindowParent
2306 */
2307extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowModal(SDL_Window *window, bool modal);
2308
2309/**
2310 * Set whether the window may have input focus.
2311 *
2312 * \param window the window to set focusable state.
2313 * \param focusable true to allow input focus, false to not allow input focus.
2314 * \returns true on success or false on failure; call SDL_GetError() for more
2315 * information.
2316 *
2317 * \since This function is available since SDL 3.0.0.
2318 */
2319extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowFocusable(SDL_Window *window, bool focusable);
2320
2321
2322/**
2323 * Display the system-level window menu.
2324 *
2325 * This default window menu is provided by the system and on some platforms
2326 * provides functionality for setting or changing privileged state on the
2327 * window, such as moving it between workspaces or displays, or toggling the
2328 * always-on-top property.
2329 *
2330 * On platforms or desktops where this is unsupported, this function does
2331 * nothing.
2332 *
2333 * \param window the window for which the menu will be displayed.
2334 * \param x the x coordinate of the menu, relative to the origin (top-left) of
2335 * the client area.
2336 * \param y the y coordinate of the menu, relative to the origin (top-left) of
2337 * the client area.
2338 * \returns true on success or false on failure; call SDL_GetError() for more
2339 * information.
2340 *
2341 * \since This function is available since SDL 3.0.0.
2342 */
2343extern SDL_DECLSPEC bool SDLCALL SDL_ShowWindowSystemMenu(SDL_Window *window, int x, int y);
2344
2345/**
2346 * Possible return values from the SDL_HitTest callback.
2347 *
2348 * \since This enum is available since SDL 3.0.0.
2349 *
2350 * \sa SDL_HitTest
2351 */
2353{
2354 SDL_HITTEST_NORMAL, /**< Region is normal. No special properties. */
2355 SDL_HITTEST_DRAGGABLE, /**< Region can drag entire window. */
2356 SDL_HITTEST_RESIZE_TOPLEFT, /**< Region is the resizable top-left corner border. */
2357 SDL_HITTEST_RESIZE_TOP, /**< Region is the resizable top border. */
2358 SDL_HITTEST_RESIZE_TOPRIGHT, /**< Region is the resizable top-right corner border. */
2359 SDL_HITTEST_RESIZE_RIGHT, /**< Region is the resizable right border. */
2360 SDL_HITTEST_RESIZE_BOTTOMRIGHT, /**< Region is the resizable bottom-right corner border. */
2361 SDL_HITTEST_RESIZE_BOTTOM, /**< Region is the resizable bottom border. */
2362 SDL_HITTEST_RESIZE_BOTTOMLEFT, /**< Region is the resizable bottom-left corner border. */
2363 SDL_HITTEST_RESIZE_LEFT /**< Region is the resizable left border. */
2365
2366/**
2367 * Callback used for hit-testing.
2368 *
2369 * \param win the SDL_Window where hit-testing was set on.
2370 * \param area an SDL_Point which should be hit-tested.
2371 * \param data what was passed as `callback_data` to SDL_SetWindowHitTest().
2372 * \returns an SDL_HitTestResult value.
2373 *
2374 * \sa SDL_SetWindowHitTest
2375 */
2377 const SDL_Point *area,
2378 void *data);
2379
2380/**
2381 * Provide a callback that decides if a window region has special properties.
2382 *
2383 * Normally windows are dragged and resized by decorations provided by the
2384 * system window manager (a title bar, borders, etc), but for some apps, it
2385 * makes sense to drag them from somewhere else inside the window itself; for
2386 * example, one might have a borderless window that wants to be draggable from
2387 * any part, or simulate its own title bar, etc.
2388 *
2389 * This function lets the app provide a callback that designates pieces of a
2390 * given window as special. This callback is run during event processing if we
2391 * need to tell the OS to treat a region of the window specially; the use of
2392 * this callback is known as "hit testing."
2393 *
2394 * Mouse input may not be delivered to your application if it is within a
2395 * special area; the OS will often apply that input to moving the window or
2396 * resizing the window and not deliver it to the application.
2397 *
2398 * Specifying NULL for a callback disables hit-testing. Hit-testing is
2399 * disabled by default.
2400 *
2401 * Platforms that don't support this functionality will return false
2402 * unconditionally, even if you're attempting to disable hit-testing.
2403 *
2404 * Your callback may fire at any time, and its firing does not indicate any
2405 * specific behavior (for example, on Windows, this certainly might fire when
2406 * the OS is deciding whether to drag your window, but it fires for lots of
2407 * other reasons, too, some unrelated to anything you probably care about _and
2408 * when the mouse isn't actually at the location it is testing_). Since this
2409 * can fire at any time, you should try to keep your callback efficient,
2410 * devoid of allocations, etc.
2411 *
2412 * \param window the window to set hit-testing on.
2413 * \param callback the function to call when doing a hit-test.
2414 * \param callback_data an app-defined void pointer passed to **callback**.
2415 * \returns true on success or false on failure; call SDL_GetError() for more
2416 * information.
2417 *
2418 * \since This function is available since SDL 3.0.0.
2419 */
2420extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowHitTest(SDL_Window *window, SDL_HitTest callback, void *callback_data);
2421
2422/**
2423 * Set the shape of a transparent window.
2424 *
2425 * This sets the alpha channel of a transparent window and any fully
2426 * transparent areas are also transparent to mouse clicks. If you are using
2427 * something besides the SDL render API, then you are responsible for setting
2428 * the alpha channel of the window yourself.
2429 *
2430 * The shape is copied inside this function, so you can free it afterwards. If
2431 * your shape surface changes, you should call SDL_SetWindowShape() again to
2432 * update the window.
2433 *
2434 * The window must have been created with the SDL_WINDOW_TRANSPARENT flag.
2435 *
2436 * \param window the window.
2437 * \param shape the surface representing the shape of the window, or NULL to
2438 * remove any current shape.
2439 * \returns true on success or false on failure; call SDL_GetError() for more
2440 * information.
2441 *
2442 * \since This function is available since SDL 3.0.0.
2443 */
2444extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowShape(SDL_Window *window, SDL_Surface *shape);
2445
2446/**
2447 * Request a window to demand attention from the user.
2448 *
2449 * \param window the window to be flashed.
2450 * \param operation the operation to perform.
2451 * \returns true on success or false on failure; call SDL_GetError() for more
2452 * information.
2453 *
2454 * \since This function is available since SDL 3.0.0.
2455 */
2456extern SDL_DECLSPEC bool SDLCALL SDL_FlashWindow(SDL_Window *window, SDL_FlashOperation operation);
2457
2458/**
2459 * Destroy a window.
2460 *
2461 * Any popups or modal windows owned by the window will be recursively
2462 * destroyed as well.
2463 *
2464 * \param window the window to destroy.
2465 *
2466 * \since This function is available since SDL 3.0.0.
2467 *
2468 * \sa SDL_CreatePopupWindow
2469 * \sa SDL_CreateWindow
2470 * \sa SDL_CreateWindowWithProperties
2471 */
2472extern SDL_DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window *window);
2473
2474
2475/**
2476 * Check whether the screensaver is currently enabled.
2477 *
2478 * The screensaver is disabled by default.
2479 *
2480 * The default can also be changed using `SDL_HINT_VIDEO_ALLOW_SCREENSAVER`.
2481 *
2482 * \returns true if the screensaver is enabled, false if it is disabled.
2483 *
2484 * \since This function is available since SDL 3.0.0.
2485 *
2486 * \sa SDL_DisableScreenSaver
2487 * \sa SDL_EnableScreenSaver
2488 */
2489extern SDL_DECLSPEC bool SDLCALL SDL_ScreenSaverEnabled(void);
2490
2491/**
2492 * Allow the screen to be blanked by a screen saver.
2493 *
2494 * \returns true on success or false on failure; call SDL_GetError() for more
2495 * information.
2496 *
2497 * \since This function is available since SDL 3.0.0.
2498 *
2499 * \sa SDL_DisableScreenSaver
2500 * \sa SDL_ScreenSaverEnabled
2501 */
2502extern SDL_DECLSPEC bool SDLCALL SDL_EnableScreenSaver(void);
2503
2504/**
2505 * Prevent the screen from being blanked by a screen saver.
2506 *
2507 * If you disable the screensaver, it is automatically re-enabled when SDL
2508 * quits.
2509 *
2510 * The screensaver is disabled by default, but this may by changed by
2511 * SDL_HINT_VIDEO_ALLOW_SCREENSAVER.
2512 *
2513 * \returns true on success or false on failure; call SDL_GetError() for more
2514 * information.
2515 *
2516 * \since This function is available since SDL 3.0.0.
2517 *
2518 * \sa SDL_EnableScreenSaver
2519 * \sa SDL_ScreenSaverEnabled
2520 */
2521extern SDL_DECLSPEC bool SDLCALL SDL_DisableScreenSaver(void);
2522
2523
2524/**
2525 * \name OpenGL support functions
2526 */
2527/* @{ */
2528
2529/**
2530 * Dynamically load an OpenGL library.
2531 *
2532 * This should be done after initializing the video driver, but before
2533 * creating any OpenGL windows. If no OpenGL library is loaded, the default
2534 * library will be loaded upon creation of the first OpenGL window.
2535 *
2536 * If you do this, you need to retrieve all of the GL functions used in your
2537 * program from the dynamic library using SDL_GL_GetProcAddress().
2538 *
2539 * \param path the platform dependent OpenGL library name, or NULL to open the
2540 * default OpenGL library.
2541 * \returns true on success or false on failure; call SDL_GetError() for more
2542 * information.
2543 *
2544 * \since This function is available since SDL 3.0.0.
2545 *
2546 * \sa SDL_GL_GetProcAddress
2547 * \sa SDL_GL_UnloadLibrary
2548 */
2549extern SDL_DECLSPEC bool SDLCALL SDL_GL_LoadLibrary(const char *path);
2550
2551/**
2552 * Get an OpenGL function by name.
2553 *
2554 * If the GL library is loaded at runtime with SDL_GL_LoadLibrary(), then all
2555 * GL functions must be retrieved this way. Usually this is used to retrieve
2556 * function pointers to OpenGL extensions.
2557 *
2558 * There are some quirks to looking up OpenGL functions that require some
2559 * extra care from the application. If you code carefully, you can handle
2560 * these quirks without any platform-specific code, though:
2561 *
2562 * - On Windows, function pointers are specific to the current GL context;
2563 * this means you need to have created a GL context and made it current
2564 * before calling SDL_GL_GetProcAddress(). If you recreate your context or
2565 * create a second context, you should assume that any existing function
2566 * pointers aren't valid to use with it. This is (currently) a
2567 * Windows-specific limitation, and in practice lots of drivers don't suffer
2568 * this limitation, but it is still the way the wgl API is documented to
2569 * work and you should expect crashes if you don't respect it. Store a copy
2570 * of the function pointers that comes and goes with context lifespan.
2571 * - On X11, function pointers returned by this function are valid for any
2572 * context, and can even be looked up before a context is created at all.
2573 * This means that, for at least some common OpenGL implementations, if you
2574 * look up a function that doesn't exist, you'll get a non-NULL result that
2575 * is _NOT_ safe to call. You must always make sure the function is actually
2576 * available for a given GL context before calling it, by checking for the
2577 * existence of the appropriate extension with SDL_GL_ExtensionSupported(),
2578 * or verifying that the version of OpenGL you're using offers the function
2579 * as core functionality.
2580 * - Some OpenGL drivers, on all platforms, *will* return NULL if a function
2581 * isn't supported, but you can't count on this behavior. Check for
2582 * extensions you use, and if you get a NULL anyway, act as if that
2583 * extension wasn't available. This is probably a bug in the driver, but you
2584 * can code defensively for this scenario anyhow.
2585 * - Just because you're on Linux/Unix, don't assume you'll be using X11.
2586 * Next-gen display servers are waiting to replace it, and may or may not
2587 * make the same promises about function pointers.
2588 * - OpenGL function pointers must be declared `APIENTRY` as in the example
2589 * code. This will ensure the proper calling convention is followed on
2590 * platforms where this matters (Win32) thereby avoiding stack corruption.
2591 *
2592 * \param proc the name of an OpenGL function.
2593 * \returns a pointer to the named OpenGL function. The returned pointer
2594 * should be cast to the appropriate function signature.
2595 *
2596 * \since This function is available since SDL 3.0.0.
2597 *
2598 * \sa SDL_GL_ExtensionSupported
2599 * \sa SDL_GL_LoadLibrary
2600 * \sa SDL_GL_UnloadLibrary
2601 */
2602extern SDL_DECLSPEC SDL_FunctionPointer SDLCALL SDL_GL_GetProcAddress(const char *proc);
2603
2604/**
2605 * Get an EGL library function by name.
2606 *
2607 * If an EGL library is loaded, this function allows applications to get entry
2608 * points for EGL functions. This is useful to provide to an EGL API and
2609 * extension loader.
2610 *
2611 * \param proc the name of an EGL function.
2612 * \returns a pointer to the named EGL function. The returned pointer should
2613 * be cast to the appropriate function signature.
2614 *
2615 * \since This function is available since SDL 3.0.0.
2616 *
2617 * \sa SDL_EGL_GetCurrentDisplay
2618 */
2619extern SDL_DECLSPEC SDL_FunctionPointer SDLCALL SDL_EGL_GetProcAddress(const char *proc);
2620
2621/**
2622 * Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().
2623 *
2624 * \since This function is available since SDL 3.0.0.
2625 *
2626 * \sa SDL_GL_LoadLibrary
2627 */
2628extern SDL_DECLSPEC void SDLCALL SDL_GL_UnloadLibrary(void);
2629
2630/**
2631 * Check if an OpenGL extension is supported for the current context.
2632 *
2633 * This function operates on the current GL context; you must have created a
2634 * context and it must be current before calling this function. Do not assume
2635 * that all contexts you create will have the same set of extensions
2636 * available, or that recreating an existing context will offer the same
2637 * extensions again.
2638 *
2639 * While it's probably not a massive overhead, this function is not an O(1)
2640 * operation. Check the extensions you care about after creating the GL
2641 * context and save that information somewhere instead of calling the function
2642 * every time you need to know.
2643 *
2644 * \param extension the name of the extension to check.
2645 * \returns true if the extension is supported, false otherwise.
2646 *
2647 * \since This function is available since SDL 3.0.0.
2648 */
2649extern SDL_DECLSPEC bool SDLCALL SDL_GL_ExtensionSupported(const char *extension);
2650
2651/**
2652 * Reset all previously set OpenGL context attributes to their default values.
2653 *
2654 * \since This function is available since SDL 3.0.0.
2655 *
2656 * \sa SDL_GL_GetAttribute
2657 * \sa SDL_GL_SetAttribute
2658 */
2659extern SDL_DECLSPEC void SDLCALL SDL_GL_ResetAttributes(void);
2660
2661/**
2662 * Set an OpenGL window attribute before window creation.
2663 *
2664 * This function sets the OpenGL attribute `attr` to `value`. The requested
2665 * attributes should be set before creating an OpenGL window. You should use
2666 * SDL_GL_GetAttribute() to check the values after creating the OpenGL
2667 * context, since the values obtained can differ from the requested ones.
2668 *
2669 * \param attr an SDL_GLattr enum value specifying the OpenGL attribute to
2670 * set.
2671 * \param value the desired value for the attribute.
2672 * \returns true on success or false on failure; call SDL_GetError() for more
2673 * information.
2674 *
2675 * \since This function is available since SDL 3.0.0.
2676 *
2677 * \sa SDL_GL_GetAttribute
2678 * \sa SDL_GL_ResetAttributes
2679 */
2680extern SDL_DECLSPEC bool SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
2681
2682/**
2683 * Get the actual value for an attribute from the current context.
2684 *
2685 * \param attr an SDL_GLattr enum value specifying the OpenGL attribute to
2686 * get.
2687 * \param value a pointer filled in with the current value of `attr`.
2688 * \returns true on success or false on failure; call SDL_GetError() for more
2689 * information.
2690 *
2691 * \since This function is available since SDL 3.0.0.
2692 *
2693 * \sa SDL_GL_ResetAttributes
2694 * \sa SDL_GL_SetAttribute
2695 */
2696extern SDL_DECLSPEC bool SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value);
2697
2698/**
2699 * Create an OpenGL context for an OpenGL window, and make it current.
2700 *
2701 * Windows users new to OpenGL should note that, for historical reasons, GL
2702 * functions added after OpenGL version 1.1 are not available by default.
2703 * Those functions must be loaded at run-time, either with an OpenGL
2704 * extension-handling library or with SDL_GL_GetProcAddress() and its related
2705 * functions.
2706 *
2707 * SDL_GLContext is opaque to the application.
2708 *
2709 * \param window the window to associate with the context.
2710 * \returns the OpenGL context associated with `window` or NULL on failure;
2711 * call SDL_GetError() for more information.
2712 *
2713 * \since This function is available since SDL 3.0.0.
2714 *
2715 * \sa SDL_GL_DestroyContext
2716 * \sa SDL_GL_MakeCurrent
2717 */
2718extern SDL_DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window *window);
2719
2720/**
2721 * Set up an OpenGL context for rendering into an OpenGL window.
2722 *
2723 * The context must have been created with a compatible window.
2724 *
2725 * \param window the window to associate with the context.
2726 * \param context the OpenGL context to associate with the window.
2727 * \returns true on success or false on failure; call SDL_GetError() for more
2728 * information.
2729 *
2730 * \since This function is available since SDL 3.0.0.
2731 *
2732 * \sa SDL_GL_CreateContext
2733 */
2734extern SDL_DECLSPEC bool SDLCALL SDL_GL_MakeCurrent(SDL_Window *window, SDL_GLContext context);
2735
2736/**
2737 * Get the currently active OpenGL window.
2738 *
2739 * \returns the currently active OpenGL window on success or NULL on failure;
2740 * call SDL_GetError() for more information.
2741 *
2742 * \since This function is available since SDL 3.0.0.
2743 */
2744extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GL_GetCurrentWindow(void);
2745
2746/**
2747 * Get the currently active OpenGL context.
2748 *
2749 * \returns the currently active OpenGL context or NULL on failure; call
2750 * SDL_GetError() for more information.
2751 *
2752 * \since This function is available since SDL 3.0.0.
2753 *
2754 * \sa SDL_GL_MakeCurrent
2755 */
2756extern SDL_DECLSPEC SDL_GLContext SDLCALL SDL_GL_GetCurrentContext(void);
2757
2758/**
2759 * Get the currently active EGL display.
2760 *
2761 * \returns the currently active EGL display or NULL on failure; call
2762 * SDL_GetError() for more information.
2763 *
2764 * \since This function is available since SDL 3.0.0.
2765 */
2766extern SDL_DECLSPEC SDL_EGLDisplay SDLCALL SDL_EGL_GetCurrentDisplay(void);
2767
2768/**
2769 * Get the currently active EGL config.
2770 *
2771 * \returns the currently active EGL config or NULL on failure; call
2772 * SDL_GetError() for more information.
2773 *
2774 * \since This function is available since SDL 3.0.0.
2775 */
2776extern SDL_DECLSPEC SDL_EGLConfig SDLCALL SDL_EGL_GetCurrentConfig(void);
2777
2778/**
2779 * Get the EGL surface associated with the window.
2780 *
2781 * \param window the window to query.
2782 * \returns the EGLSurface pointer associated with the window, or NULL on
2783 * failure.
2784 *
2785 * \since This function is available since SDL 3.0.0.
2786 */
2787extern SDL_DECLSPEC SDL_EGLSurface SDLCALL SDL_EGL_GetWindowSurface(SDL_Window *window);
2788
2789/**
2790 * Sets the callbacks for defining custom EGLAttrib arrays for EGL
2791 * initialization.
2792 *
2793 * Callbacks that aren't needed can be set to NULL.
2794 *
2795 * NOTE: These callback pointers will be reset after SDL_GL_ResetAttributes.
2796 *
2797 * \param platformAttribCallback callback for attributes to pass to
2798 * eglGetPlatformDisplay. May be NULL.
2799 * \param surfaceAttribCallback callback for attributes to pass to
2800 * eglCreateSurface. May be NULL.
2801 * \param contextAttribCallback callback for attributes to pass to
2802 * eglCreateContext. May be NULL.
2803 * \param userdata a pointer that is passed to the callbacks.
2804 *
2805 * \since This function is available since SDL 3.0.0.
2806 */
2807extern SDL_DECLSPEC void SDLCALL SDL_EGL_SetAttributeCallbacks(SDL_EGLAttribArrayCallback platformAttribCallback,
2808 SDL_EGLIntArrayCallback surfaceAttribCallback,
2809 SDL_EGLIntArrayCallback contextAttribCallback, void *userdata);
2810
2811/**
2812 * Set the swap interval for the current OpenGL context.
2813 *
2814 * Some systems allow specifying -1 for the interval, to enable adaptive
2815 * vsync. Adaptive vsync works the same as vsync, but if you've already missed
2816 * the vertical retrace for a given frame, it swaps buffers immediately, which
2817 * might be less jarring for the user during occasional framerate drops. If an
2818 * application requests adaptive vsync and the system does not support it,
2819 * this function will fail and return false. In such a case, you should
2820 * probably retry the call with 1 for the interval.
2821 *
2822 * Adaptive vsync is implemented for some glX drivers with
2823 * GLX_EXT_swap_control_tear, and for some Windows drivers with
2824 * WGL_EXT_swap_control_tear.
2825 *
2826 * Read more on the Khronos wiki:
2827 * https://www.khronos.org/opengl/wiki/Swap_Interval#Adaptive_Vsync
2828 *
2829 * \param interval 0 for immediate updates, 1 for updates synchronized with
2830 * the vertical retrace, -1 for adaptive vsync.
2831 * \returns true on success or false on failure; call SDL_GetError() for more
2832 * information.
2833 *
2834 * \since This function is available since SDL 3.0.0.
2835 *
2836 * \sa SDL_GL_GetSwapInterval
2837 */
2838extern SDL_DECLSPEC bool SDLCALL SDL_GL_SetSwapInterval(int interval);
2839
2840/**
2841 * Get the swap interval for the current OpenGL context.
2842 *
2843 * If the system can't determine the swap interval, or there isn't a valid
2844 * current context, this function will set *interval to 0 as a safe default.
2845 *
2846 * \param interval output interval value. 0 if there is no vertical retrace
2847 * synchronization, 1 if the buffer swap is synchronized with
2848 * the vertical retrace, and -1 if late swaps happen
2849 * immediately instead of waiting for the next retrace.
2850 * \returns true on success or false on failure; call SDL_GetError() for more
2851 * information.
2852 *
2853 * \since This function is available since SDL 3.0.0.
2854 *
2855 * \sa SDL_GL_SetSwapInterval
2856 */
2857extern SDL_DECLSPEC bool SDLCALL SDL_GL_GetSwapInterval(int *interval);
2858
2859/**
2860 * Update a window with OpenGL rendering.
2861 *
2862 * This is used with double-buffered OpenGL contexts, which are the default.
2863 *
2864 * On macOS, make sure you bind 0 to the draw framebuffer before swapping the
2865 * window, otherwise nothing will happen. If you aren't using
2866 * glBindFramebuffer(), this is the default and you won't have to do anything
2867 * extra.
2868 *
2869 * \param window the window to change.
2870 * \returns true on success or false on failure; call SDL_GetError() for more
2871 * information.
2872 *
2873 * \since This function is available since SDL 3.0.0.
2874 */
2875extern SDL_DECLSPEC bool SDLCALL SDL_GL_SwapWindow(SDL_Window *window);
2876
2877/**
2878 * Delete an OpenGL context.
2879 *
2880 * \param context the OpenGL context to be deleted.
2881 * \returns true on success or false on failure; call SDL_GetError() for more
2882 * information.
2883 *
2884 * \since This function is available since SDL 3.0.0.
2885 *
2886 * \sa SDL_GL_CreateContext
2887 */
2888extern SDL_DECLSPEC bool SDLCALL SDL_GL_DestroyContext(SDL_GLContext context);
2889
2890/* @} *//* OpenGL support functions */
2891
2892
2893/* Ends C function definitions when using C++ */
2894#ifdef __cplusplus
2895}
2896#endif
2897#include <SDL3/SDL_close_code.h>
2898
2899#endif /* SDL_video_h_ */
SDL_PixelFormat
Definition SDL_pixels.h:265
Uint32 SDL_PropertiesID
SDL_MALLOC size_t size
Definition SDL_stdinc.h:720
uint64_t Uint64
Definition SDL_stdinc.h:378
void(* SDL_FunctionPointer)(void)
uint32_t Uint32
Definition SDL_stdinc.h:356
SDL_SystemTheme
Definition SDL_video.h:88
@ SDL_SYSTEM_THEME_LIGHT
Definition SDL_video.h:90
@ SDL_SYSTEM_THEME_UNKNOWN
Definition SDL_video.h:89
@ SDL_SYSTEM_THEME_DARK
Definition SDL_video.h:91
struct SDL_GLContextState * SDL_GLContext
Definition SDL_video.h:228
bool SDL_SetWindowSize(SDL_Window *window, int w, int h)
bool SDL_SetWindowFocusable(SDL_Window *window, bool focusable)
SDL_HitTestResult
Definition SDL_video.h:2353
@ SDL_HITTEST_DRAGGABLE
Definition SDL_video.h:2355
@ SDL_HITTEST_RESIZE_LEFT
Definition SDL_video.h:2363
@ SDL_HITTEST_RESIZE_TOP
Definition SDL_video.h:2357
@ SDL_HITTEST_RESIZE_TOPRIGHT
Definition SDL_video.h:2358
@ SDL_HITTEST_NORMAL
Definition SDL_video.h:2354
@ SDL_HITTEST_RESIZE_BOTTOM
Definition SDL_video.h:2361
@ SDL_HITTEST_RESIZE_BOTTOMRIGHT
Definition SDL_video.h:2360
@ SDL_HITTEST_RESIZE_BOTTOMLEFT
Definition SDL_video.h:2362
@ SDL_HITTEST_RESIZE_RIGHT
Definition SDL_video.h:2359
@ SDL_HITTEST_RESIZE_TOPLEFT
Definition SDL_video.h:2356
bool SDL_SetWindowFullscreenMode(SDL_Window *window, const SDL_DisplayMode *mode)
SDL_DisplayID SDL_GetDisplayForPoint(const SDL_Point *point)
bool SDL_SetWindowShape(SDL_Window *window, SDL_Surface *shape)
bool SDL_SetWindowMouseRect(SDL_Window *window, const SDL_Rect *rect)
bool SDL_SetWindowHitTest(SDL_Window *window, SDL_HitTest callback, void *callback_data)
bool SDL_SetWindowModal(SDL_Window *window, bool modal)
SDL_EGLint *(* SDL_EGLIntArrayCallback)(void *userdata, SDL_EGLDisplay display, SDL_EGLConfig config)
Definition SDL_video.h:295
bool SDL_DisableScreenSaver(void)
SDL_Surface * SDL_GetWindowSurface(SDL_Window *window)
bool SDL_SetWindowResizable(SDL_Window *window, bool resizable)
const char * SDL_GetDisplayName(SDL_DisplayID displayID)
bool SDL_SetWindowIcon(SDL_Window *window, SDL_Surface *icon)
SDL_WindowFlags SDL_GetWindowFlags(SDL_Window *window)
bool SDL_GetDisplayBounds(SDL_DisplayID displayID, SDL_Rect *rect)
bool SDL_GetWindowPosition(SDL_Window *window, int *x, int *y)
bool SDL_ShowWindow(SDL_Window *window)
struct SDL_DisplayModeData SDL_DisplayModeData
Definition SDL_video.h:95
void * SDL_EGLDisplay
Definition SDL_video.h:235
bool SDL_FlashWindow(SDL_Window *window, SDL_FlashOperation operation)
const char * SDL_GetWindowTitle(SDL_Window *window)
bool SDL_SetWindowBordered(SDL_Window *window, bool bordered)
bool SDL_GL_LoadLibrary(const char *path)
bool SDL_SetWindowKeyboardGrab(SDL_Window *window, bool grabbed)
SDL_HitTestResult(* SDL_HitTest)(SDL_Window *win, const SDL_Point *area, void *data)
Definition SDL_video.h:2376
SDL_GLattr
Definition SDL_video.h:315
@ SDL_GL_EGL_PLATFORM
Definition SDL_video.h:343
@ SDL_GL_FRAMEBUFFER_SRGB_CAPABLE
Definition SDL_video.h:338
@ SDL_GL_CONTEXT_RELEASE_BEHAVIOR
Definition SDL_video.h:339
@ SDL_GL_DOUBLEBUFFER
Definition SDL_video.h:321
@ SDL_GL_STENCIL_SIZE
Definition SDL_video.h:323
@ SDL_GL_CONTEXT_MAJOR_VERSION
Definition SDL_video.h:333
@ SDL_GL_CONTEXT_RESET_NOTIFICATION
Definition SDL_video.h:340
@ SDL_GL_ACCUM_ALPHA_SIZE
Definition SDL_video.h:327
@ SDL_GL_MULTISAMPLESAMPLES
Definition SDL_video.h:330
@ SDL_GL_CONTEXT_MINOR_VERSION
Definition SDL_video.h:334
@ SDL_GL_FLOATBUFFERS
Definition SDL_video.h:342
@ SDL_GL_STEREO
Definition SDL_video.h:328
@ SDL_GL_MULTISAMPLEBUFFERS
Definition SDL_video.h:329
@ SDL_GL_ACCUM_GREEN_SIZE
Definition SDL_video.h:325
@ SDL_GL_BLUE_SIZE
Definition SDL_video.h:318
@ SDL_GL_SHARE_WITH_CURRENT_CONTEXT
Definition SDL_video.h:337
@ SDL_GL_RETAINED_BACKING
Definition SDL_video.h:332
@ SDL_GL_RED_SIZE
Definition SDL_video.h:316
@ SDL_GL_ALPHA_SIZE
Definition SDL_video.h:319
@ SDL_GL_BUFFER_SIZE
Definition SDL_video.h:320
@ SDL_GL_ACCELERATED_VISUAL
Definition SDL_video.h:331
@ SDL_GL_ACCUM_BLUE_SIZE
Definition SDL_video.h:326
@ SDL_GL_DEPTH_SIZE
Definition SDL_video.h:322
@ SDL_GL_ACCUM_RED_SIZE
Definition SDL_video.h:324
@ SDL_GL_CONTEXT_FLAGS
Definition SDL_video.h:335
@ SDL_GL_CONTEXT_PROFILE_MASK
Definition SDL_video.h:336
@ SDL_GL_CONTEXT_NO_ERROR
Definition SDL_video.h:341
@ SDL_GL_GREEN_SIZE
Definition SDL_video.h:317
bool SDL_SetWindowOpacity(SDL_Window *window, float opacity)
SDL_PixelFormat SDL_GetWindowPixelFormat(SDL_Window *window)
void SDL_GL_ResetAttributes(void)
bool SDL_GL_GetSwapInterval(int *interval)
bool SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
SDL_FlashOperation
Definition SDL_video.h:215
@ SDL_FLASH_UNTIL_FOCUSED
Definition SDL_video.h:218
@ SDL_FLASH_BRIEFLY
Definition SDL_video.h:217
@ SDL_FLASH_CANCEL
Definition SDL_video.h:216
bool SDL_GL_MakeCurrent(SDL_Window *window, SDL_GLContext context)
void * SDL_GetWindowICCProfile(SDL_Window *window, size_t *size)
Uint32 SDL_DisplayID
Definition SDL_video.h:54
float SDL_GetWindowOpacity(SDL_Window *window)
SDL_PropertiesID SDL_GetWindowProperties(SDL_Window *window)
SDL_DisplayID SDL_GetDisplayForRect(const SDL_Rect *rect)
intptr_t SDL_EGLAttrib
Definition SDL_video.h:238
bool SDL_MaximizeWindow(SDL_Window *window)
SDL_DisplayMode ** SDL_GetFullscreenDisplayModes(SDL_DisplayID displayID, int *count)
bool SDL_MinimizeWindow(SDL_Window *window)
bool SDL_SetWindowTitle(SDL_Window *window, const char *title)
bool SDL_ShowWindowSystemMenu(SDL_Window *window, int x, int y)
bool SDL_SetWindowMinimumSize(SDL_Window *window, int min_w, int min_h)
const SDL_Rect * SDL_GetWindowMouseRect(SDL_Window *window)
float SDL_GetWindowDisplayScale(SDL_Window *window)
bool SDL_GL_DestroyContext(SDL_GLContext context)
SDL_DisplayID * SDL_GetDisplays(int *count)
SDL_Window * SDL_GetWindowFromID(SDL_WindowID id)
bool SDL_HideWindow(SDL_Window *window)
struct SDL_Window SDL_Window
Definition SDL_video.h:144
SDL_WindowID SDL_GetWindowID(SDL_Window *window)
SDL_DisplayID SDL_GetPrimaryDisplay(void)
SDL_Window ** SDL_GetWindows(int *count)
SDL_GLContext SDL_GL_CreateContext(SDL_Window *window)
const char * SDL_GetCurrentVideoDriver(void)
bool SDL_SetWindowAlwaysOnTop(SDL_Window *window, bool on_top)
void * SDL_EGLConfig
Definition SDL_video.h:236
bool SDL_GetWindowMaximumSize(SDL_Window *window, int *w, int *h)
bool SDL_UpdateWindowSurface(SDL_Window *window)
float SDL_GetWindowPixelDensity(SDL_Window *window)
bool SDL_GetWindowSize(SDL_Window *window, int *w, int *h)
bool SDL_SetWindowMaximumSize(SDL_Window *window, int max_w, int max_h)
const SDL_DisplayMode * SDL_GetDesktopDisplayMode(SDL_DisplayID displayID)
Uint32 SDL_WindowID
Definition SDL_video.h:63
bool SDL_GetWindowSurfaceVSync(SDL_Window *window, int *vsync)
SDL_EGLConfig SDL_EGL_GetCurrentConfig(void)
SDL_DisplayID SDL_GetDisplayForWindow(SDL_Window *window)
bool SDL_GL_SwapWindow(SDL_Window *window)
int SDL_EGLint
Definition SDL_video.h:239
SDL_FunctionPointer SDL_EGL_GetProcAddress(const char *proc)
SDL_FunctionPointer SDL_GL_GetProcAddress(const char *proc)
bool SDL_GL_ExtensionSupported(const char *extension)
SDL_EGLDisplay SDL_EGL_GetCurrentDisplay(void)
SDL_Window * SDL_CreateWindow(const char *title, int w, int h, SDL_WindowFlags flags)
Uint64 SDL_WindowFlags
Definition SDL_video.h:158
bool SDL_GetClosestFullscreenDisplayMode(SDL_DisplayID displayID, int w, int h, float refresh_rate, bool include_high_density_modes, SDL_DisplayMode *mode)
SDL_GLContext SDL_GL_GetCurrentContext(void)
bool SDL_RestoreWindow(SDL_Window *window)
SDL_Window * SDL_GetGrabbedWindow(void)
void SDL_GL_UnloadLibrary(void)
bool SDL_GL_SetAttribute(SDL_GLattr attr, int value)
bool SDL_SyncWindow(SDL_Window *window)
bool SDL_GetWindowKeyboardGrab(SDL_Window *window)
SDL_GLcontextReleaseFlag
Definition SDL_video.h:378
@ SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE
Definition SDL_video.h:379
@ SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH
Definition SDL_video.h:380
int SDL_GetNumVideoDrivers(void)
float SDL_GetDisplayContentScale(SDL_DisplayID displayID)
SDL_Window * SDL_GL_GetCurrentWindow(void)
SDL_Window * SDL_CreateWindowWithProperties(SDL_PropertiesID props)
bool SDL_SetWindowAspectRatio(SDL_Window *window, float min_aspect, float max_aspect)
void SDL_EGL_SetAttributeCallbacks(SDL_EGLAttribArrayCallback platformAttribCallback, SDL_EGLIntArrayCallback surfaceAttribCallback, SDL_EGLIntArrayCallback contextAttribCallback, void *userdata)
bool SDL_GetWindowSafeArea(SDL_Window *window, SDL_Rect *rect)
bool SDL_SetWindowParent(SDL_Window *window, SDL_Window *parent)
bool SDL_SetWindowFullscreen(SDL_Window *window, bool fullscreen)
SDL_EGLAttrib *(* SDL_EGLAttribArrayCallback)(void *userdata)
Definition SDL_video.h:264
bool SDL_RaiseWindow(SDL_Window *window)
SDL_DisplayOrientation SDL_GetNaturalDisplayOrientation(SDL_DisplayID displayID)
const char * SDL_GetVideoDriver(int index)
bool SDL_GetWindowMouseGrab(SDL_Window *window)
void * SDL_EGLSurface
Definition SDL_video.h:237
SDL_GLcontextFlag
Definition SDL_video.h:364
@ SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG
Definition SDL_video.h:366
@ SDL_GL_CONTEXT_RESET_ISOLATION_FLAG
Definition SDL_video.h:368
@ SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG
Definition SDL_video.h:367
@ SDL_GL_CONTEXT_DEBUG_FLAG
Definition SDL_video.h:365
SDL_DisplayOrientation SDL_GetCurrentDisplayOrientation(SDL_DisplayID displayID)
void SDL_DestroyWindow(SDL_Window *window)
SDL_EGLSurface SDL_EGL_GetWindowSurface(SDL_Window *window)
bool SDL_GetDisplayUsableBounds(SDL_DisplayID displayID, SDL_Rect *rect)
bool SDL_WindowHasSurface(SDL_Window *window)
bool SDL_GL_SetSwapInterval(int interval)
const SDL_DisplayMode * SDL_GetWindowFullscreenMode(SDL_Window *window)
const SDL_DisplayMode * SDL_GetCurrentDisplayMode(SDL_DisplayID displayID)
SDL_Window * SDL_CreatePopupWindow(SDL_Window *parent, int offset_x, int offset_y, int w, int h, SDL_WindowFlags flags)
SDL_SystemTheme SDL_GetSystemTheme(void)
bool SDL_GetWindowBordersSize(SDL_Window *window, int *top, int *left, int *bottom, int *right)
SDL_GLprofile
Definition SDL_video.h:352
@ SDL_GL_CONTEXT_PROFILE_COMPATIBILITY
Definition SDL_video.h:354
@ SDL_GL_CONTEXT_PROFILE_ES
Definition SDL_video.h:355
@ SDL_GL_CONTEXT_PROFILE_CORE
Definition SDL_video.h:353
bool SDL_UpdateWindowSurfaceRects(SDL_Window *window, const SDL_Rect *rects, int numrects)
bool SDL_SetWindowPosition(SDL_Window *window, int x, int y)
bool SDL_GetWindowAspectRatio(SDL_Window *window, float *min_aspect, float *max_aspect)
bool SDL_DestroyWindowSurface(SDL_Window *window)
SDL_Window * SDL_GetWindowParent(SDL_Window *window)
bool SDL_SetWindowMouseGrab(SDL_Window *window, bool grabbed)
SDL_DisplayOrientation
Definition SDL_video.h:129
@ SDL_ORIENTATION_LANDSCAPE
Definition SDL_video.h:131
@ SDL_ORIENTATION_PORTRAIT
Definition SDL_video.h:133
@ SDL_ORIENTATION_PORTRAIT_FLIPPED
Definition SDL_video.h:134
@ SDL_ORIENTATION_LANDSCAPE_FLIPPED
Definition SDL_video.h:132
@ SDL_ORIENTATION_UNKNOWN
Definition SDL_video.h:130
bool SDL_GetWindowSizeInPixels(SDL_Window *window, int *w, int *h)
SDL_GLContextResetNotification
Definition SDL_video.h:389
@ SDL_GL_CONTEXT_RESET_NO_NOTIFICATION
Definition SDL_video.h:390
@ SDL_GL_CONTEXT_RESET_LOSE_CONTEXT
Definition SDL_video.h:391
bool SDL_ScreenSaverEnabled(void)
bool SDL_GetWindowMinimumSize(SDL_Window *window, int *w, int *h)
bool SDL_EnableScreenSaver(void)
bool SDL_SetWindowSurfaceVSync(SDL_Window *window, int vsync)
SDL_PropertiesID SDL_GetDisplayProperties(SDL_DisplayID displayID)
int refresh_rate_numerator
Definition SDL_video.h:116
int refresh_rate_denominator
Definition SDL_video.h:117
SDL_DisplayModeData * internal
Definition SDL_video.h:119
SDL_PixelFormat format
Definition SDL_video.h:111
float pixel_density
Definition SDL_video.h:114
SDL_DisplayID displayID
Definition SDL_video.h:110