diff --git a/docs/README-migration.md b/docs/README-migration.md index c8b0b9274b..20c7216841 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -1303,25 +1303,25 @@ The information previously available in SDL_GetWindowWMInfo() is now available a becomes: ```c #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) { ... } #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) { ... } #elif defined(__LINUX__) if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "x11") == 0) { - Display *xdisplay = (Display *)SDL_GetProperty(SDL_GetWindowProperties(window), "SDL.window.x11.display", NULL); - Window xwindow = (Window)SDL_GetNumberProperty(SDL_GetWindowProperties(window), "SDL.window.x11.window", 0); + Display *xdisplay = (Display *)SDL_GetProperty(SDL_GetWindowProperties(window), SDL_PROPERTY_WINDOW_X11_DISPLAY_POINTER, NULL); + Window xwindow = (Window)SDL_GetNumberProperty(SDL_GetWindowProperties(window), SDL_PROPERTY_WINDOW_X11_WINDOW_NUMBER, 0); if (xdisplay && xwindow) { ... } } 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_surface *surface = (struct wl_surface *)SDL_GetProperty(SDL_GetWindowProperties(window), "SDL.window.wayland.surface", 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_PROPERTY_WINDOW_WAYLAND_SURFACE_POINTER, NULL); 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. ```c SDL_PropertiesID props = SDL_CreateProperties(); - SDL_SetStringProperty(props, "title", title); - SDL_SetNumberProperty(props, "x", x); - SDL_SetNumberProperty(props, "y", y); - SDL_SetNumberProperty(props, "width", width); - SDL_SetNumberProperty(props, "height", height); + SDL_SetStringProperty(props, SDL_PROPERTY_WINDOW_CREATE_TITLE_STRING, title); + SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_X_NUMBER, x); + SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_Y_NUMBER, y); + SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_WIDTH_NUMBER, width); + SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_HEIGHT_NUMBER, height); SDL_SetNumberProperty(props, "flags", flags); pWindow = SDL_CreateWindowWithProperties(props); SDL_DestroyProperties(props); diff --git a/include/SDL3/SDL_render.h b/include/SDL3/SDL_render.h index 3923350968..07bd031237 100644 --- a/include/SDL3/SDL_render.h +++ b/include/SDL3/SDL_render.h @@ -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. * * These are the supported properties: - * - * - "window" (pointer) - the window where rendering is displayed - * - "surface" (pointer) - the surface where rendering is displayed, if you - * want a software renderer without a window - * - "name" (string) - the name of the rendering driver to use, if a specific - * one is desired - * - "present_vsync" (boolean) - true if you want present synchronized with - * the refresh rate - * + */ +#define SDL_PROPERTY_RENDERER_CREATE_WINDOW_POINTER "window" /* the window where rendering is displayed */ +#define SDL_PROPERTY_RENDERER_CREATE_SURFACE_POINTER "surface" /* the surface where rendering is displayed, if you 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 */ +#define SDL_PROPERTY_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN "present_vsync" /* true if you want present synchronized with the refresh rate */ +/* * \param props the properties to use * \returns a valid rendering context or NULL if there was an error; call * 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. * * The following read-only properties are provided by SDL: - * - * ``` - * "SDL.renderer.d3d9.device" (pointer) - the IDirect3DDevice9 associated with the renderer - * "SDL.renderer.d3d11.device" (pointer) - the ID3D11Device associated with the renderer - * "SDL.renderer.d3d12.device" (pointer) - the ID3D12Device associated with the renderer - * "SDL.renderer.d3d12.command_queue" (pointer) - the ID3D12CommandQueue associated with the renderer - * ``` - * + */ +#define SDL_PROPERTY_RENDERER_D3D9_DEVICE_POINTER "SDL.renderer.d3d9.device" /* the IDirect3DDevice9 associated with the renderer */ +#define SDL_PROPERTY_RENDERER_D3D11_DEVICE_POINTER "SDL.renderer.d3d11.device" /* the ID3D11Device associated with the renderer */ +#define SDL_PROPERTY_RENDERER_D3D12_DEVICE_POINTER "SDL.renderer.d3d12.device" /* 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 */ +/* * \param renderer the rendering context * \returns a valid property ID on success or 0 on failure; call * 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. * * These are the supported properties: - * - * - "format" (number) - one of the enumerated values in SDL_PixelFormatEnum, - * defaults to the best RGBA format for the renderer - * - "access" (number) - one of the enumerated values in SDL_TextureAccess, - * defaults to SDL_TEXTUREACCESS_STATIC - * - "width" (number) - the width of the texture in pixels, required - * - "height" (number) - the height of the texture in pixels, required - * + */ +#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 */ +#define SDL_PROPERTY_TEXTURE_CREATE_ACCESS_NUMBER "access" /* one of the enumerated values in SDL_TextureAccess, defaults to SDL_TEXTUREACCESS_STATIC */ +#define SDL_PROPERTY_TEXTURE_CREATE_WIDTH_NUMBER "width" /* the width of the texture in pixels, required */ +#define SDL_PROPERTY_TEXTURE_CREATE_HEIGHT_NUMBER "height" /* the height of the texture in pixels, required */ +/* * With the direct3d11 renderer: - * - * - "d3d11.texture" (pointer) - the ID3D11Texture2D associated with the - * texture, if you want to wrap an existing texture. - * - "d3d11.texture_u" (pointer) - the ID3D11Texture2D associated with the U - * 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. - * + */ +#define SDL_PROPERTY_TEXTURE_CREATE_D3D11_TEXTURE_POINTER "d3d11.texture" /* the ID3D11Texture2D associated with the 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. */ +#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. */ +/* * With the direct3d12 renderer: - * - * - "d3d12.texture" (pointer) - the ID3D12Resource associated with the - * texture, if you want to wrap an existing texture. - * - "d3d12.texture_u" (pointer) - the ID3D12Resource associated with the U - * 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. - * + */ +#define SDL_PROPERTY_TEXTURE_CREATE_D3D12_TEXTURE_POINTER "d3d12.texture" /* the ID3D12Resource associated with the 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. */ +#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. */ +/* * With the opengl renderer: - * - * - "opengl.texture" (number) - the GLuint texture associated with the - * texture, if you want to wrap an existing texture. - * - "opengl.texture_uv" (number) - the GLuint texture associated with the UV - * plane of an NV12 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. - * + */ +#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. */ +#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. */ +#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. */ +#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. */ +/* * With the opengles2 renderer: - * - * - "opengles2.texture" (number) - 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 - * UV plane of an NV12 texture, if you want to wrap an existing texture. - * - "opengles2.texture_u" (number) - the GLuint texture associated with the U - * 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. - * + */ +#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. */ +#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. */ +#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. */ +#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. */ +#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. */ +/* * \param renderer the rendering context * \param props the properties to use * \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. * * The following read-only properties are provided by SDL: - * + */ +/* * With the direct3d11 renderer: - * - * - "SDL.texture.d3d11.texture" (pointer) - the ID3D11Texture2D associated - * with the texture - * - "SDL.texture.d3d11.texture_u" (pointer) - the ID3D11Texture2D associated - * 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 - * + */ +#define SDL_PROPERTY_TEXTURE_D3D11_TEXTURE_POINTER "SDL.texture.d3d11.texture" /* the ID3D11Texture2D associated 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 */ +#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 direct3d12 renderer: - * - * - "SDL.texture.d3d12.texture" (pointer) - the ID3D12Resource associated - * with the texture - * - "SDL.texture.d3d12.texture_u" (pointer) - the ID3D12Resource associated - * 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 - * + */ +#define SDL_PROPERTY_TEXTURE_D3D12_TEXTURE_POINTER "SDL.texture.d3d12.texture" /* the ID3D12Resource associated 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 */ +#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 opengl renderer: - * - * - "SDL.texture.opengl.texture" (number) - the GLuint texture associated - * with the texture - * - "SDL.texture.opengl.texture_uv" (number) - the GLuint texture associated - * with the UV plane of an NV12 texture - * - "SDL.texture.opengl.texture_u" (number) - the GLuint texture associated - * with the U plane of a YUV texture - * - "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) - * + */ +#define SDL_PROPERTY_TEXTURE_OPENGL_TEXTURE_NUMBER "SDL.texture.opengl.texture" /* the GLuint texture associated 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 */ +#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 */ +#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 */ +#define SDL_PROPERTY_TEXTURE_OPENGL_TEX_W_FLOAT "SDL.texture.opengl.tex_w" /* the texture coordinate width of the texture (0.0 - 1.0) */ +#define SDL_PROPERTY_TEXTURE_OPENGL_TEX_H_FLOAT "SDL.texture.opengl.tex_h" /* the texture coordinate height of the texture (0.0 - 1.0) */ +/* * With the opengles2 renderer: - * - * - "SDL.texture.opengles2.texture" (number) - the GLuint texture associated - * with the texture - * - "SDL.texture.opengles2.texture_uv" (number) - the GLuint texture - * associated with the UV plane of an NV12 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 + */ +#define SDL_PROPERTY_TEXTURE_OPENGLES2_TEXTURE_NUMBER "SDL.texture.opengles2.texture" /* the GLuint texture associated 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 */ +#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 */ +#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 */ +/* * associated with the V plane of a YUV texture - * * \param texture the texture to query * \returns a valid property ID on success or 0 on failure; call * SDL_GetError() for more information. diff --git a/include/SDL3/SDL_video.h b/include/SDL3/SDL_video.h index d20bd0ee9a..c83762f10b 100644 --- a/include/SDL3/SDL_video.h +++ b/include/SDL3/SDL_video.h @@ -808,63 +808,46 @@ extern DECLSPEC SDL_Window *SDLCALL SDL_CreatePopupWindow(SDL_Window *parent, in * Create a window with the specified properties. * * These are the supported properties: - * - * - "always-on-top" (boolean) - true if the window should be always on top - * - "borderless" (boolean) - true if the window has no window decoration - * - "focusable" (boolean) - true if the window should accept keyboard input - * (defaults true) - * - "fullscreen" (boolean) - true if the window should start in fullscreen - * mode at desktop resolution - * - "height" (number) - the height of the window - * - "hidden" (boolean) - true if the window should start hidden - * - "high-pixel-density" (boolean) - true if the window uses a high pixel - * density buffer if possible - * - "maximized" (boolean) - true if the window should start maximized - * - "menu" (boolean) - true if the window is a popup menu - * - "metal" (string) - true if the window will be used with Metal rendering - * - "minimized" (boolean) - true if the window should start minimized - * - "mouse-grabbed" (boolean) - true if the window starts with grabbed mouse - * focus - * - "opengl" (boolean) - true if the window will be used with OpenGL - * rendering - * - "parent" (pointer) - an SDL_Window that will be the parent of this - * window, required for windows with the "toolip" and "menu" properties - * - "resizable" (boolean) - true if the window should be resizable - * - "title" (string) - the title of the window, in UTF-8 encoding - * - "transparent" (string) - true if the window show transparent in the areas - * with alpha of 0 - * - "tooltip" (boolean) - true if the window is a tooltip - * - "utility" (boolean) - true if the window is a utility window, not showing - * in the task bar and window list - * - "vulkan" (string) - true if the window will be used with Vulkan rendering - * - "width" (number) - the width of the window - * - "x" (number) - 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. - * - "y" (number) - 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. - * - * On macOS: - * - * - "cocoa.window" (pointer) - the (__unsafe_unretained) NSWindow associated - * 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. + */ +#define SDL_PROPERTY_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN "always-on-top" /* true if the window should be always on top */ +#define SDL_PROPERTY_WINDOW_CREATE_BORDERLESS_BOOLEAN "borderless" /* true if the window has no window decoration */ +#define SDL_PROPERTY_WINDOW_CREATE_FOCUSABLE_BOOLEAN "focusable" /* true if the window should accept keyboard input (defaults true) */ +#define SDL_PROPERTY_WINDOW_CREATE_FULLSCREEN_BOOLEAN "fullscreen" /* true if the window should start in fullscreen mode at desktop resolution */ +#define SDL_PROPERTY_WINDOW_CREATE_HEIGHT_NUMBER "height" /* the height of the window */ +#define SDL_PROPERTY_WINDOW_CREATE_HIDDEN_BOOLEAN "hidden" /* true if the window should start hidden */ +#define SDL_PROPERTY_WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN "high-pixel-density" /* true if the window uses a high pixel density buffer if possible */ +#define SDL_PROPERTY_WINDOW_CREATE_MAXIMIZED_BOOLEAN "maximized" /* true if the window should start maximized */ +#define SDL_PROPERTY_WINDOW_CREATE_MENU_BOOLEAN "menu" /* true if the window is a popup menu */ +#define SDL_PROPERTY_WINDOW_CREATE_METAL_BOOLEAN "metal" /* true if the window will be used with Metal rendering */ +#define SDL_PROPERTY_WINDOW_CREATE_MINIMIZED_BOOLEAN "minimized" /* true if the window should start minimized */ +#define SDL_PROPERTY_WINDOW_CREATE_MOUSE_GRABBED_BOOLEAN "mouse-grabbed" /* true if the window starts with grabbed mouse focus */ +#define SDL_PROPERTY_WINDOW_CREATE_OPENGL_BOOLEAN "opengl" /* true if the window will be used with OpenGL rendering */ +#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 */ +#define SDL_PROPERTY_WINDOW_CREATE_RESIZABLE_BOOLEAN "resizable" /* true if the window should be resizable */ +#define SDL_PROPERTY_WINDOW_CREATE_TITLE_STRING "title" /* the title of the window, in UTF-8 encoding */ +#define SDL_PROPERTY_WINDOW_CREATE_TRANSPARENT_BOOLEAN "transparent" /* true if the window show transparent in the areas with alpha of 0 */ +#define SDL_PROPERTY_WINDOW_CREATE_TOOLTIP_BOOLEAN "tooltip" /* true if the window is a tooltip */ +#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 */ +#define SDL_PROPERTY_WINDOW_CREATE_VULKAN_BOOLEAN "vulkan" /* true if the window will be used with Vulkan rendering */ +#define SDL_PROPERTY_WINDOW_CREATE_WIDTH_NUMBER "width" /* the width of the window */ +#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. */ +#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. */ +/* + * These are additional supported properties on macOS: + */ +#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. */ +#define SDL_PROPERTY_WINDOW_CREATE_COCOA_VIEW_POINTER "cocoa.view" /* the (__unsafe_unretained) NSView associated with the window, defaults to [window contentView] */ +/* + * These are additional supported properties on Windows: + */ +#define SDL_PROPERTY_WINDOW_CREATE_WIN32_HWND_POINTER "win32.hwnd" /* the HWND associated with the window, if you want to wrap an existing window. */ +#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 */ +/* + * These are additional supported properties with X11: + */ +#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. */ +/* + * The window is implicitly shown if the "hidden" property is not set. * * Windows with the "tooltip" and "menu" properties are popup windows and have * 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. * * The following read-only properties are provided by SDL: - * + */ +/* * On Android: - * - * ``` - * "SDL.window.android.window" (pointer) - the ANativeWindow associated with the window - * "SDL.window.android.surface" (pointer) - the EGLSurface associated with the window - * ``` - * + */ +#define SDL_PROPERTY_WINDOW_ANDROID_WINDOW_POINTER "SDL.window.android.window" /* the ANativeWindow associated with the window */ +#define SDL_PROPERTY_WINDOW_ANDROID_SURFACE_POINTER "SDL.window.android.surface" /* the EGLSurface associated with the window */ +/* * On iOS: - * - * ``` - * "SDL.window.uikit.window" (pointer) - the (__unsafe_unretained) UIWindow associated with the window - * "SDL.window.uikit.metal_view_tag" (number) - the NSInteger tag assocated with metal views on the window - * ``` - * + */ +#define SDL_PROPERTY_WINDOW_UIKIT_WINDOW_POINTER "SDL.window.uikit.window" /* 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 */ +/* * On KMS/DRM: - * - * ``` - * "SDL.window.kmsdrm.dev_index" (number) - the device index associated with the window (e.g. the X in /dev/dri/cardX) - * "SDL.window.kmsdrm.drm_fd" (number) - the DRM FD associated with the window - * "SDL.window.kmsdrm.gbm_dev" (pointer) - the GBM device associated with the window - * ``` - * + */ +#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) */ +#define SDL_PROPERTY_WINDOW_KMSDRM_DRM_FD_NUMBER "SDL.window.kmsdrm.drm_fd" /* 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 */ +/* * On macOS: - * - * ``` - * "SDL.window.cocoa.window" (pointer) - the (__unsafe_unretained) NSWindow associated with the window - * "SDL.window.cocoa.metal_view_tag" (number) - the NSInteger tag assocated with metal views on the window - * ``` - * + */ +#define SDL_PROPERTY_WINDOW_COCOA_WINDOW_POINTER "SDL.window.cocoa.window" /* 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 */ +/* * On Vivante: - * - * ``` - * "SDL.window.vivante.display" (pointer) - the EGLNativeDisplayType associated with the window - * "SDL.window.vivante.window" (pointer) - the EGLNativeWindowType associated with the window - * "SDL.window.vivante.surface" (pointer) - the EGLSurface associated with the window - * ``` - * + */ +#define SDL_PROPERTY_WINDOW_VIVANTE_DISPLAY_POINTER "SDL.window.vivante.display" /* the EGLNativeDisplayType associated with the window */ +#define SDL_PROPERTY_WINDOW_VIVANTE_WINDOW_POINTER "SDL.window.vivante.window" /* the EGLNativeWindowType associated with the window */ +#define SDL_PROPERTY_WINDOW_VIVANTE_SURFACE_POINTER "SDL.window.vivante.surface" /* the EGLSurface associated with the window */ +/* * On UWP: - * - * ``` - * "SDL.window.winrt.window" (pointer) - the IInspectable CoreWindow associated with the window - * ``` - * + */ +#define SDL_PROPERTY_WINDOW_WINRT_WINDOW_POINTER "SDL.window.winrt.window" /* the IInspectable CoreWindow associated with the window */ +/* * On Windows: - * - * ``` - * "SDL.window.win32.hwnd" (pointer) - the HWND associated with the window - * "SDL.window.win32.hdc" (pointer) - the HDC associated with the window - * "SDL.window.win32.instance" (pointer) - the HINSTANCE associated with the window - * ``` - * + */ +#define SDL_PROPERTY_WINDOW_WIN32_HWND_POINTER "SDL.window.win32.hwnd" /* the HWND associated with the window */ +#define SDL_PROPERTY_WINDOW_WIN32_HDC_POINTER "SDL.window.win32.hdc" /* the HDC associated with the window */ +#define SDL_PROPERTY_WINDOW_WIN32_INSTANCE_POINTER "SDL.window.win32.instance" /* the HINSTANCE associated with the window */ +/* * 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 * show/hide calls. They will be null if the window is hidden and must be * 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: - * - * ``` - * "SDL.window.x11.display" (pointer) - the X11 Display associated with the window - * "SDL.window.x11.screen" (number) - the screen number associated with the window - * "SDL.window.x11.window" (number) - the X11 Window associated with the window - * ``` - * + */ +#define SDL_PROPERTY_WINDOW_X11_DISPLAY_POINTER "SDL.window.x11.display" /* 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 */ +#define SDL_PROPERTY_WINDOW_X11_WINDOW_NUMBER "SDL.window.x11.window" /* the X11 Window associated with the window */ +/* * \param window the window to query * \returns a valid property ID on success or 0 on failure; call * SDL_GetError() for more information. diff --git a/src/core/linux/SDL_fcitx.c b/src/core/linux/SDL_fcitx.c index af16896079..a3de3c6886 100644 --- a/src/core/linux/SDL_fcitx.c +++ b/src/core/linux/SDL_fcitx.c @@ -428,9 +428,9 @@ void SDL_Fcitx_UpdateTextRect(const SDL_Rect *rect) #ifdef SDL_VIDEO_DRIVER_X11 { SDL_PropertiesID props = SDL_GetWindowProperties(focused_win); - Display *x_disp = (Display *)SDL_GetProperty(props, "SDL.window.x11.display", NULL); - int x_screen = SDL_GetNumberProperty(props, "SDL.window.x11.screen", 0); - Window x_win = SDL_GetNumberProperty(props, "SDL.window.x11.window", 0); + Display *x_disp = (Display *)SDL_GetProperty(props, SDL_PROPERTY_WINDOW_X11_DISPLAY_POINTER, NULL); + int x_screen = SDL_GetNumberProperty(props, SDL_PROPERTY_WINDOW_X11_SCREEN_NUMBER, 0); + Window x_win = SDL_GetNumberProperty(props, SDL_PROPERTY_WINDOW_X11_WINDOW_NUMBER, 0); Window unused; if (x_disp && x_win) { X11_XTranslateCoordinates(x_disp, x_win, RootWindow(x_disp, x_screen), 0, 0, &x, &y, &unused); diff --git a/src/core/linux/SDL_ibus.c b/src/core/linux/SDL_ibus.c index 6313f537ce..a919735e7e 100644 --- a/src/core/linux/SDL_ibus.c +++ b/src/core/linux/SDL_ibus.c @@ -705,9 +705,9 @@ void SDL_IBus_UpdateTextRect(const SDL_Rect *rect) #ifdef SDL_VIDEO_DRIVER_X11 { SDL_PropertiesID props = SDL_GetWindowProperties(focused_win); - Display *x_disp = (Display *)SDL_GetProperty(props, "SDL.window.x11.display", NULL); - int x_screen = SDL_GetNumberProperty(props, "SDL.window.x11.screen", 0); - Window x_win = SDL_GetNumberProperty(props, "SDL.window.x11.window", 0); + Display *x_disp = (Display *)SDL_GetProperty(props, SDL_PROPERTY_WINDOW_X11_DISPLAY_POINTER, NULL); + int x_screen = SDL_GetNumberProperty(props, SDL_PROPERTY_WINDOW_X11_SCREEN_NUMBER, 0); + Window x_win = SDL_GetNumberProperty(props, SDL_PROPERTY_WINDOW_X11_WINDOW_NUMBER, 0); Window unused; if (x_disp && x_win) { diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index 45ed877be0..6c2a351202 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -805,9 +805,9 @@ static void SDL_CalculateSimulatedVSyncInterval(SDL_Renderer *renderer, SDL_Wind SDL_Renderer *SDL_CreateRendererWithProperties(SDL_PropertiesID props) { #ifndef SDL_RENDER_DISABLED - SDL_Window *window = SDL_GetProperty(props, "window", NULL); - SDL_Surface *surface = SDL_GetProperty(props, "surface", NULL); - const char *name = SDL_GetStringProperty(props, "name", NULL); + SDL_Window *window = SDL_GetProperty(props, SDL_PROPERTY_RENDERER_CREATE_WINDOW_POINTER, NULL); + SDL_Surface *surface = SDL_GetProperty(props, SDL_PROPERTY_RENDERER_CREATE_SURFACE_POINTER, NULL); + const char *name = SDL_GetStringProperty(props, SDL_PROPERTY_RENDERER_CREATE_NAME_STRING, NULL); SDL_Renderer *renderer = NULL; const int n = SDL_GetNumRenderDrivers(); const char *hint; @@ -838,7 +838,7 @@ SDL_Renderer *SDL_CreateRendererWithProperties(SDL_PropertiesID props) hint = SDL_GetHint(SDL_HINT_RENDER_VSYNC); 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) { @@ -871,7 +871,7 @@ SDL_Renderer *SDL_CreateRendererWithProperties(SDL_PropertiesID props) 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; 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_PropertiesID props = SDL_CreateProperties(); - SDL_SetProperty(props, "window", window); + SDL_SetProperty(props, SDL_PROPERTY_RENDERER_CREATE_WINDOW_POINTER, window); if (flags & SDL_RENDERER_SOFTWARE) { - SDL_SetStringProperty(props, "name", "software"); + SDL_SetStringProperty(props, SDL_PROPERTY_RENDERER_CREATE_NAME_STRING, "software"); } else { - SDL_SetStringProperty(props, "name", name); + SDL_SetStringProperty(props, SDL_PROPERTY_RENDERER_CREATE_NAME_STRING, name); } 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); 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 *texture; - Uint32 format = (Uint32)SDL_GetNumberProperty(props, "format", SDL_PIXELFORMAT_UNKNOWN); - int access = (int)SDL_GetNumberProperty(props, "access", SDL_TEXTUREACCESS_STATIC); - int w = (int)SDL_GetNumberProperty(props, "width", 0); - int h = (int)SDL_GetNumberProperty(props, "height", 0); + Uint32 format = (Uint32)SDL_GetNumberProperty(props, SDL_PROPERTY_TEXTURE_CREATE_FORMAT_NUMBER, SDL_PIXELFORMAT_UNKNOWN); + int access = (int)SDL_GetNumberProperty(props, SDL_PROPERTY_TEXTURE_CREATE_ACCESS_NUMBER, SDL_TEXTUREACCESS_STATIC); + int w = (int)SDL_GetNumberProperty(props, SDL_PROPERTY_TEXTURE_CREATE_WIDTH_NUMBER, 0); + int h = (int)SDL_GetNumberProperty(props, SDL_PROPERTY_TEXTURE_CREATE_HEIGHT_NUMBER, 0); SDL_bool texture_is_fourcc_and_target; CHECK_RENDERER_MAGIC(renderer, NULL); @@ -1244,10 +1244,10 @@ SDL_Texture *SDL_CreateTexture(SDL_Renderer *renderer, Uint32 format, int access { SDL_Texture *texture; SDL_PropertiesID props = SDL_CreateProperties(); - SDL_SetNumberProperty(props, "format", format); - SDL_SetNumberProperty(props, "access", access); - SDL_SetNumberProperty(props, "width", w); - SDL_SetNumberProperty(props, "height", h); + SDL_SetNumberProperty(props, SDL_PROPERTY_TEXTURE_CREATE_FORMAT_NUMBER, format); + SDL_SetNumberProperty(props, SDL_PROPERTY_TEXTURE_CREATE_ACCESS_NUMBER, access); + SDL_SetNumberProperty(props, SDL_PROPERTY_TEXTURE_CREATE_WIDTH_NUMBER, w); + SDL_SetNumberProperty(props, SDL_PROPERTY_TEXTURE_CREATE_HEIGHT_NUMBER, h); texture = SDL_CreateTextureWithProperties(renderer, props); SDL_DestroyProperties(props); return texture; diff --git a/src/render/direct3d/SDL_render_d3d.c b/src/render/direct3d/SDL_render_d3d.c index 1e15ae8f2c..8c5ef45743 100644 --- a/src/render/direct3d/SDL_render_d3d.c +++ b/src/render/direct3d/SDL_render_d3d.c @@ -1610,7 +1610,7 @@ SDL_Renderer *D3D_CreateRenderer(SDL_Window *window, SDL_PropertiesID create_pro } 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.BackBufferHeight = h; pparams.BackBufferCount = 1; @@ -1625,7 +1625,7 @@ SDL_Renderer *D3D_CreateRenderer(SDL_Window *window, SDL_PropertiesID create_pro pparams.BackBufferFormat = D3DFMT_UNKNOWN; 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; } else { pparams.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; @@ -1709,7 +1709,7 @@ SDL_Renderer *D3D_CreateRenderer(SDL_Window *window, SDL_PropertiesID create_pro } #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; } diff --git a/src/render/direct3d11/SDL_render_d3d11.c b/src/render/direct3d11/SDL_render_d3d11.c index 05052be568..007f833c36 100644 --- a/src/render/direct3d11/SDL_render_d3d11.c +++ b/src/render/direct3d11/SDL_render_d3d11.c @@ -665,7 +665,7 @@ static HRESULT D3D11_CreateDeviceResources(SDL_Renderer *renderer) ID3D11DeviceContext_VSSetShader(data->d3dContext, data->vertexShader, NULL, 0); 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: SAFE_RELEASE(d3dDevice); @@ -829,7 +829,7 @@ static HRESULT D3D11_CreateSwapChain(SDL_Renderer *renderer, int w, int h) #endif } else { #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, (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); } } - 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 (texture->format == SDL_PIXELFORMAT_YV12 || 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); } } - 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) { 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); } } - 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 || 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; #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->SetVSync = D3D11_SetVSync; diff --git a/src/render/direct3d11/SDL_render_winrt.cpp b/src/render/direct3d11/SDL_render_winrt.cpp index 6c5bec8e64..0378ee280e 100644 --- a/src/render/direct3d11/SDL_render_winrt.cpp +++ b/src/render/direct3d11/SDL_render_winrt.cpp @@ -44,7 +44,7 @@ using namespace Windows::Graphics::Display; extern "C" void * 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; if (!window || FAILED(window->QueryInterface(&coreWindow))) { return NULL; diff --git a/src/render/direct3d12/SDL_render_d3d12.c b/src/render/direct3d12/SDL_render_d3d12.c index 4c590eac75..1f5dafd386 100644 --- a/src/render/direct3d12/SDL_render_d3d12.c +++ b/src/render/direct3d12/SDL_render_d3d12.c @@ -324,8 +324,8 @@ static void D3D12_ReleaseAll(SDL_Renderer *renderer) SDL_Texture *texture = NULL; SDL_PropertiesID props = SDL_GetRendererProperties(renderer); - SDL_SetProperty(props, "SDL.renderer.d3d12.device", NULL); - SDL_SetProperty(props, "SDL.renderer.d3d12.command_queue", NULL); + SDL_SetProperty(props, SDL_PROPERTY_RENDERER_D3D12_DEVICE_POINTER, NULL); + SDL_SetProperty(props, SDL_PROPERTY_RENDERER_D3D12_COMMAND_QUEUE_POINTER, NULL); /* Release all textures */ for (texture = renderer->textures; texture; texture = texture->next) { @@ -1074,8 +1074,8 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer) data->srvPoolHead = &data->srvPoolNodes[0]; SDL_PropertiesID props = SDL_GetRendererProperties(renderer); - SDL_SetProperty(props, "SDL.renderer.d3d12.device", data->d3dDevice); - SDL_SetProperty(props, "SDL.renderer.d3d12.command_queue", data->commandQueue); + SDL_SetProperty(props, SDL_PROPERTY_RENDERER_D3D12_DEVICE_POINTER, data->d3dDevice); + SDL_SetProperty(props, SDL_PROPERTY_RENDERER_D3D12_COMMAND_QUEUE_POINTER, data->commandQueue); done: 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 */ 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, (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; - 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 (texture->format == SDL_PIXELFORMAT_YV12 || 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; - 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) { return -1; @@ -1553,7 +1553,7 @@ static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL } } 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 || @@ -3027,7 +3027,7 @@ SDL_Renderer *D3D12_CreateRenderer(SDL_Window *window, SDL_PropertiesID create_p renderer->driverdata = data; 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->SetVSync = D3D12_SetVSync; diff --git a/src/render/metal/SDL_render_metal.m b/src/render/metal/SDL_render_metal.m index 2b631540b2..b471cfba50 100644 --- a/src/render/metal/SDL_render_metal.m +++ b/src/render/metal/SDL_render_metal.m @@ -1630,8 +1630,8 @@ static int METAL_SetVSync(SDL_Renderer *renderer, const int vsync) static SDL_MetalView GetWindowView(SDL_Window *window) { #ifdef SDL_VIDEO_DRIVER_COCOA - NSWindow *nswindow = (__bridge NSWindow *)SDL_GetProperty(SDL_GetWindowProperties(window), "SDL.window.cocoa.window", NULL); - NSInteger tag = (NSInteger)SDL_GetNumberProperty(SDL_GetWindowProperties(window), "SDL.window.cocoa.metal_view_tag", 0); + 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_PROPERTY_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER, 0); if (nswindow && tag) { NSView *view = nswindow.contentView; if (view.subviews.count > 0) { @@ -1644,8 +1644,8 @@ static SDL_MetalView GetWindowView(SDL_Window *window) #endif #ifdef SDL_VIDEO_DRIVER_UIKIT - UIWindow *uiwindow = (__bridge UIWindow *)SDL_GetProperty(SDL_GetWindowProperties(window), "SDL.window.uikit.window", NULL); - NSInteger tag = (NSInteger)SDL_GetNumberProperty(SDL_GetWindowProperties(window), "SDL.window.uikit.metal_view_tag", 0); + 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_PROPERTY_WINDOW_UIKIT_METAL_VIEW_TAG_NUMBER, 0); if (uiwindow && tag) { UIView *view = uiwindow.rootViewController.view; 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 (@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) { renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; } diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c index d033130b9a..dc66b18c07 100644 --- a/src/render/opengl/SDL_render_gl.c +++ b/src/render/opengl/SDL_render_gl.c @@ -498,7 +498,7 @@ static int GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_Pr 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) { data->texture_external = SDL_TRUE; } else { @@ -531,9 +531,9 @@ static int GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_Pr data->texh = (GLfloat)texture->h / texture_h; } SDL_PropertiesID props = SDL_GetTextureProperties(texture); - SDL_SetNumberProperty(props, "SDL.texture.opengl.texture", data->texture); - SDL_SetFloatProperty(props, "SDL.texture.opengl.tex_w", data->texw); - SDL_SetFloatProperty(props, "SDL.texture.opengl.tex_h", data->texh); + SDL_SetNumberProperty(props, SDL_PROPERTY_TEXTURE_OPENGL_TEXTURE_NUMBER, data->texture); + SDL_SetFloatProperty(props, SDL_PROPERTY_TEXTURE_OPENGL_TEX_W_FLOAT, data->texw); + SDL_SetFloatProperty(props, SDL_PROPERTY_TEXTURE_OPENGL_TEX_H_FLOAT, data->texh); data->format = format; data->formattype = type; @@ -592,13 +592,13 @@ static int GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_Pr texture->format == SDL_PIXELFORMAT_IYUV) { 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) { data->utexture_external = SDL_TRUE; } else { 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) { data->vtexture_external = SDL_TRUE; } else { @@ -616,7 +616,7 @@ static int GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_Pr GL_CLAMP_TO_EDGE); renderdata->glTexImage2D(textype, 0, internalFormat, (texture_w + 1) / 2, (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->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); renderdata->glTexImage2D(textype, 0, internalFormat, (texture_w + 1) / 2, (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 || texture->format == SDL_PIXELFORMAT_NV21) { 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) { data->utexture_external = SDL_TRUE; } else { @@ -653,7 +653,7 @@ static int GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_Pr GL_CLAMP_TO_EDGE); renderdata->glTexImage2D(textype, 0, GL_LUMINANCE_ALPHA, (texture_w + 1) / 2, (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 @@ -1867,7 +1867,7 @@ static SDL_Renderer *GL_CreateRenderer(SDL_Window *window, SDL_PropertiesID crea */ #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); } else { SDL_GL_SetSwapInterval(0); diff --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c index bae60b7f97..fe6cf72cc3 100644 --- a/src/render/opengles2/SDL_render_gles2.c +++ b/src/render/opengles2/SDL_render_gles2.c @@ -1508,7 +1508,7 @@ static int GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL #if SDL_HAVE_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) { data->texture_v_external = SDL_TRUE; } 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_T, GL_CLAMP_TO_EDGE); 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) { data->texture_u_external = SDL_TRUE; } else { @@ -1545,10 +1545,10 @@ static int GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL if (GL_CheckError("glTexImage2D()", renderer) < 0) { 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) { - 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) { data->texture_u_external = SDL_TRUE; } else { @@ -1567,11 +1567,11 @@ static int GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL if (GL_CheckError("glTexImage2D()", renderer) < 0) { 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 - 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) { data->texture_external = SDL_TRUE; } else { @@ -1593,7 +1593,7 @@ static int GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL 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) { 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 * 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 - 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); } else { SDL_GL_SetSwapInterval(0); diff --git a/src/render/ps2/SDL_render_ps2.c b/src/render/ps2/SDL_render_ps2.c index 1052ff4055..acf177e0d5 100644 --- a/src/render/ps2/SDL_render_ps2.c +++ b/src/render/ps2/SDL_render_ps2.c @@ -643,7 +643,7 @@ static SDL_Renderer *PS2_CreateRenderer(SDL_Window *window, SDL_PropertiesID cre data->gsGlobal = gsGlobal; 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); } diff --git a/src/render/psp/SDL_render_psp.c b/src/render/psp/SDL_render_psp.c index 7b88642ef3..aa6434fd17 100644 --- a/src/render/psp/SDL_render_psp.c +++ b/src/render/psp/SDL_render_psp.c @@ -1345,7 +1345,7 @@ SDL_Renderer *PSP_CreateRenderer(SDL_Window *window, SDL_PropertiesID create_pro data->most_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; } else { data->vsync = SDL_FALSE; diff --git a/src/render/software/SDL_render_sw.c b/src/render/software/SDL_render_sw.c index 95bc2f57ae..18c8b36e84 100644 --- a/src/render/software/SDL_render_sw.c +++ b/src/render/software/SDL_render_sw.c @@ -1168,7 +1168,7 @@ static SDL_Renderer *SW_CreateRenderer(SDL_Window *window, SDL_PropertiesID crea } 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"); } else { SDL_SetHint(SDL_HINT_RENDER_VSYNC, "0"); diff --git a/src/render/vitagxm/SDL_render_vita_gxm.c b/src/render/vitagxm/SDL_render_vita_gxm.c index b665543d6d..5b902b275d 100644 --- a/src/render/vitagxm/SDL_render_vita_gxm.c +++ b/src/render/vitagxm/SDL_render_vita_gxm.c @@ -260,7 +260,7 @@ SDL_Renderer *VITA_GXM_CreateRenderer(SDL_Window *window, SDL_PropertiesID creat 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; renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; } else { diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c index b5a258f8fb..ffca4030d4 100644 --- a/src/test/SDL_test_common.c +++ b/src/test/SDL_test_common.c @@ -1451,11 +1451,11 @@ SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state) SDL_strlcpy(title, state->window_title, SDL_arraysize(title)); } props = SDL_CreateProperties(); - SDL_SetStringProperty(props, "title", title); - SDL_SetNumberProperty(props, "x", r.x); - SDL_SetNumberProperty(props, "y", r.y); - SDL_SetNumberProperty(props, "width", r.w); - SDL_SetNumberProperty(props, "height", r.h); + SDL_SetStringProperty(props, SDL_PROPERTY_WINDOW_CREATE_TITLE_STRING, title); + SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_X_NUMBER, r.x); + SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_Y_NUMBER, r.y); + SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_WIDTH_NUMBER, r.w); + SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_HEIGHT_NUMBER, r.h); SDL_SetNumberProperty(props, "flags", state->window_flags); state->windows[i] = SDL_CreateWindowWithProperties(props); SDL_DestroyProperties(props); diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 464490e922..8efd6f0dd7 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -1916,23 +1916,23 @@ static struct { Uint32 flag; SDL_bool invert_value; } SDL_WindowFlagProperties[] = { - { "always-on-top", SDL_WINDOW_ALWAYS_ON_TOP, SDL_FALSE }, - { "borderless", SDL_WINDOW_BORDERLESS, SDL_FALSE }, - { "focusable", SDL_WINDOW_NOT_FOCUSABLE, SDL_TRUE }, - { "fullscreen", SDL_WINDOW_FULLSCREEN, SDL_FALSE }, - { "hidden", SDL_WINDOW_HIDDEN, SDL_FALSE }, - { "high-pixel-density", SDL_WINDOW_HIGH_PIXEL_DENSITY, SDL_FALSE }, - { "maximized", SDL_WINDOW_MAXIMIZED, SDL_FALSE }, - { "menu", SDL_WINDOW_POPUP_MENU, SDL_FALSE }, - { "metal", SDL_WINDOW_METAL, SDL_FALSE }, - { "minimized", SDL_WINDOW_MINIMIZED, SDL_FALSE }, - { "mouse-grabbed", SDL_WINDOW_MOUSE_GRABBED, SDL_FALSE }, - { "opengl", SDL_WINDOW_OPENGL, SDL_FALSE }, - { "resizable", SDL_WINDOW_RESIZABLE, SDL_FALSE }, - { "transparent", SDL_WINDOW_TRANSPARENT, SDL_FALSE }, - { "tooltip", SDL_WINDOW_TOOLTIP, SDL_FALSE }, - { "utility", SDL_WINDOW_UTILITY, SDL_FALSE }, - { "vulkan", SDL_WINDOW_VULKAN, SDL_FALSE } + { SDL_PROPERTY_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN, SDL_WINDOW_ALWAYS_ON_TOP, SDL_FALSE }, + { SDL_PROPERTY_WINDOW_CREATE_BORDERLESS_BOOLEAN, SDL_WINDOW_BORDERLESS, SDL_FALSE }, + { SDL_PROPERTY_WINDOW_CREATE_FOCUSABLE_BOOLEAN, SDL_WINDOW_NOT_FOCUSABLE, SDL_TRUE }, + { SDL_PROPERTY_WINDOW_CREATE_FULLSCREEN_BOOLEAN, SDL_WINDOW_FULLSCREEN, SDL_FALSE }, + { SDL_PROPERTY_WINDOW_CREATE_HIDDEN_BOOLEAN, SDL_WINDOW_HIDDEN, SDL_FALSE }, + { SDL_PROPERTY_WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN, SDL_WINDOW_HIGH_PIXEL_DENSITY, SDL_FALSE }, + { SDL_PROPERTY_WINDOW_CREATE_MAXIMIZED_BOOLEAN, SDL_WINDOW_MAXIMIZED, SDL_FALSE }, + { SDL_PROPERTY_WINDOW_CREATE_MENU_BOOLEAN, SDL_WINDOW_POPUP_MENU, SDL_FALSE }, + { SDL_PROPERTY_WINDOW_CREATE_METAL_BOOLEAN, SDL_WINDOW_METAL, SDL_FALSE }, + { SDL_PROPERTY_WINDOW_CREATE_MINIMIZED_BOOLEAN, SDL_WINDOW_MINIMIZED, SDL_FALSE }, + { SDL_PROPERTY_WINDOW_CREATE_MOUSE_GRABBED_BOOLEAN, SDL_WINDOW_MOUSE_GRABBED, SDL_FALSE }, + { SDL_PROPERTY_WINDOW_CREATE_OPENGL_BOOLEAN, SDL_WINDOW_OPENGL, SDL_FALSE }, + { SDL_PROPERTY_WINDOW_CREATE_RESIZABLE_BOOLEAN, SDL_WINDOW_RESIZABLE, SDL_FALSE }, + { SDL_PROPERTY_WINDOW_CREATE_TRANSPARENT_BOOLEAN, SDL_WINDOW_TRANSPARENT, SDL_FALSE }, + { SDL_PROPERTY_WINDOW_CREATE_TOOLTIP_BOOLEAN, SDL_WINDOW_TOOLTIP, SDL_FALSE }, + { SDL_PROPERTY_WINDOW_CREATE_UTILITY_BOOLEAN, SDL_WINDOW_UTILITY, SDL_FALSE }, + { SDL_PROPERTY_WINDOW_CREATE_VULKAN_BOOLEAN, SDL_WINDOW_VULKAN, SDL_FALSE } }; 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 *window; - const char *title = SDL_GetStringProperty(props, "title", NULL); - int x = (int)SDL_GetNumberProperty(props, "x", SDL_WINDOWPOS_UNDEFINED); - int y = (int)SDL_GetNumberProperty(props, "y", SDL_WINDOWPOS_UNDEFINED); - int w = (int)SDL_GetNumberProperty(props, "width", 0); - int h = (int)SDL_GetNumberProperty(props, "height", 0); - SDL_Window *parent = SDL_GetProperty(props, "parent", NULL); + const char *title = SDL_GetStringProperty(props, SDL_PROPERTY_WINDOW_CREATE_TITLE_STRING, NULL); + int x = (int)SDL_GetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_X_NUMBER, SDL_WINDOWPOS_UNDEFINED); + int y = (int)SDL_GetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_Y_NUMBER, SDL_WINDOWPOS_UNDEFINED); + int w = (int)SDL_GetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_WIDTH_NUMBER, 0); + int h = (int)SDL_GetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_HEIGHT_NUMBER, 0); + SDL_Window *parent = SDL_GetProperty(props, SDL_PROPERTY_WINDOW_CREATE_PARENT_POINTER, NULL); Uint32 flags = SDL_GetWindowFlagProperties(props); Uint32 type_flags, graphics_flags; 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_PropertiesID props = SDL_CreateProperties(); 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, "height", h); + SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_WIDTH_NUMBER, w); + SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_HEIGHT_NUMBER, h); SDL_SetNumberProperty(props, "flags", flags); window = SDL_CreateWindowWithProperties(props); SDL_DestroyProperties(props); @@ -2194,11 +2194,11 @@ SDL_Window *SDL_CreatePopupWindow(SDL_Window *parent, int offset_x, int offset_y return NULL; } - SDL_SetProperty(props, "parent", parent); - SDL_SetNumberProperty(props, "x", offset_x); - SDL_SetNumberProperty(props, "y", offset_y); - SDL_SetNumberProperty(props, "width", w); - SDL_SetNumberProperty(props, "height", h); + SDL_SetProperty(props, SDL_PROPERTY_WINDOW_CREATE_PARENT_POINTER, parent); + SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_X_NUMBER, offset_x); + SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_Y_NUMBER, offset_y); + SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_WIDTH_NUMBER, w); + SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_HEIGHT_NUMBER, h); SDL_SetNumberProperty(props, "flags", flags); window = SDL_CreateWindowWithProperties(props); SDL_DestroyProperties(props); diff --git a/src/video/android/SDL_androidwindow.c b/src/video/android/SDL_androidwindow.c index 858aca0f48..3ef3022864 100644 --- a/src/video/android/SDL_androidwindow.c +++ b/src/video/android/SDL_androidwindow.c @@ -72,7 +72,7 @@ int Android_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Propert retval = SDL_SetError("Could not fetch native window"); 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 incompatible with vkCreateAndroidSurfaceKHR */ @@ -87,7 +87,7 @@ int Android_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Propert 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 window->driverdata = data; diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index 5dbc04b46d..85b1866268 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -1964,8 +1964,8 @@ static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, NSWindow } SDL_PropertiesID props = SDL_GetWindowProperties(window); - SDL_SetProperty(props, "SDL.window.cocoa.window", (__bridge void *)data.nswindow); - SDL_SetNumberProperty(props, "SDL.window.cocoa.metal_view_tag", SDL_METALVIEW_TAG); + SDL_SetProperty(props, SDL_PROPERTY_WINDOW_COCOA_WINDOW_POINTER, (__bridge void *)data.nswindow); + SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER, SDL_METALVIEW_TAG); /* All done! */ window->driverdata = (SDL_WindowData *)CFBridgingRetain(data); @@ -1990,8 +1990,8 @@ int Cocoa_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Propertie SDL_assert(false); } } else { - nswindow = (__bridge NSWindow *)SDL_GetProperty(create_props, "cocoa.window", NULL); - nsview = (__bridge NSView *)SDL_GetProperty(create_props, "cocoa.view", NULL); + nswindow = (__bridge NSWindow *)SDL_GetProperty(create_props, SDL_PROPERTY_WINDOW_CREATE_COCOA_WINDOW_POINTER, NULL); + nsview = (__bridge NSView *)SDL_GetProperty(create_props, SDL_PROPERTY_WINDOW_CREATE_COCOA_VIEW_POINTER, NULL); } if (nswindow && !nsview) { nsview = [nswindow contentView]; diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c index 70dd268139..d55d38cf45 100644 --- a/src/video/kmsdrm/SDL_kmsdrmvideo.c +++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c @@ -1465,9 +1465,9 @@ int KMSDRM_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Properti window->driverdata = windata; SDL_PropertiesID props = SDL_GetWindowProperties(window); - SDL_SetNumberProperty(props, "SDL.window.kmsdrm.dev_index", viddata->devindex); - SDL_SetNumberProperty(props, "SDL.window.kmsdrm.drm_fd", viddata->drm_fd); - SDL_SetProperty(props, "SDL.window.kmsdrm.gbm_dev", viddata->gbm_dev); + SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_KMSDRM_DEVICE_INDEX_NUMBER, viddata->devindex); + SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_KMSDRM_DRM_FD_NUMBER, viddata->drm_fd); + SDL_SetProperty(props, SDL_PROPERTY_WINDOW_KMSDRM_GBM_DEVICE_POINTER, viddata->gbm_dev); if (!is_vulkan && !vulkan_mode) { /* NON-Vulkan block. */ diff --git a/src/video/uikit/SDL_uikitwindow.m b/src/video/uikit/SDL_uikitwindow.m index e786ffc146..f16ef5b0eb 100644 --- a/src/video/uikit/SDL_uikitwindow.m +++ b/src/video/uikit/SDL_uikitwindow.m @@ -146,8 +146,8 @@ static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, UIWindow [view setSDLWindow:window]; SDL_PropertiesID props = SDL_GetWindowProperties(window); - SDL_SetProperty(props, "SDL.window.uikit.window", (__bridge void *)data.uiwindow); - SDL_SetNumberProperty(props, "SDL.window.uikit.metal_view_tag", SDL_METALVIEW_TAG); + SDL_SetProperty(props, SDL_PROPERTY_WINDOW_UIKIT_WINDOW_POINTER, (__bridge void *)data.uiwindow); + SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_UIKIT_METAL_VIEW_TAG_NUMBER, SDL_METALVIEW_TAG); return 0; } diff --git a/src/video/vivante/SDL_vivantevideo.c b/src/video/vivante/SDL_vivantevideo.c index ac570bc381..49f1525099 100644 --- a/src/video/vivante/SDL_vivantevideo.c +++ b/src/video/vivante/SDL_vivantevideo.c @@ -254,7 +254,7 @@ int VIVANTE_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Propert window->driverdata = data; 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 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) { 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 if (window->flags & SDL_WINDOW_OPENGL) { @@ -275,7 +275,7 @@ int VIVANTE_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Propert } else { 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 /* Window has been successfully created */ diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index b7a3ce0bf2..249cbcb34b 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/src/video/wayland/SDL_waylandwindow.c @@ -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_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.window.wayland.xdg_toplevel", libdecor_frame_get_xdg_toplevel(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_PROPERTY_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER, libdecor_frame_get_xdg_toplevel(data->shell_surface.libdecor.frame)); } } else #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); 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); - 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) { 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.window.wayland.xdg_positioner", data->shell_surface.xdg.roleobj.popup.positioner); + SDL_SetProperty(props, SDL_PROPERTY_WINDOW_WAYLAND_XDG_POPUP_POINTER, data->shell_surface.xdg.roleobj.popup.popup); + SDL_SetProperty(props, SDL_PROPERTY_WINDOW_WAYLAND_XDG_POSITIONER_POINTER, data->shell_surface.xdg.roleobj.popup.positioner); } else { 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_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; SDL_PropertiesID props = SDL_GetWindowProperties(popup); - SDL_SetProperty(props, "SDL.window.wayland.xdg_popup", NULL); - SDL_SetProperty(props, "SDL.window.wayland.xdg_positioner", NULL); + SDL_SetProperty(props, SDL_PROPERTY_WINDOW_WAYLAND_XDG_POPUP_POINTER, NULL); + SDL_SetProperty(props, SDL_PROPERTY_WINDOW_WAYLAND_XDG_POSITIONER_POINTER, NULL); } 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); wind->shell_surface.libdecor.frame = NULL; - SDL_SetProperty(props, "SDL.window.wayland.xdg_surface", NULL); - SDL_SetProperty(props, "SDL.window.wayland.xdg_toplevel", NULL); + SDL_SetProperty(props, SDL_PROPERTY_WINDOW_WAYLAND_XDG_SURFACE_POINTER, NULL); + SDL_SetProperty(props, SDL_PROPERTY_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER, NULL); } } else #endif @@ -1722,12 +1722,12 @@ void Wayland_HideWindow(SDL_VideoDevice *_this, SDL_Window *window) } else if (wind->shell_surface.xdg.roleobj.toplevel) { xdg_toplevel_destroy(wind->shell_surface.xdg.roleobj.toplevel); 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) { xdg_surface_destroy(wind->shell_surface.xdg.surface); 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 */ SDL_PropertiesID props = SDL_GetWindowProperties(window); - SDL_SetProperty(props, "SDL.window.wayland.registry", c->registry); - SDL_SetProperty(props, "SDL.window.wayland.display", data->waylandData->display); - SDL_SetProperty(props, "SDL.window.wayland.surface", data->surface); - SDL_SetProperty(props, "SDL.window.wayland.egl_window", data->egl_window); + SDL_SetProperty(props, SDL_PROPERTY_WINDOW_WAYLAND_REGISTRY_POINTER, c->registry); + SDL_SetProperty(props, SDL_PROPERTY_WINDOW_WAYLAND_DISPLAY_POINTER, data->waylandData->display); + SDL_SetProperty(props, SDL_PROPERTY_WINDOW_WAYLAND_SURFACE_POINTER, data->surface); + SDL_SetProperty(props, SDL_PROPERTY_WINDOW_WAYLAND_EGL_WINDOW_POINTER, data->egl_window); data->hit_test_result = SDL_HITTEST_NORMAL; diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c index 0f54a73dab..38a9055a3f 100644 --- a/src/video/windows/SDL_windowswindow.c +++ b/src/video/windows/SDL_windowswindow.c @@ -476,9 +476,9 @@ static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, HWND hwnd } SDL_PropertiesID props = SDL_GetWindowProperties(window); - SDL_SetProperty(props, "SDL.window.win32.hwnd", data->hwnd); - SDL_SetProperty(props, "SDL.window.win32.hdc", data->hdc); - SDL_SetProperty(props, "SDL.window.win32.instance", data->hinstance); + SDL_SetProperty(props, SDL_PROPERTY_WINDOW_WIN32_HWND_POINTER, data->hwnd); + SDL_SetProperty(props, SDL_PROPERTY_WINDOW_WIN32_HDC_POINTER, data->hdc); + SDL_SetProperty(props, SDL_PROPERTY_WINDOW_WIN32_INSTANCE_POINTER, data->hinstance); /* All done! */ 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) { - 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; if (hwnd) { 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) { HDC hdc = GetDC(share_hwnd); int pixel_format = GetPixelFormat(hdc); diff --git a/src/video/winrt/SDL_winrtvideo.cpp b/src/video/winrt/SDL_winrtvideo.cpp index b2b307f2a6..973730e1b9 100644 --- a/src/video/winrt/SDL_winrtvideo.cpp +++ b/src/video/winrt/SDL_winrtvideo.cpp @@ -606,7 +606,7 @@ int WINRT_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Propertie data->appView = ApplicationView::GetForCurrentView(); #endif } - SDL_SetProperty(SDL_GetWindowProperties(window), "SDL.window.winrt.window", reinterpret_cast(data->coreWindow.Get())); + SDL_SetProperty(SDL_GetWindowProperties(window), SDL_PROPERTY_WINDOW_WINRT_WINDOW_POINTER, reinterpret_cast(data->coreWindow.Get())); /* Make note of the requested window flags, before they start getting changed. */ const Uint32 requestedFlags = window->flags; diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c index 7e95621ca5..cda57897b9 100644 --- a/src/video/x11/SDL_x11window.c +++ b/src/video/x11/SDL_x11window.c @@ -392,9 +392,9 @@ static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, Window w) SDL_PropertiesID props = SDL_GetWindowProperties(window); int screen = (displaydata ? displaydata->screen : 0); - SDL_SetProperty(props, "SDL.window.x11.display", data->videodata->display); - SDL_SetNumberProperty(props, "SDL.window.x11.screen", screen); - SDL_SetNumberProperty(props, "SDL.window.x11.window", data->xwindow); + SDL_SetProperty(props, SDL_PROPERTY_WINDOW_X11_DISPLAY_POINTER, data->videodata->display); + SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_X11_SCREEN_NUMBER, screen); + SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_X11_WINDOW_NUMBER, data->xwindow); /* All done! */ 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) { - 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)); if (w) { window->flags |= SDL_WINDOW_EXTERNAL; diff --git a/test/testautomation_video.c b/test/testautomation_video.c index beaeee5fd0..6c4001d7c7 100644 --- a/test/testautomation_video.c +++ b/test/testautomation_video.c @@ -1764,12 +1764,12 @@ static int video_setWindowCenteredOnDisplay(void *arg) expectedY = (expectedDisplayRect.y + ((expectedDisplayRect.h - h) / 2)); props = SDL_CreateProperties(); - SDL_SetStringProperty(props, "title", title); - SDL_SetNumberProperty(props, "x", x); - SDL_SetNumberProperty(props, "w", y); - SDL_SetNumberProperty(props, "width", w); - SDL_SetNumberProperty(props, "height", h); - SDL_SetBooleanProperty(props, "borderless", SDL_TRUE); + SDL_SetStringProperty(props, SDL_PROPERTY_WINDOW_CREATE_TITLE_STRING, title); + SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_X_NUMBER, x); + SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_Y_NUMBER, y); + SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_WIDTH_NUMBER, w); + SDL_SetNumberProperty(props, SDL_PROPERTY_WINDOW_CREATE_HEIGHT_NUMBER, h); + SDL_SetBooleanProperty(props, SDL_PROPERTY_WINDOW_CREATE_BORDERLESS_BOOLEAN, SDL_TRUE); window = SDL_CreateWindowWithProperties(props); SDL_DestroyProperties(props); 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); SDLTest_AssertPass("SDL_GetWindowSize()"); - + SDL_GetWindowPosition(window, &windowedX, &windowedY); SDLTest_AssertPass("SDL_GetWindowPosition()"); diff --git a/test/testffmpeg.c b/test/testffmpeg.c index 338063a8ce..db7c2accb7 100644 --- a/test/testffmpeg.c +++ b/test/testffmpeg.c @@ -145,7 +145,7 @@ static SDL_bool CreateWindowAndRenderer(Uint32 window_flags, const char *driver) #endif #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) { ID3D11Device_AddRef(d3d11_device); 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) { SDL_SetError("Couldn't get texture ID3D11Resource interface"); return SDL_FALSE;