sdlxGetTextInputArea function keyboard

bool sdlxGetTextInputArea(
  1. Pointer<SdlWindow> window,
  2. SdlxTextInputArea area
)

Get the area used to type Unicode text input.

This returns the values previously set by SDL_SetTextInputArea().

\param window the window for which to query the text input area. \param rect a pointer to an SDL_Rect filled in with the text input area, may be NULL. \param cursor a pointer to the offset of the current cursor location relative to rect->x, may be NULL. \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.2.0.

\sa SDL_SetTextInputArea

extern SDL_DECLSPEC bool SDLCALL SDL_GetTextInputArea(SDL_Window *window, SDL_Rect *rect, int *cursor)

Implementation

bool sdlxGetTextInputArea(Pointer<SdlWindow> window, SdlxTextInputArea area) {
  final rectPointer = area.rect.calloc();
  final cursorPointer = ffi.calloc<Int32>();
  final result = sdlGetTextInputArea(window, rectPointer, cursorPointer);
  if (result) {
    area.rect.loadFromPointer(rectPointer);
    area.cursor = cursorPointer.value;
  }
  cursorPointer.callocFree();
  rectPointer.callocFree();
  return result;
}