---
name: "SDL_SetClipboardData"
section: "3"
platform: "linux"
package: "libsdl3-doc"
version: "3.2.10+ds-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_SetClipboardData"
---

# SDL\_SetClipboardData(3)

Offer clipboard data to the OS.

## NAME

SDL\_SetClipboardData - Offer clipboard data to the OS.

## HEADER FILE

Defined in SDL3/SDL\_clipboard.h

## SYNOPSIS

```
#include "SDL3/SDL.h"
```

**bool SDL\_SetClipboardData(SDL\_ClipboardDataCallback callback, SDL\_ClipboardCleanupCallback cleanup, void \*userdata, const char \*\*mime\_types, size\_t num\_mime\_types);**

## DESCRIPTION

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.

## SEE ALSO

**•**(3), [**SDL\_ClearClipboardData**(3)](/SDL_ClearClipboardData/3.md), **•**(3), [**SDL\_GetClipboardData**(3)](/SDL_GetClipboardData/3.md), **•**(3), [**SDL\_HasClipboardData**(3)](/SDL_HasClipboardData/3.md)
