Add ability to set the clipboard. Update native with corresponding textedit change.

Fixes #6601.
This commit is contained in:
Henrik Rydgard 2014-07-21 17:36:25 +02:00
parent f81b2c5785
commit 4dfe7b86fb
2 changed files with 12 additions and 1 deletions

View File

@ -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();
}
}
}

2
native

@ -1 +1 @@
Subproject commit 6f6f6eb1fbe82b0b16dc54628cce231cda26255b
Subproject commit 9d8d64b321f6d8964066dd6ed83064a32969ec04