Offer clipboard data to the OS.
Defined in <SDL3/SDL_clipboard.h>
bool SDL_SetClipboardData(SDL_ClipboardDataCallback callback, SDL_ClipboardCleanupCallback cleanup, void *userdata, const char *const *mime_types, size_t num_mime_types);| SDL_ClipboardDataCallback | callback | a function pointer to the function that provides the clipboard data. |
| SDL_ClipboardCleanupCallback | cleanup | a function pointer to the function that cleans up the clipboard data. |
| void * | userdata | an opaque pointer that will be forwarded to the callbacks. |
| const char *const * | mime_types | a list of mime-types that are being offered. SDL copies the given list. |
| size_t | num_mime_types | the number of mime-types in the mime_types list. |
(bool) Returns true on success or false on failure; call SDL_GetError() for more information.
Tell the operating system that the application is offering clipboard data for each of the provided mime-types. Once another application requests the data the callback function will be called, allowing it to generate and respond with the data for the requested mime-type.
The size of text data does not include any terminator, and the text does not need to be null-terminated (e.g., you can directly copy a portion of a document).
When the function returns success, the data passed to the function should remain valid until the cleanup callback is invoked. If no cleanup callback was provided, then the data should remain valid until the clipboard is cleared with SDL_ClearClipboardData(), or a subsequent successful call to SDL_SetClipboardData() replaces the existing clipboard data.
On failure, the passed cleanup callback will be called, and no references to the data passed to the function are kept.
This function should only be called on the main thread.
This function is available since SDL 3.2.0.