Add read-clipboard support (for TextEdit)

This commit is contained in:
Henrik Rydgard 2014-07-21 11:59:47 +02:00
parent 399d71373f
commit 590724ea5c
3 changed files with 16 additions and 5 deletions

View File

@ -389,7 +389,7 @@ void GameSettingsScreen::CreateViews() {
systemSettings->Add(new CheckBox(&g_Config.bEnableWlan, s->T("Enable networking", "Enable networking/wlan (beta)")));
#ifdef _WIN32
systemSettings->Add(new PopupTextInputChoice(&g_Config.proAdhocServer, s->T("Change proAdhocServer Address"), "", screenManager()));
systemSettings->Add(new PopupTextInputChoice(&g_Config.proAdhocServer, s->T("Change proAdhocServer Address"), "", 255, screenManager()));
#else
systemSettings->Add(new ChoiceWithValueDisplay(&g_Config.proAdhocServer, s->T("Change proAdhocServer Address")))->OnClick.Handle(this, &GameSettingsScreen::OnChangeproAdhocServerAddress);
#endif
@ -409,7 +409,7 @@ void GameSettingsScreen::CreateViews() {
// TODO: Come up with a way to display a keyboard for mobile users,
// so until then, this is Windows/Desktop only.
#if defined(_WIN32) // TODO: Add all platforms where KEY_CHAR support is added
systemSettings->Add(new PopupTextInputChoice(&g_Config.sNickName, s->T("Change Nickname"), "", screenManager()));
systemSettings->Add(new PopupTextInputChoice(&g_Config.sNickName, s->T("Change Nickname"), "", 32, screenManager()));
#elif defined(USING_QT_UI)
systemSettings->Add(new Choice(s->T("Change Nickname")))->OnClick.Handle(this, &GameSettingsScreen::OnChangeNickname);
#endif

View File

@ -164,6 +164,18 @@ std::string System_GetProperty(SystemProperty prop) {
return osName;
case SYSPROP_LANGREGION:
return langRegion;
case SYSPROP_CLIPBOARD_TEXT:
{
std::string retval;
if (OpenClipboard(MainWindow::GetDisplayHWND())) {
HANDLE handle = GetClipboardData(CF_UNICODETEXT);
const wchar_t *wstr = (const wchar_t*)GlobalLock(handle);
retval = ConvertWStringToUTF8(wstr);
GlobalUnlock(handle);
CloseClipboard();
}
return retval;
}
default:
return "";
}
@ -179,8 +191,7 @@ void System_SendMessage(const char *command, const char *parameter) {
}
}
void EnableCrashingOnCrashes()
{
void EnableCrashingOnCrashes() {
typedef BOOL (WINAPI *tGetPolicy)(LPDWORD lpFlags);
typedef BOOL (WINAPI *tSetPolicy)(DWORD dwFlags);
const DWORD EXCEPTION_SWALLOWING = 0x1;

2
native

@ -1 +1 @@
Subproject commit a4a17415a7f12d15eb37f57181df97d46e239531
Subproject commit 6f6f6eb1fbe82b0b16dc54628cce231cda26255b