From 30fd4c070931b0ffda9b39c80bd7b08a0412d733 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Sun, 27 Dec 2015 14:02:16 -1000 Subject: [PATCH] Win32 Text input in sync --- lib/win/ApplicationWin32.cpp | 2 +- lib/win/WindowWin32.cpp | 25 +++---------------------- 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/lib/win/ApplicationWin32.cpp b/lib/win/ApplicationWin32.cpp index dc4709a..2db144f 100644 --- a/lib/win/ApplicationWin32.cpp +++ b/lib/win/ApplicationWin32.cpp @@ -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: diff --git a/lib/win/WindowWin32.cpp b/lib/win/WindowWin32.cpp index e4a6cff..9ebaeaf 100644 --- a/lib/win/WindowWin32.cpp +++ b/lib/win/WindowWin32.cpp @@ -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 out = MakeUnicodeLF(str, len/2, szOut); - if (szOut && inputCb) - inputCb->insertText(std::string((char*)out.get(), szOut)); - } - } - } - return; - } default: break; } }