From 427d5f821e736674b510cd80f02944a8c18d429e Mon Sep 17 00:00:00 2001 From: Cameron Cawley Date: Wed, 15 May 2019 22:29:40 +0100 Subject: [PATCH 1/2] SDL: Implement clipboard support --- SDL/SDLMain.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SDL/SDLMain.cpp b/SDL/SDLMain.cpp index bab2d1bb5d..b653c1ae57 100644 --- a/SDL/SDLMain.cpp +++ b/SDL/SDLMain.cpp @@ -118,6 +118,8 @@ void System_SendMessage(const char *command, const char *parameter) { } else if (!strcmp(command, "graphics_restart")) { // Not sure how we best do this, but do a clean exit, better than being stuck in a bad state. g_QuitRequested = true; + } else if (!strcmp(command, "setclipboardtext")) { + SDL_SetClipboardText(parameter); } } @@ -207,6 +209,8 @@ std::string System_GetProperty(SystemProperty prop) { } return "en_US"; } + case SYSPROP_CLIPBOARD_TEXT: + return SDL_HasClipboardText() ? SDL_GetClipboardText() : ""; default: return ""; } From c648c790ac78abb8e84700cc0b86f8f4cd3e599d Mon Sep 17 00:00:00 2001 From: Cameron Cawley Date: Wed, 15 May 2019 22:31:05 +0100 Subject: [PATCH 2/2] Qt: Implement clipboard support --- Qt/QtMain.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Qt/QtMain.cpp b/Qt/QtMain.cpp index e6e311f0e0..f8cafb0bc6 100644 --- a/Qt/QtMain.cpp +++ b/Qt/QtMain.cpp @@ -6,6 +6,7 @@ // Currently supports: Android, Linux, Windows, Mac OSX #include +#include #include #include #include @@ -67,6 +68,8 @@ std::string System_GetProperty(SystemProperty prop) { #endif case SYSPROP_LANGREGION: return QLocale::system().name().toStdString(); + case SYSPROP_CLIPBOARD_TEXT: + return QApplication::clipboard()->text().toStdString(); default: return ""; } @@ -122,6 +125,8 @@ void System_SendMessage(const char *command, const char *parameter) { } else if (!strcmp(command, "graphics_restart")) { // Should find a way to properly restart the app. qApp->exit(0); + } else if (!strcmp(command, "setclipboardtext")) { + QApplication::clipboard()->setText(parameter); } }