SDL 2.0
SDL_clipboard.h File Reference
#include "SDL_stdinc.h"
#include "begin_code.h"
#include "close_code.h"
+ Include dependency graph for SDL_clipboard.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int SDL_SetClipboardText (const char *text)
 Put UTF-8 text into the clipboard. More...
 
char * SDL_GetClipboardText (void)
 Get UTF-8 text from the clipboard, which must be freed with SDL_free() More...
 
SDL_bool SDL_HasClipboardText (void)
 Returns a flag indicating whether the clipboard exists and contains a text string that is non-empty. More...
 

Detailed Description

Include file for SDL clipboard handling

Definition in file SDL_clipboard.h.

Function Documentation

◆ SDL_GetClipboardText()

char * SDL_GetClipboardText ( void  )

Get UTF-8 text from the clipboard, which must be freed with SDL_free()

See also
SDL_SetClipboardText()

Definition at line 49 of file SDL_clipboard.c.

50{
52
53 if (!_this) {
54 SDL_SetError("Video subsystem must be initialized to get clipboard text");
55 return SDL_strdup("");
56 }
57
60 } else {
61 const char *text = _this->clipboard_text;
62 if (!text) {
63 text = "";
64 }
65 return SDL_strdup(text);
66 }
67}
#define SDL_SetError
#define SDL_strdup
SDL_VideoDevice * SDL_GetVideoDevice(void)
Definition: SDL_video.c:583
static SDL_VideoDevice * _this
Definition: SDL_video.c:118
char *(* GetClipboardText)(_THIS)
Definition: SDL_sysvideo.h:299
char * clipboard_text
Definition: SDL_sysvideo.h:321
static char text[MAX_TEXT_LENGTH]
Definition: testime.c:47

References _this, SDL_VideoDevice::clipboard_text, SDL_VideoDevice::GetClipboardText, SDL_GetVideoDevice(), SDL_SetError, SDL_strdup, and text.

◆ SDL_HasClipboardText()

SDL_bool SDL_HasClipboardText ( void  )

Returns a flag indicating whether the clipboard exists and contains a text string that is non-empty.

See also
SDL_GetClipboardText()

Definition at line 131 of file SDL_dynapi_procs.h.

References _this, SDL_VideoDevice::clipboard_text, SDL_VideoDevice::HasClipboardText, SDL_FALSE, SDL_GetVideoDevice(), SDL_SetError, and SDL_TRUE.

◆ SDL_SetClipboardText()

int SDL_SetClipboardText ( const char *  text)

Put UTF-8 text into the clipboard.

See also
SDL_GetClipboardText()

Definition at line 28 of file SDL_clipboard.c.

29{
31
32 if (!_this) {
33 return SDL_SetError("Video subsystem must be initialized to set clipboard text");
34 }
35
36 if (!text) {
37 text = "";
38 }
41 } else {
44 return 0;
45 }
46}
#define SDL_free
int(* SetClipboardText)(_THIS, const char *text)
Definition: SDL_sysvideo.h:298

References _this, SDL_VideoDevice::clipboard_text, SDL_free, SDL_GetVideoDevice(), SDL_SetError, SDL_strdup, SDL_VideoDevice::SetClipboardText, and text.