Only clear the clipboard if setting empty text
parent
f4bd17deee
commit
ddb817a1af
|
@ -276,18 +276,13 @@ int SDL_SetClipboardText(const char *text)
|
||||||
return SDL_SetError("Video subsystem must be initialized to set clipboard text");
|
return SDL_SetError("Video subsystem must be initialized to set clipboard text");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SDL_ClearClipboardData() < 0) {
|
if (text && *text) {
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!text || !*text) {
|
|
||||||
/* All done! */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
text_mime_types = SDL_GetTextMimeTypes(_this, &num_mime_types);
|
text_mime_types = SDL_GetTextMimeTypes(_this, &num_mime_types);
|
||||||
|
|
||||||
return SDL_SetClipboardData(SDL_ClipboardTextCallback, SDL_free, SDL_strdup(text), text_mime_types, num_mime_types);
|
return SDL_SetClipboardData(SDL_ClipboardTextCallback, SDL_free, SDL_strdup(text), text_mime_types, num_mime_types);
|
||||||
|
} else {
|
||||||
|
return SDL_ClearClipboardData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char *SDL_GetClipboardText(void)
|
char *SDL_GetClipboardText(void)
|
||||||
|
|
Loading…
Reference in New Issue