SDL_SetClipboardData(3)

SDL_SetClipboardData3

Offer clipboard data to the os.

Usage

#include "SDL3/SDL.h"

bool SDL_SetClipboardData(SDL_ClipboardDataCallback callback, SDL_ClipboardCleanupCallback cleanup, void *userdata, const char **mime_types, size_t num_mime_types);

Header file

Defined in SDL3/SDL_clipboard.h

Overview

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).

Function parameters

callback

a function pointer to the function that provides the clipboard data.

cleanup

a function pointer to the function that cleans up the clipboard data.

userdata

an opaque pointer that will be forwarded to the callbacks.

mime_types

a list of mime-types that are being offered.

num_mime_types

the number of mime-types in the mime_types list.

Return value

Returns true on success or false on failure; call

SDL_GetError () for more information.

Thread safety

This function should only be called on the main thread.

Availability

This function is available since SDL 3.2.0.

From libsdl3-doc 3.2.10+ds-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.