Commit e2cd4dcf authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

comctl32/edit: Notify IME on caret position, format_rect and font changes.

parent 478ffa8c
......@@ -38,6 +38,7 @@
#include "windef.h"
#include "winbase.h"
#include "winnt.h"
#include "wingdi.h"
#include "imm.h"
#include "usp10.h"
#include "commctrl.h"
......@@ -1697,6 +1698,20 @@ static LRESULT EDIT_EM_Scroll(EDITSTATE *es, INT action)
}
static void EDIT_UpdateImmCompositionWindow(EDITSTATE *es, UINT x, UINT y)
{
COMPOSITIONFORM form =
{
.dwStyle = CFS_RECT,
.ptCurrentPos = {.x = x, .y = y},
.rcArea = es->format_rect,
};
HIMC himc = ImmGetContext(es->hwndSelf);
ImmSetCompositionWindow(himc, &form);
ImmReleaseContext(es->hwndSelf, himc);
}
/*********************************************************************
*
* EDIT_SetCaretPos
......@@ -1712,6 +1727,7 @@ static void EDIT_SetCaretPos(EDITSTATE *es, INT pos,
res = EDIT_EM_PosFromChar(es, pos, after_wrap);
TRACE("%d - %dx%d\n", pos, (short)LOWORD(res), (short)HIWORD(res));
SetCaretPos((short)LOWORD(res), (short)HIWORD(res));
EDIT_UpdateImmCompositionWindow(es, (short)LOWORD(res), (short)HIWORD(res));
}
}
......@@ -3728,6 +3744,15 @@ static DWORD get_font_margins(HDC hdc, const TEXTMETRICW *tm)
return MAKELONG(left, right);
}
static void EDIT_UpdateImmCompositionFont(EDITSTATE *es)
{
LOGFONTW composition_font;
HIMC himc = ImmGetContext(es->hwndSelf);
GetObjectW(es->font, sizeof(LOGFONTW), &composition_font);
ImmSetCompositionFontW(himc, &composition_font);
ImmReleaseContext(es->hwndSelf, himc);
}
/*********************************************************************
*
* WM_SETFONT
......@@ -3779,6 +3804,8 @@ static void EDIT_WM_SetFont(EDITSTATE *es, HFONT font, BOOL redraw)
es->flags & EF_AFTER_WRAP);
ShowCaret(es->hwndSelf);
}
EDIT_UpdateImmCompositionFont(es);
}
......@@ -4593,6 +4620,7 @@ static LRESULT CALLBACK EDIT_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
EDITSTATE *es = (EDITSTATE *)GetWindowLongPtrW(hwnd, 0);
LRESULT result = 0;
RECT *rect;
POINT pt;
TRACE("hwnd %p, msg %#x, wparam %Ix, lparam %Ix\n", hwnd, msg, wParam, lParam);
......@@ -5048,6 +5076,9 @@ static LRESULT CALLBACK EDIT_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
/* IME messages to make the edit control IME aware */
case WM_IME_SETCONTEXT:
GetCaretPos(&pt);
EDIT_UpdateImmCompositionWindow(es, pt.x, pt.y);
EDIT_UpdateImmCompositionFont(es);
break;
case WM_IME_STARTCOMPOSITION:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment