diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-08-24 23:56:02 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-08-24 23:56:02 +0300 |
commit | 948d940d46240ff518ec9b1037503bebdb47196a (patch) | |
tree | 553ea138e3bdcd4169d02abd817ac743ed121547 | |
parent | db523d927180ff84b952f2655ceae93e0239a545 (diff) | |
download | manaverse-948d940d46240ff518ec9b1037503bebdb47196a.tar.gz manaverse-948d940d46240ff518ec9b1037503bebdb47196a.tar.bz2 manaverse-948d940d46240ff518ec9b1037503bebdb47196a.tar.xz manaverse-948d940d46240ff518ec9b1037503bebdb47196a.zip |
add clipboard support in SDL2.
-rw-r--r-- | src/utils/copynpaste.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/utils/copynpaste.cpp b/src/utils/copynpaste.cpp index 86b5a668c..9684ebf7a 100644 --- a/src/utils/copynpaste.cpp +++ b/src/utils/copynpaste.cpp @@ -43,6 +43,27 @@ #include "debug.h" +#ifdef USE_SDL2 +bool retrieveBuffer(std::string& text, size_t& pos) +{ + char *buf = SDL_GetClipboardText(); + if (buf) + { + text.insert(pos, buf); + pos += strlen(buf); + SDL_free(buf); + return true; + } + return false; +} + +bool sendBuffer(std::string& text) +{ + return !SDL_SetClipboardText(text.c_str()); +} + +#else + #ifdef WIN32 bool retrieveBuffer(std::string& text, size_t& pos) { @@ -455,3 +476,4 @@ bool sendBuffer(std::string& text A_UNUSED) return false; } #endif +#endif // USE_SDL2 |