Added constant definitions for SDL properties

Fixes https://github.com/libsdl-org/SDL/issues/8622
This commit is contained in:
Sam Lantinga 2024-01-07 16:59:41 -08:00
parent 3deefa6b43
commit 1a13dae219
30 changed files with 322 additions and 390 deletions

View file

@ -1303,25 +1303,25 @@ The information previously available in SDL_GetWindowWMInfo() is now available a
becomes: becomes:
```c ```c
#if defined(__WIN32__) #if defined(__WIN32__)
HWND hwnd = (HWND)SDL_GetProperty(SDL_GetWindowProperties(window), "SDL.window.win32.hwnd", NULL); HWND hwnd = (HWND)SDL_GetProperty(SDL_GetWindowProperties(window), SDL_PROPERTY_WINDOW_WIN32_HWND_POINTER, NULL);
if (hwnd) { if (hwnd) {
... ...
} }
#elif defined(__MACOS__) #elif defined(__MACOS__)
NSWindow *nswindow = (__bridge NSWindow *)SDL_GetProperty(SDL_GetWindowProperties(window), "SDL.window.cocoa.window", NULL); NSWindow *nswindow = (__bridge NSWindow *)SDL_GetProperty(SDL_GetWindowProperties(window), SDL_PROPERTY_WINDOW_COCOA_WINDOW_POINTER, NULL);
if (nswindow) { if (nswindow) {
... ...
} }
#elif defined(__LINUX__) #elif defined(__LINUX__)
if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "x11") == 0) { if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "x11") == 0) {
Display *xdisplay = (Display *)SDL_GetProperty(SDL_GetWindowProperties(window), "SDL.window.x11.display", NULL); Display *xdisplay = (Display *)SDL_GetProperty(SDL_GetWindowProperties(window), SDL_PROPERTY_WINDOW_X11_DISPLAY_POINTER, NULL);
Window xwindow = (Window)SDL_GetNumberProperty(SDL_GetWindowProperties(window), "SDL.window.x11.window", 0); Window xwindow = (Window)SDL_GetNumberProperty(SDL_GetWindowProperties(window), SDL_PROPERTY_WINDOW_X11_WINDOW_NUMBER, 0);
if (xdisplay && xwindow) { if (xdisplay && xwindow) {
... ...
} }
} else if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "wayland") == 0) { } else if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "wayland") == 0) {
struct wl_display *display = (struct wl_display *)SDL_GetProperty(SDL_GetWindowProperties(window), "SDL.window.wayland.display", NULL); struct wl_display *display = (struct wl_display *)SDL_GetProperty(SDL_GetWindowProperties(window), SDL_PROPERTY_WINDOW_WAYLAND_DISPLAY_POINTER, NULL);
struct wl_surface *surface = (struct wl_surface *)SDL_GetProperty(SDL_GetWindowProperties(window), "SDL.window.wayland.surface", NULL); struct wl_surface *surface = (struct wl_surface *)SDL_GetProperty(SDL_GetWindowProperties(window), SDL_PROPERTY_WINDOW_WAYLAND_SURFACE_POINTER, NULL);
if (display && surface) { if (display && surface) {
... ...
} }
@ -1404,11 +1404,11 @@ Rather than iterating over displays using display index, there is a new function
SDL_CreateWindow() has been simplified and no longer takes a window position. You can use SDL_CreateWindowWithProperties() if you need to set the window position when creating it, e.g. SDL_CreateWindow() has been simplified and no longer takes a window position. You can use SDL_CreateWindowWithProperties() if you need to set the window position when creating it, e.g.
```c ```c
SDL_PropertiesID props = SDL_CreateProperties(); SDL_PropertiesID props = SDL_CreateProperties();
SDL_SetStringProperty(props, "title", title); SDL_SetStringProperty(props, SDL_PROPERTY_WINDOW_CREATE_TITLE_STRING, title);
SDL_SetNumberProperty(props, "x", x); SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_X_NUMBER, x);
SDL_SetNumberProperty(props, "y", y); SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_Y_NUMBER, y);
SDL_SetNumberProperty(props, "width", width); SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_WIDTH_NUMBER, width);
SDL_SetNumberProperty(props, "height", height); SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_HEIGHT_NUMBER, height);
SDL_SetNumberProperty(props, "flags", flags); SDL_SetNumberProperty(props, "flags", flags);
pWindow = SDL_CreateWindowWithProperties(props); pWindow = SDL_CreateWindowWithProperties(props);
SDL_DestroyProperties(props); SDL_DestroyProperties(props);

View file

