summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-08-24 23:56:02 +0300
committerAndrei Karas <akaras@inbox.ru>2013-08-24 23:56:02 +0300
commit948d940d46240ff518ec9b1037503bebdb47196a (patch)
tree553ea138e3bdcd4169d02abd817ac743ed121547
parentdb523d927180ff84b952f2655ceae93e0239a545 (diff)
downloadplus-948d940d46240ff518ec9b1037503bebdb47196a.tar.gz
plus-948d940d46240ff518ec9b1037503bebdb47196a.tar.bz2
plus-948d940d46240ff518ec9b1037503bebdb47196a.tar.xz
plus-948d940d46240ff518ec9b1037503bebdb47196a.zip
add clipboard support in SDL2.
-rw-r--r--src/utils/copynpaste.cpp22
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