Win32 Text input in sync

This commit is contained in:
Jack Andersen 2015-12-27 14:02:16 -10:00
parent 52692b0459
commit 30fd4c0709
2 changed files with 4 additions and 23 deletions

View File

@ -267,8 +267,8 @@ public:
case WM_NCMOUSELEAVE:
case WM_MOUSEHOVER:
case WM_NCMOUSEHOVER:
case WM_CHAR:
case WM_UNICHAR:
case WM_IME_COMPOSITION:
window->_incomingEvent(&HWNDEvent(uMsg, wParam, lParam));
default:

View File

@ -877,11 +877,11 @@ public:
{
if (!coord)
{
_immSetOpenStatus(false);
//_immSetOpenStatus(false);
return;
}
_immSetCompositionWindow(coord);
_immSetOpenStatus(true);
//_immSetOpenStatus(true);
}
bool clipboardCopy(EClipboardType type, const uint8_t* data, size_t sz)
@ -1170,6 +1170,7 @@ public:
}
return;
}
case WM_CHAR:
case WM_UNICHAR:
{
if (m_callback)
@ -1182,26 +1183,6 @@ public:
}
return;
}
case WM_IME_COMPOSITION:
{
if (m_callback)
{
ITextInputCallback* inputCb = m_callback->getTextInputCallback();
if ((e.lParam & GCS_RESULTSTR) != 0)
{
wchar_t str[512];
LONG len = ImmGetCompositionStringW(m_imc, GCS_RESULTSTR, str, sizeof(str));
if (len > 0)
{
size_t szOut;
std::unique_ptr<uint8_t[]> out = MakeUnicodeLF(str, len/2, szOut);
if (szOut && inputCb)
inputCb->insertText(std::string((char*)out.get(), szOut));
}
}
}
return;
}
default: break;
}
}