SDL: Added SDL properties API

From 973c8b3273820f9421d85292911809f319d19964 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 10 Oct 2023 12:38:22 -0700
Subject: [PATCH] Added SDL properties API

Fixes https://github.com/libsdl-org/SDL/issues/7799
---
 VisualC-GDK/SDL/SDL.vcxproj                   |   6 +-
 VisualC-GDK/SDL/SDL.vcxproj.filters           |   5 +
 VisualC-WinRT/SDL-UWP.vcxproj                 |   3 +
 VisualC-WinRT/SDL-UWP.vcxproj.filters         |  26 +-
 VisualC/SDL/SDL.vcxproj                       |   9 +-
 VisualC/SDL/SDL.vcxproj.filters               |   5 +
 .../testautomation/testautomation.vcxproj     |   1 +
 Xcode/SDL/SDL.xcodeproj/project.pbxproj       |  29 +-
 include/SDL3/SDL.h                            |   1 +
 include/SDL3/SDL_properties.h                 | 133 +++++++++
 src/SDL.c                                     |   3 +
 src/SDL_hashtable.c                           |  40 ++-
 src/SDL_hashtable.h                           |  11 +-
 src/SDL_properties.c                          | 278 ++++++++++++++++++
 src/SDL_properties_c.h                        |  23 ++
 src/dynapi/SDL_dynapi.sym                     |   6 +
 src/dynapi/SDL_dynapi_overrides.h             |   6 +
 src/dynapi/SDL_dynapi_procs.h                 |   6 +
 test/testautomation.c                         |   1 +
 test/testautomation_properties.c              | 190 ++++++++++++
 test/testautomation_suites.h                  |   1 +
 21 files changed, 746 insertions(+), 37 deletions(-)
 create mode 100644 include/SDL3/SDL_properties.h
 create mode 100644 src/SDL_properties.c
 create mode 100644 src/SDL_properties_c.h
 create mode 100644 test/testautomation_properties.c

diff --git a/VisualC-GDK/SDL/SDL.vcxproj b/VisualC-GDK/SDL/SDL.vcxproj
index d222f42cd6a3..7df28485fcaa 100644
--- a/VisualC-GDK/SDL/SDL.vcxproj
+++ b/VisualC-GDK/SDL/SDL.vcxproj
@@ -473,6 +473,7 @@
     <ClInclude Include="..\..\src\SDL_internal.h" />
     <ClInclude Include="..\..\src\SDL_list.h" />
     <ClInclude Include="..\..\src\SDL_log_c.h" />
+    <ClInclude Include="..\..\src\SDL_properties_c.h" />
     <ClInclude Include="..\..\src\sensor\dummy\SDL_dummysensor.h" />
     <ClInclude Include="..\..\src\sensor\SDL_sensor_c.h" />
     <ClInclude Include="..\..\src\sensor\SDL_syssensor.h" />
@@ -541,9 +542,6 @@
     <ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb.h" />
     <ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb_sse_func.h" />
     <ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb_std_func.h" />
-    <ClCompile Include="..\..\src\SDL_hashtable.c" />
-  </ItemGroup>
-  <ItemGroup>
     <ClCompile Include="..\..\src\atomic\SDL_atomic.c" />
     <ClCompile Include="..\..\src\atomic\SDL_spinlock.c" />
     <ClCompile Include="..\..\src\audio\directsound\SDL_directsound.c" />
@@ -714,8 +712,10 @@
     <ClCompile Include="..\..\src\SDL_assert.c" />
     <ClCompile Include="..\..\src\SDL_list.c" />
     <ClCompile Include="..\..\src\SDL_error.c" />
+    <ClCompile Include="..\..\src\SDL_hashtable.c" />
     <ClCompile Include="..\..\src\SDL_hints.c" />
     <ClCompile Include="..\..\src\SDL_log.c" />
+    <ClCompile Include="..\..\src\SDL_properties.c" />
     <ClCompile Include="..\..\src\SDL_utils.c" />
     <ClCompile Include="..\..\src\sensor\dummy\SDL_dummysensor.c" />
     <ClCompile Include="..\..\src\sensor\SDL_sensor.c" />
diff --git a/VisualC-GDK/SDL/SDL.vcxproj.filters b/VisualC-GDK/SDL/SDL.vcxproj.filters
index 683d6b4f3e76..19b7eb904b86 100644
--- a/VisualC-GDK/SDL/SDL.vcxproj.filters
+++ b/VisualC-GDK/SDL/SDL.vcxproj.filters
@@ -306,6 +306,9 @@
     <ClInclude Include="..\..\include\SDL3\SDL_power.h">
       <Filter>API Headers</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\include\SDL3\SDL_properties.h">
