From f017af8aaa76866f92406549abca4e673db152b8 Mon Sep 17 00:00:00 2001 From: dmitry Date: Mon, 2 Aug 2010 23:52:51 +0000 Subject: [PATCH] win32: implement IME input support for Edit controls. KeyUp (for VK_RETURN) event is supressed if IME composition is finished, bug #16430 git-svn-id: trunk@26984 - --- lcl/interfaces/win32/win32callback.inc | 13 +++++++++++++ lcl/interfaces/win32/win32proc.pp | 1 + 2 files changed, 14 insertions(+) diff --git a/lcl/interfaces/win32/win32callback.inc b/lcl/interfaces/win32/win32callback.inc index c773176331..85c808d9cd 100644 --- a/lcl/interfaces/win32/win32callback.inc +++ b/lcl/interfaces/win32/win32callback.inc @@ -1024,6 +1024,12 @@ begin end; end; lWinControl := WindowInfo^.AWinControl; + {for ComboBox IME sends WM_IME_NOTIFY with WParam=WM_IME_ENDCOMPOSITION} + if (Msg = WM_IME_NOTIFY) and (WPARAM=WM_IME_ENDCOMPOSITION) then + begin + if Assigned(WindowInfo) then WindowInfo^.IMEComposed:=True; + end; + // filter messages we want to pass on to LCL if (Msg <> WM_KILLFOCUS) and (Msg <> WM_SETFOCUS) and (Msg <> WM_NCDESTROY) and ((Msg < WM_KEYFIRST) or (Msg > WM_KEYLAST)) @@ -1095,6 +1101,11 @@ begin end; end; end; + WM_IME_ENDCOMPOSITION: + begin + {IME Windows the composition has finished} + if Assigned(WindowInfo) then WindowInfo^.IMEComposed:=True; + end; BM_SETCHECK: begin LMessage.Msg := LM_CHANGED; @@ -1562,6 +1573,7 @@ begin Assert(False,Format('WM_KEYDOWN KeyData= %d CharCode= %d ',[KeyData,CharCode])); Assert(False,' lWinControl= '+TComponent(lWinControl).Name+':'+lWinControl.ClassName); end; + if Assigned(WindowInfo) then WindowInfo^.IMEComposed:=False; WinProcess := false; end; WM_KEYUP: @@ -1577,6 +1589,7 @@ begin Assert(False,Format('WM_KEYUP KeyData= %d CharCode= %d ',[KeyData,CharCode])); end; WinProcess := false; + if Assigned(WindowInfo) and WindowInfo^.IMEComposed then LMKey.Msg:=LM_NULL; end; WM_KILLFOCUS: begin diff --git a/lcl/interfaces/win32/win32proc.pp b/lcl/interfaces/win32/win32proc.pp index 659542ddd8..78dc186187 100644 --- a/lcl/interfaces/win32/win32proc.pp +++ b/lcl/interfaces/win32/win32proc.pp @@ -65,6 +65,7 @@ Type DispInfoTextA: array [0..LV_DISP_INFO_COUNT-1] of AnsiString; // buffer for ListView LVN_GETDISPINFO notification DispInfoTextW: array [0..LV_DISP_INFO_COUNT-1] of WideString; // it's recommended to keep buffer unchanged DispInfoIndex: Integer; // between 2 calls of LVN_GETDISPINFO + IMEComposed: Boolean; case integer of 0: (spinValue: Double); 1: (