From 4dfe7b86fb5be55c1665f2f36bad58a18774bd23 Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Mon, 21 Jul 2014 17:36:25 +0200 Subject: [PATCH] Add ability to set the clipboard. Update native with corresponding textedit change. Fixes #6601. --- Windows/main.cpp | 11 +++++++++++ native | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Windows/main.cpp b/Windows/main.cpp index a398364c8..e61b4742b 100644 --- a/Windows/main.cpp +++ b/Windows/main.cpp @@ -191,6 +191,17 @@ int System_GetPropertyInt(SystemProperty prop) { void System_SendMessage(const char *command, const char *parameter) { if (!strcmp(command, "finish")) { PostMessage(MainWindow::GetHWND(), WM_CLOSE, 0, 0); + } else if (!strcmp(command, "setclipboardtext")) { + if (OpenClipboard(MainWindow::GetDisplayHWND())) { + std::wstring data = ConvertUTF8ToWString(parameter); + HANDLE handle = GlobalAlloc(GMEM_MOVEABLE, (data.size() + 1) * sizeof(wchar_t)); + wchar_t *wstr = (wchar_t *)GlobalLock(handle); + memcpy(wstr, data.c_str(), (data.size() + 1) * sizeof(wchar_t)); + GlobalUnlock(wstr); + SetClipboardData(CF_UNICODETEXT, handle); + GlobalFree(handle); + CloseClipboard(); + } } } diff --git a/native b/native index 6f6f6eb1f..9d8d64b32 160000 --- a/native +++ b/native @@ -1 +1 @@ -Subproject commit 6f6f6eb1fbe82b0b16dc54628cce231cda26255b +Subproject commit 9d8d64b321f6d8964066dd6ed83064a32969ec04