+      <Filter>API Headers</Filter>
+    </ClInclude>
     <ClInclude Include="..\..\include\SDL3\SDL_quit.h">
       <Filter>API Headers</Filter>
     </ClInclude>
@@ -823,6 +826,7 @@
     <ClInclude Include="..\..\src\SDL_hints_c.h" />
     <ClInclude Include="..\..\src\SDL_internal.h" />
     <ClInclude Include="..\..\src\SDL_log_c.h" />
+    <ClInclude Include="..\..\src\SDL_properties_c.h" />
     <ClInclude Include="..\..\src\render\direct3d12\SDL_shaders_d3d12.h">
       <Filter>render\direct3d12</Filter>
     </ClInclude>
@@ -849,6 +853,7 @@
     <ClCompile Include="..\..\src\SDL_hashtable.c" />
     <ClCompile Include="..\..\src\SDL_hints.c" />
     <ClCompile Include="..\..\src\SDL_list.c" />
+    <ClCompile Include="..\..\src\SDL_properties.c" />
     <ClCompile Include="..\..\src\SDL_utils.c" />
     <ClCompile Include="..\..\src\audio\SDL_audio.c">
       <Filter>audio</Filter>
diff --git a/VisualC-WinRT/SDL-UWP.vcxproj b/VisualC-WinRT/SDL-UWP.vcxproj
index 863b0e3e397a..c911765b9941 100644
--- a/VisualC-WinRT/SDL-UWP.vcxproj
+++ b/VisualC-WinRT/SDL-UWP.vcxproj
@@ -71,6 +71,7 @@
     <ClInclude Include="..\include\SDL3\SDL_platform.h" />
     <ClInclude Include="..\include\SDL3\SDL_platform_defines.h" />
     <ClInclude Include="..\include\SDL3\SDL_power.h" />
+    <ClInclude Include="..\include\SDL3\SDL_properties.h" />
     <ClInclude Include="..\include\SDL3\SDL_quit.h" />
     <ClInclude Include="..\include\SDL3\SDL_rect.h" />
     <ClInclude Include="..\include\SDL3\SDL_render.h" />
@@ -156,6 +157,7 @@
     <ClInclude Include="..\src\SDL_internal.h" />
     <ClInclude Include="..\src\SDL_list.h" />
     <ClInclude Include="..\src\SDL_log_c.h" />
+    <ClInclude Include="..\src\SDL_properties_c.h" />
     <ClInclude Include="..\src\sensor\dummy\SDL_dummysensor.h" />
     <ClInclude Include="..\src\sensor\SDL_sensor_c.h" />
     <ClInclude Include="..\src\sensor\SDL_syssensor.h" />
@@ -398,6 +400,7 @@
     <ClCompile Include="..\src\SDL_guid.c" />
     <ClCompile Include="..\src\SDL_hints.c" />
     <ClCompile Include="..\src\SDL_log.c" />
+    <ClCompile Include="..\src\SDL_properties.c" />
     <ClCompile Include="..\src\SDL_utils.c" />
     <ClCompile Include="..\src\sensor\dummy\SDL_dummysensor.c" />
     <ClCompile Include="..\src\sensor\SDL_sensor.c" />
diff --git a/VisualC-WinRT/SDL-UWP.vcxproj.filters b/VisualC-WinRT/SDL-UWP.vcxproj.filters
index a1c99a51e712..7b90f411fbee 100644
--- a/VisualC-WinRT/SDL-UWP.vcxproj.filters
+++ b/VisualC-WinRT/SDL-UWP.vcxproj.filters
@@ -324,7 +324,9 @@
     <ClInclude Include="..\src\SDL_fatal.h">
       <Filter>Source Files</Filter>
     </ClInclude>
-    <ClInclude Include="..\src\SDL_hashtable.h" />
+    <ClInclude Include="..\src\SDL_hashtable.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
     <ClInclude Include="..\src\SDL_hints_c.h">
       <Filter>Source Files</Filter>
     </ClInclude>
@@ -334,6 +336,9 @@
     <ClInclude Include="..\src\SDL_log_c.h">
       <Filter>Source Files</Filter>
     </ClInclude>
+    <ClInclude Include="..\src\SDL_properties_c.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
     <ClInclude Include="..\src\locale\SDL_syslocale.h">
       <Filter>Source Files</Filter>
     </ClInclude>
