sdlSetWindowParent function

bool sdlSetWindowParent(
  1. Pointer<SdlWindow> window,
  2. Pointer<SdlWindow> parent
)

Set the window as a child of a parent window.

If the window is already the child of an existing window, it will be reparented to the new owner. Setting the parent window to NULL unparents the window and removes child window status.

If a parent window is hidden or destroyed, the operation will be recursively applied to child windows. Child windows hidden with the parent that did not have their hidden status explicitly set will be restored when the parent is shown.

Attempting to set the parent of a window that is currently in the modal state will fail. Use SDL_SetWindowModal() to cancel the modal status before attempting to change the parent.

Popup windows cannot change parents and attempts to do so will fail.

Setting a parent window that is currently the sibling or descendent of the child window results in undefined behavior.

\param window the window that should become the child of a parent. \param parent the new parent window for the child 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

extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowParent(SDL_Window *window, SDL_Window *parent)

Implementation

bool sdlSetWindowParent(Pointer<SdlWindow> window, Pointer<SdlWindow> parent) {
  final sdlSetWindowParentLookupFunction = libSdl3.lookupFunction<
      Uint8 Function(Pointer<SdlWindow> window, Pointer<SdlWindow> parent),
      int Function(Pointer<SdlWindow> window,
          Pointer<SdlWindow> parent)>('SDL_SetWindowParent');
  return sdlSetWindowParentLookupFunction(window, parent) == 1;
}