SDL_GetWindows() follows the SDL_GetStringRule

This commit is contained in:
Sam Lantinga 2024-07-18 08:30:50 -07:00
parent 8ca6caeda5
commit bdafc8e212
4 changed files with 8 additions and 9 deletions

View File

@ -791,15 +791,15 @@ extern SDL_DECLSPEC SDL_PixelFormat SDLCALL SDL_GetWindowPixelFormat(SDL_Window
/**
* Get a list of valid windows.
*
* The returned array follows the SDL_GetStringRule, and will be automatically freed later.
*
* \param count a pointer filled in with the number of windows returned, may
* be NULL.
* \returns a 0 terminated array of window pointers which should be freed with
* SDL_free(), or NULL on error; call SDL_GetError() for more
* details.
* \returns a NULL terminated array of SDL_Window pointers or NULL on failure; call SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC SDL_Window **SDLCALL SDL_GetWindows(int *count);
extern SDL_DECLSPEC SDL_Window * const *SDLCALL SDL_GetWindows(int *count);
/**
* Create a window with the specified dimensions and flags.

View File

@ -533,7 +533,7 @@ SDL_DYNAPI_PROC(int,SDL_GetWindowSizeInPixels,(SDL_Window *a, int *b, int *c),(a
SDL_DYNAPI_PROC(SDL_Surface*,SDL_GetWindowSurface,(SDL_Window *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_GetWindowSurfaceVSync,(SDL_Window *a, int *b),(a,b),return)
SDL_DYNAPI_PROC(const char*,SDL_GetWindowTitle,(SDL_Window *a),(a),return)
SDL_DYNAPI_PROC(SDL_Window**,SDL_GetWindows,(int *a),(a),return)
SDL_DYNAPI_PROC(SDL_Window* const*,SDL_GetWindows,(int *a),(a),return)
SDL_DYNAPI_PROC(const char * const *,SDL_GlobDirectory,(const char *a, const char *b, SDL_GlobFlags c, int *d),(a,b,c,d),return)
SDL_DYNAPI_PROC(const char * const *,SDL_GlobStorageDirectory,(SDL_Storage *a, const char *b, const char *c, SDL_GlobFlags d, int *e),(a,b,c,d,e),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_HapticEffectSupported,(SDL_Haptic *a, const SDL_HapticEffect *b),(a,b),return)

View File

@ -2056,7 +2056,7 @@ void SDL_ToggleDragAndDropSupport(void)
}
}
SDL_Window **SDLCALL SDL_GetWindows(int *count)
SDL_Window * const *SDLCALL SDL_GetWindows(int *count)
{
if (count) {
*count = 0;
@ -2091,7 +2091,7 @@ SDL_Window **SDLCALL SDL_GetWindows(int *count)
if (count) {
*count = num_added;
}
return windows;
return SDL_FreeLater(windows);
}
static void ApplyWindowFlags(SDL_Window *window, SDL_WindowFlags flags)

View File

@ -13,7 +13,7 @@
static SDL_Window *createVideoSuiteTestWindow(const char *title)
{
SDL_Window *window;
SDL_Window **windows;
SDL_Window * const *windows;
SDL_Event event;
int w, h;
int count;
@ -34,7 +34,6 @@ static SDL_Window *createVideoSuiteTestWindow(const char *title)
windows = SDL_GetWindows(&count);
SDLTest_AssertCheck(windows != NULL, "Validate that returned window list is not NULL");
SDLTest_AssertCheck(windows[0] == window, "Validate that the window is first in the window list");
SDL_free(windows);
/* Wayland and XWayland windows require that a frame be presented before they are fully mapped and visible onscreen.
* This is required for the mouse/keyboard grab tests to pass.