@@ -640,13 +645,24 @@
     <ClCompile Include="..\src\SDL_guid.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\src\SDL_hashtable.c" />
+    <ClCompile Include="..\src\SDL_hashtable.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
     <ClCompile Include="..\src\SDL_hints.c">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="..\src\SDL_list.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
     <ClCompile Include="..\src\SDL_log.c">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="..\src\SDL_utils.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\src\SDL_properties.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
     <ClCompile Include="..\src\locale\SDL_locale.c">
       <Filter>Source Files</Filter>
     </ClCompile>
@@ -797,12 +813,6 @@
     <ClCompile Include="..\src\video\winrt\SDL_winrtgamebar.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\src\SDL_list.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\src\SDL_utils.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="..\src\haptic\windows\SDL_dinputhaptic.c">
       <Filter>Source Files</Filter>
     </ClCompile>
diff --git a/VisualC/SDL/SDL.vcxproj b/VisualC/SDL/SDL.vcxproj
index 31263605cea0..f4d4dc002cb0 100644
--- a/VisualC/SDL/SDL.vcxproj
+++ b/VisualC/SDL/SDL.vcxproj
@@ -283,6 +283,7 @@
     <ClInclude Include="..\..\include\SDL3\SDL_platform.h" />
     <ClInclude Include="..\..\include\SDL3\SDL_platform_defines.h" />
     <ClInclude Include="..\..\include\SDL3\SDL_power.h" />
+    <ClInclude Include="..\..\include\SDL3\SDL_properties.h" />
     <ClInclude Include="..\..\include\SDL3\SDL_quit.h" />
     <ClInclude Include="..\..\include\SDL3\SDL_rect.h" />
     <ClInclude Include="..\..\include\SDL3\SDL_render.h" />
@@ -400,6 +401,7 @@
     <ClInclude Include="..\..\src\SDL_internal.h" />
     <ClInclude Include="..\..\src\SDL_list.h" />
     <ClInclude Include="..\..\src\SDL_log_c.h" />
+    <ClInclude Include="..\..\src\SDL_properties_c.h" />
     <ClInclude Include="..\..\src\sensor\dummy\SDL_dummysensor.h" />
     <ClInclude Include="..\..\src\sensor\SDL_sensor_c.h" />
     <ClInclude Include="..\..\src\sensor\SDL_syssensor.h" />
@@ -467,9 +469,6 @@
     <ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb.h" />
     <ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb_sse_func.h" />
     <ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb_std_func.h" />
-    <ClCompile Include="..\..\src\SDL_hashtable.c" />
-  </ItemGroup>
-  <ItemGroup>
     <ClCompile Include="..\..\src\atomic\SDL_atomic.c" />
     <ClCompile Include="..\..\src\atomic\SDL_spinlock.c" />
     <ClCompile Include="..\..\src\audio\directsound\SDL_directsound.c" />
@@ -590,10 +589,12 @@
     <ClCompile Include="..\..\src\render\software\SDL_triangle.c" />
     <ClCompile Include="..\..\src\SDL.c" />
     <ClCompile Include="..\..\src\SDL_assert.c" />
-    <ClCompile Include="..\..\src\SDL_list.c" />
     <ClCompile Include="..\..\src\SDL_error.c" />
+    <ClCompile Include="..\..\src\SDL_hashtable.c" />
     <ClCompile Include="..\..\src\SDL_hints.c" />
+    <ClCompile Include="..\..\src\SDL_list.c" />
     <ClCompile Include="..\..\src\SDL_log.c" />
+    <ClCompile Include="..\..\src\SDL_properties.c" />
     <ClCompile Include="..\..\src\SDL_utils.c" />
     <ClCompile Include="..\..\src\sensor\dummy\SDL_dummysensor.c" />
     <ClCompile Include="..\..\src\sensor\SDL_sensor.c" />
diff --git a/VisualC/SDL/SDL.vcxproj.filters b/VisualC/SDL/SDL.vcxproj.filters
index df44db6b2de1..f72de3a0a0cf 100644
--- a/VisualC/SDL/SDL.vcxproj.filters
+++ b/VisualC/SDL/SDL.vcxproj.filters
@@ -300,6 +300,9 @@
     <ClInclude Include="..\..\include\SDL3\SDL_power.h">
       <Filter>API Headers</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\include\SDL3\SDL_properties.h">
