winemac.drv: Improve positioning of IME client window based on caret.

This commit is contained in:
Aric Stewart 2014-02-20 15:28:33 +09:00 committed by Alexandre Julliard
parent 147cf6cc4e
commit eb19c39126
1 changed files with 5 additions and 10 deletions

View File

@ -1581,17 +1581,12 @@ BOOL query_ime_char_rect(macdrv_query* query)
if (!ret)
{
HWND focus = GetFocus();
if (focus && (focus == hwnd || IsChild(hwnd, focus)) &&
GetClientRect(focus, &charpos.rcDocument))
GUITHREADINFO gti;
gti.cbSize = sizeof(gti);
if (GetGUIThreadInfo(0, &gti))
{
if (!GetCaretPos((POINT*)&charpos.rcDocument))
charpos.rcDocument.left = charpos.rcDocument.top = 0;
charpos.rcDocument.right = charpos.rcDocument.left + 1;
MapWindowPoints(focus, 0, (POINT*)&charpos.rcDocument, 2);
*rect = cgrect_from_rect(charpos.rcDocument);
MapWindowPoints(gti.hwndCaret, 0, (POINT*)&gti.rcCaret, 2);
*rect = cgrect_from_rect(gti.rcCaret);
ret = TRUE;
}
}