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