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