diff options
author | Cameron Cawley | 2019-09-19 22:20:08 +0100 |
---|---|---|
committer | Filippos Karapetis | 2019-09-21 22:16:01 +0300 |
commit | 014bef9eab9fb409cfb3ec66830e033e4aaa29a9 (patch) | |
tree | 1d4dedd703446cbf1cb90a279fc186cc293f1486 /backends | |
parent | bdd7b6baedea7455fdc1754f7c7b49fef201cc2a (diff) | |
download | scummvm-rg350-014bef9eab9fb409cfb3ec66830e033e4aaa29a9.tar.gz scummvm-rg350-014bef9eab9fb409cfb3ec66830e033e4aaa29a9.tar.bz2 scummvm-rg350-014bef9eab9fb409cfb3ec66830e033e4aaa29a9.zip |
BACKENDS: Add a default clipboard implementation
Diffstat (limited to 'backends')
-rw-r--r-- | backends/platform/sdl/sdl.cpp | 14 | ||||
-rw-r--r-- | backends/platform/sdl/sdl.h | 2 |
2 files changed, 4 insertions, 12 deletions
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index 39933cc94c..b799d6a026 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -457,18 +457,14 @@ Common::String OSystem_SDL::getSystemLanguage() const { #endif // USE_DETECTLANG } -bool OSystem_SDL::hasTextInClipboard() { #if SDL_VERSION_ATLEAST(2, 0, 0) +bool OSystem_SDL::hasTextInClipboard() { return SDL_HasClipboardText() == SDL_TRUE; -#else - return false; -#endif } Common::String OSystem_SDL::getTextFromClipboard() { if (!hasTextInClipboard()) return ""; -#if SDL_VERSION_ATLEAST(2, 0, 0) char *text = SDL_GetClipboardText(); // The string returned by SDL is in UTF-8. Convert to the // current TranslationManager encoding or ISO-8859-1. @@ -485,13 +481,9 @@ Common::String OSystem_SDL::getTextFromClipboard() { SDL_free(text); return strText; -#else - return ""; -#endif } bool OSystem_SDL::setTextInClipboard(const Common::String &text) { -#if SDL_VERSION_ATLEAST(2, 0, 0) // The encoding we need to use is UTF-8. Assume we currently have the // current TranslationManager encoding or ISO-8859-1. #ifdef USE_TRANSLATION @@ -505,10 +497,8 @@ bool OSystem_SDL::setTextInClipboard(const Common::String &text) { return status == 0; } return SDL_SetClipboardText(text.c_str()) == 0; -#else - return false; -#endif } +#endif uint32 OSystem_SDL::getMillis(bool skipRecord) { uint32 millis = SDL_GetTicks(); diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h index ccbaeddb6d..d2912cbeb8 100644 --- a/backends/platform/sdl/sdl.h +++ b/backends/platform/sdl/sdl.h @@ -69,10 +69,12 @@ public: virtual Common::String getSystemLanguage() const; +#if SDL_VERSION_ATLEAST(2, 0, 0) // Clipboard virtual bool hasTextInClipboard(); virtual Common::String getTextFromClipboard(); virtual bool setTextInClipboard(const Common::String &text); +#endif virtual void setWindowCaption(const char *caption); virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0); |