@ -239,15 +239,12 @@ extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window *window, co
* Create a 2D rendering context for a window, with the specified properties. * Create a 2D rendering context for a window, with the specified properties.
* *
* These are the supported properties: * These are the supported properties:
* */
* - "window" (pointer) - the window where rendering is displayed #define SDL_PROPERTY_RENDERER_CREATE_WINDOW_POINTER "window" /* the window where rendering is displayed */
* - "surface" (pointer) - the surface where rendering is displayed, if you #define SDL_PROPERTY_RENDERER_CREATE_SURFACE_POINTER "surface" /* the surface where rendering is displayed, if you want a software renderer without a window */
* want a software renderer without a window #define SDL_PROPERTY_RENDERER_CREATE_NAME_STRING "name" /* the name of the rendering driver to use, if a specific one is desired */
* - "name" (string) - the name of the rendering driver to use, if a specific #define SDL_PROPERTY_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN "present_vsync" /* true if you want present synchronized with the refresh rate */
* one is desired /*
* - "present_vsync" (boolean) - true if you want present synchronized with
* the refresh rate
*
* \param props the properties to use * \param props the properties to use
* \returns a valid rendering context or NULL if there was an error; call * \returns a valid rendering context or NULL if there was an error; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
@ -325,14 +322,12 @@ extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer *renderer, SDL_Rend
* Get the properties associated with a renderer. * Get the properties associated with a renderer.
* *
* The following read-only properties are provided by SDL: * The following read-only properties are provided by SDL:
* */
* ``` #define SDL_PROPERTY_RENDERER_D3D9_DEVICE_POINTER "SDL.renderer.d3d9.device" /* the IDirect3DDevice9 associated with the renderer */
* "SDL.renderer.d3d9.device" (pointer) - the IDirect3DDevice9 associated with the renderer #define SDL_PROPERTY_RENDERER_D3D11_DEVICE_POINTER "SDL.renderer.d3d11.device" /* the ID3D11Device associated with the renderer */
* "SDL.renderer.d3d11.device" (pointer) - the ID3D11Device associated with the renderer #define SDL_PROPERTY_RENDERER_D3D12_DEVICE_POINTER "SDL.renderer.d3d12.device" /* the ID3D12Device associated with the renderer */
* "SDL.renderer.d3d12.device" (pointer) - the ID3D12Device associated with the renderer #define SDL_PROPERTY_RENDERER_D3D12_COMMAND_QUEUE_POINTER "SDL.renderer.d3d12.command_queue" /* the ID3D12CommandQueue associated with the renderer */
* "SDL.renderer.d3d12.command_queue" (pointer) - the ID3D12CommandQueue associated with the renderer /*
* ```
*
* \param renderer the rendering context * \param renderer the rendering context
* \returns a valid property ID on success or 0 on failure; call * \returns a valid property ID on success or 0 on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
@ -439,54 +434,39 @@ extern DECLSPEC SDL_Texture *SDLCALL SDL_CreateTextureFromSurface(SDL_Renderer *
* Create a texture for a rendering context with the specified properties. * Create a texture for a rendering context with the specified properties.
* *
* These are the supported properties: * These are the supported properties:
* */
* - "format" (number) - one of the enumerated values in SDL_PixelFormatEnum, #define SDL_PROPERTY_TEXTURE_CREATE_FORMAT_NUMBER "format" /* one of the enumerated values in SDL_PixelFormatEnum, defaults to the best RGBA format for the renderer */
* defaults to the best RGBA format for the renderer #define SDL_PROPERTY_TEXTURE_CREATE_ACCESS_NUMBER "access" /* one of the enumerated values in SDL_TextureAccess, defaults to SDL_TEXTUREACCESS_STATIC */
* - "access" (number) - one of the enumerated values in SDL_TextureAccess, #define SDL_PROPERTY_TEXTURE_CREATE_WIDTH_NUMBER "width" /* the width of the texture in pixels, required */
* defaults to SDL_TEXTUREACCESS_STATIC #define SDL_PROPERTY_TEXTURE_CREATE_HEIGHT_NUMBER "height" /* the height of the texture in pixels, required */
* - "width" (number) - the width of the texture in pixels, required /*
* - "height" (number) - the height of the texture in pixels, required
*
* With the direct3d11 renderer: * With the direct3d11 renderer:
* */
* - "d3d11.texture" (pointer) - the ID3D11Texture2D associated with the #define SDL_PROPERTY_TEXTURE_CREATE_D3D11_TEXTURE_POINTER "d3d11.texture" /* the ID3D11Texture2D associated with the texture, if you want to wrap an existing texture. */
* texture, if you want to wrap an existing texture. #define SDL_PROPERTY_TEXTURE_CREATE_D3D11_TEXTURE_U_POINTER "d3d11.texture_u" /* the ID3D11Texture2D associated with the U plane of a YUV texture, if you want to wrap an existing texture. */
* - "d3d11.texture_u" (pointer) - the ID3D11Texture2D associated with the U #define SDL_PROPERTY_TEXTURE_CREATE_D3D11_TEXTURE_V_POINTER "d3d11.texture_v" /* the ID3D11Texture2D associated with the V plane of a YUV texture, if you want to wrap an existing texture. */
* plane of a YUV texture, if you want to wrap an existing texture. /*
* - "d3d11.texture_v" (pointer) - the ID3D11Texture2D associated with the V
* plane of a YUV texture, if you want to wrap an existing texture.
*
* With the direct3d12 renderer: * With the direct3d12 renderer:
* */
* - "d3d12.texture" (pointer) - the ID3D12Resource associated with the #define SDL_PROPERTY_TEXTURE_CREATE_D3D12_TEXTURE_POINTER "d3d12.texture" /* the ID3D12Resource associated with the texture, if you want to wrap an existing texture. */
* texture, if you want to wrap an existing texture. #define SDL_PROPERTY_TEXTURE_CREATE_D3D12_TEXTURE_U_POINTER "d3d12.texture_u" /* the ID3D12Resource associated with the U plane of a YUV texture, if you want to wrap an existing texture. */
* - "d3d12.texture_u" (pointer) - the ID3D12Resource associated with the U #define SDL_PROPERTY_TEXTURE_CREATE_D3D12_TEXTURE_V_POINTER "d3d12.texture_v" /* the ID3D12Resource associated with the V plane of a YUV texture, if you want to wrap an existing texture. */
* plane of a YUV texture, if you want to wrap an existing texture. /*
* - "d3d12.texture_v" (pointer) - the ID3D12Resource associated with the V
* plane of a YUV texture, if you want to wrap an existing texture.
*
* With the opengl renderer: * With the opengl renderer:
* */
* - "opengl.texture" (number) - the GLuint texture associated with the #define SDL_PROPERTY_TEXTURE_CREATE_OPENGL_TEXTURE_NUMBER "opengl.texture" /* the GLuint texture associated with the texture, if you want to wrap an existing texture. */
* texture, if you want to wrap an existing texture. #define SDL_PROPERTY_TEXTURE_CREATE_OPENGL_TEXTURE_UV_NUMBER "opengl.texture_uv" /* the GLuint texture associated with the UV plane of an NV12 texture, if you want to wrap an existing texture. */
* - "opengl.texture_uv" (number) - the GLuint texture associated with the UV #define SDL_PROPERTY_TEXTURE_CREATE_OPENGL_TEXTURE_U_NUMBER "opengl.texture_u" /* the GLuint texture associated with the U plane of a YUV texture, if you want to wrap an existing texture. */
* plane of an NV12 texture, if you want to wrap an existing texture. #define SDL_PROPERTY_TEXTURE_CREATE_OPENGL_TEXTURE_V_NUMBER "opengl.texture_v" /* the GLuint texture associated with the V plane of a YUV texture, if you want to wrap an existing texture. */
* - "opengl.texture_u" (number) - the GLuint texture associated with the U /*
* plane of a YUV texture, if you want to wrap an existing texture.
* - "opengl.texture_v" (number) - the GLuint texture associated with the V
* plane of a YUV texture, if you want to wrap an existing texture.
*
* With the opengles2 renderer: * With the opengles2 renderer:
* */
* - "opengles2.texture" (number) - the GLuint texture associated with the #define SDL_PROPERTY_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER "opengles2.texture" /* the GLuint texture associated with the texture, if you want to wrap an existing texture. */
* texture, if you want to wrap an existing texture. #define SDL_PROPERTY_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER "opengles2.texture" /* the GLuint texture associated with the texture, if you want to wrap an existing texture. */
* - "opengles2.texture_uv" (number) - the GLuint texture associated with the #define SDL_PROPERTY_TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBER "opengles2.texture_uv" /* the GLuint texture associated with the UV plane of an NV12 texture, if you want to wrap an existing texture. */
* UV plane of an NV12 texture, if you want to wrap an existing texture. #define SDL_PROPERTY_TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBER "opengles2.texture_u" /* the GLuint texture associated with the U plane of a YUV texture, if you want to wrap an existing texture. */
* - "opengles2.texture_u" (number) - the GLuint texture associated with the U #define SDL_PROPERTY_TEXTURE_CREATE_OPENGLES2_TEXTURE_V_NUMBER "opengles2.texture_v" /* the GLuint texture associated with the V plane of a YUV texture, if you want to wrap an existing texture. */
* plane of a YUV texture, if you want to wrap an existing texture. /*
* - "opengles2.texture_v" (number) - the GLuint texture associated with the V
* plane of a YUV texture, if you want to wrap an existing texture.
*
* \param renderer the rendering context * \param renderer the rendering context
* \param props the properties to use * \param props the properties to use
* \returns a pointer to the created texture or NULL if no rendering context * \returns a pointer to the created texture or NULL if no rendering context
@ -507,51 +487,37 @@ extern DECLSPEC SDL_Texture *SDLCALL SDL_CreateTextureWithProperties(SDL_Rendere
* Get the properties associated with a texture. * Get the properties associated with a texture.
* *
* The following read-only properties are provided by SDL: * The following read-only properties are provided by SDL:
* */
/*
* With the direct3d11 renderer: * With the direct3d11 renderer:
* */
* - "SDL.texture.d3d11.texture" (pointer) - the ID3D11Texture2D associated #define SDL_PROPERTY_TEXTURE_D3D11_TEXTURE_POINTER "SDL.texture.d3d11.texture" /* the ID3D11Texture2D associated with the texture */
* with the texture #define SDL_PROPERTY_TEXTURE_D3D11_TEXTURE_U_POINTER "SDL.texture.d3d11.texture_u" /* the ID3D11Texture2D associated with the U plane of a YUV texture */
* - "SDL.texture.d3d11.texture_u" (pointer) - the ID3D11Texture2D associated #define SDL_PROPERTY_TEXTURE_D3D11_TEXTURE_V_POINTER "SDL.texture.d3d11.texture_v" /* the ID3D11Texture2D associated with the V plane of a YUV texture */
* with the U plane of a YUV texture /*
* - "SDL.texture.d3d11.texture_v" (pointer) - the ID3D11Texture2D associated
* with the V plane of a YUV texture
*
* With the direct3d12 renderer: * With the direct3d12 renderer:
* */
* - "SDL.texture.d3d12.texture" (pointer) - the ID3D12Resource associated #define SDL_PROPERTY_TEXTURE_D3D12_TEXTURE_POINTER "SDL.texture.d3d12.texture" /* the ID3D12Resource associated with the texture */
* with the texture #define SDL_PROPERTY_TEXTURE_D3D12_TEXTURE_U_POINTER "SDL.texture.d3d12.texture_u" /* the ID3D12Resource associated with the U plane of a YUV texture */
* - "SDL.texture.d3d12.texture_u" (pointer) - the ID3D12Resource associated #define SDL_PROPERTY_TEXTURE_D3D12_TEXTURE_V_POINTER "SDL.texture.d3d12.texture_v" /* the ID3D12Resource associated with the V plane of a YUV texture */
* with the U plane of a YUV texture /*
* - "SDL.texture.d3d12.texture_v" (pointer) - the ID3D12Resource associated
* with the V plane of a YUV texture
*
* With the opengl renderer: * With the opengl renderer:
* */
* - "SDL.texture.opengl.texture" (number) - the GLuint texture associated #define SDL_PROPERTY_TEXTURE_OPENGL_TEXTURE_NUMBER "SDL.texture.opengl.texture" /* the GLuint texture associated with the texture */
* with the texture #define SDL_PROPERTY_TEXTURE_OPENGL_TEXTURE_UV_NUMBER "SDL.texture.opengl.texture_uv" /* the GLuint texture associated with the UV plane of an NV12 texture */
* - "SDL.texture.opengl.texture_uv" (number) - the GLuint texture associated #define SDL_PROPERTY_TEXTURE_OPENGL_TEXTURE_U_NUMBER "SDL.texture.opengl.texture_u" /* the GLuint texture associated with the U plane of a YUV texture */
* with the UV plane of an NV12 texture #define SDL_PROPERTY_TEXTURE_OPENGL_TEXTURE_V_NUMBER "SDL.texture.opengl.texture_v" /* the GLuint texture associated with the V plane of a YUV texture */
* - "SDL.texture.opengl.texture_u" (number) - the GLuint texture associated #define SDL_PROPERTY_TEXTURE_OPENGL_TEX_W_FLOAT "SDL.texture.opengl.tex_w" /* the texture coordinate width of the texture (0.0 - 1.0) */
* with the U plane of a YUV texture #define SDL_PROPERTY_TEXTURE_OPENGL_TEX_H_FLOAT "SDL.texture.opengl.tex_h" /* the texture coordinate height of the texture (0.0 - 1.0) */
* - "SDL.texture.opengl.texture_v" (number) - the GLuint texture associated /*
* with the V plane of a YUV texture
* - "SDL.texture.opengl.tex_w" (float) - the texture coordinate width of the
* texture (0.0 - 1.0)
* - "SDL.texture.opengl.tex_h" (float) - the texture coordinate height of the
* texture (0.0 - 1.0)
*
* With the opengles2 renderer: * With the opengles2 renderer:
* */
* - "SDL.texture.opengles2.texture" (number) - the GLuint texture associated #define SDL_PROPERTY_TEXTURE_OPENGLES2_TEXTURE_NUMBER "SDL.texture.opengles2.texture" /* the GLuint texture associated with the texture */
* with the texture #define SDL_PROPERTY_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER "SDL.texture.opengles2.texture_uv" /* the GLuint texture associated with the UV plane of an NV12 texture */
* - "SDL.texture.opengles2.texture_uv" (number) - the GLuint texture #define SDL_PROPERTY_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER "SDL.texture.opengles2.texture_u" /* the GLuint texture associated with the U plane of a YUV texture */
* associated with the UV plane of an NV12 texture #define SDL_PROPERTY_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER "SDL.texture.opengles2.texture_v" /* the GLuint texture associated with the V plane of a YUV texture */
* - "SDL.texture.opengles2.texture_u" (number) - the GLuint texture /*
* associated with the U plane of a YUV texture
* - "SDL.texture.opengles2.texture_v" (number) - the GLuint texture
* associated with the V plane of a YUV texture * associated with the V plane of a YUV texture
*
* \param texture the texture to query * \param texture the texture to query
* \returns a valid property ID on success or 0 on failure; call * \returns a valid property ID on success or 0 on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.

View file

@ -808,63 +808,46 @@ extern DECLSPEC SDL_Window *SDLCALL SDL_CreatePopupWindow(SDL_Window *parent, in
* Create a window with the specified properties. * Create a window with the specified properties.
* *
* These are the supported properties: * These are the supported properties:
* */
* - "always-on-top" (boolean) - true if the window should be always on top #define SDL_PROPERTY_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN "always-on-top" /* true if the window should be always on top */
* - "borderless" (boolean) - true if the window has no window decoration #define SDL_PROPERTY_WINDOW_CREATE_BORDERLESS_BOOLEAN "borderless" /* true if the window has no window decoration */
* - "focusable" (boolean) - true if the window should accept keyboard input #define SDL_PROPERTY_WINDOW_CREATE_FOCUSABLE_BOOLEAN "focusable" /* true if the window should accept keyboard input (defaults true) */
* (defaults true) #define SDL_PROPERTY_WINDOW_CREATE_FULLSCREEN_BOOLEAN "fullscreen" /* true if the window should start in fullscreen mode at desktop resolution */
* - "fullscreen" (boolean) - true if the window should start in fullscreen #define SDL_PROPERTY_WINDOW_CREATE_HEIGHT_NUMBER "height" /* the height of the window */
* mode at desktop resolution #define SDL_PROPERTY_WINDOW_CREATE_HIDDEN_BOOLEAN "hidden" /* true if the window should start hidden */
* - "height" (number) - the height of the window #define SDL_PROPERTY_WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN "high-pixel-density" /* true if the window uses a high pixel density buffer if possible */
* - "hidden" (boolean) - true if the window should start hidden #define SDL_PROPERTY_WINDOW_CREATE_MAXIMIZED_BOOLEAN "maximized" /* true if the window should start maximized */
* - "high-pixel-density" (boolean) - true if the window uses a high pixel #define SDL_PROPERTY_WINDOW_CREATE_MENU_BOOLEAN "menu" /* true if the window is a popup menu */
* density buffer if possible #define SDL_PROPERTY_WINDOW_CREATE_METAL_BOOLEAN "metal" /* true if the window will be used with Metal rendering */
* - "maximized" (boolean) - true if the window should start maximized #define SDL_PROPERTY_WINDOW_CREATE_MINIMIZED_BOOLEAN "minimized" /* true if the window should start minimized */
* - "menu" (boolean) - true if the window is a popup menu #define SDL_PROPERTY_WINDOW_CREATE_MOUSE_GRABBED_BOOLEAN "mouse-grabbed" /* true if the window starts with grabbed mouse focus */
* - "metal" (string) - true if the window will be used with Metal rendering #define SDL_PROPERTY_WINDOW_CREATE_OPENGL_BOOLEAN "opengl" /* true if the window will be used with OpenGL rendering */
* - "minimized" (boolean) - true if the window should start minimized #define SDL_PROPERTY_WINDOW_CREATE_PARENT_POINTER "parent" /* an SDL_Window that will be the parent of this window, required for windows with the "toolip" and "menu" properties */
* - "mouse-grabbed" (boolean) - true if the window starts with grabbed mouse #define SDL_PROPERTY_WINDOW_CREATE_RESIZABLE_BOOLEAN "resizable" /* true if the window should be resizable */
* focus #define SDL_PROPERTY_WINDOW_CREATE_TITLE_STRING "title" /* the title of the window, in UTF-8 encoding */
* - "opengl" (boolean) - true if the window will be used with OpenGL #define SDL_PROPERTY_WINDOW_CREATE_TRANSPARENT_BOOLEAN "transparent" /* true if the window show transparent in the areas with alpha of 0 */
* rendering #define SDL_PROPERTY_WINDOW_CREATE_TOOLTIP_BOOLEAN "tooltip" /* true if the window is a tooltip */
* - "parent" (pointer) - an SDL_Window that will be the parent of this #define SDL_PROPERTY_WINDOW_CREATE_UTILITY_BOOLEAN "utility" /* true if the window is a utility window, not showing in the task bar and window list */
* window, required for windows with the "toolip" and "menu" properties #define SDL_PROPERTY_WINDOW_CREATE_VULKAN_BOOLEAN "vulkan" /* true if the window will be used with Vulkan rendering */
* - "resizable" (boolean) - true if the window should be resizable #define SDL_PROPERTY_WINDOW_CREATE_WIDTH_NUMBER "width" /* the width of the window */
* - "title" (string) - the title of the window, in UTF-8 encoding #define SDL_PROPERTY_WINDOW_CREATE_X_NUMBER "x" /* the x position of the window, or `SDL_WINDOWPOS_CENTERED`, defaults to `SDL_WINDOWPOS_UNDEFINED`. This is relative to the parent for windows with the "parent" property set. */
* - "transparent" (string) - true if the window show transparent in the areas #define SDL_PROPERTY_WINDOW_CREATE_Y_NUMBER "y" /* the y position of the window, or `SDL_WINDOWPOS_CENTERED`, defaults to `SDL_WINDOWPOS_UNDEFINED`. This is relative to the parent for windows with the "parent" property set. */
* with alpha of 0 /*
* - "tooltip" (boolean) - true if the window is a tooltip * These are additional supported properties on macOS:
* - "utility" (boolean) - true if the window is a utility window, not showing */
* in the task bar and window list #define SDL_PROPERTY_WINDOW_CREATE_COCOA_WINDOW_POINTER "cocoa.window" /* the (__unsafe_unretained) NSWindow associated with the window, if you want to wrap an existing window. */
* - "vulkan" (string) - true if the window will be used with Vulkan rendering #define SDL_PROPERTY_WINDOW_CREATE_COCOA_VIEW_POINTER "cocoa.view" /* the (__unsafe_unretained) NSView associated with the window, defaults to [window contentView] */
* - "width" (number) - the width of the window /*
* - "x" (number) - the x position of the window, or `SDL_WINDOWPOS_CENTERED`, * These are additional supported properties on Windows:
* defaults to `SDL_WINDOWPOS_UNDEFINED`. This is relative to the parent for */
* windows with the "parent" property set. #define SDL_PROPERTY_WINDOW_CREATE_WIN32_HWND_POINTER "win32.hwnd" /* the HWND associated with the window, if you want to wrap an existing window. */
* - "y" (number) - the y position of the window, or `SDL_WINDOWPOS_CENTERED`, #define SDL_PROPERTY_WINDOW_CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER "win32.pixel_format_hwnd" /* optional, another window to share pixel format with, useful for OpenGL windows */
* defaults to `SDL_WINDOWPOS_UNDEFINED`. This is relative to the parent for /*
* windows with the "parent" property set. * These are additional supported properties with X11:
* */
* On macOS: #define SDL_PROPERTY_WINDOW_CREATE_X11_WINDOW_NUMBER "x11.window" /* the X11 Window associated with the window, if you want to wrap an existing window. */
* /*
* - "cocoa.window" (pointer) - the (__unsafe_unretained) NSWindow associated * The window is implicitly shown if the "hidden" property is not set.
* with the window, if you want to wrap an existing window.
* - "cocoa.view" (pointer) - the (__unsafe_unretained) NSView associated with
* the window, defaults to [window contentView]
*
* On Windows:
*
* - "win32.hwnd" (pointer) - the HWND associated with the window, if you want
* to wrap an existing window.
* - "win32.pixel_format_hwnd" (pointer) - optional, another window to share
* pixel format with, useful for OpenGL windows
*
* On X11:
*
* - "x11.window" (number) - the X11 Window associated with the window, if you
* want to wrap an existing window.
*
* The SDL_Window is implicitly shown if the "hidden" property is not set.
* *
* Windows with the "tooltip" and "menu" properties are popup windows and have * Windows with the "tooltip" and "menu" properties are popup windows and have
* the behaviors and guidelines outlined in `SDL_CreatePopupWindow()`. * the behaviors and guidelines outlined in `SDL_CreatePopupWindow()`.
@ -929,83 +912,66 @@ extern DECLSPEC SDL_Window *SDLCALL SDL_GetWindowParent(SDL_Window *window);
* Get the properties associated with a window. * Get the properties associated with a window.
* *
* The following read-only properties are provided by SDL: * The following read-only properties are provided by SDL:
* */
/*
* On Android: * On Android:
* */
* ``` #define SDL_PROPERTY_WINDOW_ANDROID_WINDOW_POINTER "SDL.window.android.window" /* the ANativeWindow associated with the window */
* "SDL.window.android.window" (pointer) - the ANativeWindow associated with the window #define SDL_PROPERTY_WINDOW_ANDROID_SURFACE_POINTER "SDL.window.android.surface" /* the EGLSurface associated with the window */
* "SDL.window.android.surface" (pointer) - the EGLSurface associated with the window /*
* ```
*
* On iOS: * On iOS:
* */
* ``` #define SDL_PROPERTY_WINDOW_UIKIT_WINDOW_POINTER "SDL.window.uikit.window" /* the (__unsafe_unretained) UIWindow associated with the window */
* "SDL.window.uikit.window" (pointer) - the (__unsafe_unretained) UIWindow associated with the window #define SDL_PROPERTY_WINDOW_UIKIT_METAL_VIEW_TAG_NUMBER "SDL.window.uikit.metal_view_tag" /* the NSInteger tag assocated with metal views on the window */
* "SDL.window.uikit.metal_view_tag" (number) - the NSInteger tag assocated with metal views on the window /*
* ```
*
* On KMS/DRM: * On KMS/DRM:
* */
* ``` #define SDL_PROPERTY_WINDOW_KMSDRM_DEVICE_INDEX_NUMBER "SDL.window.kmsdrm.dev_index" /* the device index associated with the window (e.g. the X in /dev/dri/cardX) */
* "SDL.window.kmsdrm.dev_index" (number) - the device index associated with the window (e.g. the X in /dev/dri/cardX) #define SDL_PROPERTY_WINDOW_KMSDRM_DRM_FD_NUMBER "SDL.window.kmsdrm.drm_fd" /* the DRM FD associated with the window */
* "SDL.window.kmsdrm.drm_fd" (number) - the DRM FD associated with the window #define SDL_PROPERTY_WINDOW_KMSDRM_GBM_DEVICE_POINTER "SDL.window.kmsdrm.gbm_dev" /* the GBM device associated with the window */
* "SDL.window.kmsdrm.gbm_dev" (pointer) - the GBM device associated with the window /*
* ```
*
* On macOS: * On macOS:
* */
* ``` #define SDL_PROPERTY_WINDOW_COCOA_WINDOW_POINTER "SDL.window.cocoa.window" /* the (__unsafe_unretained) NSWindow associated with the window */
* "SDL.window.cocoa.window" (pointer) - the (__unsafe_unretained) NSWindow associated with the window #define SDL_PROPERTY_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER "SDL.window.cocoa.metal_view_tag" /* the NSInteger tag assocated with metal views on the window */
* "SDL.window.cocoa.metal_view_tag" (number) - the NSInteger tag assocated with metal views on the window /*
* ```
*
* On Vivante: * On Vivante:
* */
* ``` #define SDL_PROPERTY_WINDOW_VIVANTE_DISPLAY_POINTER "SDL.window.vivante.display" /* the EGLNativeDisplayType associated with the window */
* "SDL.window.vivante.display" (pointer) - the EGLNativeDisplayType associated with the window #define SDL_PROPERTY_WINDOW_VIVANTE_WINDOW_POINTER "SDL.window.vivante.window" /* the EGLNativeWindowType associated with the window */
* "SDL.window.vivante.window" (pointer) - the EGLNativeWindowType associated with the window #define SDL_PROPERTY_WINDOW_VIVANTE_SURFACE_POINTER "SDL.window.vivante.surface" /* the EGLSurface associated with the window */
* "SDL.window.vivante.surface" (pointer) - the EGLSurface associated with the window /*
* ```
*
* On UWP: * On UWP:
* */
* ``` #define SDL_PROPERTY_WINDOW_WINRT_WINDOW_POINTER "SDL.window.winrt.window" /* the IInspectable CoreWindow associated with the window */
* "SDL.window.winrt.window" (pointer) - the IInspectable CoreWindow associated with the window /*
* ```
*
* On Windows: * On Windows:
* */
* ``` #define SDL_PROPERTY_WINDOW_WIN32_HWND_POINTER "SDL.window.win32.hwnd" /* the HWND associated with the window */
* "SDL.window.win32.hwnd" (pointer) - the HWND associated with the window #define SDL_PROPERTY_WINDOW_WIN32_HDC_POINTER "SDL.window.win32.hdc" /* the HDC associated with the window */
* "SDL.window.win32.hdc" (pointer) - the HDC associated with the window #define SDL_PROPERTY_WINDOW_WIN32_INSTANCE_POINTER "SDL.window.win32.instance" /* the HINSTANCE associated with the window */
* "SDL.window.win32.instance" (pointer) - the HINSTANCE associated with the window /*
* ```
*
* On Wayland: * On Wayland:
* *
* ```
* "SDL.window.wayland.registry" (pointer) - the wl_registry associated with the window
* "SDL.window.wayland.display" (pointer) - the wl_display associated with the window
* "SDL.window.wayland.surface" (pointer) - the wl_surface associated with the window
* "SDL.window.wayland.egl_window" (pointer) - the wl_egl_window associated with the window
* "SDL.window.wayland.xdg_surface" (pointer) - the xdg_surface associated with the window
* "SDL.window.wayland.xdg_toplevel" (pointer) - the xdg_toplevel role associated with the window
* "SDL.window.wayland.xdg_popup" (pointer) - the xdg_popup role associated with the window
* "SDL.window.wayland.xdg_positioner" (pointer) - the xdg_positioner associated with the window, in popup mode
* ```
*
* Note: The xdg_* window objects do not internally persist across window * 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 * show/hide calls. They will be null if the window is hidden and must be
* queried each time it is shown. * queried each time it is shown.
* */
#define SDL_PROPERTY_WINDOW_WAYLAND_REGISTRY_POINTER "SDL.window.wayland.registry" /* the wl_registry associated with the window */
#define SDL_PROPERTY_WINDOW_WAYLAND_DISPLAY_POINTER "SDL.window.wayland.display" /* the wl_display associated with the window */
#define SDL_PROPERTY_WINDOW_WAYLAND_SURFACE_POINTER "SDL.window.wayland.surface" /* the wl_surface associated with the window */
#define SDL_PROPERTY_WINDOW_WAYLAND_EGL_WINDOW_POINTER "SDL.window.wayland.egl_window" /* the wl_egl_window associated with the window */
#define SDL_PROPERTY_WINDOW_WAYLAND_XDG_SURFACE_POINTER "SDL.window.wayland.xdg_surface" /* the xdg_surface associated with the window */
#define SDL_PROPERTY_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER "SDL.window.wayland.xdg_toplevel" /* the xdg_toplevel role associated with the window */
#define SDL_PROPERTY_WINDOW_WAYLAND_XDG_POPUP_POINTER "SDL.window.wayland.xdg_popup" /* the xdg_popup role associated with the window */
#define SDL_PROPERTY_WINDOW_WAYLAND_XDG_POSITIONER_POINTER "SDL.window.wayland.xdg_positioner" /* the xdg_positioner associated with the window, in popup mode */
/*
* On X11: * On X11:
* */
* ``` #define SDL_PROPERTY_WINDOW_X11_DISPLAY_POINTER "SDL.window.x11.display" /* the X11 Display associated with the window */
* "SDL.window.x11.display" (pointer) - the X11 Display associated with the window #define SDL_PROPERTY_WINDOW_X11_SCREEN_NUMBER "SDL.window.x11.screen" /* the screen number associated with the window */
* "SDL.window.x11.screen" (number) - the screen number associated with the window #define SDL_PROPERTY_WINDOW_X11_WINDOW_NUMBER "SDL.window.x11.window" /* the X11 Window associated with the window */
* "SDL.window.x11.window" (number) - the X11 Window associated with the window /*
* ```
*
* \param window the window to query * \param window the window to query
* \returns a valid property ID on success or 0 on failure; call * \returns a valid property ID on success or 0 on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.

View file

@ -428,9 +428,9 @@ void SDL_Fcitx_UpdateTextRect(const SDL_Rect *rect)
#ifdef SDL_VIDEO_DRIVER_X11 #ifdef SDL_VIDEO_DRIVER_X11
{ {
SDL_PropertiesID props = SDL_GetWindowProperties(focused_win); SDL_PropertiesID props = SDL_GetWindowProperties(focused_win);
Display *x_disp = (Display *)SDL_GetProperty(props, "SDL.window.x11.display", NULL); Display *x_disp = (Display *)SDL_GetProperty(props, SDL_PROPERTY_WINDOW_X11_DISPLAY_POINTER, NULL);
int x_screen = SDL_GetNumberProperty(props, "SDL.window.x11.screen", 0); int x_screen = SDL_GetNumberProperty(props, SDL_PROPERTY_WINDOW_X11_SCREEN_NUMBER, 0);
Window x_win = SDL_GetNumberProperty(props, "SDL.window.x11.window", 0); Window x_win = SDL_GetNumberProperty(props, SDL_PROPERTY_WINDOW_X11_WINDOW_NUMBER, 0);
Window unused; Window unused;
if (x_disp && x_win) { if (x_disp && x_win) {
X11_XTranslateCoordinates(x_disp, x_win, RootWindow(x_disp, x_screen), 0, 0, &x, &y, &unused); X11_XTranslateCoordinates(x_disp, x_win, RootWindow(x_disp, x_screen), 0, 0, &x, &y, &unused);

View file

@ -705,9 +705,9 @@ void SDL_IBus_UpdateTextRect(const SDL_Rect *rect)
#ifdef SDL_VIDEO_DRIVER_X11 #ifdef SDL_VIDEO_DRIVER_X11
{ {
SDL_PropertiesID props = SDL_GetWindowProperties(focused_win); SDL_PropertiesID props = SDL_GetWindowProperties(focused_win);
Display *x_disp = (Display *)SDL_GetProperty(props, "SDL.window.x11.display", NULL); Display *x_disp = (Display *)SDL_GetProperty(props, SDL_PROPERTY_WINDOW_X11_DISPLAY_POINTER, NULL);
int x_screen = SDL_GetNumberProperty(props, "SDL.window.x11.screen", 0); int x_screen = SDL_GetNumberProperty(props, SDL_PROPERTY_WINDOW_X11_SCREEN_NUMBER, 0);
Window x_win = SDL_GetNumberProperty(props, "SDL.window.x11.window", 0); Window x_win = SDL_GetNumberProperty(props, SDL_PROPERTY_WINDOW_X11_WINDOW_NUMBER, 0);
Window unused; Window unused;
if (x_disp && x_win) { if (x_disp && x_win) {

View file

@ -805,9 +805,9 @@ static void SDL_CalculateSimulatedVSyncInterval(SDL_Renderer *renderer, SDL_Wind
SDL_Renderer *SDL_CreateRendererWithProperties(SDL_PropertiesID props) SDL_Renderer *SDL_CreateRendererWithProperties(SDL_PropertiesID props)
{ {
#ifndef SDL_RENDER_DISABLED #ifndef SDL_RENDER_DISABLED
SDL_Window *window = SDL_GetProperty(props, "window", NULL); SDL_Window *window = SDL_GetProperty(props, SDL_PROPERTY_RENDERER_CREATE_WINDOW_POINTER, NULL);
SDL_Surface *surface = SDL_GetProperty(props, "surface", NULL); SDL_Surface *surface = SDL_GetProperty(props, SDL_PROPERTY_RENDERER_CREATE_SURFACE_POINTER, NULL);
const char *name = SDL_GetStringProperty(props, "name", NULL); const char *name = SDL_GetStringProperty(props, SDL_PROPERTY_RENDERER_CREATE_NAME_STRING, NULL);
SDL_Renderer *renderer = NULL; SDL_Renderer *renderer = NULL;
const int n = SDL_GetNumRenderDrivers(); const int n = SDL_GetNumRenderDrivers();
const char *hint; const char *hint;
@ -838,7 +838,7 @@ SDL_Renderer *SDL_CreateRendererWithProperties(SDL_PropertiesID props)
hint = SDL_GetHint(SDL_HINT_RENDER_VSYNC); hint = SDL_GetHint(SDL_HINT_RENDER_VSYNC);
if (hint && *hint) { if (hint && *hint) {
SDL_SetBooleanProperty(props, "present_vsync", SDL_GetHintBoolean(SDL_HINT_RENDER_VSYNC, SDL_TRUE)); SDL_SetBooleanProperty(props, SDL_PROPERTY_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN, SDL_GetHintBoolean(SDL_HINT_RENDER_VSYNC, SDL_TRUE));
} }
if (!name) { if (!name) {
@ -871,7 +871,7 @@ SDL_Renderer *SDL_CreateRendererWithProperties(SDL_PropertiesID props)
goto error; goto error;
} }
if (SDL_GetBooleanProperty(props, "present_vsync", SDL_FALSE)) { if (SDL_GetBooleanProperty(props, SDL_PROPERTY_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN, SDL_FALSE)) {
renderer->wanted_vsync = SDL_TRUE; renderer->wanted_vsync = SDL_TRUE;
if (!(renderer->info.flags & SDL_RENDERER_PRESENTVSYNC)) { if (!(renderer->info.flags & SDL_RENDERER_PRESENTVSYNC)) {
@ -947,14 +947,14 @@ SDL_Renderer *SDL_CreateRenderer(SDL_Window *window, const char *name, Uint32 fl
{ {
SDL_Renderer *renderer; SDL_Renderer *renderer;
SDL_PropertiesID props = SDL_CreateProperties(); SDL_PropertiesID props = SDL_CreateProperties();
SDL_SetProperty(props, "window", window); SDL_SetProperty(props, SDL_PROPERTY_RENDERER_CREATE_WINDOW_POINTER, window);
if (flags & SDL_RENDERER_SOFTWARE) { if (flags & SDL_RENDERER_SOFTWARE) {
SDL_SetStringProperty(props, "name", "software"); SDL_SetStringProperty(props, SDL_PROPERTY_RENDERER_CREATE_NAME_STRING, "software");
} else { } else {
SDL_SetStringProperty(props, "name", name); SDL_SetStringProperty(props, SDL_PROPERTY_RENDERER_CREATE_NAME_STRING, name);
} }
if (flags & SDL_RENDERER_PRESENTVSYNC) { if (flags & SDL_RENDERER_PRESENTVSYNC) {
SDL_SetBooleanProperty(props, "present_vsync", SDL_TRUE); SDL_SetBooleanProperty(props, SDL_PROPERTY_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN, SDL_TRUE);
} }
renderer = SDL_CreateRendererWithProperties(props); renderer = SDL_CreateRendererWithProperties(props);
SDL_DestroyProperties(props); SDL_DestroyProperties(props);
@ -1124,10 +1124,10 @@ static SDL_ScaleMode SDL_GetScaleMode(void)
SDL_Texture *SDL_CreateTextureWithProperties(SDL_Renderer *renderer, SDL_PropertiesID props) SDL_Texture *SDL_CreateTextureWithProperties(SDL_Renderer *renderer, SDL_PropertiesID props)
{ {
SDL_Texture *texture; SDL_Texture *texture;
Uint32 format = (Uint32)SDL_GetNumberProperty(props, "format", SDL_PIXELFORMAT_UNKNOWN); Uint32 format = (Uint32)SDL_GetNumberProperty(props, SDL_PROPERTY_TEXTURE_CREATE_FORMAT_NUMBER, SDL_PIXELFORMAT_UNKNOWN);
int access = (int)SDL_GetNumberProperty(props, "access", SDL_TEXTUREACCESS_STATIC); int access = (int)SDL_GetNumberProperty(props, SDL_PROPERTY_TEXTURE_CREATE_ACCESS_NUMBER, SDL_TEXTUREACCESS_STATIC);
int w = (int)SDL_GetNumberProperty(props, "width", 0); int w = (int)SDL_GetNumberProperty(props, SDL_PROPERTY_TEXTURE_CREATE_WIDTH_NUMBER, 0);
int h = (int)SDL_GetNumberProperty(props, "height", 0); int h = (int)SDL_GetNumberProperty(props, SDL_PROPERTY_TEXTURE_CREATE_HEIGHT_NUMBER, 0);
SDL_bool texture_is_fourcc_and_target; SDL_bool texture_is_fourcc_and_target;
CHECK_RENDERER_MAGIC(renderer, NULL); CHECK_RENDERER_MAGIC(renderer, NULL);
@ -1244,10 +1244,10 @@ SDL_Texture *SDL_CreateTexture(SDL_Renderer *renderer, Uint32 format, int access
{ {
SDL_Texture *texture; SDL_Texture *texture;
SDL_PropertiesID props = SDL_CreateProperties(); SDL_PropertiesID props = SDL_CreateProperties();
SDL_SetNumberProperty(props, "format", format); SDL_SetNumberProperty(props, SDL_PROPERTY_TEXTURE_CREATE_FORMAT_NUMBER, format);
SDL_SetNumberProperty(props, "access", access); SDL_SetNumberProperty(props, SDL_PROPERTY_TEXTURE_CREATE_ACCESS_NUMBER, access);
SDL_SetNumberProperty(props, "width", w); SDL_SetNumberProperty(props, SDL_PROPERTY_TEXTURE_CREATE_WIDTH_NUMBER, w);
SDL_SetNumberProperty(props, "height", h); SDL_SetNumberProperty(props, SDL_PROPERTY_TEXTURE_CREATE_HEIGHT_NUMBER, h);
texture = SDL_CreateTextureWithProperties(renderer, props); texture = SDL_CreateTextureWithProperties(renderer, props);
SDL_DestroyProperties(props); SDL_DestroyProperties(props);
return texture; return texture;

View file

@ -1610,7 +1610,7 @@ SDL_Renderer *D3D_CreateRenderer(SDL_Window *window, SDL_PropertiesID create_pro
} }
SDL_zero(pparams); SDL_zero(pparams);
pparams.hDeviceWindow = (HWND)SDL_GetProperty(SDL_GetWindowProperties(window), "SDL.window.win32.hwnd", NULL); pparams.hDeviceWindow = (HWND)SDL_GetProperty(SDL_GetWindowProperties(window), SDL_PROPERTY_WINDOW_WIN32_HWND_POINTER, NULL);
pparams.BackBufferWidth = w; pparams.BackBufferWidth = w;
pparams.BackBufferHeight = h; pparams.BackBufferHeight = h;
pparams.BackBufferCount = 1; pparams.BackBufferCount = 1;
@ -1625,7 +1625,7 @@ SDL_Renderer *D3D_CreateRenderer(SDL_Window *window, SDL_PropertiesID create_pro
pparams.BackBufferFormat = D3DFMT_UNKNOWN; pparams.BackBufferFormat = D3DFMT_UNKNOWN;
pparams.FullScreen_RefreshRateInHz = 0; pparams.FullScreen_RefreshRateInHz = 0;
} }
if (SDL_GetBooleanProperty(create_props, "present_vsync", SDL_FALSE)) { if (SDL_GetBooleanProperty(create_props, SDL_PROPERTY_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN, SDL_FALSE)) {
pparams.PresentationInterval = D3DPRESENT_INTERVAL_ONE; pparams.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
} else { } else {
pparams.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; pparams.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
@ -1709,7 +1709,7 @@ SDL_Renderer *D3D_CreateRenderer(SDL_Window *window, SDL_PropertiesID create_pro
} }
#endif #endif
SDL_SetProperty(SDL_GetRendererProperties(renderer), "SDL.renderer.d3d9.device", data->device); SDL_SetProperty(SDL_GetRendererProperties(renderer), SDL_PROPERTY_RENDERER_D3D9_DEVICE_POINTER, data->device);
return renderer; return renderer;
} }

View file

@ -665,7 +665,7 @@ static HRESULT D3D11_CreateDeviceResources(SDL_Renderer *renderer)
ID3D11DeviceContext_VSSetShader(data->d3dContext, data->vertexShader, NULL, 0); ID3D11DeviceContext_VSSetShader(data->d3dContext, data->vertexShader, NULL, 0);
ID3D11DeviceContext_VSSetConstantBuffers(data->d3dContext, 0, 1, &data->vertexShaderConstants); ID3D11DeviceContext_VSSetConstantBuffers(data->d3dContext, 0, 1, &data->vertexShaderConstants);
SDL_SetProperty(SDL_GetRendererProperties(renderer), "SDL.renderer.d3d11.device", data->d3dDevice); SDL_SetProperty(SDL_GetRendererProperties(renderer), SDL_PROPERTY_RENDERER_D3D11_DEVICE_POINTER, data->d3dDevice);
done: done:
SAFE_RELEASE(d3dDevice); SAFE_RELEASE(d3dDevice);
@ -829,7 +829,7 @@ static HRESULT D3D11_CreateSwapChain(SDL_Renderer *renderer, int w, int h)
#endif #endif
} else { } else {
#if defined(__WIN32__) || defined(__WINGDK__) #if defined(__WIN32__) || defined(__WINGDK__)
HWND hwnd = (HWND)SDL_GetProperty(SDL_GetWindowProperties(renderer->window), "SDL.window.win32.hwnd", NULL); HWND hwnd = (HWND)SDL_GetProperty(SDL_GetWindowProperties(renderer->window), SDL_PROPERTY_WINDOW_WIN32_HWND_POINTER, NULL);
result = IDXGIFactory2_CreateSwapChainForHwnd(data->dxgiFactory, result = IDXGIFactory2_CreateSwapChainForHwnd(data->dxgiFactory,
(IUnknown *)data->d3dDevice, (IUnknown *)data->d3dDevice,
@ -1137,7 +1137,7 @@ static int D3D11_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result); return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result);
} }
} }
SDL_SetProperty(SDL_GetTextureProperties(texture), "SDL.texture.d3d11.texture", textureData->mainTexture); SDL_SetProperty(SDL_GetTextureProperties(texture), SDL_PROPERTY_TEXTURE_D3D11_TEXTURE_POINTER, textureData->mainTexture);
#if SDL_HAVE_YUV #if SDL_HAVE_YUV
if (texture->format == SDL_PIXELFORMAT_YV12 || if (texture->format == SDL_PIXELFORMAT_YV12 ||
texture->format == SDL_PIXELFORMAT_IYUV) { texture->format == SDL_PIXELFORMAT_IYUV) {
@ -1159,7 +1159,7 @@ static int D3D11_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result); return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result);
} }
} }
SDL_SetProperty(SDL_GetTextureProperties(texture), "SDL.texture.d3d11.texture_u", textureData->mainTextureU); SDL_SetProperty(SDL_GetTextureProperties(texture), SDL_PROPERTY_TEXTURE_D3D11_TEXTURE_U_POINTER, textureData->mainTextureU);
if (GetTextureProperty(create_props, "d3d11.texture_v", &textureData->mainTextureV) < 0) { if (GetTextureProperty(create_props, "d3d11.texture_v", &textureData->mainTextureV) < 0) {
return -1; return -1;
@ -1174,7 +1174,7 @@ static int D3D11_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result); return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result);
} }
} }
SDL_SetProperty(SDL_GetTextureProperties(texture), "SDL.texture.d3d11.texture_v", textureData->mainTextureV); SDL_SetProperty(SDL_GetTextureProperties(texture), SDL_PROPERTY_TEXTURE_D3D11_TEXTURE_V_POINTER, textureData->mainTextureV);
} }
if (texture->format == SDL_PIXELFORMAT_NV12 || if (texture->format == SDL_PIXELFORMAT_NV12 ||
texture->format == SDL_PIXELFORMAT_NV21) { texture->format == SDL_PIXELFORMAT_NV21) {
@ -2488,7 +2488,7 @@ SDL_Renderer *D3D11_CreateRenderer(SDL_Window *window, SDL_PropertiesID create_p
*/ */
renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
#else #else
if (SDL_GetBooleanProperty(create_props, "present_vsync", SDL_FALSE)) { if (SDL_GetBooleanProperty(create_props, SDL_PROPERTY_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN, SDL_FALSE)) {
renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
} }
renderer->SetVSync = D3D11_SetVSync; renderer->SetVSync = D3D11_SetVSync;

View file

@ -44,7 +44,7 @@ using namespace Windows::Graphics::Display;
extern "C" void * extern "C" void *
D3D11_GetCoreWindowFromSDLRenderer(SDL_Renderer *renderer) D3D11_GetCoreWindowFromSDLRenderer(SDL_Renderer *renderer)
{ {
IInspectable *window = (IInspectable *)SDL_GetProperty(SDL_GetWindowProperties(renderer->window), "SDL.window.winrt.window", NULL); IInspectable *window = (IInspectable *)SDL_GetProperty(SDL_GetWindowProperties(renderer->window), SDL_PROPERTY_WINDOW_WINRT_WINDOW_POINTER, NULL);
ABI::Windows::UI::Core::ICoreWindow *coreWindow = NULL; ABI::Windows::UI::Core::ICoreWindow *coreWindow = NULL;
if (!window || FAILED(window->QueryInterface(&coreWindow))) { if (!window || FAILED(window->QueryInterface(&coreWindow))) {
return NULL; return NULL;

View file

@ -324,8 +324,8 @@ static void D3D12_ReleaseAll(SDL_Renderer *renderer)
SDL_Texture *texture = NULL; SDL_Texture *texture = NULL;
SDL_PropertiesID props = SDL_GetRendererProperties(renderer); SDL_PropertiesID props = SDL_GetRendererProperties(renderer);
SDL_SetProperty(props, "SDL.renderer.d3d12.device", NULL); SDL_SetProperty(props, SDL_PROPERTY_RENDERER_D3D12_DEVICE_POINTER, NULL);
SDL_SetProperty(props, "SDL.renderer.d3d12.command_queue", NULL); SDL_SetProperty(props, SDL_PROPERTY_RENDERER_D3D12_COMMAND_QUEUE_POINTER, NULL);
/* Release all textures */ /* Release all textures */
for (texture = renderer->textures; texture; texture = texture->next) { for (texture = renderer->textures; texture; texture = texture->next) {
@ -1074,8 +1074,8 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer)
data->srvPoolHead = &data->srvPoolNodes[0]; data->srvPoolHead = &data->srvPoolNodes[0];
SDL_PropertiesID props = SDL_GetRendererProperties(renderer); SDL_PropertiesID props = SDL_GetRendererProperties(renderer);
SDL_SetProperty(props, "SDL.renderer.d3d12.device", data->d3dDevice); SDL_SetProperty(props, SDL_PROPERTY_RENDERER_D3D12_DEVICE_POINTER, data->d3dDevice);
SDL_SetProperty(props, "SDL.renderer.d3d12.command_queue", data->commandQueue); SDL_SetProperty(props, SDL_PROPERTY_RENDERER_D3D12_COMMAND_QUEUE_POINTER, data->commandQueue);
done: done:
SAFE_RELEASE(d3dDevice); SAFE_RELEASE(d3dDevice);
@ -1179,7 +1179,7 @@ static HRESULT D3D12_CreateSwapChain(SDL_Renderer *renderer, int w, int h)
swapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT | /* To support SetMaximumFrameLatency */ swapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT | /* To support SetMaximumFrameLatency */
DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING; /* To support presenting with allow tearing on */ DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING; /* To support presenting with allow tearing on */
HWND hwnd = (HWND)SDL_GetProperty(SDL_GetWindowProperties(renderer->window), "SDL.window.win32.hwnd", NULL); HWND hwnd = (HWND)SDL_GetProperty(SDL_GetWindowProperties(renderer->window), SDL_PROPERTY_WINDOW_WIN32_HWND_POINTER, NULL);
result = D3D_CALL(data->dxgiFactory, CreateSwapChainForHwnd, result = D3D_CALL(data->dxgiFactory, CreateSwapChainForHwnd,
(IUnknown *)data->commandQueue, (IUnknown *)data->commandQueue,
@ -1506,7 +1506,7 @@ static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
} }
} }
textureData->mainResourceState = D3D12_RESOURCE_STATE_COPY_DEST; textureData->mainResourceState = D3D12_RESOURCE_STATE_COPY_DEST;
SDL_SetProperty(SDL_GetTextureProperties(texture), "SDL.texture.d3d12.texture", textureData->mainTexture); SDL_SetProperty(SDL_GetTextureProperties(texture), SDL_PROPERTY_TEXTURE_D3D12_TEXTURE_POINTER, textureData->mainTexture);
#if SDL_HAVE_YUV #if SDL_HAVE_YUV
if (texture->format == SDL_PIXELFORMAT_YV12 || if (texture->format == SDL_PIXELFORMAT_YV12 ||
texture->format == SDL_PIXELFORMAT_IYUV) { texture->format == SDL_PIXELFORMAT_IYUV) {
@ -1533,7 +1533,7 @@ static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
} }
} }
textureData->mainResourceStateU = D3D12_RESOURCE_STATE_COPY_DEST; textureData->mainResourceStateU = D3D12_RESOURCE_STATE_COPY_DEST;
SDL_SetProperty(SDL_GetTextureProperties(texture), "SDL.texture.d3d12.texture_u", textureData->mainTextureU); SDL_SetProperty(SDL_GetTextureProperties(texture), SDL_PROPERTY_TEXTURE_D3D12_TEXTURE_U_POINTER, textureData->mainTextureU);
if (GetTextureProperty(create_props, "d3d12.texture_v", &textureData->mainTextureV) < 0) { if (GetTextureProperty(create_props, "d3d12.texture_v", &textureData->mainTextureV) < 0) {
return -1; return -1;
@ -1553,7 +1553,7 @@ static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
} }
} }
textureData->mainResourceStateV = D3D12_RESOURCE_STATE_COPY_DEST; textureData->mainResourceStateV = D3D12_RESOURCE_STATE_COPY_DEST;
SDL_SetProperty(SDL_GetTextureProperties(texture), "SDL.texture.d3d12.texture_v", textureData->mainTextureV); SDL_SetProperty(SDL_GetTextureProperties(texture), SDL_PROPERTY_TEXTURE_D3D12_TEXTURE_V_POINTER, textureData->mainTextureV);
} }
if (texture->format == SDL_PIXELFORMAT_NV12 || if (texture->format == SDL_PIXELFORMAT_NV12 ||
@ -3027,7 +3027,7 @@ SDL_Renderer *D3D12_CreateRenderer(SDL_Window *window, SDL_PropertiesID create_p
renderer->driverdata = data; renderer->driverdata = data;
D3D12_InvalidateCachedState(renderer); D3D12_InvalidateCachedState(renderer);
if (SDL_GetBooleanProperty(create_props, "present_vsync", SDL_FALSE)) { if (SDL_GetBooleanProperty(create_props, SDL_PROPERTY_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN, SDL_FALSE)) {
renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
} }
renderer->SetVSync = D3D12_SetVSync; renderer->SetVSync = D3D12_SetVSync;

View file

@ -1630,8 +1630,8 @@ static int METAL_SetVSync(SDL_Renderer *renderer, const int vsync)
static SDL_MetalView GetWindowView(SDL_Window *window) static SDL_MetalView GetWindowView(SDL_Window *window)
{ {
#ifdef SDL_VIDEO_DRIVER_COCOA #ifdef SDL_VIDEO_DRIVER_COCOA
NSWindow *nswindow = (__bridge NSWindow *)SDL_GetProperty(SDL_GetWindowProperties(window), "SDL.window.cocoa.window", NULL); NSWindow *nswindow = (__bridge NSWindow *)SDL_GetProperty(SDL_GetWindowProperties(window), SDL_PROPERTY_WINDOW_COCOA_WINDOW_POINTER, NULL);
NSInteger tag = (NSInteger)SDL_GetNumberProperty(SDL_GetWindowProperties(window), "SDL.window.cocoa.metal_view_tag", 0); NSInteger tag = (NSInteger)SDL_GetNumberProperty(SDL_GetWindowProperties(window), SDL_PROPERTY_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER, 0);
if (nswindow && tag) { if (nswindow && tag) {
NSView *view = nswindow.contentView; NSView *view = nswindow.contentView;
if (view.subviews.count > 0) { if (view.subviews.count > 0) {
@ -1644,8 +1644,8 @@ static SDL_MetalView GetWindowView(SDL_Window *window)
#endif #endif
#ifdef SDL_VIDEO_DRIVER_UIKIT #ifdef SDL_VIDEO_DRIVER_UIKIT
UIWindow *uiwindow = (__bridge UIWindow *)SDL_GetProperty(SDL_GetWindowProperties(window), "SDL.window.uikit.window", NULL); UIWindow *uiwindow = (__bridge UIWindow *)SDL_GetProperty(SDL_GetWindowProperties(window), SDL_PROPERTY_WINDOW_UIKIT_WINDOW_POINTER, NULL);
NSInteger tag = (NSInteger)SDL_GetNumberProperty(SDL_GetWindowProperties(window), "SDL.window.uikit.metal_view_tag", 0); NSInteger tag = (NSInteger)SDL_GetNumberProperty(SDL_GetWindowProperties(window), SDL_PROPERTY_WINDOW_UIKIT_METAL_VIEW_TAG_NUMBER, 0);
if (uiwindow && tag) { if (uiwindow && tag) {
UIView *view = uiwindow.rootViewController.view; UIView *view = uiwindow.rootViewController.view;
if (view.tag == tag) { if (view.tag == tag) {
@ -1924,7 +1924,7 @@ static SDL_Renderer *METAL_CreateRenderer(SDL_Window *window, SDL_PropertiesID c
#if (defined(__MACOS__) && defined(MAC_OS_X_VERSION_10_13)) || TARGET_OS_MACCATALYST #if (defined(__MACOS__) && defined(MAC_OS_X_VERSION_10_13)) || TARGET_OS_MACCATALYST
if (@available(macOS 10.13, *)) { if (@available(macOS 10.13, *)) {
data.mtllayer.displaySyncEnabled = SDL_GetBooleanProperty(create_props, "present_vsync", SDL_FALSE); data.mtllayer.displaySyncEnabled = SDL_GetBooleanProperty(create_props, SDL_PROPERTY_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN, SDL_FALSE);
if (data.mtllayer.displaySyncEnabled) { if (data.mtllayer.displaySyncEnabled) {
renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
} }

View file

@ -498,7 +498,7 @@ static int GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_Pr
data->fbo = NULL; data->fbo = NULL;
} }
data->texture = (GLuint)SDL_GetNumberProperty(create_props, "opengl.texture", 0); data->texture = (GLuint)SDL_GetNumberProperty(create_props, SDL_PROPERTY_TEXTURE_CREATE_OPENGL_TEXTURE_NUMBER, 0);
if (data->texture) { if (data->texture) {
data->texture_external = SDL_TRUE; data->texture_external = SDL_TRUE;
} else { } else {
@ -531,9 +531,9 @@ static int GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_Pr
data->texh = (GLfloat)texture->h / texture_h; data->texh = (GLfloat)texture->h / texture_h;
} }
SDL_PropertiesID props = SDL_GetTextureProperties(texture); SDL_PropertiesID props = SDL_GetTextureProperties(texture);
SDL_SetNumberProperty(props, "SDL.texture.opengl.texture", data->texture); SDL_SetNumberProperty(props, SDL_PROPERTY_TEXTURE_OPENGL_TEXTURE_NUMBER, data->texture);
SDL_SetFloatProperty(props, "SDL.texture.opengl.tex_w", data->texw); SDL_SetFloatProperty(props, SDL_PROPERTY_TEXTURE_OPENGL_TEX_W_FLOAT, data->texw);
SDL_SetFloatProperty(props, "SDL.texture.opengl.tex_h", data->texh); SDL_SetFloatProperty(props, SDL_PROPERTY_TEXTURE_OPENGL_TEX_H_FLOAT, data->texh);
data->format = format; data->format = format;
data->formattype = type; data->formattype = type;
@ -592,13 +592,13 @@ static int GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_Pr
texture->format == SDL_PIXELFORMAT_IYUV) { texture->format == SDL_PIXELFORMAT_IYUV) {
data->yuv = SDL_TRUE; data->yuv = SDL_TRUE;
data->utexture = (GLuint)SDL_GetNumberProperty(create_props, "opengl.texture_u", 0); data->utexture = (GLuint)SDL_GetNumberProperty(create_props, SDL_PROPERTY_TEXTURE_CREATE_OPENGL_TEXTURE_U_NUMBER, 0);
if (data->utexture) { if (data->utexture) {
data->utexture_external = SDL_TRUE; data->utexture_external = SDL_TRUE;
} else { } else {
renderdata->glGenTextures(1, &data->utexture); renderdata->glGenTextures(1, &data->utexture);
} }
data->vtexture = (GLuint)SDL_GetNumberProperty(create_props, "opengl.texture_v", 0); data->vtexture = (GLuint)SDL_GetNumberProperty(create_props, SDL_PROPERTY_TEXTURE_CREATE_OPENGL_TEXTURE_V_NUMBER, 0);
if (data->vtexture) { if (data->vtexture) {
data->vtexture_external = SDL_TRUE; data->vtexture_external = SDL_TRUE;
} else { } else {
@ -616,7 +616,7 @@ static int GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_Pr
GL_CLAMP_TO_EDGE); GL_CLAMP_TO_EDGE);
renderdata->glTexImage2D(textype, 0, internalFormat, (texture_w + 1) / 2, renderdata->glTexImage2D(textype, 0, internalFormat, (texture_w + 1) / 2,
(texture_h + 1) / 2, 0, format, type, NULL); (texture_h + 1) / 2, 0, format, type, NULL);
SDL_SetNumberProperty(props, "SDL.texture.opengl.texture_u", data->utexture); SDL_SetNumberProperty(props, SDL_PROPERTY_TEXTURE_OPENGL_TEXTURE_U_NUMBER, data->utexture);
renderdata->glBindTexture(textype, data->vtexture); renderdata->glBindTexture(textype, data->vtexture);
renderdata->glTexParameteri(textype, GL_TEXTURE_MIN_FILTER, renderdata->glTexParameteri(textype, GL_TEXTURE_MIN_FILTER,
@ -629,14 +629,14 @@ static int GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_Pr
GL_CLAMP_TO_EDGE); GL_CLAMP_TO_EDGE);
renderdata->glTexImage2D(textype, 0, internalFormat, (texture_w + 1) / 2, renderdata->glTexImage2D(textype, 0, internalFormat, (texture_w + 1) / 2,
(texture_h + 1) / 2, 0, format, type, NULL); (texture_h + 1) / 2, 0, format, type, NULL);
SDL_SetNumberProperty(props, "SDL.texture.opengl.texture_v", data->vtexture); SDL_SetNumberProperty(props, SDL_PROPERTY_TEXTURE_OPENGL_TEXTURE_V_NUMBER, data->vtexture);
} }
if (texture->format == SDL_PIXELFORMAT_NV12 || if (texture->format == SDL_PIXELFORMAT_NV12 ||
texture->format == SDL_PIXELFORMAT_NV21) { texture->format == SDL_PIXELFORMAT_NV21) {
data->nv12 = SDL_TRUE; data->nv12 = SDL_TRUE;
data->utexture = (GLuint)SDL_GetNumberProperty(create_props, "opengl.texture_uv", 0); data->utexture = (GLuint)SDL_GetNumberProperty(create_props, SDL_PROPERTY_TEXTURE_CREATE_OPENGL_TEXTURE_UV_NUMBER, 0);
if (data->utexture) { if (data->utexture) {
data->utexture_external = SDL_TRUE; data->utexture_external = SDL_TRUE;
} else { } else {
@ -653,7 +653,7 @@ static int GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_Pr
GL_CLAMP_TO_EDGE); GL_CLAMP_TO_EDGE);
renderdata->glTexImage2D(textype, 0, GL_LUMINANCE_ALPHA, (texture_w + 1) / 2, renderdata->glTexImage2D(textype, 0, GL_LUMINANCE_ALPHA, (texture_w + 1) / 2,
(texture_h + 1) / 2, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, NULL); (texture_h + 1) / 2, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, NULL);
SDL_SetNumberProperty(props, "SDL.texture.opengl.texture_uv", data->utexture); SDL_SetNumberProperty(props, SDL_PROPERTY_TEXTURE_OPENGL_TEXTURE_UV_NUMBER, data->utexture);
} }
#endif #endif
@ -1867,7 +1867,7 @@ static SDL_Renderer *GL_CreateRenderer(SDL_Window *window, SDL_PropertiesID crea
*/ */
#endif #endif
if (SDL_GetBooleanProperty(create_props, "present_vsync", SDL_FALSE)) { if (SDL_GetBooleanProperty(create_props, SDL_PROPERTY_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN, SDL_FALSE)) {
SDL_GL_SetSwapInterval(1); SDL_GL_SetSwapInterval(1);
} else { } else {
SDL_GL_SetSwapInterval(0); SDL_GL_SetSwapInterval(0);

View file

@ -1508,7 +1508,7 @@ static int GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
#if SDL_HAVE_YUV #if SDL_HAVE_YUV
if (data->yuv) { if (data->yuv) {
data->texture_v = (GLuint)SDL_GetNumberProperty(create_props, "opengles2.texture_v", 0); data->texture_v = (GLuint)SDL_GetNumberProperty(create_props, SDL_PROPERTY_TEXTURE_CREATE_OPENGLES2_TEXTURE_V_NUMBER, 0);
if (data->texture_v) { if (data->texture_v) {
data->texture_v_external = SDL_TRUE; data->texture_v_external = SDL_TRUE;
} else { } else {
@ -1524,9 +1524,9 @@ static int GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
renderdata->glTexImage2D(data->texture_type, 0, format, (texture->w + 1) / 2, (texture->h + 1) / 2, 0, format, type, NULL); renderdata->glTexImage2D(data->texture_type, 0, format, (texture->w + 1) / 2, (texture->h + 1) / 2, 0, format, type, NULL);
SDL_SetNumberProperty(SDL_GetTextureProperties(texture), "SDL.texture.opengles2.texture_v", data->texture_v); SDL_SetNumberProperty(SDL_GetTextureProperties(texture), SDL_PROPERTY_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER, data->texture_v);
data->texture_u = (GLuint)SDL_GetNumberProperty(create_props, "opengles2.texture_u", 0); data->texture_u = (GLuint)SDL_GetNumberProperty(create_props, SDL_PROPERTY_TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBER, 0);
if (data->texture_u) { if (data->texture_u) {
data->texture_u_external = SDL_TRUE; data->texture_u_external = SDL_TRUE;
} else { } else {
@ -1545,10 +1545,10 @@ static int GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
if (GL_CheckError("glTexImage2D()", renderer) < 0) { if (GL_CheckError("glTexImage2D()", renderer) < 0) {
return -1; return -1;
} }
SDL_SetNumberProperty(SDL_GetTextureProperties(texture), "SDL.texture.opengles2.texture_u", data->texture_u); SDL_SetNumberProperty(SDL_GetTextureProperties(texture), SDL_PROPERTY_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER, data->texture_u);
} else if (data->nv12) { } else if (data->nv12) {
data->texture_u = (GLuint)SDL_GetNumberProperty(create_props, "opengles2.texture_uv", 0); data->texture_u = (GLuint)SDL_GetNumberProperty(create_props, SDL_PROPERTY_TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBER, 0);
if (data->texture_u) { if (data->texture_u) {
data->texture_u_external = SDL_TRUE; data->texture_u_external = SDL_TRUE;
} else { } else {
@ -1567,11 +1567,11 @@ static int GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
if (GL_CheckError("glTexImage2D()", renderer) < 0) { if (GL_CheckError("glTexImage2D()", renderer) < 0) {
return -1; return -1;
} }
SDL_SetNumberProperty(SDL_GetTextureProperties(texture), "SDL.texture.opengles2.texture_uv", data->texture_u); SDL_SetNumberProperty(SDL_GetTextureProperties(texture), SDL_PROPERTY_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER, data->texture_u);
} }
#endif #endif
data->texture = (GLuint)SDL_GetNumberProperty(create_props, "opengles2.texture", 0); data->texture = (GLuint)SDL_GetNumberProperty(create_props, SDL_PROPERTY_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER, 0);
if (data->texture) { if (data->texture) {
data->texture_external = SDL_TRUE; data->texture_external = SDL_TRUE;
} else { } else {
@ -1593,7 +1593,7 @@ static int GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
return -1; return -1;
} }
} }
SDL_SetNumberProperty(SDL_GetTextureProperties(texture), "SDL.texture.opengles2.texture", data->texture); SDL_SetNumberProperty(SDL_GetTextureProperties(texture), SDL_PROPERTY_TEXTURE_OPENGLES2_TEXTURE_NUMBER, data->texture);
if (texture->access == SDL_TEXTUREACCESS_TARGET) { if (texture->access == SDL_TEXTUREACCESS_TARGET) {
data->fbo = GLES2_GetFBO(renderer->driverdata, texture->w, texture->h); data->fbo = GLES2_GetFBO(renderer->driverdata, texture->w, texture->h);
@ -2155,10 +2155,10 @@ static SDL_Renderer *GLES2_CreateRenderer(SDL_Window *window, SDL_PropertiesID c
* is turned on. Not doing so will freeze the screen's contents to that * is turned on. Not doing so will freeze the screen's contents to that
* of the first drawn frame. * of the first drawn frame.
*/ */
SDL_SetBooleanProperty(create_props, "present_vsync", SDL_TRUE); SDL_SetBooleanProperty(create_props, SDL_PROPERTY_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN, SDL_TRUE);
#endif #endif
if (SDL_GetBooleanProperty(create_props, "present_vsync", SDL_FALSE)) { if (SDL_GetBooleanProperty(create_props, SDL_PROPERTY_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN, SDL_FALSE)) {
SDL_GL_SetSwapInterval(1); SDL_GL_SetSwapInterval(1);
} else { } else {
SDL_GL_SetSwapInterval(0); SDL_GL_SetSwapInterval(0);

View file

@ -643,7 +643,7 @@ static SDL_Renderer *PS2_CreateRenderer(SDL_Window *window, SDL_PropertiesID cre
data->gsGlobal = gsGlobal; data->gsGlobal = gsGlobal;
dynamicVsync = SDL_GetHintBoolean(SDL_HINT_PS2_DYNAMIC_VSYNC, SDL_FALSE); dynamicVsync = SDL_GetHintBoolean(SDL_HINT_PS2_DYNAMIC_VSYNC, SDL_FALSE);
if (SDL_GetBooleanProperty(create_props, "present_vsync", SDL_FALSE)) { if (SDL_GetBooleanProperty(create_props, SDL_PROPERTY_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN, SDL_FALSE)) {
data->vsync = (dynamicVsync ? 2 : 1); data->vsync = (dynamicVsync ? 2 : 1);
} }

View file

@ -1345,7 +1345,7 @@ SDL_Renderer *PSP_CreateRenderer(SDL_Window *window, SDL_PropertiesID create_pro
data->most_recent_target = NULL; data->most_recent_target = NULL;
data->least_recent_target = NULL; data->least_recent_target = NULL;
if (SDL_GetBooleanProperty(create_props, "present_vsync", SDL_FALSE)) { if (SDL_GetBooleanProperty(create_props, SDL_PROPERTY_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN, SDL_FALSE)) {
data->vsync = SDL_TRUE; data->vsync = SDL_TRUE;
} else { } else {
data->vsync = SDL_FALSE; data->vsync = SDL_FALSE;

View file

@ -1168,7 +1168,7 @@ static SDL_Renderer *SW_CreateRenderer(SDL_Window *window, SDL_PropertiesID crea
} }
if (no_hint_set) { if (no_hint_set) {
if (SDL_GetBooleanProperty(create_props, "present_vsync", SDL_FALSE)) { if (SDL_GetBooleanProperty(create_props, SDL_PROPERTY_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN, SDL_FALSE)) {
SDL_SetHint(SDL_HINT_RENDER_VSYNC, "1"); SDL_SetHint(SDL_HINT_RENDER_VSYNC, "1");
} else { } else {
SDL_SetHint(SDL_HINT_RENDER_VSYNC, "0"); SDL_SetHint(SDL_HINT_RENDER_VSYNC, "0");

View file

@ -260,7 +260,7 @@ SDL_Renderer *VITA_GXM_CreateRenderer(SDL_Window *window, SDL_PropertiesID creat
data->initialized = SDL_TRUE; data->initialized = SDL_TRUE;
if (SDL_GetBooleanProperty(create_props, "present_vsync", SDL_FALSE)) { if (SDL_GetBooleanProperty(create_props, SDL_PROPERTY_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN, SDL_FALSE)) {
data->displayData.wait_vblank = SDL_TRUE; data->displayData.wait_vblank = SDL_TRUE;
renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
} else { } else {

View file

@ -1451,11 +1451,11 @@ SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state)
SDL_strlcpy(title, state->window_title, SDL_arraysize(title)); SDL_strlcpy(title, state->window_title, SDL_arraysize(title));
} }
props = SDL_CreateProperties(); props = SDL_CreateProperties();
SDL_SetStringProperty(props, "title", title); SDL_SetStringProperty(props, SDL_PROPERTY_WINDOW_CREATE_TITLE_STRING, title);
SDL_SetNumberProperty(props, "x", r.x); SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_X_NUMBER, r.x);
SDL_SetNumberProperty(props, "y", r.y); SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_Y_NUMBER, r.y);
SDL_SetNumberProperty(props, "width", r.w); SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_WIDTH_NUMBER, r.w);
SDL_SetNumberProperty(props, "height", r.h); SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_HEIGHT_NUMBER, r.h);
SDL_SetNumberProperty(props, "flags", state->window_flags); SDL_SetNumberProperty(props, "flags", state->window_flags);
state->windows[i] = SDL_CreateWindowWithProperties(props); state->windows[i] = SDL_CreateWindowWithProperties(props);
SDL_DestroyProperties(props); SDL_DestroyProperties(props);

View file

@ -1916,23 +1916,23 @@ static struct {
Uint32 flag; Uint32 flag;
SDL_bool invert_value; SDL_bool invert_value;
} SDL_WindowFlagProperties[] = { } SDL_WindowFlagProperties[] = {
{ "always-on-top", SDL_WINDOW_ALWAYS_ON_TOP, SDL_FALSE }, { SDL_PROPERTY_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN, SDL_WINDOW_ALWAYS_ON_TOP, SDL_FALSE },
{ "borderless", SDL_WINDOW_BORDERLESS, SDL_FALSE }, { SDL_PROPERTY_WINDOW_CREATE_BORDERLESS_BOOLEAN, SDL_WINDOW_BORDERLESS, SDL_FALSE },
{ "focusable", SDL_WINDOW_NOT_FOCUSABLE, SDL_TRUE }, { SDL_PROPERTY_WINDOW_CREATE_FOCUSABLE_BOOLEAN, SDL_WINDOW_NOT_FOCUSABLE, SDL_TRUE },
{ "fullscreen", SDL_WINDOW_FULLSCREEN, SDL_FALSE }, { SDL_PROPERTY_WINDOW_CREATE_FULLSCREEN_BOOLEAN, SDL_WINDOW_FULLSCREEN, SDL_FALSE },
{ "hidden", SDL_WINDOW_HIDDEN, SDL_FALSE }, { SDL_PROPERTY_WINDOW_CREATE_HIDDEN_BOOLEAN, SDL_WINDOW_HIDDEN, SDL_FALSE },
{ "high-pixel-density", SDL_WINDOW_HIGH_PIXEL_DENSITY, SDL_FALSE }, { SDL_PROPERTY_WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN, SDL_WINDOW_HIGH_PIXEL_DENSITY, SDL_FALSE },
{ "maximized", SDL_WINDOW_MAXIMIZED, SDL_FALSE }, { SDL_PROPERTY_WINDOW_CREATE_MAXIMIZED_BOOLEAN, SDL_WINDOW_MAXIMIZED, SDL_FALSE },
{ "menu", SDL_WINDOW_POPUP_MENU, SDL_FALSE }, { SDL_PROPERTY_WINDOW_CREATE_MENU_BOOLEAN, SDL_WINDOW_POPUP_MENU, SDL_FALSE },
{ "metal", SDL_WINDOW_METAL, SDL_FALSE }, { SDL_PROPERTY_WINDOW_CREATE_METAL_BOOLEAN, SDL_WINDOW_METAL, SDL_FALSE },
{ "minimized", SDL_WINDOW_MINIMIZED, SDL_FALSE }, { SDL_PROPERTY_WINDOW_CREATE_MINIMIZED_BOOLEAN, SDL_WINDOW_MINIMIZED, SDL_FALSE },
{ "mouse-grabbed", SDL_WINDOW_MOUSE_GRABBED, SDL_FALSE }, { SDL_PROPERTY_WINDOW_CREATE_MOUSE_GRABBED_BOOLEAN, SDL_WINDOW_MOUSE_GRABBED, SDL_FALSE },
{ "opengl", SDL_WINDOW_OPENGL, SDL_FALSE }, { SDL_PROPERTY_WINDOW_CREATE_OPENGL_BOOLEAN, SDL_WINDOW_OPENGL, SDL_FALSE },
{ "resizable", SDL_WINDOW_RESIZABLE, SDL_FALSE }, { SDL_PROPERTY_WINDOW_CREATE_RESIZABLE_BOOLEAN, SDL_WINDOW_RESIZABLE, SDL_FALSE },
{ "transparent", SDL_WINDOW_TRANSPARENT, SDL_FALSE }, { SDL_PROPERTY_WINDOW_CREATE_TRANSPARENT_BOOLEAN, SDL_WINDOW_TRANSPARENT, SDL_FALSE },
{ "tooltip", SDL_WINDOW_TOOLTIP, SDL_FALSE }, { SDL_PROPERTY_WINDOW_CREATE_TOOLTIP_BOOLEAN, SDL_WINDOW_TOOLTIP, SDL_FALSE },
{ "utility", SDL_WINDOW_UTILITY, SDL_FALSE }, { SDL_PROPERTY_WINDOW_CREATE_UTILITY_BOOLEAN, SDL_WINDOW_UTILITY, SDL_FALSE },
{ "vulkan", SDL_WINDOW_VULKAN, SDL_FALSE } { SDL_PROPERTY_WINDOW_CREATE_VULKAN_BOOLEAN, SDL_WINDOW_VULKAN, SDL_FALSE }
}; };
static Uint32 SDL_GetWindowFlagProperties(SDL_PropertiesID props) static Uint32 SDL_GetWindowFlagProperties(SDL_PropertiesID props)
@ -1957,12 +1957,12 @@ static Uint32 SDL_GetWindowFlagProperties(SDL_PropertiesID props)
SDL_Window *SDL_CreateWindowWithProperties(SDL_PropertiesID props) SDL_Window *SDL_CreateWindowWithProperties(SDL_PropertiesID props)
{ {
SDL_Window *window; SDL_Window *window;
const char *title = SDL_GetStringProperty(props, "title", NULL); const char *title = SDL_GetStringProperty(props, SDL_PROPERTY_WINDOW_CREATE_TITLE_STRING, NULL);
int x = (int)SDL_GetNumberProperty(props, "x", SDL_WINDOWPOS_UNDEFINED); int x = (int)SDL_GetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_X_NUMBER, SDL_WINDOWPOS_UNDEFINED);
int y = (int)SDL_GetNumberProperty(props, "y", SDL_WINDOWPOS_UNDEFINED); int y = (int)SDL_GetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_Y_NUMBER, SDL_WINDOWPOS_UNDEFINED);
int w = (int)SDL_GetNumberProperty(props, "width", 0); int w = (int)SDL_GetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_WIDTH_NUMBER, 0);
int h = (int)SDL_GetNumberProperty(props, "height", 0); int h = (int)SDL_GetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_HEIGHT_NUMBER, 0);
SDL_Window *parent = SDL_GetProperty(props, "parent", NULL); SDL_Window *parent = SDL_GetProperty(props, SDL_PROPERTY_WINDOW_CREATE_PARENT_POINTER, NULL);
Uint32 flags = SDL_GetWindowFlagProperties(props); Uint32 flags = SDL_GetWindowFlagProperties(props);
Uint32 type_flags, graphics_flags; Uint32 type_flags, graphics_flags;
SDL_bool undefined_x = SDL_FALSE; SDL_bool undefined_x = SDL_FALSE;
@ -2173,10 +2173,10 @@ SDL_Window *SDL_CreateWindow(const char *title, int w, int h, Uint32 flags)
SDL_Window *window; SDL_Window *window;
SDL_PropertiesID props = SDL_CreateProperties(); SDL_PropertiesID props = SDL_CreateProperties();
if (title && *title) { if (title && *title) {
SDL_SetStringProperty(props, "title", title); SDL_SetStringProperty(props, SDL_PROPERTY_WINDOW_CREATE_TITLE_STRING, title);
} }
SDL_SetNumberProperty(props, "width", w); SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_WIDTH_NUMBER, w);
SDL_SetNumberProperty(props, "height", h); SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_HEIGHT_NUMBER, h);
SDL_SetNumberProperty(props, "flags", flags); SDL_SetNumberProperty(props, "flags", flags);
window = SDL_CreateWindowWithProperties(props); window = SDL_CreateWindowWithProperties(props);
SDL_DestroyProperties(props); SDL_DestroyProperties(props);
@ -2194,11 +2194,11 @@ SDL_Window *SDL_CreatePopupWindow(SDL_Window *parent, int offset_x, int offset_y
return NULL; return NULL;
} }
SDL_SetProperty(props, "parent", parent); SDL_SetProperty(props, SDL_PROPERTY_WINDOW_CREATE_PARENT_POINTER, parent);
SDL_SetNumberProperty(props, "x", offset_x); SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_X_NUMBER, offset_x);
SDL_SetNumberProperty(props, "y", offset_y); SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_Y_NUMBER, offset_y);
SDL_SetNumberProperty(props, "width", w); SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_WIDTH_NUMBER, w);
SDL_SetNumberProperty(props, "height", h); SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_HEIGHT_NUMBER, h);
SDL_SetNumberProperty(props, "flags", flags); SDL_SetNumberProperty(props, "flags", flags);
window = SDL_CreateWindowWithProperties(props); window = SDL_CreateWindowWithProperties(props);
SDL_DestroyProperties(props); SDL_DestroyProperties(props);

View file

@ -72,7 +72,7 @@ int Android_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Propert
retval = SDL_SetError("Could not fetch native window"); retval = SDL_SetError("Could not fetch native window");
goto endfunction; goto endfunction;
} }
SDL_SetProperty(SDL_GetWindowProperties(window), "SDL.window.android.window", data->native_window); SDL_SetProperty(SDL_GetWindowProperties(window), SDL_PROPERTY_WINDOW_ANDROID_WINDOW_POINTER, data->native_window);
/* Do not create EGLSurface for Vulkan window since it will then make the window /* Do not create EGLSurface for Vulkan window since it will then make the window
incompatible with vkCreateAndroidSurfaceKHR */ incompatible with vkCreateAndroidSurfaceKHR */
@ -87,7 +87,7 @@ int Android_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Propert
goto endfunction; goto endfunction;
} }
} }
SDL_SetProperty(SDL_GetWindowProperties(window), "SDL.window.android.surface", data->egl_surface); SDL_SetProperty(SDL_GetWindowProperties(window), SDL_PROPERTY_WINDOW_ANDROID_SURFACE_POINTER, data->egl_surface);
#endif #endif
window->driverdata = data; window->driverdata = data;

View file

@ -1964,8 +1964,8 @@ static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, NSWindow
} }
SDL_PropertiesID props = SDL_GetWindowProperties(window); SDL_PropertiesID props = SDL_GetWindowProperties(window);
SDL_SetProperty(props, "SDL.window.cocoa.window", (__bridge void *)data.nswindow); SDL_SetProperty(props, SDL_PROPERTY_WINDOW_COCOA_WINDOW_POINTER, (__bridge void *)data.nswindow);
SDL_SetNumberProperty(props, "SDL.window.cocoa.metal_view_tag", SDL_METALVIEW_TAG); SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER, SDL_METALVIEW_TAG);
/* All done! */ /* All done! */
window->driverdata = (SDL_WindowData *)CFBridgingRetain(data); window->driverdata = (SDL_WindowData *)CFBridgingRetain(data);
@ -1990,8 +1990,8 @@ int Cocoa_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Propertie
SDL_assert(false); SDL_assert(false);
} }
} else { } else {
nswindow = (__bridge NSWindow *)SDL_GetProperty(create_props, "cocoa.window", NULL); nswindow = (__bridge NSWindow *)SDL_GetProperty(create_props, SDL_PROPERTY_WINDOW_CREATE_COCOA_WINDOW_POINTER, NULL);
nsview = (__bridge NSView *)SDL_GetProperty(create_props, "cocoa.view", NULL); nsview = (__bridge NSView *)SDL_GetProperty(create_props, SDL_PROPERTY_WINDOW_CREATE_COCOA_VIEW_POINTER, NULL);
} }
if (nswindow && !nsview) { if (nswindow && !nsview) {
nsview = [nswindow contentView]; nsview = [nswindow contentView];

View file

@ -1465,9 +1465,9 @@ int KMSDRM_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Properti
window->driverdata = windata; window->driverdata = windata;
SDL_PropertiesID props = SDL_GetWindowProperties(window); SDL_PropertiesID props = SDL_GetWindowProperties(window);
SDL_SetNumberProperty(props, "SDL.window.kmsdrm.dev_index", viddata->devindex); SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_KMSDRM_DEVICE_INDEX_NUMBER, viddata->devindex);
SDL_SetNumberProperty(props, "SDL.window.kmsdrm.drm_fd", viddata->drm_fd); SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_KMSDRM_DRM_FD_NUMBER, viddata->drm_fd);
SDL_SetProperty(props, "SDL.window.kmsdrm.gbm_dev", viddata->gbm_dev); SDL_SetProperty(props, SDL_PROPERTY_WINDOW_KMSDRM_GBM_DEVICE_POINTER, viddata->gbm_dev);
if (!is_vulkan && !vulkan_mode) { /* NON-Vulkan block. */ if (!is_vulkan && !vulkan_mode) { /* NON-Vulkan block. */

View file

@ -146,8 +146,8 @@ static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, UIWindow
[view setSDLWindow:window]; [view setSDLWindow:window];
SDL_PropertiesID props = SDL_GetWindowProperties(window); SDL_PropertiesID props = SDL_GetWindowProperties(window);
SDL_SetProperty(props, "SDL.window.uikit.window", (__bridge void *)data.uiwindow); SDL_SetProperty(props, SDL_PROPERTY_WINDOW_UIKIT_WINDOW_POINTER, (__bridge void *)data.uiwindow);
SDL_SetNumberProperty(props, "SDL.window.uikit.metal_view_tag", SDL_METALVIEW_TAG); SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_UIKIT_METAL_VIEW_TAG_NUMBER, SDL_METALVIEW_TAG);
return 0; return 0;
} }

View file

@ -254,7 +254,7 @@ int VIVANTE_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Propert
window->driverdata = data; window->driverdata = data;
SDL_PropertiesID props = SDL_GetWindowProperties(window); SDL_PropertiesID props = SDL_GetWindowProperties(window);
SDL_SetProperty(props, "SDL.window.vivante.display", displaydata->native_display); SDL_SetProperty(props, SDL_PROPERTY_WINDOW_VIVANTE_DISPLAY_POINTER, displaydata->native_display);
#ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK #ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK
data->native_window = vdkCreateWindow(displaydata->native_display, window->x, window->y, window->w, window->h); data->native_window = vdkCreateWindow(displaydata->native_display, window->x, window->y, window->w, window->h);
@ -264,7 +264,7 @@ int VIVANTE_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Propert
if (!data->native_window) { if (!data->native_window) {
return SDL_SetError("VIVANTE: Can't create native window"); return SDL_SetError("VIVANTE: Can't create native window");
} }
SDL_SetProperty(props, "SDL.window.vivante.window", data->native_window); SDL_SetProperty(props, SDL_PROPERTY_WINDOW_VIVANTE_WINDOW_POINTER, data->native_window);
#ifdef SDL_VIDEO_OPENGL_EGL #ifdef SDL_VIDEO_OPENGL_EGL
if (window->flags & SDL_WINDOW_OPENGL) { if (window->flags & SDL_WINDOW_OPENGL) {
@ -275,7 +275,7 @@ int VIVANTE_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Propert
} else { } else {
data->egl_surface = EGL_NO_SURFACE; data->egl_surface = EGL_NO_SURFACE;
} }
SDL_SetProperty(props, "SDL.window.vivante.surface", data->egl_surface); SDL_SetProperty(props, SDL_PROPERTY_WINDOW_VIVANTE_SURFACE_POINTER, data->egl_surface);
#endif #endif
/* Window has been successfully created */ /* Window has been successfully created */

View file

@ -1471,8 +1471,8 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
libdecor_frame_set_app_id(data->shell_surface.libdecor.frame, data->app_id); libdecor_frame_set_app_id(data->shell_surface.libdecor.frame, data->app_id);
libdecor_frame_map(data->shell_surface.libdecor.frame); libdecor_frame_map(data->shell_surface.libdecor.frame);
SDL_SetProperty(props, "SDL.window.wayland.xdg_surface", libdecor_frame_get_xdg_surface(data->shell_surface.libdecor.frame)); SDL_SetProperty(props, SDL_PROPERTY_WINDOW_WAYLAND_XDG_SURFACE_POINTER, libdecor_frame_get_xdg_surface(data->shell_surface.libdecor.frame));
SDL_SetProperty(props, "SDL.window.wayland.xdg_toplevel", libdecor_frame_get_xdg_toplevel(data->shell_surface.libdecor.frame)); SDL_SetProperty(props, SDL_PROPERTY_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER, libdecor_frame_get_xdg_toplevel(data->shell_surface.libdecor.frame));
} }
} else } else
#endif #endif
@ -1480,7 +1480,7 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
data->shell_surface.xdg.surface = xdg_wm_base_get_xdg_surface(c->shell.xdg, data->surface); data->shell_surface.xdg.surface = xdg_wm_base_get_xdg_surface(c->shell.xdg, data->surface);
xdg_surface_set_user_data(data->shell_surface.xdg.surface, data); xdg_surface_set_user_data(data->shell_surface.xdg.surface, data);
xdg_surface_add_listener(data->shell_surface.xdg.surface, &shell_surface_listener_xdg, data); xdg_surface_add_listener(data->shell_surface.xdg.surface, &shell_surface_listener_xdg, data);
SDL_SetProperty(SDL_GetWindowProperties(window), "SDL.window.wayland.xdg_surface", data->shell_surface.xdg.surface); SDL_SetProperty(SDL_GetWindowProperties(window), SDL_PROPERTY_WINDOW_WAYLAND_XDG_SURFACE_POINTER, data->shell_surface.xdg.surface);
if (data->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP) { if (data->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP) {
SDL_Window *parent = window->parent; SDL_Window *parent = window->parent;
@ -1533,13 +1533,13 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
} }
} }
SDL_SetProperty(props, "SDL.window.wayland.xdg_popup", data->shell_surface.xdg.roleobj.popup.popup); SDL_SetProperty(props, SDL_PROPERTY_WINDOW_WAYLAND_XDG_POPUP_POINTER, data->shell_surface.xdg.roleobj.popup.popup);
SDL_SetProperty(props, "SDL.window.wayland.xdg_positioner", data->shell_surface.xdg.roleobj.popup.positioner); SDL_SetProperty(props, SDL_PROPERTY_WINDOW_WAYLAND_XDG_POSITIONER_POINTER, data->shell_surface.xdg.roleobj.popup.positioner);
} else { } else {
data->shell_surface.xdg.roleobj.toplevel = xdg_surface_get_toplevel(data->shell_surface.xdg.surface); data->shell_surface.xdg.roleobj.toplevel = xdg_surface_get_toplevel(data->shell_surface.xdg.surface);
xdg_toplevel_set_app_id(data->shell_surface.xdg.roleobj.toplevel, data->app_id); xdg_toplevel_set_app_id(data->shell_surface.xdg.roleobj.toplevel, data->app_id);
xdg_toplevel_add_listener(data->shell_surface.xdg.roleobj.toplevel, &toplevel_listener_xdg, data); xdg_toplevel_add_listener(data->shell_surface.xdg.roleobj.toplevel, &toplevel_listener_xdg, data);
SDL_SetProperty(props, "SDL.window.wayland.xdg_toplevel", data->shell_surface.xdg.roleobj.toplevel); SDL_SetProperty(props, SDL_PROPERTY_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER, data->shell_surface.xdg.roleobj.toplevel);
} }
} }
@ -1675,8 +1675,8 @@ static void Wayland_ReleasePopup(SDL_VideoDevice *_this, SDL_Window *popup)
popupdata->shell_surface.xdg.roleobj.popup.positioner = NULL; popupdata->shell_surface.xdg.roleobj.popup.positioner = NULL;
SDL_PropertiesID props = SDL_GetWindowProperties(popup); SDL_PropertiesID props = SDL_GetWindowProperties(popup);
SDL_SetProperty(props, "SDL.window.wayland.xdg_popup", NULL); SDL_SetProperty(props, SDL_PROPERTY_WINDOW_WAYLAND_XDG_POPUP_POINTER, NULL);
SDL_SetProperty(props, "SDL.window.wayland.xdg_positioner", NULL); SDL_SetProperty(props, SDL_PROPERTY_WINDOW_WAYLAND_XDG_POSITIONER_POINTER, NULL);
} }
void Wayland_HideWindow(SDL_VideoDevice *_this, SDL_Window *window) void Wayland_HideWindow(SDL_VideoDevice *_this, SDL_Window *window)
@ -1711,8 +1711,8 @@ void Wayland_HideWindow(SDL_VideoDevice *_this, SDL_Window *window)
libdecor_frame_unref(wind->shell_surface.libdecor.frame); libdecor_frame_unref(wind->shell_surface.libdecor.frame);
wind->shell_surface.libdecor.frame = NULL; wind->shell_surface.libdecor.frame = NULL;
SDL_SetProperty(props, "SDL.window.wayland.xdg_surface", NULL); SDL_SetProperty(props, SDL_PROPERTY_WINDOW_WAYLAND_XDG_SURFACE_POINTER, NULL);
SDL_SetProperty(props, "SDL.window.wayland.xdg_toplevel", NULL); SDL_SetProperty(props, SDL_PROPERTY_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER, NULL);
} }
} else } else
#endif #endif
@ -1722,12 +1722,12 @@ void Wayland_HideWindow(SDL_VideoDevice *_this, SDL_Window *window)
} else if (wind->shell_surface.xdg.roleobj.toplevel) { } else if (wind->shell_surface.xdg.roleobj.toplevel) {
xdg_toplevel_destroy(wind->shell_surface.xdg.roleobj.toplevel); xdg_toplevel_destroy(wind->shell_surface.xdg.roleobj.toplevel);
wind->shell_surface.xdg.roleobj.toplevel = NULL; wind->shell_surface.xdg.roleobj.toplevel = NULL;
SDL_SetProperty(props, "SDL.window.wayland.xdg_toplevel", NULL); SDL_SetProperty(props, SDL_PROPERTY_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER, NULL);
} }
if (wind->shell_surface.xdg.surface) { if (wind->shell_surface.xdg.surface) {
xdg_surface_destroy(wind->shell_surface.xdg.surface); xdg_surface_destroy(wind->shell_surface.xdg.surface);
wind->shell_surface.xdg.surface = NULL; wind->shell_surface.xdg.surface = NULL;
SDL_SetProperty(props, "SDL.window.wayland.xdg_surface", NULL); SDL_SetProperty(props, SDL_PROPERTY_WINDOW_WAYLAND_XDG_SURFACE_POINTER, NULL);
} }
} }
@ -2158,10 +2158,10 @@ int Wayland_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Propert
} /* All other cases will be WAYLAND_SURFACE_UNKNOWN */ } /* All other cases will be WAYLAND_SURFACE_UNKNOWN */
SDL_PropertiesID props = SDL_GetWindowProperties(window); SDL_PropertiesID props = SDL_GetWindowProperties(window);
SDL_SetProperty(props, "SDL.window.wayland.registry", c->registry); SDL_SetProperty(props, SDL_PROPERTY_WINDOW_WAYLAND_REGISTRY_POINTER, c->registry);
SDL_SetProperty(props, "SDL.window.wayland.display", data->waylandData->display); SDL_SetProperty(props, SDL_PROPERTY_WINDOW_WAYLAND_DISPLAY_POINTER, data->waylandData->display);
SDL_SetProperty(props, "SDL.window.wayland.surface", data->surface); SDL_SetProperty(props, SDL_PROPERTY_WINDOW_WAYLAND_SURFACE_POINTER, data->surface);
SDL_SetProperty(props, "SDL.window.wayland.egl_window", data->egl_window); SDL_SetProperty(props, SDL_PROPERTY_WINDOW_WAYLAND_EGL_WINDOW_POINTER, data->egl_window);
data->hit_test_result = SDL_HITTEST_NORMAL; data->hit_test_result = SDL_HITTEST_NORMAL;

