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_PROPERTY_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_PROPERTY_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_PROPERTY_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN`: true if the window
831 * should be always on top
832 * - `SDL_PROPERTY_WINDOW_CREATE_BORDERLESS_BOOLEAN`: true if the window has
833 * no window decoration
834 * - `SDL_PROPERTY_WINDOW_CREATE_FOCUSABLE_BOOLEAN`: true if the window should
835 * accept keyboard input (defaults true)
836 * - `SDL_PROPERTY_WINDOW_CREATE_FULLSCREEN_BOOLEAN`: true if the window
837 * should start in fullscreen mode at desktop resolution
838 * - `SDL_PROPERTY_WINDOW_CREATE_HEIGHT_NUMBER`: the height of the window
839 * - `SDL_PROPERTY_WINDOW_CREATE_HIDDEN_BOOLEAN`: true if the window should
840 * start hidden
841 * - `SDL_PROPERTY_WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN`: true if the
842 * window uses a high pixel density buffer if possible
843 * - `SDL_PROPERTY_WINDOW_CREATE_MAXIMIZED_BOOLEAN`: true if the window should
844 * start maximized
845 * - `SDL_PROPERTY_WINDOW_CREATE_MENU_BOOLEAN`: true if the window is a popup
846 * menu
847 * - `SDL_PROPERTY_WINDOW_CREATE_METAL_BOOLEAN`: true if the window will be
848 * used with Metal rendering
849 * - `SDL_PROPERTY_WINDOW_CREATE_MINIMIZED_BOOLEAN`: true if the window should
850 * start minimized
851 * - `SDL_PROPERTY_WINDOW_CREATE_MOUSE_GRABBED_BOOLEAN`: true if the window
852 * starts with grabbed mouse focus
853 * - `SDL_PROPERTY_WINDOW_CREATE_OPENGL_BOOLEAN`: true if the window will be
854 * used with OpenGL rendering
855 * - `SDL_PROPERTY_WINDOW_CREATE_PARENT_POINTER`: an SDL_Window that will be
856 * the parent of this window, required for windows with the "toolip" and
857 * "menu" properties
858 * - `SDL_PROPERTY_WINDOW_CREATE_RESIZABLE_BOOLEAN`: true if the window should
859 * be resizable
860 * - `SDL_PROPERTY_WINDOW_CREATE_TITLE_STRING`: the title of the window, in
861 * UTF-8 encoding
862 * - `SDL_PROPERTY_WINDOW_CREATE_TRANSPARENT_BOOLEAN`: true if the window show
863 * transparent in the areas with alpha of 0
864 * - `SDL_PROPERTY_WINDOW_CREATE_TOOLTIP_BOOLEAN`: true if the window is a
865 * tooltip
866 * - `SDL_PROPERTY_WINDOW_CREATE_UTILITY_BOOLEAN`: true if the window is a
867 * utility window, not showing in the task bar and window list
868 * - `SDL_PROPERTY_WINDOW_CREATE_VULKAN_BOOLEAN`: true if the window will be
869 * used with Vulkan rendering
870 * - `SDL_PROPERTY_WINDOW_CREATE_WIDTH_NUMBER`: the width of the window
871 * - `SDL_PROPERTY_WINDOW_CREATE_X_NUMBER`: the x position of the window, or
872 * `SDL_WINDOWPOS_CENTERED`, defaults to `SDL_WINDOWPOS_UNDEFINED`. This is
873 * relative to the parent for windows with the "parent" property set.
874 * - `SDL_PROPERTY_WINDOW_CREATE_Y_NUMBER`: the y position of the window, or
875 * `SDL_WINDOWPOS_CENTERED`, defaults to `SDL_WINDOWPOS_UNDEFINED`. This is
876 * relative to the parent for windows with the "parent" property set.
877 *
878 * These are additional supported properties on macOS:
879 *
880 * - `SDL_PROPERTY_WINDOW_CREATE_COCOA_WINDOW_POINTER`: the
881 * `(__unsafe_unretained)` NSWindow associated with the window, if you want
882 * to wrap an existing window.
883 * - `SDL_PROPERTY_WINDOW_CREATE_COCOA_VIEW_POINTER`: the
884 * `(__unsafe_unretained)` NSView associated with the window, defaults to
885 * `[window contentView]`
886 *
887 * These are additional supported properties on Wayland:
888 *
889 * - `SDL_PROPERTY_WINDOW_CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN` - true
890 * if the application wants to use the Wayland surface for a custom role and
891 * does not want it attached to an XDG toplevel window. See
892 * docs/README-wayland.md for more information on using custom surfaces.
893 * - `SDL_PROPERTY_WINDOW_CREATE_WAYLAND_CREATE_EGL_WINDOW_BOOLEAN - true if
894 * the application wants an associated `wl_egl_window` object to be created,
895 * even if the window does not have the OpenGL property or flag set.
896 * - `SDL_PROPERTY_WINDOW_CREATE_WAYLAND_WL_SURFACE_POINTER` - the wl_surface
897 * associated with the window, if you want to wrap an existing window. See
898 * docs/README-wayland.md for more information.
899 *
900 * These are additional supported properties on Windows:
901 *
902 * - `SDL_PROPERTY_WINDOW_CREATE_WIN32_HWND_POINTER`: the HWND associated with
903 * the window, if you want to wrap an existing window.
904 * - `SDL_PROPERTY_WINDOW_CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER`: optional,
905 * another window to share pixel format with, useful for OpenGL windows
906 *
907 * These are additional supported properties with X11:
908 *
909 * - `SDL_PROPERTY_WINDOW_CREATE_X11_WINDOW_NUMBER`: the X11 Window associated
910 * with the window, if you want to wrap an existing window.
911 *
912 * The window is implicitly shown if the "hidden" property is not set.
913 *
914 * Windows with the "tooltip" and "menu" properties are popup windows and have
915 * the behaviors and guidelines outlined in `SDL_CreatePopupWindow()`.
916 *
917 * \param props the properties to use
918 * \returns the window that was created or NULL on failure; call
919 * SDL_GetError() for more information.
920 *
921 * \since This function is available since SDL 3.0.0.
922 *
923 * \sa SDL_CreateWindow
924 * \sa SDL_DestroyWindow
925 */
927
928#define SDL_PROPERTY_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN "always-on-top"
929#define SDL_PROPERTY_WINDOW_CREATE_BORDERLESS_BOOLEAN "borderless"
930#define SDL_PROPERTY_WINDOW_CREATE_FOCUSABLE_BOOLEAN "focusable"
931#define SDL_PROPERTY_WINDOW_CREATE_FULLSCREEN_BOOLEAN "fullscreen"
932#define SDL_PROPERTY_WINDOW_CREATE_HEIGHT_NUMBER "height"
933#define SDL_PROPERTY_WINDOW_CREATE_HIDDEN_BOOLEAN "hidden"
934#define SDL_PROPERTY_WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN "high-pixel-density"
935#define SDL_PROPERTY_WINDOW_CREATE_MAXIMIZED_BOOLEAN "maximized"
936#define SDL_PROPERTY_WINDOW_CREATE_MENU_BOOLEAN "menu"
937#define SDL_PROPERTY_WINDOW_CREATE_METAL_BOOLEAN "metal"
938#define SDL_PROPERTY_WINDOW_CREATE_MINIMIZED_BOOLEAN "minimized"
939#define SDL_PROPERTY_WINDOW_CREATE_MOUSE_GRABBED_BOOLEAN "mouse-grabbed"
940#define SDL_PROPERTY_WINDOW_CREATE_OPENGL_BOOLEAN "opengl"
941#define SDL_PROPERTY_WINDOW_CREATE_PARENT_POINTER "parent"
942#define SDL_PROPERTY_WINDOW_CREATE_RESIZABLE_BOOLEAN "resizable"
943#define SDL_PROPERTY_WINDOW_CREATE_TITLE_STRING "title"
944#define SDL_PROPERTY_WINDOW_CREATE_TRANSPARENT_BOOLEAN "transparent"
945#define SDL_PROPERTY_WINDOW_CREATE_TOOLTIP_BOOLEAN "tooltip"
946#define SDL_PROPERTY_WINDOW_CREATE_UTILITY_BOOLEAN "utility"
947#define SDL_PROPERTY_WINDOW_CREATE_VULKAN_BOOLEAN "vulkan"
948#define SDL_PROPERTY_WINDOW_CREATE_WIDTH_NUMBER "width"
949#define SDL_PROPERTY_WINDOW_CREATE_X_NUMBER "x"
950#define SDL_PROPERTY_WINDOW_CREATE_Y_NUMBER "y"
951#define SDL_PROPERTY_WINDOW_CREATE_COCOA_WINDOW_POINTER "cocoa.window"
952#define SDL_PROPERTY_WINDOW_CREATE_COCOA_VIEW_POINTER "cocoa.view"
953#define SDL_PROPERTY_WINDOW_CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN "wayland.surface_role_custom"
954#define SDL_PROPERTY_WINDOW_CREATE_WAYLAND_CREATE_EGL_WINDOW_BOOLEAN "wayland.create_egl_window"
955#define SDL_PROPERTY_WINDOW_CREATE_WAYLAND_WL_SURFACE_POINTER "wayland.wl_surface"
956#define SDL_PROPERTY_WINDOW_CREATE_WIN32_HWND_POINTER "win32.hwnd"
957#define SDL_PROPERTY_WINDOW_CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER "win32.pixel_format_hwnd"
958#define SDL_PROPERTY_WINDOW_CREATE_X11_WINDOW_NUMBER "x11.window"
959
960/**
961 * Get the numeric ID of a window.
962 *
963 * The numeric ID is what SDL_WindowEvent references, and is necessary to map
964 * these events to specific SDL_Window objects.
965 *
966 * \param window the window to query
967 * \returns the ID of the window on success or 0 on failure; call
968 * SDL_GetError() for more information.
969 *
970 * \since This function is available since SDL 3.0.0.
971 *
972 * \sa SDL_GetWindowFromID
973 */
974extern DECLSPEC SDL_WindowID SDLCALL SDL_GetWindowID(SDL_Window *window);
975
976/**
977 * Get a window from a stored ID.
978 *
979 * The numeric ID is what SDL_WindowEvent references, and is necessary to map
980 * these events to specific SDL_Window objects.
981 *
982 * \param id the ID of the window
983 * \returns the window associated with `id` or NULL if it doesn't exist; call
984 * SDL_GetError() for more information.
985 *
986 * \since This function is available since SDL 3.0.0.
987 *
988 * \sa SDL_GetWindowID
989 */
990extern DECLSPEC SDL_Window *SDLCALL SDL_GetWindowFromID(SDL_WindowID id);
991
992/**
993 * Get parent of a window.
994 *
995 * \param window the window to query
996 * \returns the parent of the window on success or NULL if the window has no
997 * parent.
998 *
999 * \since This function is available since SDL 3.0.0.
1000 *
1001 * \sa SDL_CreatePopupWindow
1002 */
1003extern DECLSPEC SDL_Window *SDLCALL SDL_GetWindowParent(SDL_Window *window);
1004
1005/**
1006 * Get the properties associated with a window.
1007 *
1008 * The following read-only properties are provided by SDL:
1009 *
1010 * On Android:
1011 *
1012 * - `SDL_PROPERTY_WINDOW_ANDROID_WINDOW_POINTER`: the ANativeWindow
1013 * associated with the window
1014 * - `SDL_PROPERTY_WINDOW_ANDROID_SURFACE_POINTER`: the EGLSurface associated
1015 * with the window
1016 *
1017 * On iOS:
1018 *
1019 * - `SDL_PROPERTY_WINDOW_UIKIT_WINDOW_POINTER`: the `(__unsafe_unretained)`
1020 * UIWindow associated with the window
1021 * - `SDL_PROPERTY_WINDOW_UIKIT_METAL_VIEW_TAG_NUMBER`: the NSInteger tag
1022 * assocated with metal views on the window
1023 *
1024 * On KMS/DRM:
1025 *
1026 * - `SDL_PROPERTY_WINDOW_KMSDRM_DEVICE_INDEX_NUMBER`: the device index
1027 * associated with the window (e.g. the X in /dev/dri/cardX)
1028 * - `SDL_PROPERTY_WINDOW_KMSDRM_DRM_FD_NUMBER`: the DRM FD associated with
1029 * the window
1030 * - `SDL_PROPERTY_WINDOW_KMSDRM_GBM_DEVICE_POINTER`: the GBM device
1031 * associated with the window
1032 *
1033 * On macOS:
1034 *
1035 * - `SDL_PROPERTY_WINDOW_COCOA_WINDOW_POINTER`: the `(__unsafe_unretained)`
1036 * NSWindow associated with the window
1037 * - `SDL_PROPERTY_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER`: the NSInteger tag
1038 * assocated with metal views on the window
1039 *
1040 * On Vivante:
1041 *
1042 * - `SDL_PROPERTY_WINDOW_VIVANTE_DISPLAY_POINTER`: the EGLNativeDisplayType
1043 * associated with the window
1044 * - `SDL_PROPERTY_WINDOW_VIVANTE_WINDOW_POINTER`: the EGLNativeWindowType
1045 * associated with the window
1046 * - `SDL_PROPERTY_WINDOW_VIVANTE_SURFACE_POINTER`: the EGLSurface associated
1047 * with the window
1048 *
1049 * On UWP:
1050 *
1051 * - `SDL_PROPERTY_WINDOW_WINRT_WINDOW_POINTER`: the IInspectable CoreWindow
1052 * associated with the window
1053 *
1054 * On Windows:
1055 *
1056 * - `SDL_PROPERTY_WINDOW_WIN32_HWND_POINTER`: the HWND associated with the
1057 * window
1058 * - `SDL_PROPERTY_WINDOW_WIN32_HDC_POINTER`: the HDC associated with the
1059 * window
1060 * - `SDL_PROPERTY_WINDOW_WIN32_INSTANCE_POINTER`: the HINSTANCE associated
1061 * with the window
1062 *
1063 * On Wayland:
1064 *
1065 * Note: The `xdg_*` window objects do not internally persist across window
1066 * show/hide calls. They will be null if the window is hidden and must be
1067 * queried each time it is shown.
1068 *
1069 * - `SDL_PROPERTY_WINDOW_WAYLAND_DISPLAY_POINTER`: the wl_display associated
1070 * with the window
1071 * - `SDL_PROPERTY_WINDOW_WAYLAND_SURFACE_POINTER`: the wl_surface associated
1072 * with the window
1073 * - `SDL_PROPERTY_WINDOW_WAYLAND_EGL_WINDOW_POINTER`: the wl_egl_window
1074 * associated with the window
1075 * - `SDL_PROPERTY_WINDOW_WAYLAND_XDG_SURFACE_POINTER`: the xdg_surface
1076 * associated with the window
1077 * - `SDL_PROPERTY_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER`: the xdg_toplevel role
1078 * associated with the window
1079 * - `SDL_PROPERTY_WINDOW_WAYLAND_XDG_POPUP_POINTER`: the xdg_popup role
1080 * associated with the window
1081 * - `SDL_PROPERTY_WINDOW_WAYLAND_XDG_POSITIONER_POINTER`: the xdg_positioner
1082 * associated with the window, in popup mode
1083 *
1084 * On X11:
1085 *
1086 * - `SDL_PROPERTY_WINDOW_X11_DISPLAY_POINTER`: the X11 Display associated
1087 * with the window
1088 * - `SDL_PROPERTY_WINDOW_X11_SCREEN_NUMBER`: the screen number associated
1089 * with the window
1090 * - `SDL_PROPERTY_WINDOW_X11_WINDOW_NUMBER`: the X11 Window associated with
1091 * the window
1092 *
1093 * \param window the window to query
1094 * \returns a valid property ID on success or 0 on failure; call
1095 * SDL_GetError() for more information.
1096 *
1097 * \since This function is available since SDL 3.0.0.
1098 *
1099 * \sa SDL_GetProperty
1100 * \sa SDL_SetProperty
1101 */
1102extern DECLSPEC SDL_PropertiesID SDLCALL SDL_GetWindowProperties(SDL_Window *window);
1103
1104#define SDL_PROPERTY_WINDOW_ANDROID_WINDOW_POINTER "SDL.window.android.window"
1105#define SDL_PROPERTY_WINDOW_ANDROID_SURFACE_POINTER "SDL.window.android.surface"
1106#define SDL_PROPERTY_WINDOW_UIKIT_WINDOW_POINTER "SDL.window.uikit.window"
1107#define SDL_PROPERTY_WINDOW_UIKIT_METAL_VIEW_TAG_NUMBER "SDL.window.uikit.metal_view_tag"
1108#define SDL_PROPERTY_WINDOW_KMSDRM_DEVICE_INDEX_NUMBER "SDL.window.kmsdrm.dev_index"
1109#define SDL_PROPERTY_WINDOW_KMSDRM_DRM_FD_NUMBER "SDL.window.kmsdrm.drm_fd"
1110#define SDL_PROPERTY_WINDOW_KMSDRM_GBM_DEVICE_POINTER "SDL.window.kmsdrm.gbm_dev"
1111#define SDL_PROPERTY_WINDOW_COCOA_WINDOW_POINTER "SDL.window.cocoa.window"
1112#define SDL_PROPERTY_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER "SDL.window.cocoa.metal_view_tag"
1113#define SDL_PROPERTY_WINDOW_VIVANTE_DISPLAY_POINTER "SDL.window.vivante.display"
1114#define SDL_PROPERTY_WINDOW_VIVANTE_WINDOW_POINTER "SDL.window.vivante.window"
1115#define SDL_PROPERTY_WINDOW_VIVANTE_SURFACE_POINTER "SDL.window.vivante.surface"
1116#define SDL_PROPERTY_WINDOW_WINRT_WINDOW_POINTER "SDL.window.winrt.window"
1117#define SDL_PROPERTY_WINDOW_WIN32_HWND_POINTER "SDL.window.win32.hwnd"
1118#define SDL_PROPERTY_WINDOW_WIN32_HDC_POINTER "SDL.window.win32.hdc"
1119#define SDL_PROPERTY_WINDOW_WIN32_INSTANCE_POINTER "SDL.window.win32.instance"
1120#define SDL_PROPERTY_WINDOW_WAYLAND_DISPLAY_POINTER "SDL.window.wayland.display"
1121#define SDL_PROPERTY_WINDOW_WAYLAND_SURFACE_POINTER "SDL.window.wayland.surface"
1122#define SDL_PROPERTY_WINDOW_WAYLAND_EGL_WINDOW_POINTER "SDL.window.wayland.egl_window"
1123#define SDL_PROPERTY_WINDOW_WAYLAND_XDG_SURFACE_POINTER "SDL.window.wayland.xdg_surface"
1124#define SDL_PROPERTY_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER "SDL.window.wayland.xdg_toplevel"
1125#define SDL_PROPERTY_WINDOW_WAYLAND_XDG_POPUP_POINTER "SDL.window.wayland.xdg_popup"
1126#define SDL_PROPERTY_WINDOW_WAYLAND_XDG_POSITIONER_POINTER "SDL.window.wayland.xdg_positioner"
1127#define SDL_PROPERTY_WINDOW_X11_DISPLAY_POINTER "SDL.window.x11.display"
1128#define SDL_PROPERTY_WINDOW_X11_SCREEN_NUMBER "SDL.window.x11.screen"
1129#define SDL_PROPERTY_WINDOW_X11_WINDOW_NUMBER "SDL.window.x11.window"
1130
1131/**
1132 * Get the window flags.
1133 *
1134 * \param window the window to query
1135 * \returns a mask of the SDL_WindowFlags associated with `window`
1136 *
1137 * \since This function is available since SDL 3.0.0.
1138 *
1139 * \sa SDL_CreateWindow
1140 * \sa SDL_HideWindow
1141 * \sa SDL_MaximizeWindow
1142 * \sa SDL_MinimizeWindow
1143 * \sa SDL_SetWindowFullscreen
1144 * \sa SDL_SetWindowGrab
1145 * \sa SDL_ShowWindow
1146 */
1147extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_Window *window);
1148
1149/**
1150 * Set the title of a window.
1151 *
1152 * This string is expected to be in UTF-8 encoding.
1153 *
1154 * \param window the window to change
1155 * \param title the desired window title in UTF-8 format
1156 * \returns 0 on success or a negative error code on failure; call
1157 * SDL_GetError() for more information.
1158 *
1159 * \since This function is available since SDL 3.0.0.
1160 *
1161 * \sa SDL_GetWindowTitle
1162 */
1163extern DECLSPEC int SDLCALL SDL_SetWindowTitle(SDL_Window *window, const char *title);
1164
1165/**
1166 * Get the title of a window.
1167 *
1168 * \param window the window to query
1169 * \returns the title of the window in UTF-8 format or "" if there is no
1170 * title.
1171 *
1172 * \since This function is available since SDL 3.0.0.
1173 *
1174 * \sa SDL_SetWindowTitle
1175 */
1176extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_Window *window);
1177
1178/**
1179 * Set the icon for a window.
1180 *
1181 * \param window the window to change
1182 * \param icon an SDL_Surface structure containing the icon for the window
1183 * \returns 0 on success or a negative error code on failure; call
1184 * SDL_GetError() for more information.
1185 *
1186 * \since This function is available since SDL 3.0.0.
1187 */
1188extern DECLSPEC int SDLCALL SDL_SetWindowIcon(SDL_Window *window, SDL_Surface *icon);
1189
1190/**
1191 * Request that the window's position be set.
1192 *
1193 * If, at the time of this request, the window is in a fixed-size state such
1194 * as maximized, this request may be deferred until the window returns to a
1195 * resizable state.
1196 *
1197 * This can be used to reposition fullscreen-desktop windows onto a different
1198 * display, however, exclusive fullscreen windows are locked to a specific
1199 * display and can only be repositioned programmatically via
1200 * SDL_SetWindowFullscreenMode().
1201 *
1202 * On some windowing systems this request is asynchronous and the new
1203 * coordinates may not have have been applied immediately upon the return of
1204 * this function. If an immediate change is required, call SDL_SyncWindow() to
1205 * block until the changes have taken effect.
1206 *
1207 * When the window position changes, an SDL_EVENT_WINDOW_MOVED event will be
1208 * emitted with the window's new coordinates. Note that the new coordinates
1209 * may not match the exact coordinates requested, as some windowing systems
1210 * can restrict the position of the window in certain scenarios (e.g.
1211 * constraining the position so the window is always within desktop bounds).
1212 * Additionally, as this is just a request, it can be denied by the windowing
1213 * system.
1214 *
1215 * \param window the window to reposition
1216 * \param x the x coordinate of the window, or `SDL_WINDOWPOS_CENTERED` or
1217 * `SDL_WINDOWPOS_UNDEFINED`
1218 * \param y the y coordinate of the window, or `SDL_WINDOWPOS_CENTERED` or
1219 * `SDL_WINDOWPOS_UNDEFINED`
1220 * \returns 0 on success or a negative error code on failure; call
1221 * SDL_GetError() for more information.
1222 *
1223 * \since This function is available since SDL 3.0.0.
1224 *
1225 * \sa SDL_GetWindowPosition
1226 * \sa SDL_SyncWindow
1227 */
1228extern DECLSPEC int SDLCALL SDL_SetWindowPosition(SDL_Window *window, int x, int y);
1229
1230/**
1231 * Get the position of a window.
1232 *
1233 * This is the current position of the window as last reported by the
1234 * windowing system.
1235 *
1236 * If you do not need the value for one of the positions a NULL may be passed
1237 * in the `x` or `y` parameter.
1238 *
1239 * \param window the window to query
1240 * \param x a pointer filled in with the x position of the window, may be NULL
1241 * \param y a pointer filled in with the y position of the window, may be NULL
1242 * \returns 0 on success or a negative error code on failure; call
1243 * SDL_GetError() for more information.
1244 *
1245 * \since This function is available since SDL 3.0.0.
1246 *
1247 * \sa SDL_SetWindowPosition
1248 */
1249extern DECLSPEC int SDLCALL SDL_GetWindowPosition(SDL_Window *window, int *x, int *y);
1250
1251/**
1252 * Request that the size of a window's client area be set.
1253 *
1254 * NULL can safely be passed as the `w` or `h` parameter if the width or
1255 * height value is not desired.
1256 *
1257 * If, at the time of this request, the window in a fixed-size state, such as
1258 * maximized or fullscreen, the request will be deferred until the window
1259 * exits this state and becomes resizable again.
1260 *
1261 * To change the fullscreen mode of a window, use
1262 * SDL_SetWindowFullscreenMode()
1263 *
1264 * On some windowing systems, this request is asynchronous and the new window
1265 * size may not have have been applied immediately upon the return of this
1266 * function. If an immediate change is required, call SDL_SyncWindow() to
1267 * block until the changes have taken effect.
1268 *
1269 * When the window size changes, an SDL_EVENT_WINDOW_RESIZED event will be
1270 * emitted with the new window dimensions. Note that the new dimensions may
1271 * not match the exact size requested, as some windowing systems can restrict
1272 * the window size in certain scenarios (e.g. constraining the size of the
1273 * content area to remain within the usable desktop bounds). Additionally, as
1274 * this is just a request, it can be denied by the windowing system.
1275 *
1276 * \param window the window to change
1277 * \param w the width of the window, must be > 0
1278 * \param h the height of the window, must be > 0
1279 * \returns 0 on success or a negative error code on failure; call
1280 * SDL_GetError() for more information.
1281 *
1282 * \since This function is available since SDL 3.0.0.
1283 *
1284 * \sa SDL_GetWindowSize
1285 * \sa SDL_SetWindowFullscreenMode
1286 * \sa SDL_SyncWindow
1287 */
1288extern DECLSPEC int SDLCALL SDL_SetWindowSize(SDL_Window *window, int w, int h);
1289
1290/**
1291 * Get the size of a window's client area.
1292 *
1293 * NULL can safely be passed as the `w` or `h` parameter if the width or
1294 * height value is not desired.
1295 *
1296 * The window pixel size may differ from its window coordinate size if the
1297 * window is on a high pixel density display. Use SDL_GetWindowSizeInPixels()
1298 * or SDL_GetRenderOutputSize() to get the real client area size in pixels.
1299 *
1300 * \param window the window to query the width and height from
1301 * \param w a pointer filled in with the width of the window, may be NULL
1302 * \param h a pointer filled in with the height of the window, may be NULL
1303 * \returns 0 on success or a negative error code on failure; call
1304 * SDL_GetError() for more information.
1305 *
1306 * \since This function is available since SDL 3.0.0.
1307 *
1308 * \sa SDL_GetRenderOutputSize
1309 * \sa SDL_GetWindowSizeInPixels
1310 * \sa SDL_SetWindowSize
1311 */
1312extern DECLSPEC int SDLCALL SDL_GetWindowSize(SDL_Window *window, int *w, int *h);
1313
1314/**
1315 * Get the size of a window's borders (decorations) around the client area.
1316 *
1317 * Note: If this function fails (returns -1), the size values will be
1318 * initialized to 0, 0, 0, 0 (if a non-NULL pointer is provided), as if the
1319 * window in question was borderless.
1320 *
1321 * Note: This function may fail on systems where the window has not yet been
1322 * decorated by the display server (for example, immediately after calling
1323 * SDL_CreateWindow). It is recommended that you wait at least until the
1324 * window has been presented and composited, so that the window system has a
1325 * chance to decorate the window and provide the border dimensions to SDL.
1326 *
1327 * This function also returns -1 if getting the information is not supported.
1328 *
1329 * \param window the window to query the size values of the border
1330 * (decorations) from
1331 * \param top pointer to variable for storing the size of the top border; NULL
1332 * is permitted
1333 * \param left pointer to variable for storing the size of the left border;
1334 * NULL is permitted
1335 * \param bottom pointer to variable for storing the size of the bottom
1336 * border; NULL is permitted
1337 * \param right pointer to variable for storing the size of the right border;
1338 * NULL is permitted
1339 * \returns 0 on success or a negative error code on failure; call
1340 * SDL_GetError() for more information.
1341 *
1342 * \since This function is available since SDL 3.0.0.
1343 *
1344 * \sa SDL_GetWindowSize
1345 */
1346extern DECLSPEC int SDLCALL SDL_GetWindowBordersSize(SDL_Window *window, int *top, int *left, int *bottom, int *right);
1347
1348/**
1349 * Get the size of a window's client area, in pixels.
1350 *
1351 * \param window the window from which the drawable size should be queried
1352 * \param w a pointer to variable for storing the width in pixels, may be NULL
1353 * \param h a pointer to variable for storing the height in pixels, may be
1354 * NULL
1355 * \returns 0 on success or a negative error code on failure; call
1356 * SDL_GetError() for more information.
1357 *
1358 * \since This function is available since SDL 3.0.0.
1359 *
1360 * \sa SDL_CreateWindow
1361 * \sa SDL_GetWindowSize
1362 */
1363extern DECLSPEC int SDLCALL SDL_GetWindowSizeInPixels(SDL_Window *window, int *w, int *h);
1364
1365/**
1366 * Set the minimum size of a window's client area.
1367 *
1368 * \param window the window to change
1369 * \param min_w the minimum width of the window, or 0 for no limit
1370 * \param min_h the minimum height of the window, or 0 for no limit
1371 * \returns 0 on success or a negative error code on failure; call
1372 * SDL_GetError() for more information.
1373 *
1374 * \since This function is available since SDL 3.0.0.
1375 *
1376 * \sa SDL_GetWindowMinimumSize
1377 * \sa SDL_SetWindowMaximumSize
1378 */
1379extern DECLSPEC int SDLCALL SDL_SetWindowMinimumSize(SDL_Window *window, int min_w, int min_h);
1380
1381/**
1382 * Get the minimum size of a window's client area.
1383 *
1384 * \param window the window to query
1385 * \param w a pointer filled in with the minimum width of the window, may be
1386 * NULL
1387 * \param h a pointer filled in with the minimum height of the window, may be
1388 * NULL
1389 * \returns 0 on success or a negative error code on failure; call
1390 * SDL_GetError() for more information.
1391 *
1392 * \since This function is available since SDL 3.0.0.
1393 *
1394 * \sa SDL_GetWindowMaximumSize
1395 * \sa SDL_SetWindowMinimumSize
1396 */
1397extern DECLSPEC int SDLCALL SDL_GetWindowMinimumSize(SDL_Window *window, int *w, int *h);
1398
1399/**
1400 * Set the maximum size of a window's client area.
1401 *
1402 * \param window the window to change
1403 * \param max_w the maximum width of the window, or 0 for no limit
1404 * \param max_h the maximum height of the window, or 0 for no limit
1405 * \returns 0 on success or a negative error code on failure; call
1406 * SDL_GetError() for more information.
1407 *
1408 * \since This function is available since SDL 3.0.0.
1409 *
1410 * \sa SDL_GetWindowMaximumSize
1411 * \sa SDL_SetWindowMinimumSize
1412 */
1413extern DECLSPEC int SDLCALL SDL_SetWindowMaximumSize(SDL_Window *window, int max_w, int max_h);
1414
1415/**
1416 * Get the maximum size of a window's client area.
1417 *
1418 * \param window the window to query
1419 * \param w a pointer filled in with the maximum width of the window, may be
1420 * NULL
1421 * \param h a pointer filled in with the maximum height of the window, may be
1422 * NULL
1423 * \returns 0 on success or a negative error code on failure; call
1424 * SDL_GetError() for more information.
1425 *
1426 * \since This function is available since SDL 3.0.0.
1427 *
1428 * \sa SDL_GetWindowMinimumSize
1429 * \sa SDL_SetWindowMaximumSize
1430 */
1431extern DECLSPEC int SDLCALL SDL_GetWindowMaximumSize(SDL_Window *window, int *w, int *h);
1432
1433/**
1434 * Set the border state of a window.
1435 *
1436 * This will add or remove the window's `SDL_WINDOW_BORDERLESS` flag and add
1437 * or remove the border from the actual window. This is a no-op if the
1438 * window's border already matches the requested state.
1439 *
1440 * You can't change the border state of a fullscreen window.
1441 *
1442 * \param window the window of which to change the border state
1443 * \param bordered SDL_FALSE to remove border, SDL_TRUE to add border
1444 * \returns 0 on success or a negative error code on failure; call
1445 * SDL_GetError() for more information.
1446 *
1447 * \since This function is available since SDL 3.0.0.
1448 *
1449 * \sa SDL_GetWindowFlags
1450 */
1451extern DECLSPEC int SDLCALL SDL_SetWindowBordered(SDL_Window *window, SDL_bool bordered);
1452
1453/**
1454 * Set the user-resizable state of a window.
1455 *
1456 * This will add or remove the window's `SDL_WINDOW_RESIZABLE` flag and
1457 * allow/disallow user resizing of the window. This is a no-op if the window's
1458 * resizable state already matches the requested state.
1459 *
1460 * You can't change the resizable state of a fullscreen window.
1461 *
1462 * \param window the window of which to change the resizable state
1463 * \param resizable SDL_TRUE to allow resizing, SDL_FALSE to disallow
1464 * \returns 0 on success or a negative error code on failure; call
1465 * SDL_GetError() for more information.
1466 *
1467 * \since This function is available since SDL 3.0.0.
1468 *
1469 * \sa SDL_GetWindowFlags
1470 */
1471extern DECLSPEC int SDLCALL SDL_SetWindowResizable(SDL_Window *window, SDL_bool resizable);
1472
1473/**
1474 * Set the window to always be above the others.
1475 *
1476 * This will add or remove the window's `SDL_WINDOW_ALWAYS_ON_TOP` flag. This
1477 * will bring the window to the front and keep the window above the rest.
1478 *
1479 * \param window The window of which to change the always on top state
1480 * \param on_top SDL_TRUE to set the window always on top, SDL_FALSE to
1481 * disable
1482 * \returns 0 on success or a negative error code on failure; call
1483 * SDL_GetError() for more information.
1484 *
1485 * \since This function is available since SDL 3.0.0.
1486 *
1487 * \sa SDL_GetWindowFlags
1488 */
1489extern DECLSPEC int SDLCALL SDL_SetWindowAlwaysOnTop(SDL_Window *window, SDL_bool on_top);
1490
1491/**
1492 * Show a window.
1493 *
1494 * \param window the window to show
1495 * \returns 0 on success or a negative error code on failure; call
1496 * SDL_GetError() for more information.
1497 *
1498 * \since This function is available since SDL 3.0.0.
1499 *
1500 * \sa SDL_HideWindow
1501 * \sa SDL_RaiseWindow
1502 */
1503extern DECLSPEC int SDLCALL SDL_ShowWindow(SDL_Window *window);
1504
1505/**
1506 * Hide a window.
1507 *
1508 * \param window the window to hide
1509 * \returns 0 on success or a negative error code on failure; call
1510 * SDL_GetError() for more information.
1511 *
1512 * \since This function is available since SDL 3.0.0.
1513 *
1514 * \sa SDL_ShowWindow
1515 */
1516extern DECLSPEC int SDLCALL SDL_HideWindow(SDL_Window *window);
1517
1518/**
1519 * Raise a window above other windows and set the input focus.
1520 *
1521 * \param window the window to raise
1522 * \returns 0 on success or a negative error code on failure; call
1523 * SDL_GetError() for more information.
1524 *
1525 * \since This function is available since SDL 3.0.0.
1526 */
1527extern DECLSPEC int SDLCALL SDL_RaiseWindow(SDL_Window *window);
1528
1529/**
1530 * Request that the window be made as large as possible.
1531 *
1532 * Non-resizable windows can't be maximized. The window must have the
1533 * SDL_WINDOW_RESIZABLE flag set, or this will have no effect.
1534 *
1535 * On some windowing systems this request is asynchronous and the new window
1536 * state may not have have been applied immediately upon the return of this
1537 * function. If an immediate change is required, call SDL_SyncWindow() to
1538 * block until the changes have taken effect.
1539 *
1540 * When the window state changes, an SDL_EVENT_WINDOW_MAXIMIZED event will be
1541 * emitted. Note that, as this is just a request, the windowing system can
1542 * deny the state change.
1543 *
1544 * When maximizing a window, whether the constraints set via
1545 * SDL_SetWindowMaximumSize() are honored depends on the policy of the window
1546 * manager. Win32 and macOS enforce the constraints when maximizing, while X11
1547 * and Wayland window managers may vary.
1548 *
1549 * \param window the window to maximize
1550 * \returns 0 on success or a negative error code on failure; call
1551 * SDL_GetError() for more information.
1552 *
1553 * \since This function is available since SDL 3.0.0.
1554 *
1555 * \sa SDL_MinimizeWindow
1556 * \sa SDL_RestoreWindow
1557 * \sa SDL_SyncWindow
1558 */
1559extern DECLSPEC int SDLCALL SDL_MaximizeWindow(SDL_Window *window);
1560
1561/**
1562 * Request that the window be minimized to an iconic representation.
1563 *
1564 * On some windowing systems this request is asynchronous and the new window
1565 * state may not have have been applied immediately upon the return of this
1566 * function. If an immediate change is required, call SDL_SyncWindow() to
1567 * block until the changes have taken effect.
1568 *
1569 * When the window state changes, an SDL_EVENT_WINDOW_MINIMIZED event will be
1570 * emitted. Note that, as this is just a request, the windowing system can
1571 * deny the state change.
1572 *
1573 * \param window the window to minimize
1574 * \returns 0 on success or a negative error code on failure; call
1575 * SDL_GetError() for more information.
1576 *
1577 * \since This function is available since SDL 3.0.0.
1578 *
1579 * \sa SDL_MaximizeWindow
1580 * \sa SDL_RestoreWindow
1581 * \sa SDL_SyncWindow
1582 */
1583extern DECLSPEC int SDLCALL SDL_MinimizeWindow(SDL_Window *window);
1584
1585/**
1586 * Request that the size and position of a minimized or maximized window be
1587 * restored.
1588 *
1589 * On some windowing systems this request is asynchronous and the new window
1590 * state may not have have been applied immediately upon the return of this
1591 * function. If an immediate change is required, call SDL_SyncWindow() to
1592 * block until the changes have taken effect.
1593 *
1594 * When the window state changes, an SDL_EVENT_WINDOW_RESTORED event will be
1595 * emitted. Note that, as this is just a request, the windowing system can
1596 * deny the state change.
1597 *
1598 * \param window the window to restore
1599 * \returns 0 on success or a negative error code on failure; call
1600 * SDL_GetError() for more information.
1601 *
1602 * \since This function is available since SDL 3.0.0.
1603 *
1604 * \sa SDL_MaximizeWindow
1605 * \sa SDL_MinimizeWindow
1606 * \sa SDL_SyncWindow
1607 */
1608extern DECLSPEC int SDLCALL SDL_RestoreWindow(SDL_Window *window);
1609
1610/**
1611 * Request that the window's fullscreen state be changed.
1612 *
1613 * By default a window in fullscreen state uses borderless fullscreen desktop
1614 * mode, but a specific exclusive display mode can be set using
1615 * SDL_SetWindowFullscreenMode().
1616 *
1617 * On some windowing systems this request is asynchronous and the new
1618 * fullscreen state may not have have been applied immediately upon the return
1619 * of this function. If an immediate change is required, call SDL_SyncWindow()
1620 * to block until the changes have taken effect.
1621 *
1622 * When the window state changes, an SDL_EVENT_WINDOW_ENTER_FULLSCREEN or
1623 * SDL_EVENT_WINDOW_LEAVE_FULLSCREEN event will be emitted. Note that, as this
1624 * is just a request, it can be denied by the windowing system.
1625 *
1626 * \param window the window to change
1627 * \param fullscreen SDL_TRUE for fullscreen mode, SDL_FALSE for windowed mode
1628 * \returns 0 on success or a negative error code on failure; call
1629 * SDL_GetError() for more information.
1630 *
1631 * \since This function is available since SDL 3.0.0.
1632 *
1633 * \sa SDL_GetWindowFullscreenMode
1634 * \sa SDL_SetWindowFullscreenMode
1635 * \sa SDL_SyncWindow
1636 */
1637extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window *window, SDL_bool fullscreen);
1638
1639/**
1640 * Block until any pending window state is finalized.
1641 *
1642 * On asynchronous windowing systems, this acts as a synchronization barrier
1643 * for pending window state. It will attempt to wait until any pending window
1644 * state has been applied and is guaranteed to return within finite time. Note
1645 * that for how long it can potentially block depends on the underlying window
1646 * system, as window state changes may involve somewhat lengthy animations
1647 * that must complete before the window is in its final requested state.
1648 *
1649 * On windowing systems where changes are immediate, this does nothing.
1650 *
1651 * \param window the window for which to wait for the pending state to be
1652 * applied
1653 * \returns 0 on success, a positive value if the operation timed out before
1654 * the window was in the requested state, or a negative error code on
1655 * failure; call SDL_GetError() for more information.
1656 *
1657 * \since This function is available since SDL 3.0.0.
1658 *
1659 * \sa SDL_SetWindowSize
1660 * \sa SDL_SetWindowPosition
1661 * \sa SDL_SetWindowFullscreen
1662 * \sa SDL_MinimizeWindow
1663 * \sa SDL_MaximizeWindow
1664 * \sa SDL_RestoreWindow
1665 */
1666extern DECLSPEC int SDLCALL SDL_SyncWindow(SDL_Window *window);
1667
1668/**
1669 * Return whether the window has a surface associated with it.
1670 *
1671 * \param window the window to query
1672 * \returns SDL_TRUE if there is a surface associated with the window, or
1673 * SDL_FALSE otherwise.
1674 *
1675 * \since This function is available since SDL 3.0.0.
1676 *
1677 * \sa SDL_GetWindowSurface
1678 */
1679extern DECLSPEC SDL_bool SDLCALL SDL_HasWindowSurface(SDL_Window *window);
1680
1681/**
1682 * Get the SDL surface associated with the window.
1683 *
1684 * A new surface will be created with the optimal format for the window, if
1685 * necessary. This surface will be freed when the window is destroyed. Do not
1686 * free this surface.
1687 *
1688 * This surface will be invalidated if the window is resized. After resizing a
1689 * window this function must be called again to return a valid surface.
1690 *
1691 * You may not combine this with 3D or the rendering API on this window.
1692 *
1693 * This function is affected by `SDL_HINT_FRAMEBUFFER_ACCELERATION`.
1694 *
1695 * \param window the window to query
1696 * \returns the surface associated with the window, or NULL on failure; call
1697 * SDL_GetError() for more information.
1698 *
1699 * \since This function is available since SDL 3.0.0.
1700 *
1701 * \sa SDL_DestroyWindowSurface
1702 * \sa SDL_HasWindowSurface
1703 * \sa SDL_UpdateWindowSurface
1704 * \sa SDL_UpdateWindowSurfaceRects
1705 */
1706extern DECLSPEC SDL_Surface *SDLCALL SDL_GetWindowSurface(SDL_Window *window);
1707
1708/**
1709 * Copy the window surface to the screen.
1710 *
1711 * This is the function you use to reflect any changes to the surface on the
1712 * screen.
1713 *
1714 * This function is equivalent to the SDL 1.2 API SDL_Flip().
1715 *
1716 * \param window the window to update
1717 * \returns 0 on success or a negative error code on failure; call
1718 * SDL_GetError() for more information.
1719 *
1720 * \since This function is available since SDL 3.0.0.
1721 *
1722 * \sa SDL_GetWindowSurface
1723 * \sa SDL_UpdateWindowSurfaceRects
1724 */
1725extern DECLSPEC int SDLCALL SDL_UpdateWindowSurface(SDL_Window *window);
1726
1727/**
1728 * Copy areas of the window surface to the screen.
1729 *
1730 * This is the function you use to reflect changes to portions of the surface
1731 * on the screen.
1732 *
1733 * This function is equivalent to the SDL 1.2 API SDL_UpdateRects().
1734 *
1735 * Note that this function will update _at least_ the rectangles specified,
1736 * but this is only intended as an optimization; in practice, this might
1737 * update more of the screen (or all of the screen!), depending on what method
1738 * SDL uses to send pixels to the system.
1739 *
1740 * \param window the window to update
1741 * \param rects an array of SDL_Rect structures representing areas of the
1742 * surface to copy, in pixels
1743 * \param numrects the number of rectangles
1744 * \returns 0 on success or a negative error code on failure; call
1745 * SDL_GetError() for more information.
1746 *
1747 * \since This function is available since SDL 3.0.0.
1748 *
1749 * \sa SDL_GetWindowSurface
1750 * \sa SDL_UpdateWindowSurface
1751 */
1752extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window *window, const SDL_Rect *rects, int numrects);
1753
1754/**
1755 * Destroy the surface associated with the window.
1756 *
1757 * \param window the window to update
1758 * \returns 0 on success or a negative error code on failure; call
1759 * SDL_GetError() for more information.
1760 *
1761 * \since This function is available since SDL 3.0.0.
1762 *
1763 * \sa SDL_GetWindowSurface
1764 * \sa SDL_HasWindowSurface
1765 */
1766extern DECLSPEC int SDLCALL SDL_DestroyWindowSurface(SDL_Window *window);
1767
1768/**
1769 * Set a window's input grab mode.
1770 *
1771 * When input is grabbed, the mouse is confined to the window. This function
1772 * will also grab the keyboard if `SDL_HINT_GRAB_KEYBOARD` is set. To grab the
1773 * keyboard without also grabbing the mouse, use SDL_SetWindowKeyboardGrab().
1774 *
1775 * If the caller enables a grab while another window is currently grabbed, the
1776 * other window loses its grab in favor of the caller's window.
1777 *
1778 * \param window the window for which the input grab mode should be set
1779 * \param grabbed SDL_TRUE to grab input or SDL_FALSE to release input
1780 * \returns 0 on success or a negative error code on failure; call
1781 * SDL_GetError() for more information.
1782 *
1783 * \since This function is available since SDL 3.0.0.
1784 *
1785 * \sa SDL_GetGrabbedWindow
1786 * \sa SDL_GetWindowGrab
1787 */
1788extern DECLSPEC int SDLCALL SDL_SetWindowGrab(SDL_Window *window, SDL_bool grabbed);
1789
1790/**
1791 * Set a window's keyboard grab mode.
1792 *
1793 * Keyboard grab enables capture of system keyboard shortcuts like Alt+Tab or
1794 * the Meta/Super key. Note that not all system keyboard shortcuts can be
1795 * captured by applications (one example is Ctrl+Alt+Del on Windows).
1796 *
1797 * This is primarily intended for specialized applications such as VNC clients
1798 * or VM frontends. Normal games should not use keyboard grab.
1799 *
1800 * When keyboard grab is enabled, SDL will continue to handle Alt+Tab when the
1801 * window is full-screen to ensure the user is not trapped in your
1802 * application. If you have a custom keyboard shortcut to exit fullscreen
1803 * mode, you may suppress this behavior with
1804 * `SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED`.
1805 *
1806 * If the caller enables a grab while another window is currently grabbed, the
1807 * other window loses its grab in favor of the caller's window.
1808 *
1809 * \param window The window for which the keyboard grab mode should be set.
1810 * \param grabbed This is SDL_TRUE to grab keyboard, and SDL_FALSE to release.
1811 * \returns 0 on success or a negative error code on failure; call
1812 * SDL_GetError() for more information.
1813 *
1814 * \since This function is available since SDL 3.0.0.
1815 *
1816 * \sa SDL_GetWindowKeyboardGrab
1817 * \sa SDL_SetWindowMouseGrab
1818 * \sa SDL_SetWindowGrab
1819 */
1820extern DECLSPEC int SDLCALL SDL_SetWindowKeyboardGrab(SDL_Window *window, SDL_bool grabbed);
1821
1822/**
1823 * Set a window's mouse grab mode.
1824 *
1825 * Mouse grab confines the mouse cursor to the window.
1826 *
1827 * \param window The window for which the mouse grab mode should be set.
1828 * \param grabbed This is SDL_TRUE to grab mouse, and SDL_FALSE to release.
1829 * \returns 0 on success or a negative error code on failure; call
1830 * SDL_GetError() for more information.
1831 *
1832 * \since This function is available since SDL 3.0.0.
1833 *
1834 * \sa SDL_GetWindowMouseGrab
1835 * \sa SDL_SetWindowKeyboardGrab
1836 * \sa SDL_SetWindowGrab
1837 */
1838extern DECLSPEC int SDLCALL SDL_SetWindowMouseGrab(SDL_Window *window, SDL_bool grabbed);
1839
1840/**
1841 * Get a window's input grab mode.
1842 *
1843 * \param window the window to query
1844 * \returns SDL_TRUE if input is grabbed, SDL_FALSE otherwise.
1845 *
1846 * \since This function is available since SDL 3.0.0.
1847 *
1848 * \sa SDL_SetWindowGrab
1849 */
1850extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab(SDL_Window *window);
1851
1852/**
1853 * Get a window's keyboard grab mode.
1854 *
1855 * \param window the window to query
1856 * \returns SDL_TRUE if keyboard is grabbed, and SDL_FALSE otherwise.
1857 *
1858 * \since This function is available since SDL 3.0.0.
1859 *
1860 * \sa SDL_SetWindowKeyboardGrab
1861 * \sa SDL_GetWindowGrab
1862 */
1863extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowKeyboardGrab(SDL_Window *window);
1864
1865/**
1866 * Get a window's mouse grab mode.
1867 *
1868 * \param window the window to query
1869 * \returns SDL_TRUE if mouse is grabbed, and SDL_FALSE otherwise.
1870 *
1871 * \since This function is available since SDL 3.0.0.
1872 *
1873 * \sa SDL_SetWindowKeyboardGrab
1874 * \sa SDL_GetWindowGrab
1875 */
1876extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowMouseGrab(SDL_Window *window);
1877
1878/**
1879 * Get the window that currently has an input grab enabled.
1880 *
1881 * \returns the window if input is grabbed or NULL otherwise.
1882 *
1883 * \since This function is available since SDL 3.0.0.
1884 *
1885 * \sa SDL_GetWindowGrab
1886 * \sa SDL_SetWindowGrab
1887 */
1888extern DECLSPEC SDL_Window *SDLCALL SDL_GetGrabbedWindow(void);
1889
1890/**
1891 * Confines the cursor to the specified area of a window.
1892 *
1893 * Note that this does NOT grab the cursor, it only defines the area a cursor
1894 * is restricted to when the window has mouse focus.
1895 *
1896 * \param window The window that will be associated with the barrier.
1897 * \param rect A rectangle area in window-relative coordinates. If NULL the
1898 * barrier for the specified window will be destroyed.
1899 * \returns 0 on success or a negative error code on failure; call
1900 * SDL_GetError() for more information.
1901 *
1902 * \since This function is available since SDL 3.0.0.
1903 *
1904 * \sa SDL_GetWindowMouseRect
1905 * \sa SDL_SetWindowMouseGrab
1906 */
1907extern DECLSPEC int SDLCALL SDL_SetWindowMouseRect(SDL_Window *window, const SDL_Rect *rect);
1908
1909/**
1910 * Get the mouse confinement rectangle of a window.
1911 *
1912 * \param window The window to query
1913 * \returns A pointer to the mouse confinement rectangle of a window, or NULL
1914 * if there isn't one.
1915 *
1916 * \since This function is available since SDL 3.0.0.
1917 *
1918 * \sa SDL_SetWindowMouseRect
1919 */
1920extern DECLSPEC const SDL_Rect *SDLCALL SDL_GetWindowMouseRect(SDL_Window *window);
1921
1922/**
1923 * Set the opacity for a window.
1924 *
1925 * The parameter `opacity` will be clamped internally between 0.0f
1926 * (transparent) and 1.0f (opaque).
1927 *
1928 * This function also returns -1 if setting the opacity isn't supported.
1929 *
1930 * \param window the window which will be made transparent or opaque
1931 * \param opacity the opacity value (0.0f - transparent, 1.0f - opaque)
1932 * \returns 0 on success or a negative error code on failure; call
1933 * SDL_GetError() for more information.
1934 *
1935 * \since This function is available since SDL 3.0.0.
1936 *
1937 * \sa SDL_GetWindowOpacity
1938 */
1939extern DECLSPEC int SDLCALL SDL_SetWindowOpacity(SDL_Window *window, float opacity);
1940
1941/**
1942 * Get the opacity of a window.
1943 *
1944 * If transparency isn't supported on this platform, opacity will be reported
1945 * as 1.0f without error.
1946 *
1947 * The parameter `opacity` is ignored if it is NULL.
1948 *
1949 * This function also returns -1 if an invalid window was provided.
1950 *
1951 * \param window the window to get the current opacity value from
1952 * \param out_opacity the float filled in (0.0f - transparent, 1.0f - opaque)
1953 * \returns 0 on success or a negative error code on failure; call
1954 * SDL_GetError() for more information.
1955 *
1956 * \since This function is available since SDL 3.0.0.
1957 *
1958 * \sa SDL_SetWindowOpacity
1959 */
1960extern DECLSPEC int SDLCALL SDL_GetWindowOpacity(SDL_Window *window, float *out_opacity);
1961
1962/**
1963 * Set the window as a modal for another window.
1964 *
1965 * \param modal_window the window that should be set modal
1966 * \param parent_window the parent window for the modal window
1967 * \returns 0 on success or a negative error code on failure; call
1968 * SDL_GetError() for more information.
1969 *
1970 * \since This function is available since SDL 3.0.0.
1971 */
1972extern DECLSPEC int SDLCALL SDL_SetWindowModalFor(SDL_Window *modal_window, SDL_Window *parent_window);
1973
1974/**
1975 * Explicitly set input focus to the window.
1976 *
1977 * You almost certainly want SDL_RaiseWindow() instead of this function. Use
1978 * this with caution, as you might give focus to a window that is completely
1979 * obscured by other windows.
1980 *
1981 * \param window the window that should get the input focus
1982 * \returns 0 on success or a negative error code on failure; call
1983 * SDL_GetError() for more information.
1984 *
1985 * \since This function is available since SDL 3.0.0.
1986 *
1987 * \sa SDL_RaiseWindow
1988 */
1989extern DECLSPEC int SDLCALL SDL_SetWindowInputFocus(SDL_Window *window);
1990
1991/**
1992 * Set whether the window may have input focus.
1993 *
1994 * \param window the window to set focusable state
1995 * \param focusable SDL_TRUE to allow input focus, SDL_FALSE to not allow
1996 * input focus
1997 * \returns 0 on success or a negative error code on failure; call
1998 * SDL_GetError() for more information.
1999 *
2000 * \since This function is available since SDL 3.0.0.
2001 */
2002extern DECLSPEC int SDLCALL SDL_SetWindowFocusable(SDL_Window *window, SDL_bool focusable);
2003
2004
2005/**
2006 * Display the system-level window menu.
2007 *
2008 * This default window menu is provided by the system and on some platforms
2009 * provides functionality for setting or changing privileged state on the
2010 * window, such as moving it between workspaces or displays, or toggling the
2011 * always-on-top property.
2012 *
2013 * On platforms or desktops where this is unsupported, this function does
2014 * nothing.
2015 *
2016 * \param window the window for which the menu will be displayed
2017 * \param x the x coordinate of the menu, relative to the origin (top-left) of
2018 * the client area
2019 * \param y the y coordinate of the menu, relative to the origin (top-left) of
2020 * the client area
2021 * \returns 0 on success or a negative error code on failure; call
2022 * SDL_GetError() for more information.
2023 *
2024 * \since This function is available since SDL 3.0.0.
2025 */
2026extern DECLSPEC int SDLCALL SDL_ShowWindowSystemMenu(SDL_Window *window, int x, int y);
2027
2028/**
2029 * Possible return values from the SDL_HitTest callback.
2030 *
2031 * \sa SDL_HitTest
2032 */
2046
2047/**
2048 * Callback used for hit-testing.
2049 *
2050 * \param win the SDL_Window where hit-testing was set on
2051 * \param area an SDL_Point which should be hit-tested
2052 * \param data what was passed as `callback_data` to SDL_SetWindowHitTest()
2053 * \returns an SDL_HitTestResult value.
2054 *
2055 * \sa SDL_SetWindowHitTest
2056 */
2058 const SDL_Point *area,
2059 void *data);
2060
2061/**
2062 * Provide a callback that decides if a window region has special properties.
2063 *
2064 * Normally windows are dragged and resized by decorations provided by the
2065 * system window manager (a title bar, borders, etc), but for some apps, it
2066 * makes sense to drag them from somewhere else inside the window itself; for
2067 * example, one might have a borderless window that wants to be draggable from
2068 * any part, or simulate its own title bar, etc.
2069 *
2070 * This function lets the app provide a callback that designates pieces of a
2071 * given window as special. This callback is run during event processing if we
2072 * need to tell the OS to treat a region of the window specially; the use of
2073 * this callback is known as "hit testing."
2074 *
2075 * Mouse input may not be delivered to your application if it is within a
2076 * special area; the OS will often apply that input to moving the window or
2077 * resizing the window and not deliver it to the application.
2078 *
2079 * Specifying NULL for a callback disables hit-testing. Hit-testing is
2080 * disabled by default.
2081 *
2082 * Platforms that don't support this functionality will return -1
2083 * unconditionally, even if you're attempting to disable hit-testing.
2084 *
2085 * Your callback may fire at any time, and its firing does not indicate any
2086 * specific behavior (for example, on Windows, this certainly might fire when
2087 * the OS is deciding whether to drag your window, but it fires for lots of
2088 * other reasons, too, some unrelated to anything you probably care about _and
2089 * when the mouse isn't actually at the location it is testing_). Since this
2090 * can fire at any time, you should try to keep your callback efficient,
2091 * devoid of allocations, etc.
2092 *
2093 * \param window the window to set hit-testing on
2094 * \param callback the function to call when doing a hit-test
2095 * \param callback_data an app-defined void pointer passed to **callback**
2096 * \returns 0 on success or a negative error code on failure; call
2097 * SDL_GetError() for more information.
2098 *
2099 * \since This function is available since SDL 3.0.0.
2100 */
2101extern DECLSPEC int SDLCALL SDL_SetWindowHitTest(SDL_Window *window, SDL_HitTest callback, void *callback_data);
2102
2103/**
2104 * Request a window to demand attention from the user.
2105 *
2106 * \param window the window to be flashed
2107 * \param operation the flash operation
2108 * \returns 0 on success or a negative error code on failure; call
2109 * SDL_GetError() for more information.
2110 *
2111 * \since This function is available since SDL 3.0.0.
2112 */
2113extern DECLSPEC int SDLCALL SDL_FlashWindow(SDL_Window *window, SDL_FlashOperation operation);
2114
2115/**
2116 * Destroy a window.
2117 *
2118 * If `window` is NULL, this function will return immediately after setting
2119 * the SDL error message to "Invalid window". See SDL_GetError().
2120 *
2121 * \param window the window to destroy
2122 *
2123 * \since This function is available since SDL 3.0.0.
2124 *
2125 * \sa SDL_CreatePopupWindow
2126 * \sa SDL_CreateWindow
2127 * \sa SDL_CreateWindowWithProperties
2128 */
2129extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window *window);
2130
2131
2132/**
2133 * Check whether the screensaver is currently enabled.
2134 *
2135 * The screensaver is disabled by default since SDL 2.0.2. Before SDL 2.0.2
2136 * the screensaver was enabled by default.
2137 *
2138 * The default can also be changed using `SDL_HINT_VIDEO_ALLOW_SCREENSAVER`.
2139 *
2140 * \returns SDL_TRUE if the screensaver is enabled, SDL_FALSE if it is
2141 * disabled.
2142 *
2143 * \since This function is available since SDL 3.0.0.
2144 *
2145 * \sa SDL_DisableScreenSaver
2146 * \sa SDL_EnableScreenSaver
2147 */
2148extern DECLSPEC SDL_bool SDLCALL SDL_ScreenSaverEnabled(void);
2149
2150/**
2151 * Allow the screen to be blanked by a screen saver.
2152 *
2153 * \returns 0 on success or a negative error code on failure; call
2154 * SDL_GetError() for more information.
2155 *
2156 * \since This function is available since SDL 3.0.0.
2157 *
2158 * \sa SDL_DisableScreenSaver
2159 * \sa SDL_ScreenSaverEnabled
2160 */
2161extern DECLSPEC int SDLCALL SDL_EnableScreenSaver(void);
2162
2163/**
2164 * Prevent the screen from being blanked by a screen saver.
2165 *
2166 * If you disable the screensaver, it is automatically re-enabled when SDL
2167 * quits.
2168 *
2169 * The screensaver is disabled by default since SDL 2.0.2. Before SDL 2.0.2
2170 * the screensaver was enabled by default.
2171 *
2172 * \returns 0 on success or a negative error code on failure; call
2173 * SDL_GetError() for more information.
2174 *
2175 * \since This function is available since SDL 3.0.0.
2176 *
2177 * \sa SDL_EnableScreenSaver
2178 * \sa SDL_ScreenSaverEnabled
2179 */
2180extern DECLSPEC int SDLCALL SDL_DisableScreenSaver(void);
2181
2182
2183/**
2184 * \name OpenGL support functions
2185 */
2186/* @{ */
2187
2188/**
2189 * Dynamically load an OpenGL library.
2190 *
2191 * This should be done after initializing the video driver, but before
2192 * creating any OpenGL windows. If no OpenGL library is loaded, the default
2193 * library will be loaded upon creation of the first OpenGL window.
2194 *
2195 * If you do this, you need to retrieve all of the GL functions used in your
2196 * program from the dynamic library using SDL_GL_GetProcAddress().
2197 *
2198 * \param path the platform dependent OpenGL library name, or NULL to open the
2199 * default OpenGL library
2200 * \returns 0 on success or a negative error code on failure; call
2201 * SDL_GetError() for more information.
2202 *
2203 * \since This function is available since SDL 3.0.0.
2204 *
2205 * \sa SDL_GL_GetProcAddress
2206 * \sa SDL_GL_UnloadLibrary
2207 */
2208extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path);
2209
2210/**
2211 * Get an OpenGL function by name.
2212 *
2213 * If the GL library is loaded at runtime with SDL_GL_LoadLibrary(), then all
2214 * GL functions must be retrieved this way. Usually this is used to retrieve
2215 * function pointers to OpenGL extensions.
2216 *
2217 * There are some quirks to looking up OpenGL functions that require some
2218 * extra care from the application. If you code carefully, you can handle
2219 * these quirks without any platform-specific code, though:
2220 *
2221 * - On Windows, function pointers are specific to the current GL context;
2222 * this means you need to have created a GL context and made it current
2223 * before calling SDL_GL_GetProcAddress(). If you recreate your context or
2224 * create a second context, you should assume that any existing function
2225 * pointers aren't valid to use with it. This is (currently) a
2226 * Windows-specific limitation, and in practice lots of drivers don't suffer
2227 * this limitation, but it is still the way the wgl API is documented to
2228 * work and you should expect crashes if you don't respect it. Store a copy
2229 * of the function pointers that comes and goes with context lifespan.
2230 * - On X11, function pointers returned by this function are valid for any
2231 * context, and can even be looked up before a context is created at all.
2232 * This means that, for at least some common OpenGL implementations, if you
2233 * look up a function that doesn't exist, you'll get a non-NULL result that
2234 * is _NOT_ safe to call. You must always make sure the function is actually
2235 * available for a given GL context before calling it, by checking for the
2236 * existence of the appropriate extension with SDL_GL_ExtensionSupported(),
2237 * or verifying that the version of OpenGL you're using offers the function
2238 * as core functionality.
2239 * - Some OpenGL drivers, on all platforms, *will* return NULL if a function
2240 * isn't supported, but you can't count on this behavior. Check for
2241 * extensions you use, and if you get a NULL anyway, act as if that
2242 * extension wasn't available. This is probably a bug in the driver, but you
2243 * can code defensively for this scenario anyhow.
2244 * - Just because you're on Linux/Unix, don't assume you'll be using X11.
2245 * Next-gen display servers are waiting to replace it, and may or may not
2246 * make the same promises about function pointers.
2247 * - OpenGL function pointers must be declared `APIENTRY` as in the example
2248 * code. This will ensure the proper calling convention is followed on
2249 * platforms where this matters (Win32) thereby avoiding stack corruption.
2250 *
2251 * \param proc the name of an OpenGL function
2252 * \returns a pointer to the named OpenGL function. The returned pointer
2253 * should be cast to the appropriate function signature.
2254 *
2255 * \since This function is available since SDL 3.0.0.
2256 *
2257 * \sa SDL_GL_ExtensionSupported
2258 * \sa SDL_GL_LoadLibrary
2259 * \sa SDL_GL_UnloadLibrary
2260 */
2261extern DECLSPEC SDL_FunctionPointer SDLCALL SDL_GL_GetProcAddress(const char *proc);
2262
2263/**
2264 * Get an EGL library function by name.
2265 *
2266 * If an EGL library is loaded, this function allows applications to get entry
2267 * points for EGL functions. This is useful to provide to an EGL API and
2268 * extension loader.
2269 *
2270 * \param proc the name of an EGL function
2271 * \returns a pointer to the named EGL function. The returned pointer should
2272 * be cast to the appropriate function signature.
2273 *
2274 * \since This function is available since SDL 3.0.0.
2275 *
2276 * \sa SDL_GL_GetCurrentEGLDisplay
2277 */
2278extern DECLSPEC SDL_FunctionPointer SDLCALL SDL_EGL_GetProcAddress(const char *proc);
2279
2280/**
2281 * Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().
2282 *
2283 * \since This function is available since SDL 3.0.0.
2284 *
2285 * \sa SDL_GL_LoadLibrary
2286 */
2287extern DECLSPEC void SDLCALL SDL_GL_UnloadLibrary(void);
2288
2289/**
2290 * Check if an OpenGL extension is supported for the current context.
2291 *
2292 * This function operates on the current GL context; you must have created a
2293 * context and it must be current before calling this function. Do not assume
2294 * that all contexts you create will have the same set of extensions
2295 * available, or that recreating an existing context will offer the same
2296 * extensions again.
2297 *
2298 * While it's probably not a massive overhead, this function is not an O(1)
2299 * operation. Check the extensions you care about after creating the GL
2300 * context and save that information somewhere instead of calling the function
2301 * every time you need to know.
2302 *
2303 * \param extension the name of the extension to check
2304 * \returns SDL_TRUE if the extension is supported, SDL_FALSE otherwise.
2305 *
2306 * \since This function is available since SDL 3.0.0.
2307 */
2308extern DECLSPEC SDL_bool SDLCALL SDL_GL_ExtensionSupported(const char *extension);
2309
2310/**
2311 * Reset all previously set OpenGL context attributes to their default values.
2312 *
2313 * \since This function is available since SDL 3.0.0.
2314 *
2315 * \sa SDL_GL_GetAttribute
2316 * \sa SDL_GL_SetAttribute
2317 */
2318extern DECLSPEC void SDLCALL SDL_GL_ResetAttributes(void);
2319
2320/**
2321 * Set an OpenGL window attribute before window creation.
2322 *
2323 * This function sets the OpenGL attribute `attr` to `value`. The requested
2324 * attributes should be set before creating an OpenGL window. You should use
2325 * SDL_GL_GetAttribute() to check the values after creating the OpenGL
2326 * context, since the values obtained can differ from the requested ones.
2327 *
2328 * \param attr an SDL_GLattr enum value specifying the OpenGL attribute to set
2329 * \param value the desired value for the attribute
2330 * \returns 0 on success or a negative error code on failure; call
2331 * SDL_GetError() for more information.
2332 *
2333 * \since This function is available since SDL 3.0.0.
2334 *
2335 * \sa SDL_GL_GetAttribute
2336 * \sa SDL_GL_ResetAttributes
2337 */
2338extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
2339
2340/**
2341 * Get the actual value for an attribute from the current context.
2342 *
2343 * \param attr an SDL_GLattr enum value specifying the OpenGL attribute to get
2344 * \param value a pointer filled in with the current value of `attr`
2345 * \returns 0 on success or a negative error code on failure; call
2346 * SDL_GetError() for more information.
2347 *
2348 * \since This function is available since SDL 3.0.0.
2349 *
2350 * \sa SDL_GL_ResetAttributes
2351 * \sa SDL_GL_SetAttribute
2352 */
2353extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value);
2354
2355/**
2356 * Create an OpenGL context for an OpenGL window, and make it current.
2357 *
2358 * Windows users new to OpenGL should note that, for historical reasons, GL
2359 * functions added after OpenGL version 1.1 are not available by default.
2360 * Those functions must be loaded at run-time, either with an OpenGL
2361 * extension-handling library or with SDL_GL_GetProcAddress() and its related
2362 * functions.
2363 *
2364 * SDL_GLContext is an alias for `void *`. It's opaque to the application.
2365 *
2366 * \param window the window to associate with the context
2367 * \returns the OpenGL context associated with `window` or NULL on error; call
2368 * SDL_GetError() for more details.
2369 *
2370 * \since This function is available since SDL 3.0.0.
2371 *
2372 * \sa SDL_GL_DeleteContext
2373 * \sa SDL_GL_MakeCurrent
2374 */
2375extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window *window);
2376
2377/**
2378 * Set up an OpenGL context for rendering into an OpenGL window.
2379 *
2380 * The context must have been created with a compatible window.
2381 *
2382 * \param window the window to associate with the context
2383 * \param context the OpenGL context to associate with the window
2384 * \returns 0 on success or a negative error code on failure; call
2385 * SDL_GetError() for more information.
2386 *
2387 * \since This function is available since SDL 3.0.0.
2388 *
2389 * \sa SDL_GL_CreateContext
2390 */
2391extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_Window *window, SDL_GLContext context);
2392
2393/**
2394 * Get the currently active OpenGL window.
2395 *
2396 * \returns the currently active OpenGL window on success or NULL on failure;
2397 * call SDL_GetError() for more information.
2398 *
2399 * \since This function is available since SDL 3.0.0.
2400 */
2401extern DECLSPEC SDL_Window *SDLCALL SDL_GL_GetCurrentWindow(void);
2402
2403/**
2404 * Get the currently active OpenGL context.
2405 *
2406 * \returns the currently active OpenGL context or NULL on failure; call
2407 * SDL_GetError() for more information.
2408 *
2409 * \since This function is available since SDL 3.0.0.
2410 *
2411 * \sa SDL_GL_MakeCurrent
2412 */
2413extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_GetCurrentContext(void);
2414
2415/**
2416 * Get the currently active EGL display.
2417 *
2418 * \returns the currently active EGL display or NULL on failure; call
2419 * SDL_GetError() for more information.
2420 *
2421 * \since This function is available since SDL 3.0.0.
2422 */
2423extern DECLSPEC SDL_EGLDisplay SDLCALL SDL_EGL_GetCurrentEGLDisplay(void);
2424
2425/**
2426 * Get the currently active EGL config.
2427 *
2428 * \returns the currently active EGL config or NULL on failure; call
2429 * SDL_GetError() for more information.
2430 *
2431 * \since This function is available since SDL 3.0.0.
2432 */
2433extern DECLSPEC SDL_EGLConfig SDLCALL SDL_EGL_GetCurrentEGLConfig(void);
2434
2435/**
2436 * Get the EGL surface associated with the window.
2437 *
2438 * \param window the window to query
2439 * \returns the EGLSurface pointer associated with the window, or NULL on
2440 * failure.
2441 *
2442 * \since This function is available since SDL 3.0.0.
2443 */
2445
2446/**
2447 * Sets the callbacks for defining custom EGLAttrib arrays for EGL
2448 * initialization.
2449 *
2450 * Each callback should return a pointer to an EGL attribute array terminated
2451 * with EGL_NONE. Callbacks may return NULL pointers to signal an error, which
2452 * will cause the SDL_CreateWindow process to fail gracefully.
2453 *
2454 * The arrays returned by each callback will be appended to the existing
2455 * attribute arrays defined by SDL.
2456 *
2457 * NOTE: These callback pointers will be reset after SDL_GL_ResetAttributes.
2458 *
2459 * \param platformAttribCallback Callback for attributes to pass to
2460 * eglGetPlatformDisplay.
2461 * \param surfaceAttribCallback Callback for attributes to pass to
2462 * eglCreateSurface.
2463 * \param contextAttribCallback Callback for attributes to pass to
2464 * eglCreateContext.
2465 *
2466 * \since This function is available since SDL 3.0.0.
2467 */
2468extern DECLSPEC void SDLCALL SDL_EGL_SetEGLAttributeCallbacks(SDL_EGLAttribArrayCallback platformAttribCallback,
2469 SDL_EGLIntArrayCallback surfaceAttribCallback,
2470 SDL_EGLIntArrayCallback contextAttribCallback);
2471
2472/**
2473 * Set the swap interval for the current OpenGL context.
2474 *
2475 * Some systems allow specifying -1 for the interval, to enable adaptive
2476 * vsync. Adaptive vsync works the same as vsync, but if you've already missed
2477 * the vertical retrace for a given frame, it swaps buffers immediately, which
2478 * might be less jarring for the user during occasional framerate drops. If an
2479 * application requests adaptive vsync and the system does not support it,
2480 * this function will fail and return -1. In such a case, you should probably
2481 * retry the call with 1 for the interval.
2482 *
2483 * Adaptive vsync is implemented for some glX drivers with
2484 * GLX_EXT_swap_control_tear, and for some Windows drivers with
2485 * WGL_EXT_swap_control_tear.
2486 *
2487 * Read more on the Khronos wiki:
2488 * https://www.khronos.org/opengl/wiki/Swap_Interval#Adaptive_Vsync
2489 *
2490 * \param interval 0 for immediate updates, 1 for updates synchronized with
2491 * the vertical retrace, -1 for adaptive vsync
2492 * \returns 0 on success or a negative error code on failure; call
2493 * SDL_GetError() for more information.
2494 *
2495 * \since This function is available since SDL 3.0.0.
2496 *
2497 * \sa SDL_GL_GetSwapInterval
2498 */
2499extern DECLSPEC int SDLCALL SDL_GL_SetSwapInterval(int interval);
2500
2501/**
2502 * Get the swap interval for the current OpenGL context.
2503 *
2504 * If the system can't determine the swap interval, or there isn't a valid
2505 * current context, this function will set *interval to 0 as a safe default.
2506 *
2507 * \param interval Output interval value. 0 if there is no vertical retrace
2508 * synchronization, 1 if the buffer swap is synchronized with
2509 * the vertical retrace, and -1 if late swaps happen
2510 * immediately instead of waiting for the next retrace
2511 * \returns 0 on success or a negative error code on failure; call
2512 * SDL_GetError() for more information.
2513 *
2514 * \since This function is available since SDL 3.0.0.
2515 *
2516 * \sa SDL_GL_SetSwapInterval
2517 */
2518extern DECLSPEC int SDLCALL SDL_GL_GetSwapInterval(int *interval);
2519
2520/**
2521 * Update a window with OpenGL rendering.
2522 *
2523 * This is used with double-buffered OpenGL contexts, which are the default.
2524 *
2525 * On macOS, make sure you bind 0 to the draw framebuffer before swapping the
2526 * window, otherwise nothing will happen. If you aren't using
2527 * glBindFramebuffer(), this is the default and you won't have to do anything
2528 * extra.
2529 *
2530 * \param window the window to change
2531 * \returns 0 on success or a negative error code on failure; call
2532 * SDL_GetError() for more information.
2533 *
2534 * \since This function is available since SDL 3.0.0.
2535 */
2536extern DECLSPEC int SDLCALL SDL_GL_SwapWindow(SDL_Window *window);
2537
2538/**
2539 * Delete an OpenGL context.
2540 *
2541 * \param context the OpenGL context to be deleted
2542 * \returns 0 on success or a negative error code on failure; call
2543 * SDL_GetError() for more information.
2544 *
2545 * \since This function is available since SDL 3.0.0.
2546 *
2547 * \sa SDL_GL_CreateContext
2548 */
2549extern DECLSPEC int SDLCALL SDL_GL_DeleteContext(SDL_GLContext context);
2550
2551/* @} *//* OpenGL support functions */
2552
2553
2554/* Ends C function definitions when using C++ */
2555#ifdef __cplusplus
2556}
2557#endif
2558#include <SDL3/SDL_close_code.h>
2559
2560#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:2034
@ SDL_HITTEST_DRAGGABLE
Definition SDL_video.h:2036
@ SDL_HITTEST_RESIZE_LEFT
Definition SDL_video.h:2044
@ SDL_HITTEST_RESIZE_TOP
Definition SDL_video.h:2038
@ SDL_HITTEST_RESIZE_TOPRIGHT
Definition SDL_video.h:2039
@ SDL_HITTEST_NORMAL
Definition SDL_video.h:2035
@ SDL_HITTEST_RESIZE_BOTTOM
Definition SDL_video.h:2042
@ SDL_HITTEST_RESIZE_BOTTOMRIGHT
Definition SDL_video.h:2041
@ SDL_HITTEST_RESIZE_BOTTOMLEFT
Definition SDL_video.h:2043
@ SDL_HITTEST_RESIZE_RIGHT
Definition SDL_video.h:2040
@ SDL_HITTEST_RESIZE_TOPLEFT
Definition SDL_video.h:2037
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:2057
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