mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-04 14:49:40 +00:00
Added SDL_GetWindows()
This commit is contained in:
@@ -480,6 +480,7 @@ SDL3_0.0.0 {
|
||||
SDL_GetWindowSurface;
|
||||
SDL_GetWindowSurfaceVSync;
|
||||
SDL_GetWindowTitle;
|
||||
SDL_GetWindows;
|
||||
SDL_GlobDirectory;
|
||||
SDL_GlobStorageDirectory;
|
||||
SDL_HapticEffectSupported;
|
||||
|
||||
@@ -505,6 +505,7 @@
|
||||
#define SDL_GetWindowSurface SDL_GetWindowSurface_REAL
|
||||
#define SDL_GetWindowSurfaceVSync SDL_GetWindowSurfaceVSync_REAL
|
||||
#define SDL_GetWindowTitle SDL_GetWindowTitle_REAL
|
||||
#define SDL_GetWindows SDL_GetWindows_REAL
|
||||
#define SDL_GlobDirectory SDL_GlobDirectory_REAL
|
||||
#define SDL_GlobStorageDirectory SDL_GlobStorageDirectory_REAL
|
||||
#define SDL_HapticEffectSupported SDL_HapticEffectSupported_REAL
|
||||
|
||||
@@ -525,6 +525,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(char**,SDL_GlobDirectory,(const char *a, const char *b, SDL_GlobFlags c, int *d),(a,b,c,d),return)
|
||||
SDL_DYNAPI_PROC(char**,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)
|
||||
|
||||
@@ -1999,6 +1999,44 @@ void SDL_ToggleDragAndDropSupport(void)
|
||||
}
|
||||
}
|
||||
|
||||
SDL_Window **SDLCALL SDL_GetWindows(int *count)
|
||||
{
|
||||
if (count) {
|
||||
*count = 0;
|
||||
}
|
||||
|
||||
if (!_this) {
|
||||
SDL_UninitializedVideo();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SDL_Window *window;
|
||||
int num_added = 0;
|
||||
int num_windows = 0;
|
||||
for (window = _this->windows; window; window = window->next) {
|
||||
++num_windows;
|
||||
}
|
||||
|
||||
SDL_Window **windows = SDL_malloc((num_windows + 1) * sizeof(*windows));
|
||||
if (!windows) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (window = _this->windows; window; window = window->next) {
|
||||
windows[num_added++] = window;
|
||||
if (num_added == num_windows) {
|
||||
// Race condition? Multi-threading not supported, ignore it
|
||||
break;
|
||||
}
|
||||
}
|
||||
windows[num_added] = NULL;
|
||||
|
||||
if (count) {
|
||||
*count = num_added;
|
||||
}
|
||||
return windows;
|
||||
}
|
||||
|
||||
static void ApplyWindowFlags(SDL_Window *window, SDL_WindowFlags flags)
|
||||
{
|
||||
if (!SDL_WINDOW_IS_POPUP(window)) {
|
||||
@@ -3955,7 +3993,7 @@ SDL_bool SDL_ScreenSaverEnabled(void)
|
||||
int SDL_EnableScreenSaver(void)
|
||||
{
|
||||
if (!_this) {
|
||||
return 0;
|
||||
return SDL_UninitializedVideo();
|
||||
}
|
||||
if (!_this->suspend_screensaver) {
|
||||
return 0;
|
||||
@@ -3971,7 +4009,7 @@ int SDL_EnableScreenSaver(void)
|
||||
int SDL_DisableScreenSaver(void)
|
||||
{
|
||||
if (!_this) {
|
||||
return 0;
|
||||
return SDL_UninitializedVideo();
|
||||
}
|
||||
if (_this->suspend_screensaver) {
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user