View file

@ -476,9 +476,9 @@ static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, HWND hwnd
} }
SDL_PropertiesID props = SDL_GetWindowProperties(window); SDL_PropertiesID props = SDL_GetWindowProperties(window);
SDL_SetProperty(props, "SDL.window.win32.hwnd", data->hwnd); SDL_SetProperty(props, SDL_PROPERTY_WINDOW_WIN32_HWND_POINTER, data->hwnd);
SDL_SetProperty(props, "SDL.window.win32.hdc", data->hdc); SDL_SetProperty(props, SDL_PROPERTY_WINDOW_WIN32_HDC_POINTER, data->hdc);
SDL_SetProperty(props, "SDL.window.win32.instance", data->hinstance); SDL_SetProperty(props, SDL_PROPERTY_WINDOW_WIN32_INSTANCE_POINTER, data->hinstance);
/* All done! */ /* All done! */
return 0; return 0;
@ -578,7 +578,7 @@ static void WIN_SetKeyboardFocus(SDL_Window *window)
int WIN_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID create_props) int WIN_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID create_props)
{ {
HWND hwnd = (HWND)SDL_GetProperty(create_props, "win32.hwnd", SDL_GetProperty(create_props, "sdl2-compat.external_window", NULL)); HWND hwnd = (HWND)SDL_GetProperty(create_props, SDL_PROPERTY_WINDOW_CREATE_WIN32_HWND_POINTER, SDL_GetProperty(create_props, "sdl2-compat.external_window", NULL));
HWND parent = NULL; HWND parent = NULL;
if (hwnd) { if (hwnd) {
window->flags |= SDL_WINDOW_EXTERNAL; window->flags |= SDL_WINDOW_EXTERNAL;
@ -655,7 +655,7 @@ int WIN_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesI
} }
} }
HWND share_hwnd = (HWND)SDL_GetProperty(create_props, "win32.pixel_format_hwnd", NULL); HWND share_hwnd = (HWND)SDL_GetProperty(create_props, SDL_PROPERTY_WINDOW_CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER, NULL);
if (share_hwnd) { if (share_hwnd) {
HDC hdc = GetDC(share_hwnd); HDC hdc = GetDC(share_hwnd);
int pixel_format = GetPixelFormat(hdc); int pixel_format = GetPixelFormat(hdc);

View file

@ -606,7 +606,7 @@ int WINRT_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Propertie
data->appView = ApplicationView::GetForCurrentView(); data->appView = ApplicationView::GetForCurrentView();
#endif #endif
} }
SDL_SetProperty(SDL_GetWindowProperties(window), "SDL.window.winrt.window", reinterpret_cast<IInspectable *>(data->coreWindow.Get())); SDL_SetProperty(SDL_GetWindowProperties(window), SDL_PROPERTY_WINDOW_WINRT_WINDOW_POINTER, reinterpret_cast<IInspectable *>(data->coreWindow.Get()));
/* Make note of the requested window flags, before they start getting changed. */ /* Make note of the requested window flags, before they start getting changed. */
const Uint32 requestedFlags = window->flags; const Uint32 requestedFlags = window->flags;

