sdlSetClipboardText function
Put UTF-8 text into the clipboard.
\param text the text to store in the clipboard. \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_GetClipboardText \sa SDL_HasClipboardText
extern SDL_DECLSPEC bool SDLCALL SDL_SetClipboardText(const char *text)
Implementation
bool sdlSetClipboardText(String? text) {
final sdlSetClipboardTextLookupFunction = libSdl3.lookupFunction<
Uint8 Function(Pointer<Utf8> text),
int Function(Pointer<Utf8> text)>('SDL_SetClipboardText');
final textPointer = text != null ? text.toNativeUtf8() : nullptr;
final result = sdlSetClipboardTextLookupFunction(textPointer) == 1;
calloc.free(textPointer);
return result;
}