+      <Filter>API Headers</Filter>
+    </ClInclude>
     <ClInclude Include="..\..\include\SDL3\SDL_quit.h">
       <Filter>API Headers</Filter>
     </ClInclude>
@@ -814,6 +817,7 @@
     <ClInclude Include="..\..\src\SDL_hints_c.h" />
     <ClInclude Include="..\..\src\SDL_internal.h" />
     <ClInclude Include="..\..\src\SDL_log_c.h" />
+    <ClInclude Include="..\..\src\SDL_properties_c.h" />
     <ClInclude Include="..\..\src\render\direct3d12\SDL_shaders_d3d12.h">
       <Filter>render\direct3d12</Filter>
     </ClInclude>
@@ -828,6 +832,7 @@
     <ClCompile Include="..\..\src\SDL_hashtable.c" />
     <ClCompile Include="..\..\src\SDL_hints.c" />
     <ClCompile Include="..\..\src\SDL_list.c" />
+    <ClCompile Include="..\..\src\SDL_properties.c" />
     <ClCompile Include="..\..\src\SDL_utils.c" />
     <ClCompile Include="..\..\src\audio\SDL_audio.c">
       <Filter>audio</Filter>
diff --git a/VisualC/tests/testautomation/testautomation.vcxproj b/VisualC/tests/testautomation/testautomation.vcxproj
index 2cae2109f3a7..fd1f86c9b3f4 100644
--- a/VisualC/tests/testautomation/testautomation.vcxproj
+++ b/VisualC/tests/testautomation/testautomation.vcxproj
@@ -211,6 +211,7 @@
     <ClCompile Include="..\..\..\test\testautomation_mouse.c" />
     <ClCompile Include="..\..\..\test\testautomation_pixels.c" />
     <ClCompile Include="..\..\..\test\testautomation_platform.c" />
+    <ClCompile Include="..\..\..\test\testautomation_properties.c" />
     <ClCompile Include="..\..\..\test\testautomation_rect.c" />
     <ClCompile Include="..\..\..\test\testautomation_render.c" />
     <ClCompile Include="..\..\..\test\testautomation_rwops.c" />
diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj
index 2ed36dcb0408..cc082179e3f5 100644
--- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj
+++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj
@@ -33,6 +33,7 @@
 /* End PBXAggregateTarget section */
 
 /* Begin PBXBuildFile section */
+		000040E76FDC6AE48CBF0000 /* SDL_hashtable.c in Sources */ = {isa = PBXBuildFile; fileRef = 000078E1881E857EBB6C0000 /* SDL_hashtable.c */; };
 		007317A40858DECD00B2BC32 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179D0858DECD00B2BC32 /* Cocoa.framework */; platformFilters = (macos, ); };
 		007317A60858DECD00B2BC32 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179F0858DECD00B2BC32 /* IOKit.framework */; platformFilters = (ios, maccatalyst, macos, ); };
 		00CFA89D106B4BA100758660 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00CFA89C106B4BA100758660 /* ForceFeedback.framework */; platformFilters = (macos, ); };
@@ -405,6 +406,8 @@
 		F3B38CDB296E2E52005DA6D3 /* SDL_oldnames.h in Headers */ = {isa = PBXBuildFile; fileRef = F3B38CCD296E2E52005DA6D3 /* SDL_oldnames.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		F3B38CDF296E2E52005DA6D3 /* SDL_intrin.h in Headers */ = {isa = PBXBuildFile; fileRef = F3B38CCE296E2E52005DA6D3 /* SDL_intrin.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		F3D60A8328C16A1900788A3A /* SDL_hidapi_wii.c in Sources */ = {isa = PBXBuildFile; fileRef = F3D60A8228C16A1800788A3A /* SDL_hidapi_wii.c */; };
+		F3E5A6EB2AD5E0E600293D83 /* SDL_properties.c in Sources */ = {isa = PBXBuildFile; fileRef = F3E5A6EA2AD5E0E600293D83 /* SDL_properties.c */; };
+		F3E5A6ED2AD5E10800293D83 /* SDL_properties.h in Headers */ = {isa = PBXBuildFile; fileRef = F3E5A6EC2AD5E10800293D83 /* SDL_properties.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		F3F07D5A269640160074468B /* SDL_hidapi_luna.c in Sources */ = {isa = PBXBuildFile; fileRef = F3F07D59269640160074468B /* SDL_hidapi_luna.c */; };
 		F3F7D8ED2933074E00816151 /* SDL_audio.h in Headers */ = {isa = PBXBuildFile; fileRef = F3F7D8AA2933074900816151 /* SDL_audio.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		F3F7D8F12933074E00816151 /* SDL_platform.h in Headers */ = {isa = PBXBuildFile; fileRef = F3F7D8AB2933074900816151 /* SDL_platform.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -469,8 +472,6 @@
 		F3F7D9E12933074E00816151 /* SDL_begin_code.h in Headers */ = {isa = PBXBuildFile; fileRef = F3F7D8E72933074E00816151 /* SDL_begin_code.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		F3F7D9E52933074E00816151 /* SDL_system.h in Headers */ = {isa = PBXBuildFile; fileRef = F3F7D8E82933074E00816151 /* SDL_system.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		FA73671D19A540EF004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; platformFilters = (ios, maccatalyst, macos, tvos, watchos, ); };
-		000040E76FDC6AE48CBF0000 /* SDL_hashtable.c in Sources */ = {isa = PBXBuildFile; fileRef = 000078E1881E857EBB6C0000 /* SDL_hashtable.c */; };
-		0000CE8F0EF0E7EF781D0000 /* SDL_hashtable.h in Headers */ = {isa = PBXBuildFile; fileRef = 0000B6ADCD88CAD6610F0000 /* SDL_hashtable.h */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXContainerItemProxy section */
@@ -497,6 +498,8 @@
 /* End PBXCopyFilesBuildPhase section */
 
 /* Begin PBXFileReference section */
+		000078E1881E857EBB6C0000 /* SDL_hashtable.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hashtable.c; sourceTree = "<group>"; };
+		0000B6ADCD88CAD6610F0000 /* SDL_hashtable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_hashtable.h; sourceTree = "<group>"; };
 		0073179D0858DECD00B2BC32 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
 		0073179F0858DECD00B2BC32 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; };
 		007317C10858E15000B2BC32 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = System/Library/Frameworks/Carbon.framework; sourceTree = SDKROOT; };
@@ -897,6 +900,8 @@
 		F3B38CCD296E2E52005DA6D3 /* SDL_oldnames.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_oldnames.h; path = SDL3/SDL_oldnames.h; sourceTree = "<group>"; };
 		F3B38CCE296E2E52005DA6D3 /* SDL_intrin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_intrin.h; path = SDL3/SDL_intrin.h; sourceTree = "<group>"; };
 		F3D60A8228C16A1800788A3A /* SDL_hidapi_wii.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_wii.c; sourceTree = "<group>"; };
+		F3E5A6EA2AD5E0E600293D83 /* SDL_properties.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_properties.c; sourceTree = "<group>"; };
+		F3E5A6EC2AD5E10800293D83 /* SDL_properties.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_properties.h; path = SDL3/SDL_properties.h; sourceTree = "<group>"; };
 		F3F07D59269640160074468B /* SDL_hidapi_luna.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_luna.c; sourceTree = "<group>"; };
 		F3F7D8AA2933074900816151 /* SDL_audio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_audio.h; path = SDL3/SDL_audio.h; sourceTree = "<group>"; };
 		F3F7D8AB2933074900816151 /* SDL_platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_platform.h; path = SDL3/SDL_platform.h; sourceTree = "<group>"; };
@@ -964,8 +969,6 @@
 		F59C710600D5CB5801000001 /* SDL.info */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = SDL.info; sourceTree = "<group>"; };
 		F5A2EF3900C6A39A01000001 /* BUGS.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = BUGS.txt; path = ../../BUGS.txt; sourceTree = SOURCE_ROOT; };
 		FA73671C19A540EF004122E4 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; };
-		000078E1881E857EBB6C0000 /* SDL_hashtable.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_hashtable.c; path = SDL_hashtable.c; sourceTree = "<group>"; };
-		0000B6ADCD88CAD6610F0000 /* SDL_hashtable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_hashtable.h; path = SDL_hashtable.h; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -994,7 +997,6 @@
 		0153844A006D81B07F000001 /* Public Headers */ = {
 			isa = PBXGroup;
 			children = (
-				F3F7D8CF2933074C00816151 /* SDL.h */,
 				F3F7D8E02933074D00816151 /* SDL_assert.h */,
 				F3F7D8B92933074A00816151 /* SDL_atomic.h */,
 				F3F7D8AA2933074900816151 /* SDL_audio.h */,
@@ -1023,26 +1025,27 @@
 				F3F7D8D92933074C00816151 /* SDL_loadso.h */,
 				F3F7D8C42933074B00816151 /* SDL_locale.h */,
 				F3F7D8B72933074A00816151 /* SDL_log.h */,
-				F3F7D8B02933074900816151 /* SDL_main.h */,
 				F3B38CCA296E2E52005DA6D3 /* SDL_main_impl.h */,
+				F3F7D8B02933074900816151 /* SDL_main.h */,
 				F3F7D8B62933074A00816151 /* SDL_messagebox.h */,
 				F3F7D8D22933074C00816151 /* SDL_metal.h */,
 				F3F7D8D52933074C00816151 /* SDL_misc.h */,
 				F3F7D8DA2933074D00816151 /* SDL_mouse.h */,
 				F3F7D8E62933074E00816151 /* SDL_mutex.h */,
 				F3B38CCD296E2E52005DA6D3 /* SDL_oldnames.h */,
-				F3F7D8E12933074D00816151 /* SDL_opengl.h */,
 				F3F7D8C02933074A00816151 /* SDL_opengl_glext.h */,
+				F3F7D8E12933074D00816151 /* SDL_opengl.h */,
 				F3F7D8C62933074B00816151 /* SDL_opengles.h */,
-				F3F7D8C72933074B00816151 /* SDL_opengles2.h */,
 				F3F7D8AE2933074900816151 /* SDL_opengles2_gl2.h */,
 				F3F7D8BD2933074A00816151 /* SDL_opengles2_gl2ext.h */,
 				F3F7D8C92933074B00816151 /* SDL_opengles2_gl2platform.h */,
 				F3F7D8B12933074900816151 /* SDL_opengles2_khrplatform.h */,
+				F3F7D8C72933074B00816151 /* SDL_opengles2.h */,
 				F3F7D8B52933074A00816151 /* SDL_pixels.h */,
-				F3F7D8AB2933074900816151 /* SDL_platform.h */,
 				F3B38CCB296E2E52005DA6D3 /* SDL_platform_defines.h */,
+				F3F7D8AB2933074900816151 /* SDL_platform.h */,
 				F3F7D8DB2933074D00816151 /* SDL_power.h */,
+				F3E5A6EC2AD5E10800293D83 /* SDL_properties.h */,
 				F3F7D8DF2933074D00816151 /* SDL_quit.h */,
 				F3F7D8E22933074D00816151 /* SDL_rect.h */,
 				F3F7D8DE2933074D00816151 /* SDL_render.h */,
@@ -1061,6 +1064,7 @@
 				F3F7D8E42933074D00816151 /* SDL_version.h */,
 				F3F7D8C52933074B00816151 /* SDL_video.h */,
 				F3F7D8D42933074C00816151 /* SDL_vulkan.h */,
+				F3F7D8CF2933074C00816151 /* SDL.h */,
 			);
 			name = "Public Headers";
 			path = ../../include;
@@ -1123,6 +1127,8 @@
 				A7D8A57523E2513D00DCD162 /* SDL_error_c.h */,
 				A7D8A8BF23E2513F00DCD162 /* SDL_error.c */,
 				F382071C284F362F004DD584 /* SDL_guid.c */,
+				000078E1881E857EBB6C0000 /* SDL_hashtable.c */,
+				0000B6ADCD88CAD6610F0000 /* SDL_hashtable.h */,
 				A7D8A8D123E2514000DCD162 /* SDL_hints_c.h */,
 				A7D8A5AB23E2513D00DCD162 /* SDL_hints.c */,
 				A7D8A58323E2513D00DCD162 /* SDL_internal.h */,
@@ -1130,11 +1136,10 @@
 				A1BB8B6227F6CF330057CFA8 /* SDL_list.h */,
 				F386F6E42884663E001840AA /* SDL_log_c.h */,
 				A7D8A5DD23E2513D00DCD162 /* SDL_log.c */,
+				F3E5A6EA2AD5E0E600293D83 /* SDL_properties.c */,
 				F386F6E52884663E001840AA /* SDL_utils_c.h */,
 				F386F6E62884663E001840AA /* SDL_utils.c */,
 				A7D8A57123E2513D00DCD162 /* SDL.c */,
-				000078E1881E857EBB6C0000 /* SDL_hashtable.c */,
-				0000B6ADCD88CAD6610F0000 /* SDL_hashtable.h */,
 			);
 			name = "Library Source";
 			path = ../../src;
@@ -2156,6 +2161,7 @@
 				F3B38CDB296E2E52005DA6D3 /* SDL_oldnames.h in Headers */,
 				F3F7D9C92933074E00816151 /* SDL_opengl.h in Headers */,
 				F3F7D9452933074E00816151 /* SDL_opengl_glext.h in Headers */,
+				F3E5A6ED2AD5E10800293D83 /* SDL_properties.h in Headers */,
 				F3F7D95D2933074E00816151 /* SDL_opengles.h in Headers */,
 				F3F7D9612933074E00816151 /* SDL_opengles2.h in Headers */,
 				F3F7D8FD2933074E00816151 /* SDL_opengles2_gl2.h in Headers */,
@@ -2502,6 +2508,7 @@
 				A7D8BBD723E2574800DCD162 /* SDL_uikitevents.m in Sources */,
 				A7D8B5F323E2514300DCD162 /* SDL_syspower.c in Sources */,
 				A7D8B95023E2514400DCD162 /* SDL_iconv.c in Sources */,
+				F3E5A6EB2AD5E0E600293D83 /* SDL_properties.c in Sources */,
 				A7D8BA9D23E2514400DCD162 /* s_fabs.c in Sources */,
 				F395C1B12569C6A000942BFF /* SDL_mfijoystick.m in Sources */,
 				A7D8B99223E2514400DCD162 /* SDL_shaders_metal.metal in Sources */,
diff --git a/include/SDL3/SDL.h b/include/SDL3/SDL.h
index cb51cd7ac2f8..498f0520c15c 100644
--- a/include/SDL3/SDL.h
+++ b/include/SDL3/SDL.h
@@ -61,6 +61,7 @@
 #include <SDL3/SDL_pixels.h>
 #include <SDL3/SDL_platform.h>
 #include <SDL3/SDL_power.h>
+#include <SDL3/SDL_properties.h>
 #include <SDL3/SDL_quit.h>
 #include <SDL3/SDL_rect.h>
 #include <SDL3/SDL_render.h>
diff --git a/include/SDL3/SDL_properties.h b/include/SDL3/SDL_properties.h
new file mode 100644
index 000000000000..13a881c0b8ae
--- /dev/null
+++ b/include/SDL3/SDL_properties.h
@@ -0,0 +1,133 @@
+/*
+  Simple DiretMedia Layer
+  Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ *  \file SDL_properties.h
+ *
+ *  \brief Header file for SDL properties.
+ */
+
+#ifndef SDL_properties_h_
+#define SDL_properties_h_
+
+#include <SDL3/SDL_begin_code.h>
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * SDL properties ID
+ */
+typedef Uint32 SDL_PropertiesID;
+
+/**
+ * Create a set of properties
+ *
+ * \returns an ID for a new set of properties, or 0 on failure; call SDL_GetError() for more information.
+ *
+ * \since This function is available since SDL 3.0.0.
+ *
+ * \sa SDL_DestroyProperties
+ */
+extern DECLSPEC SDL_PropertiesID SDLCALL SDL_CreateProperties(void);
+
+/**
+ * Lock a set of properties
+ *
+ * Obtain a multi-threaded lock for these properties. Other threads will wait while trying to lock these properties until they are unlocked. Properties must be unlocked before they are destroyed.
+ *
+ * The lock is automatically taken when setting individual properties, this function is only needed when you want to set several properties atomically or want to guarantee that properties being queried aren't freed in another thread.
+ *
+ * \param props the properties to lock
+ *
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
+ *
+ * \since This function is available since SDL 3.0.0.
+ *
+ * \sa SDL_UnlockProperties
+ */
+extern DECLSPEC int SDLCALL SDL_LockProperties(SDL_PropertiesID props);
+
+/**
+ * Unlock a set of properties
+ *
+ * \param props the properties to unlock
+ *
+ * \since This function is available since SDL 3.0.0.
+ *
+ * \sa SDL_LockProperties
+ */
+extern DECLSPEC void SDLCALL SDL_UnlockProperties(SDL_PropertiesID props);
+
+/**
+ * Set a property on a set of properties
+ *
+ * \param props the properties to modify
+ * \param name the name of the property to modify
+ * \param value the new value of the property, or NULL to delete the property
+ * \param cleanup the function to call when this property is deleted, or NULL if no cleanup is necessary
+ * \param userdata a pointer that is passed to the cleanup function
+ *
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
+ *
+ * \since This function is available since SDL 3.0.0.
+ *
+ * \sa SDL_GetProperty
+ */
+extern DECLSPEC int SDLCALL SDL_SetProperty(SDL_PropertiesID props, const char *name, void *value, void (SDLCALL *cleanup)(void *userdata, void *value), void *userdata);
+
+/**
+ * Get a property on a set of properties
+ *
+ * \param props the properties to query
+ * \param name the name of the property to query
+ *
+ * \returns the value of the property, or NULL if it is not set.
+ *
+ * \since This function is available since SDL 3.0.0.
+ *
+ * \sa SDL_SetProperty
+ */
+extern DECLSPEC void *SDLCALL SDL_GetProperty(SDL_PropertiesID props, const char *name);
+
+/**
+ * Destroy a set of properties
+ *
+ * All properties are deleted and their cleanup functions will be called, if any. The set of properties must be unlocked when it is destroyed.
+ *
+ * \param props the properties to destroy
+ *
+ * \since This function is available since SDL 3.0.0.
+ *
+ * \sa SDL_CreateProperties
+ */
+extern DECLSPEC void SDLCALL SDL_DestroyProperties(SDL_PropertiesID props);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include <SDL3/SDL_close_code.h>
+
+#endif /* SDL_properties_h_ */
diff --git a/src/SDL.c b/src/SDL.c
index f099b04826e8..31bd02ea4199 100644
--- a/src/SDL.c
+++ b/src/SDL.c
@@ -38,6 +38,7 @@
 
 #include "SDL_assert_c.h"
 #include "SDL_log_c.h"
+#include "SDL_properties_c.h"
 #include "audio/SDL_audio_c.h"
 #include "video/SDL_video_c.h"
 #include "events/SDL_events_c.h"
@@ -167,6 +168,7 @@ int SDL_InitSubSystem(Uint32 flags)
     }
 
     SDL_InitLog();
+    SDL_InitProperties();
 
     /* Clear the error message */
     SDL_ClearError();
@@ -499,6 +501,7 @@ void SDL_Quit(void)
     SDL_DBus_Quit();
 #endif
 
+    SDL_QuitProperties();
     SDL_QuitLog();
 
     /* Now that every subsystem has been quit, we reset the subsystem refcount
diff --git a/src/SDL_hashtable.c b/src/SDL_hashtable.c
index e4b301c54776..a5fc0f09e67b 100644
--- a/src/SDL_hashtable.c
+++ b/src/SDL_hashtable.c
@@ -18,7 +18,6 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
-
 #include "SDL_internal.h"
 #include "SDL_hashtable.h"
 
@@ -209,6 +208,21 @@ SDL_bool SDL_IterateHashTableKeys(const SDL_HashTable *table, const void **_key,
     return SDL_TRUE;
 }
 
+SDL_bool SDL_HashTableEmpty(SDL_HashTable *table)
+{
+    if (table != NULL) {
+        Uint32 i;
+
+        for (i = 0; i < table->table_len; i++) {
+            SDL_HashItem *item = table->table[i];
+            if (item != NULL) {
+                return SDL_FALSE;
+            }
+        }
+    }
+    return SDL_TRUE;
+}
+
 void SDL_DestroyHashTable(SDL_HashTable *table)
 {
     if (table != NULL) {
@@ -240,10 +254,10 @@ static SDL_INLINE Uint32 hash_string_djbxor(const char *str, size_t len)
     return hash;
 }
 
-Uint32 SDL_HashString(const void *sym, void *data)
+Uint32 SDL_HashString(const void *key, void *data)
 {
-    const char *str = (const char*) sym;
-    return hash_string_djbxor(str, SDL_strlen((const char *) str));
+    const char *str = (const char *)key;
+    return hash_string_djbxor(str, SDL_strlen(str));
 }
 
 SDL_bool SDL_KeyMatchString(const void *a, const void *b, void *data)
@@ -253,7 +267,21 @@ SDL_bool SDL_KeyMatchString(const void *a, const void *b, void *data)
     } else if (!a || !b) {
         return SDL_FALSE;  /* one pointer is NULL (and first test shows they aren't the same pointer), must not match. */
     }
-    return (SDL_strcmp((const char *) a, (const char *) b) == 0) ? SDL_TRUE : SDL_FALSE;  /* Check against actual string contents. */
+    return (SDL_strcmp((const char *)a, (const char *)b) == 0) ? SDL_TRUE : SDL_FALSE;  /* Check against actual string contents. */
+}
+
+/* We assume we can fit the ID in the key directly */
+SDL_COMPILE_TIME_ASSERT(SDL_HashI

(Patch may be truncated, please check the link at the top of this post.)