View file

@ -392,9 +392,9 @@ static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, Window w)
SDL_PropertiesID props = SDL_GetWindowProperties(window); SDL_PropertiesID props = SDL_GetWindowProperties(window);
int screen = (displaydata ? displaydata->screen : 0); int screen = (displaydata ? displaydata->screen : 0);
SDL_SetProperty(props, "SDL.window.x11.display", data->videodata->display); SDL_SetProperty(props, SDL_PROPERTY_WINDOW_X11_DISPLAY_POINTER, data->videodata->display);
SDL_SetNumberProperty(props, "SDL.window.x11.screen", screen); SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_X11_SCREEN_NUMBER, screen);
SDL_SetNumberProperty(props, "SDL.window.x11.window", data->xwindow); SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_X11_WINDOW_NUMBER, data->xwindow);
/* All done! */ /* All done! */
window->driverdata = data; window->driverdata = data;
@ -433,7 +433,7 @@ static void SetWindowBordered(Display *display, int screen, Window window, SDL_b
int X11_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID create_props) int X11_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID create_props)
{ {
Window w = (Window)SDL_GetNumberProperty(create_props, "x11.window", Window w = (Window)SDL_GetNumberProperty(create_props, SDL_PROPERTY_WINDOW_CREATE_X11_WINDOW_NUMBER,
(Window)SDL_GetProperty(create_props, "sdl2-compat.external_window", NULL)); (Window)SDL_GetProperty(create_props, "sdl2-compat.external_window", NULL));
if (w) { if (w) {
window->flags |= SDL_WINDOW_EXTERNAL; window->flags |= SDL_WINDOW_EXTERNAL;

View file

@ -1764,12 +1764,12 @@ static int video_setWindowCenteredOnDisplay(void *arg)
expectedY = (expectedDisplayRect.y + ((expectedDisplayRect.h - h) / 2)); expectedY = (expectedDisplayRect.y + ((expectedDisplayRect.h - h) / 2));
props = SDL_CreateProperties(); props = SDL_CreateProperties();
SDL_SetStringProperty(props, "title", title); SDL_SetStringProperty(props, SDL_PROPERTY_WINDOW_CREATE_TITLE_STRING, title);
SDL_SetNumberProperty(props, "x", x); SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_X_NUMBER, x);
SDL_SetNumberProperty(props, "w", y); SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_Y_NUMBER, y);
SDL_SetNumberProperty(props, "width", w); SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_WIDTH_NUMBER, w);
SDL_SetNumberProperty(props, "height", h); SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_HEIGHT_NUMBER, h);
SDL_SetBooleanProperty(props, "borderless", SDL_TRUE); SDL_SetBooleanProperty(props, SDL_PROPERTY_WINDOW_CREATE_BORDERLESS_BOOLEAN, SDL_TRUE);
window = SDL_CreateWindowWithProperties(props); window = SDL_CreateWindowWithProperties(props);
SDL_DestroyProperties(props); SDL_DestroyProperties(props);
SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,%d,%d,SHOWN)", x, y, w, h); SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,%d,%d,SHOWN)", x, y, w, h);
@ -1961,7 +1961,7 @@ static int video_getSetWindowState(void *arg)
SDL_GetWindowSize(window, &windowedW, &windowedH); SDL_GetWindowSize(window, &windowedW, &windowedH);
SDLTest_AssertPass("SDL_GetWindowSize()"); SDLTest_AssertPass("SDL_GetWindowSize()");
SDL_GetWindowPosition(window, &windowedX, &windowedY); SDL_GetWindowPosition(window, &windowedX, &windowedY);
SDLTest_AssertPass("SDL_GetWindowPosition()"); SDLTest_AssertPass("SDL_GetWindowPosition()");

