Add ability to set the clipboard. Update native with corresponding textedit change.
Fixes #6601.
This commit is contained in:
parent
f81b2c5785
commit
4dfe7b86fb
2 changed files with 12 additions and 1 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue