sdlGetWindowBordersSize function

bool sdlGetWindowBordersSize(
  1. Pointer<SdlWindow> window,
  2. Pointer<Int32> top,
  3. Pointer<Int32> left,
  4. Pointer<Int32> bottom,
  5. Pointer<Int32> right,
)

Get the size of a window's borders (decorations) around the client area.

Note: If this function fails (returns false), the size values will be initialized to 0, 0, 0, 0 (if a non-NULL pointer is provided), as if the window in question was borderless.

Note: This function may fail on systems where the window has not yet been decorated by the display server (for example, immediately after calling SDL_CreateWindow). It is recommended that you wait at least until the window has been presented and composited, so that the window system has a chance to decorate the window and provide the border dimensions to SDL.

This function also returns false if getting the information is not supported.

\param window the window to query the size values of the border (decorations) from. \param top pointer to variable for storing the size of the top border; NULL is permitted. \param left pointer to variable for storing the size of the left border; NULL is permitted. \param bottom pointer to variable for storing the size of the bottom border; NULL is permitted. \param right pointer to variable for storing the size of the right border; NULL is permitted. \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

extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowBordersSize(SDL_Window *window, int *top, int *left, int *bottom, int *right)

Implementation

bool sdlGetWindowBordersSize(Pointer<SdlWindow> window, Pointer<Int32> top,
    Pointer<Int32> left, Pointer<Int32> bottom, Pointer<Int32> right) {
  final sdlGetWindowBordersSizeLookupFunction = libSdl3.lookupFunction<
      Uint8 Function(Pointer<SdlWindow> window, Pointer<Int32> top,
          Pointer<Int32> left, Pointer<Int32> bottom, Pointer<Int32> right),
      int Function(
          Pointer<SdlWindow> window,
          Pointer<Int32> top,
          Pointer<Int32> left,
          Pointer<Int32> bottom,
          Pointer<Int32> right)>('SDL_GetWindowBordersSize');
  return sdlGetWindowBordersSizeLookupFunction(
          window, top, left, bottom, right) ==
      1;
}