View file

@ -145,7 +145,7 @@ static SDL_bool CreateWindowAndRenderer(Uint32 window_flags, const char *driver)
#endif #endif
#ifdef __WIN32__ #ifdef __WIN32__
d3d11_device = (ID3D11Device *)SDL_GetProperty(SDL_GetRendererProperties(renderer), "SDL.renderer.d3d11.device", NULL); d3d11_device = (ID3D11Device *)SDL_GetProperty(SDL_GetRendererProperties(renderer), SDL_PROPERTY_RENDERER_D3D11_DEVICE_POINTER, NULL);
if (d3d11_device) { if (d3d11_device) {
ID3D11Device_AddRef(d3d11_device); ID3D11Device_AddRef(d3d11_device);
ID3D11Device_GetImmediateContext(d3d11_device, &d3d11_context); ID3D11Device_GetImmediateContext(d3d11_device, &d3d11_context);
@ -622,7 +622,7 @@ static SDL_bool GetTextureForD3D11Frame(AVFrame *frame, SDL_Texture **texture)
} }
} }
ID3D11Resource *dx11_resource = SDL_GetProperty(SDL_GetTextureProperties(*texture), "SDL.texture.d3d11.texture", NULL); ID3D11Resource *dx11_resource = SDL_GetProperty(SDL_GetTextureProperties(*texture), SDL_PROPERTY_TEXTURE_D3D11_TEXTURE_POINTER, NULL);
if (!dx11_resource) { if (!dx11_resource) {
SDL_SetError("Couldn't get texture ID3D11Resource interface"); SDL_SetError("Couldn't get texture ID3D11Resource interface");
return SDL_FALSE; return SDL_FALSE;