SDL_GetWindowProperties(3)
π SDL_GetWindowProperties(3) π
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where we're talking about SDL_GetWindowProperties π
β¨ NAME β¨
SDL_GetWindowProperties β grab the properties that are attached to a window πͺ
β¨ SYNOPSIS β¨
#include <SDL3/SDL_video.h>
SDL_PropertiesID SDL_GetWindowProperties(SDL_Window *window);
β¨ DESCRIPTION β¨
SDL hands you the following read-only properties, and bestie they are the vibe check on your window. Here's the whole roster π«Ά
SDL_PROP_WINDOW_SHAPE_POINTERβ the surface that's associated with a shaped window πSDL_PROP_WINDOW_HDR_ENABLED_BOOLEANβtrueif the window has HDR headroom above the SDR white point. Heads up: this property can change dynamically wheneverSDL_EVENT_WINDOW_HDR_STATE_CHANGEDis sent πSDL_PROP_WINDOW_SDR_WHITE_LEVEL_FLOATβ the value of SDR white in theSDL_COLORSPACE_SRGB_LINEARcolorspace. On Windows this corresponds to the SDR white level in scRGB colorspace, and on Apple platforms this is always1.0for EDR content. This property can change dynamically whenSDL_EVENT_WINDOW_HDR_STATE_CHANGEDis sent β¨SDL_PROP_WINDOW_HDR_HEADROOM_FLOATβ the additional high dynamic range that can be displayed, in terms of the SDR white point. When HDR is not enabled, this will be1.0. This property can change dynamically whenSDL_EVENT_WINDOW_HDR_STATE_CHANGEDis sent π
π€ On Android
SDL_PROP_WINDOW_ANDROID_WINDOW_POINTERβ theANativeWindowassociated with the windowSDL_PROP_WINDOW_ANDROID_SURFACE_POINTERβ theEGLSurfaceassociated with the window
π On iOS
SDL_PROP_WINDOW_UIKIT_WINDOW_POINTERβ the (__unsafe_unretained)UIWindowassociated with the windowSDL_PROP_WINDOW_UIKIT_METAL_VIEW_TAG_NUMBERβ theNSIntegertag associated with metal views on the windowSDL_PROP_WINDOW_UIKIT_OPENGL_FRAMEBUFFER_NUMBERβ the OpenGL view's framebuffer object. It must be bound when rendering to the screen using OpenGL πSDL_PROP_WINDOW_UIKIT_OPENGL_RENDERBUFFER_NUMBERβ the OpenGL view's renderbuffer object. It must be bound whenSDL_GL_SwapWindowis called.SDL_PROP_WINDOW_UIKIT_OPENGL_RESOLVE_FRAMEBUFFER_NUMBERβ the OpenGL view's resolve framebuffer, when MSAA is used.
π₯οΈ On KMS/DRM
SDL_PROP_WINDOW_KMSDRM_DEVICE_INDEX_NUMBERβ the device index associated with the window (e.g. theXin/dev/dri/cardX)SDL_PROP_WINDOW_KMSDRM_DRM_FD_NUMBERβ the DRM FD associated with the windowSDL_PROP_WINDOW_KMSDRM_GBM_DEVICE_POINTERβ the GBM device associated with the window
πΈ On macOS
SDL_PROP_WINDOW_COCOA_WINDOW_POINTERβ the (__unsafe_unretained)NSWindowassociated with the windowSDL_PROP_WINDOW_COCOA_METAL_VIEW_TAG_NUMBERβ theNSIntegertag associated with metal views on the window
π₯½ On OpenVR
SDL_PROP_WINDOW_OPENVR_OVERLAY_ID_NUMBERβ the OpenVR Overlay Handle ID for the associated overlay window.
π§ On Vivante
SDL_PROP_WINDOW_VIVANTE_DISPLAY_POINTERβ theEGLNativeDisplayTypeassociated with the windowSDL_PROP_WINDOW_VIVANTE_WINDOW_POINTERβ theEGLNativeWindowTypeassociated with the windowSDL_PROP_WINDOW_VIVANTE_SURFACE_POINTERβ theEGLSurfaceassociated with the window
πͺ On Windows
SDL_PROP_WINDOW_WIN32_HWND_POINTERβ theHWNDassociated with the windowSDL_PROP_WINDOW_WIN32_HDC_POINTERβ theHDCassociated with the windowSDL_PROP_WINDOW_WIN32_INSTANCE_POINTERβ theHINSTANCEassociated with the window
π¦ On Wayland
Note: the xdg_* window objects do not internally persist across window show/hide calls. They will be null if the window is hidden and must be queried each time it is shown. π so literally re-query every time, okay?
SDL_PROP_WINDOW_WAYLAND_DISPLAY_POINTERβ thewl_displayassociated with the windowSDL_PROP_WINDOW_WAYLAND_SURFACE_POINTERβ thewl_surfaceassociated with the windowSDL_PROP_WINDOW_WAYLAND_VIEWPORT_POINTERβ thewp_viewportassociated with the windowSDL_PROP_WINDOW_WAYLAND_EGL_WINDOW_POINTERβ thewl_egl_windowassociated with the windowSDL_PROP_WINDOW_WAYLAND_XDG_SURFACE_POINTERβ thexdg_surfaceassociated with the windowSDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTERβ thexdg_toplevelrole associated with the window'SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING'β the export handle associated with the windowSDL_PROP_WINDOW_WAYLAND_XDG_POPUP_POINTERβ thexdg_popuprole associated with the windowSDL_PROP_WINDOW_WAYLAND_XDG_POSITIONER_POINTERβ thexdg_positionerassociated with the window, in popup mode
π§ On X11
SDL_PROP_WINDOW_X11_DISPLAY_POINTERβ the X11Displayassociated with the windowSDL_PROP_WINDOW_X11_SCREEN_NUMBERβ the screen number associated with the windowSDL_PROP_WINDOW_X11_WINDOW_NUMBERβ the X11Windowassociated with the window
π On Emscripten
SDL_PROP_WINDOW_EMSCRIPTEN_CANVAS_ID_STRINGβ the id the canvas element will haveSDL_PROP_WINDOW_EMSCRIPTEN_KEYBOARD_ELEMENT_STRINGβ the keyboard element that associates keyboard events to this window
β¨ FUNCTION PARAMETERS β¨
windowβ the window you wanna query, bestie π
β¨ RETURN VALUE β¨
Returns a valid property ID on success, or 0 on failure π β and when it fails you call SDL_GetError() for more info, fr fr.
β¨ THREAD SAFETY β¨
This function should only be called on the main thread. no side-quests, no background threads, main character thread only π
β¨ AVAILABILITY β¨
This function is available since SDL 3.2.0 β
and that's the whole page, periodt π
this lil writeup came to you from Simple Directmedia Layer, running SDL 3.4.18, on SDL_GetWindowProperties(3) β stay iconic, go query your windows, and don't forget to re-query those Wayland objects bestie π«Άπ
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms