Document that video and input functions should be called on the main thread.

This is a hard requirement on Apple platforms and while most other platforms don't have a concept of main thread, all video and input functions should be called on the same thread.
This commit is contained in:
Sam Lantinga
2024-12-05 09:45:32 -08:00
parent fffa6c7a2b
commit bc4185c685
7 changed files with 407 additions and 103 deletions

View File

@@ -419,6 +419,8 @@ typedef Uint32 SDL_GLContextResetNotification;
*
* \returns the number of built in video drivers.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetVideoDriver
@@ -438,6 +440,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void);
* \param index the index of a video driver.
* \returns the name of the video driver with the given **index**.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetNumVideoDrivers
@@ -454,6 +458,8 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetVideoDriver(int index);
* \returns the name of the current video driver or NULL if no driver has been
* initialized.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetNumVideoDrivers
@@ -466,6 +472,8 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetCurrentVideoDriver(void);
*
* \returns the current system theme, light, dark, or unknown.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC SDL_SystemTheme SDLCALL SDL_GetSystemTheme(void);
@@ -479,6 +487,8 @@ extern SDL_DECLSPEC SDL_SystemTheme SDLCALL SDL_GetSystemTheme(void);
* call SDL_GetError() for more information. This should be freed
* with SDL_free() when it is no longer needed.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC SDL_DisplayID * SDLCALL SDL_GetDisplays(int *count);
@@ -489,6 +499,8 @@ extern SDL_DECLSPEC SDL_DisplayID * SDLCALL SDL_GetDisplays(int *count);
* \returns the instance ID of the primary display on success or 0 on failure;
* call SDL_GetError() for more information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetDisplays
@@ -517,6 +529,8 @@ extern SDL_DECLSPEC SDL_DisplayID SDLCALL SDL_GetPrimaryDisplay(void);
* \returns a valid property ID on success or 0 on failure; call
* SDL_GetError() for more information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetDisplayProperties(SDL_DisplayID displayID);
@@ -531,6 +545,8 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetDisplayProperties(SDL_Displa
* \returns the name of a display or NULL on failure; call SDL_GetError() for
* more information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetDisplays
@@ -547,6 +563,8 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetDisplayName(SDL_DisplayID displa
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetDisplayUsableBounds
@@ -571,6 +589,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetDisplayBounds(SDL_DisplayID displayID, S
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetDisplayBounds
@@ -585,6 +605,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetDisplayUsableBounds(SDL_DisplayID displa
* \returns the SDL_DisplayOrientation enum value of the display, or
* `SDL_ORIENTATION_UNKNOWN` if it isn't available.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetDisplays
@@ -598,6 +620,8 @@ extern SDL_DECLSPEC SDL_DisplayOrientation SDLCALL SDL_GetNaturalDisplayOrientat
* \returns the SDL_DisplayOrientation enum value of the display, or
* `SDL_ORIENTATION_UNKNOWN` if it isn't available.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetDisplays
@@ -616,6 +640,8 @@ extern SDL_DECLSPEC SDL_DisplayOrientation SDLCALL SDL_GetCurrentDisplayOrientat
* \returns the content scale of the display, or 0.0f on failure; call
* SDL_GetError() for more information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetDisplays
@@ -642,6 +668,8 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetDisplayContentScale(SDL_DisplayID displ
* single allocation that should be freed with SDL_free() when it is
* no longer needed.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetDisplays
@@ -670,6 +698,8 @@ extern SDL_DECLSPEC SDL_DisplayMode ** SDLCALL SDL_GetFullscreenDisplayModes(SDL
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetDisplays
@@ -689,6 +719,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetClosestFullscreenDisplayMode(SDL_Display
* \returns a pointer to the desktop display mode or NULL on failure; call
* SDL_GetError() for more information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetCurrentDisplayMode
@@ -708,6 +740,8 @@ extern SDL_DECLSPEC const SDL_DisplayMode * SDLCALL SDL_GetDesktopDisplayMode(SD
* \returns a pointer to the desktop display mode or NULL on failure; call
* SDL_GetError() for more information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetDesktopDisplayMode
@@ -722,6 +756,8 @@ extern SDL_DECLSPEC const SDL_DisplayMode * SDLCALL SDL_GetCurrentDisplayMode(SD
* \returns the instance ID of the display containing the point or 0 on
* failure; call SDL_GetError() for more information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetDisplayBounds
@@ -737,6 +773,8 @@ extern SDL_DECLSPEC SDL_DisplayID SDLCALL SDL_GetDisplayForPoint(const SDL_Point
* closest to the center of the rect on success or 0 on failure; call
* SDL_GetError() for more information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetDisplayBounds
@@ -752,6 +790,8 @@ extern SDL_DECLSPEC SDL_DisplayID SDLCALL SDL_GetDisplayForRect(const SDL_Rect *
* on success or 0 on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetDisplayBounds
@@ -770,6 +810,8 @@ extern SDL_DECLSPEC SDL_DisplayID SDLCALL SDL_GetDisplayForWindow(SDL_Window *wi
* \returns the pixel density or 0.0f on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetWindowDisplayScale
@@ -794,6 +836,8 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetWindowPixelDensity(SDL_Window *window);
* \returns the display scale, or 0.0f on failure; call SDL_GetError() for
* more information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC float SDLCALL SDL_GetWindowDisplayScale(SDL_Window *window);
@@ -823,6 +867,8 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetWindowDisplayScale(SDL_Window *window);
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetWindowFullscreenMode
@@ -838,6 +884,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowFullscreenMode(SDL_Window *window,
* \returns a pointer to the exclusive fullscreen mode to use or NULL for
* borderless fullscreen desktop mode.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_SetWindowFullscreenMode
@@ -854,6 +902,8 @@ extern SDL_DECLSPEC const SDL_DisplayMode * SDLCALL SDL_GetWindowFullscreenMode(
* SDL_GetError() for more information. This should be freed with
* SDL_free() when it is no longer needed.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC void * SDLCALL SDL_GetWindowICCProfile(SDL_Window *window, size_t *size);
@@ -866,6 +916,8 @@ extern SDL_DECLSPEC void * SDLCALL SDL_GetWindowICCProfile(SDL_Window *window, s
* SDL_PIXELFORMAT_UNKNOWN on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC SDL_PixelFormat SDLCALL SDL_GetWindowPixelFormat(SDL_Window *window);
@@ -880,6 +932,8 @@ extern SDL_DECLSPEC SDL_PixelFormat SDLCALL SDL_GetWindowPixelFormat(SDL_Window
* allocation that should be freed with SDL_free() when it is no
* longer needed.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC SDL_Window ** SDLCALL SDL_GetWindows(int *count);
@@ -959,6 +1013,8 @@ extern SDL_DECLSPEC SDL_Window ** SDLCALL SDL_GetWindows(int *count);
* \returns the window that was created or NULL on failure; call
* SDL_GetError() for more information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_CreateWindowAndRenderer
@@ -1019,6 +1075,8 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title, int
* \returns the window that was created or NULL on failure; call
* SDL_GetError() for more information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_CreateWindow
@@ -1137,6 +1195,8 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_CreatePopupWindow(SDL_Window *paren
* \returns the window that was created or NULL on failure; call
* SDL_GetError() for more information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_CreateProperties
@@ -1190,6 +1250,8 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_CreateWindowWithProperties(SDL_Prop
* \returns the ID of the window on success or 0 on failure; call
* SDL_GetError() for more information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetWindowFromID
@@ -1206,6 +1268,8 @@ extern SDL_DECLSPEC SDL_WindowID SDLCALL SDL_GetWindowID(SDL_Window *window);
* \returns the window associated with `id` or NULL if it doesn't exist; call
* SDL_GetError() for more information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetWindowID
@@ -1219,6 +1283,8 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetWindowFromID(SDL_WindowID id);
* \returns the parent of the window on success or NULL if the window has no
* parent.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_CreatePopupWindow
@@ -1341,6 +1407,8 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetWindowParent(SDL_Window *window)
* \returns a valid property ID on success or 0 on failure; call
* SDL_GetError() for more information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetWindowProperties(SDL_Window *window);
@@ -1387,6 +1455,8 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetWindowProperties(SDL_Window
* \param window the window to query.
* \returns a mask of the SDL_WindowFlags associated with `window`.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_CreateWindow
@@ -1409,6 +1479,8 @@ extern SDL_DECLSPEC SDL_WindowFlags SDLCALL SDL_GetWindowFlags(SDL_Window *windo
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetWindowTitle
@@ -1422,6 +1494,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowTitle(SDL_Window *window, const ch
* \returns the title of the window in UTF-8 format or "" if there is no
* title.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_SetWindowTitle
@@ -1446,6 +1520,8 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetWindowTitle(SDL_Window *window);
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowIcon(SDL_Window *window, SDL_Surface *icon);
@@ -1483,6 +1559,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowIcon(SDL_Window *window, SDL_Surfa
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetWindowPosition
@@ -1507,6 +1585,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowPosition(SDL_Window *window, int x
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_SetWindowPosition
@@ -1541,6 +1621,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowPosition(SDL_Window *window, int *
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetWindowSize
@@ -1562,6 +1644,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowSize(SDL_Window *window, int w, in
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetRenderOutputSize
@@ -1586,6 +1670,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowSize(SDL_Window *window, int *w, i
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowSafeArea(SDL_Window *window, SDL_Rect *rect);
@@ -1622,6 +1708,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowSafeArea(SDL_Window *window, SDL_R
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetWindowAspectRatio
@@ -1640,6 +1728,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowAspectRatio(SDL_Window *window, fl
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_SetWindowAspectRatio
@@ -1675,6 +1765,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowAspectRatio(SDL_Window *window, fl
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetWindowSize
@@ -1692,6 +1784,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowBordersSize(SDL_Window *window, in
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_CreateWindow
@@ -1708,6 +1802,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowSizeInPixels(SDL_Window *window, i
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetWindowMinimumSize
@@ -1726,6 +1822,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowMinimumSize(SDL_Window *window, in
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetWindowMaximumSize
@@ -1742,6 +1840,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowMinimumSize(SDL_Window *window, in
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetWindowMaximumSize
@@ -1760,6 +1860,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowMaximumSize(SDL_Window *window, in
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetWindowMinimumSize
@@ -1781,6 +1883,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowMaximumSize(SDL_Window *window, in
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetWindowFlags
@@ -1801,6 +1905,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowBordered(SDL_Window *window, bool
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetWindowFlags
@@ -1818,6 +1924,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowResizable(SDL_Window *window, bool
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetWindowFlags
@@ -1831,6 +1939,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowAlwaysOnTop(SDL_Window *window, bo
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_HideWindow
@@ -1845,6 +1955,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ShowWindow(SDL_Window *window);
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_ShowWindow
@@ -1866,6 +1978,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HideWindow(SDL_Window *window);
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_RaiseWindow(SDL_Window *window);
@@ -1894,6 +2008,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RaiseWindow(SDL_Window *window);
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_MinimizeWindow
@@ -1918,6 +2034,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_MaximizeWindow(SDL_Window *window);
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_MaximizeWindow
@@ -1943,6 +2061,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_MinimizeWindow(SDL_Window *window);
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_MaximizeWindow
@@ -1972,6 +2092,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RestoreWindow(SDL_Window *window);
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetWindowFullscreenMode
@@ -1998,6 +2120,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowFullscreen(SDL_Window *window, boo
* \returns true on success or false if the operation timed out before the
* window was in the requested state.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_SetWindowSize
@@ -2017,6 +2141,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SyncWindow(SDL_Window *window);
* \returns true if there is a surface associated with the window, or false
* otherwise.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetWindowSurface
@@ -2041,6 +2167,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WindowHasSurface(SDL_Window *window);
* \returns the surface associated with the window, or NULL on failure; call
* SDL_GetError() for more information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_DestroyWindowSurface
@@ -2068,6 +2196,8 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_GetWindowSurface(SDL_Window *windo
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetWindowSurfaceVSync
@@ -2086,6 +2216,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowSurfaceVSync(SDL_Window *window, i
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_SetWindowSurfaceVSync
@@ -2104,6 +2236,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowSurfaceVSync(SDL_Window *window, i
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetWindowSurface
@@ -2131,6 +2265,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_UpdateWindowSurface(SDL_Window *window);
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetWindowSurface
@@ -2145,6 +2281,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window *window
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetWindowSurface
@@ -2176,6 +2314,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_DestroyWindowSurface(SDL_Window *window);
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetWindowKeyboardGrab
@@ -2193,6 +2333,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowKeyboardGrab(SDL_Window *window, b
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetWindowMouseRect
@@ -2208,6 +2350,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowMouseGrab(SDL_Window *window, bool
* \param window the window to query.
* \returns true if keyboard is grabbed, and false otherwise.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_SetWindowKeyboardGrab
@@ -2220,6 +2364,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowKeyboardGrab(SDL_Window *window);
* \param window the window to query.
* \returns true if mouse is grabbed, and false otherwise.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetWindowMouseRect
@@ -2234,6 +2380,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowMouseGrab(SDL_Window *window);
*
* \returns the window if input is grabbed or NULL otherwise.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_SetWindowMouseGrab
@@ -2253,6 +2401,8 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetGrabbedWindow(void);
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetWindowMouseRect
@@ -2268,6 +2418,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowMouseRect(SDL_Window *window, cons
* \returns a pointer to the mouse confinement rectangle of a window, or NULL
* if there isn't one.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_SetWindowMouseRect
@@ -2289,6 +2441,8 @@ extern SDL_DECLSPEC const SDL_Rect * SDLCALL SDL_GetWindowMouseRect(SDL_Window *
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GetWindowOpacity
@@ -2305,6 +2459,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowOpacity(SDL_Window *window, float
* \returns the opacity, (0.0f - transparent, 1.0f - opaque), or -1.0f on
* failure; call SDL_GetError() for more information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_SetWindowOpacity
@@ -2337,6 +2493,8 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetWindowOpacity(SDL_Window *window);
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_SetWindowModal
@@ -2354,6 +2512,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowParent(SDL_Window *window, SDL_Win
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_SetWindowParent
@@ -2369,6 +2529,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowModal(SDL_Window *window, bool mod
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowFocusable(SDL_Window *window, bool focusable);
@@ -2393,6 +2555,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowFocusable(SDL_Window *window, bool
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_ShowWindowSystemMenu(SDL_Window *window, int x, int y);
@@ -2400,6 +2564,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ShowWindowSystemMenu(SDL_Window *window, in
/**
* Possible return values from the SDL_HitTest callback.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This enum is available since SDL 3.1.3.
*
* \sa SDL_HitTest
@@ -2470,6 +2636,8 @@ typedef SDL_HitTestResult (SDLCALL *SDL_HitTest)(SDL_Window *win,
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowHitTest(SDL_Window *window, SDL_HitTest callback, void *callback_data);
@@ -2496,6 +2664,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowHitTest(SDL_Window *window, SDL_Hi
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowShape(SDL_Window *window, SDL_Surface *shape);
@@ -2508,6 +2678,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowShape(SDL_Window *window, SDL_Surf
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_FlashWindow(SDL_Window *window, SDL_FlashOperation operation);
@@ -2520,6 +2692,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_FlashWindow(SDL_Window *window, SDL_FlashOp
*
* \param window the window to destroy.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_CreatePopupWindow
@@ -2538,6 +2712,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window *window);
*
* \returns true if the screensaver is enabled, false if it is disabled.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_DisableScreenSaver
@@ -2551,6 +2727,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ScreenSaverEnabled(void);
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_DisableScreenSaver
@@ -2570,6 +2748,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_EnableScreenSaver(void);
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_EnableScreenSaver
@@ -2598,6 +2778,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_DisableScreenSaver(void);
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GL_GetProcAddress
@@ -2650,6 +2832,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GL_LoadLibrary(const char *path);
* \returns a pointer to the named OpenGL function. The returned pointer
* should be cast to the appropriate function signature.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GL_ExtensionSupported
@@ -2669,6 +2853,8 @@ extern SDL_DECLSPEC SDL_FunctionPointer SDLCALL SDL_GL_GetProcAddress(const char
* \returns a pointer to the named EGL function. The returned pointer should
* be cast to the appropriate function signature.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_EGL_GetCurrentDisplay
@@ -2678,6 +2864,8 @@ extern SDL_DECLSPEC SDL_FunctionPointer SDLCALL SDL_EGL_GetProcAddress(const cha
/**
* Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GL_LoadLibrary
@@ -2701,6 +2889,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_GL_UnloadLibrary(void);
* \param extension the name of the extension to check.
* \returns true if the extension is supported, false otherwise.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_GL_ExtensionSupported(const char *extension);
@@ -2708,6 +2898,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GL_ExtensionSupported(const char *extension
/**
* Reset all previously set OpenGL context attributes to their default values.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GL_GetAttribute
@@ -2729,6 +2921,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_GL_ResetAttributes(void);
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GL_GetAttribute
@@ -2745,6 +2939,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GL_SetAttribute(SDL_GLAttr attr, int value)
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GL_ResetAttributes
@@ -2767,6 +2963,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GL_GetAttribute(SDL_GLAttr attr, int *value
* \returns the OpenGL context associated with `window` or NULL on failure;
* call SDL_GetError() for more information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GL_DestroyContext
@@ -2784,6 +2982,8 @@ extern SDL_DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window *windo
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GL_CreateContext
@@ -2796,6 +2996,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GL_MakeCurrent(SDL_Window *window, SDL_GLCo
* \returns the currently active OpenGL window on success or NULL on failure;
* call SDL_GetError() for more information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GL_GetCurrentWindow(void);
@@ -2806,6 +3008,8 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GL_GetCurrentWindow(void);
* \returns the currently active OpenGL context or NULL on failure; call
* SDL_GetError() for more information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GL_MakeCurrent
@@ -2818,6 +3022,8 @@ extern SDL_DECLSPEC SDL_GLContext SDLCALL SDL_GL_GetCurrentContext(void);
* \returns the currently active EGL display or NULL on failure; call
* SDL_GetError() for more information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC SDL_EGLDisplay SDLCALL SDL_EGL_GetCurrentDisplay(void);
@@ -2828,6 +3034,8 @@ extern SDL_DECLSPEC SDL_EGLDisplay SDLCALL SDL_EGL_GetCurrentDisplay(void);
* \returns the currently active EGL config or NULL on failure; call
* SDL_GetError() for more information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC SDL_EGLConfig SDLCALL SDL_EGL_GetCurrentConfig(void);
@@ -2839,6 +3047,8 @@ extern SDL_DECLSPEC SDL_EGLConfig SDLCALL SDL_EGL_GetCurrentConfig(void);
* \returns the EGLSurface pointer associated with the window, or NULL on
* failure.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC SDL_EGLSurface SDLCALL SDL_EGL_GetWindowSurface(SDL_Window *window);
@@ -2859,6 +3069,8 @@ extern SDL_DECLSPEC SDL_EGLSurface SDLCALL SDL_EGL_GetWindowSurface(SDL_Window *
* eglCreateContext. May be NULL.
* \param userdata a pointer that is passed to the callbacks.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC void SDLCALL SDL_EGL_SetAttributeCallbacks(SDL_EGLAttribArrayCallback platformAttribCallback,
@@ -2888,6 +3100,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_EGL_SetAttributeCallbacks(SDL_EGLAttribArra
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GL_GetSwapInterval
@@ -2907,6 +3121,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GL_SetSwapInterval(int interval);
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GL_SetSwapInterval
@@ -2927,6 +3143,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GL_GetSwapInterval(int *interval);
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_GL_SwapWindow(SDL_Window *window);
@@ -2938,6 +3156,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GL_SwapWindow(SDL_Window *window);
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_GL_CreateContext