summaryrefslogtreecommitdiff
path: root/src/utils/copynpaste.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/copynpaste.cpp')
-rw-r--r--src/utils/copynpaste.cpp31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/utils/copynpaste.cpp b/src/utils/copynpaste.cpp
index 8bce3a4c0..b27768422 100644
--- a/src/utils/copynpaste.cpp
+++ b/src/utils/copynpaste.cpp
@@ -35,17 +35,32 @@
#include "utils/copynpaste.h"
+#include "debug.h"
+
+#ifdef USE_SDL2
+#include <SDL_clipboard.h>
+
+#else // USE_SDL2
+
+#if defined(__APPLE__)
+#ifdef Status
+#undef Status
+#endif
+#include <Carbon/Carbon.h>
+#elif defined USE_X11
#include "render/graphics.h"
#include "utils/sdlhelper.h"
#include <SDL_syswm.h>
+#include <unistd.h>
+#elif defined __native_client__
+#include "utils/naclmessages.h"
+#endif
-#include "debug.h"
+#endif // USE_SDL2
#ifdef USE_SDL2
-#include <SDL_clipboard.h>
-
bool retrieveBuffer(std::string& text, size_t& pos)
{
char *buf = SDL_GetClipboardText();
@@ -155,12 +170,6 @@ bool sendBuffer(const std::string &restrict text)
#elif defined(__APPLE__)
-#ifdef Status
-#undef Status
-#endif
-
-#include <Carbon/Carbon.h>
-
// Sorry for the very long code, all nicer OS X APIs are coded in
// Objective C and not C!
// Also it does very thorough error handling
@@ -300,8 +309,6 @@ bool sendBuffer(const std::string &restrict text)
#elif defined USE_X11
-#include <unistd.h>
-
static char* getSelection2(Display *const dpy, Window us, Atom selection,
Atom request_target)
{
@@ -472,8 +479,6 @@ static bool runxsel(const std::string &text, const char *p1, const char *p2)
#elif defined __native_client__
-#include "utils/naclmessages.h"
-
bool retrieveBuffer(std::string& text, size_t& pos)
{
NaclMessageHandle *handle = naclRegisterMessageHandler("clipboard-paste");