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