sdlxGetTextInputArea function keyboard

({int cursor, SdlxRect rect})? sdlxGetTextInputArea(
  1. Pointer<SdlWindow> window
)

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

({int cursor, SdlxRect rect})? sdlxGetTextInputArea(Pointer<SdlWindow> window) {
  SdlxRect? rect;
  int? cursor;
  final rectPointer = ffi.calloc<SdlRect>();
  final cursorPointer = ffi.calloc<Int32>();
  final bl = sdlGetTextInputArea(window, rectPointer, cursorPointer);
  if (bl) {
    rect = SdlxRect()..loadFromPointer(rectPointer);
    cursor = cursorPointer.value;
  }
  cursorPointer.callocFree();
  rectPointer.callocFree();
  if (!bl) {
    return null;
  }
  return (cursor: cursor!, rect: rect!);
}