Added SDL_GetWindowParent() to get the parent of popup windows

This commit is contained in:
Sam Lantinga 2023-03-13 11:20:42 -07:00
parent ebe3a9dc44
commit 4dd26698fc
6 changed files with 24 additions and 0 deletions

View File

@ -15,6 +15,7 @@ General:
* Added SDL_GetSystemTheme() to return whether the system is using a dark or light color theme, and SDL_EVENT_SYSTEM_THEME_CHANGED is sent when this changes
* Added SDL_GetDisplays() to return a list of connected displays
* Added SDL_GetPrimaryDisplay() to get the instance ID of the primary display
* Added SDL_GetWindowParent() to get the parent of popup windows
* Added SDL_CreateSurface() and SDL_CreateSurfaceFrom() which replace SDL_CreateRGBSurface*(), and can also be used to create YUV surfaces
* Added SDL_GetJoysticks(), SDL_GetJoystickInstanceName(), SDL_GetJoystickInstancePath(), SDL_GetJoystickInstancePlayerIndex(), SDL_GetJoystickInstanceGUID(), SDL_GetJoystickInstanceVendor(), SDL_GetJoystickInstanceProduct(), SDL_GetJoystickInstanceProductVersion(), and SDL_GetJoystickInstanceType() to directly query the list of available joysticks
* Added SDL_GetGamepads(), SDL_GetGamepadInstanceName(), SDL_GetGamepadInstancePath(), SDL_GetGamepadInstancePlayerIndex(), SDL_GetGamepadInstanceGUID(), SDL_GetGamepadInstanceVendor(), SDL_GetGamepadInstanceProduct(), SDL_GetGamepadInstanceProductVersion(), and SDL_GetGamepadInstanceType() to directly query the list of available gamepads

View File

@ -711,6 +711,7 @@ extern DECLSPEC SDL_Window *SDLCALL SDL_CreateWindow(const char *title, int w, i
*
* \sa SDL_CreateWindow
* \sa SDL_DestroyWindow
* \sa SDL_GetWindowParent
*/
extern DECLSPEC SDL_Window *SDLCALL SDL_CreatePopupWindow(SDL_Window *parent, int offset_x, int offset_y, int w, int h, Uint32 flags);
@ -765,6 +766,18 @@ extern DECLSPEC SDL_WindowID SDLCALL SDL_GetWindowID(SDL_Window *window);
*/
extern DECLSPEC SDL_Window *SDLCALL SDL_GetWindowFromID(SDL_WindowID id);
/**
* Get parent of a window.
*
* \param window the window to query
* \returns the parent of the window on success or NULL if the window has no parent.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_CreatePopupWindow
*/
extern DECLSPEC SDL_Window *SDLCALL SDL_GetWindowParent(SDL_Window *window);
/**
* Get the window flags.
*

View File

@ -840,6 +840,7 @@ SDL3_0.0.0 {
SDL_GetRenderWindowSize;
SDL_GetSystemTheme;
SDL_CreatePopupWindow;
SDL_GetWindowParent;
# extra symbols go here (don't modify this line)
local: *;
};

View File

@ -867,3 +867,4 @@
#define SDL_GetRenderWindowSize SDL_GetRenderWindowSize_REAL
#define SDL_GetSystemTheme SDL_GetSystemTheme_REAL
#define SDL_CreatePopupWindow SDL_CreatePopupWindow_REAL
#define SDL_GetWindowParent SDL_GetWindowParent_REAL

View File

@ -912,3 +912,4 @@ SDL_DYNAPI_PROC(int,SDL_GetRenderScale,(SDL_Renderer *a, float *b, float *c),(a,
SDL_DYNAPI_PROC(int,SDL_GetRenderWindowSize,(SDL_Renderer *a, int *b, int *c),(a,b,c),return)
SDL_DYNAPI_PROC(SDL_SystemTheme,SDL_GetSystemTheme,(void),(),return)
SDL_DYNAPI_PROC(SDL_Window*,SDL_CreatePopupWindow,(SDL_Window *a, int b, int c, int d, int e, Uint32 f),(a,b,c,d,e,f),return)
SDL_DYNAPI_PROC(SDL_Window*,SDL_GetWindowParent,(SDL_Window *a),(a),return)

View File

@ -2191,6 +2191,13 @@ SDL_Window *SDL_GetWindowFromID(SDL_WindowID id)
return NULL;
}
SDL_Window *SDL_GetWindowParent(SDL_Window *window)
{
CHECK_WINDOW_MAGIC(window, NULL);
return window->parent;
}
Uint32 SDL_GetWindowFlags(SDL_Window *window)
{
CHECK_WINDOW_MAGIC(window, 0);