summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-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