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