aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/sdl/sdl.cpp
diff options
context:
space:
mode:
authorThierry Crozat2018-04-10 23:41:10 +0100
committerThierry Crozat2018-04-29 21:47:10 +0100
commit3fe0e3c38ee63534486a4353cdab1cfc76dab74f (patch)
tree99511156232ea131938e8fa83807c675862f23e3 /backends/platform/sdl/sdl.cpp
parenta23216fbfcbe5b345f27d648775e6da6780e4dbd (diff)
downloadscummvm-rg350-3fe0e3c38ee63534486a4353cdab1cfc76dab74f.tar.gz
scummvm-rg350-3fe0e3c38ee63534486a4353cdab1cfc76dab74f.tar.bz2
scummvm-rg350-3fe0e3c38ee63534486a4353cdab1cfc76dab74f.zip
OSYSTEM: Add API to copy text to clipboard
This has also been implemented for the SDL2 and macOS backends.
Diffstat (limited to 'backends/platform/sdl/sdl.cpp')
-rw-r--r--backends/platform/sdl/sdl.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index 3082a69ebf..8a60e9231b 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -513,6 +513,15 @@ Common::String OSystem_SDL::getTextFromClipboard() {
#endif
}
+bool OSystem_SDL::setTextInClipboard(const Common::String &text) {
+#if SDL_VERSION_ATLEAST(2, 0, 0)
+ // FIXME: The string we get from SDL is in UTF-8 and should probably be converted.
+ return SDL_SetClipboardText(text.c_str()) == 0;
+#else
+ return false;
+#endif
+}
+
uint32 OSystem_SDL::getMillis(bool skipRecord) {
uint32 millis = SDL_GetTicks();