private void OnImeComposition(IntPtr hwnd, int lParam)
        {
            string text = string.Empty;

            if (ImeHandler.GetResult(hwnd, (uint)lParam, out text))
            {
                owner.GetBrowserHost().ImeCommitText(text, new Range(int.MaxValue, int.MaxValue), 0);
            }
            else
            {
                var underlines       = new List <CompositionUnderline>();
                int compositionStart = 0;

                if (ImeHandler.GetComposition(hwnd, (uint)lParam, underlines, ref compositionStart, out text))
                {
                    owner.GetBrowserHost().ImeSetComposition(text, underlines.ToArray(),
                                                             new Range(int.MaxValue, int.MaxValue), new Range(compositionStart, compositionStart));

                    UpdateCaretPosition(compositionStart - 1);
                }
                else
                {
                    CancelComposition(hwnd);
                }
            }
        }
Пример #2
0
        private void OnImeComposition(IntPtr hwnd, int lParam)
        {
            string text = string.Empty;

            if (ImeHandler.GetResult(hwnd, (uint)lParam, out text))
            {
                owner.GetBrowserHost().ImeCommitText(text, new Range(int.MaxValue, int.MaxValue), 0);
                if (languageCodeId == ImeNative.LANG_KOREAN || languageCodeId == ImeNative.LANG_CHINESE)
                {
                    owner.GetBrowserHost().ImeSetComposition(text, new CompositionUnderline[0], new Range(int.MaxValue, int.MaxValue), new Range(0, 0));
                    owner.GetBrowserHost().ImeFinishComposingText(false);
                }
            }
            else
            {
                var underlines       = new List <CompositionUnderline>();
                int compositionStart = 0;

                if (ImeHandler.GetComposition(hwnd, (uint)lParam, underlines, ref compositionStart, out text))
                {
                    owner.GetBrowserHost().ImeSetComposition(text, underlines.ToArray(),
                                                             new Range(int.MaxValue, int.MaxValue), new Range(compositionStart, compositionStart));

                    UpdateCaretPosition(compositionStart - 1);
                }
                else
                {
                    CancelComposition(hwnd);
                }
            }
        }