imm32: Update position of default IME window.
This commit is contained in:
parent
f20432bb62
commit
39aa755600
@ -1967,6 +1967,8 @@ static void PaintDefaultIMEWnd(HWND hwnd)
|
|||||||
HDC hdc = BeginPaint(hwnd,&ps);
|
HDC hdc = BeginPaint(hwnd,&ps);
|
||||||
LPCOMPOSITIONSTRING compstr;
|
LPCOMPOSITIONSTRING compstr;
|
||||||
LPBYTE compdata = NULL;
|
LPBYTE compdata = NULL;
|
||||||
|
HMONITOR monitor;
|
||||||
|
MONITORINFO mon_info;
|
||||||
|
|
||||||
GetClientRect(hwnd,&rect);
|
GetClientRect(hwnd,&rect);
|
||||||
FillRect(hdc, &rect, (HBRUSH)(COLOR_WINDOW + 1));
|
FillRect(hdc, &rect, (HBRUSH)(COLOR_WINDOW + 1));
|
||||||
@ -2000,28 +2002,51 @@ static void PaintDefaultIMEWnd(HWND hwnd)
|
|||||||
rect.top = cpt.y;
|
rect.top = cpt.y;
|
||||||
rect.right = rect.left + pt.x + 20;
|
rect.right = rect.left + pt.x + 20;
|
||||||
rect.bottom = rect.top + pt.y + 20;
|
rect.bottom = rect.top + pt.y + 20;
|
||||||
|
monitor = MonitorFromPoint(cpt, MONITOR_DEFAULTTOPRIMARY);
|
||||||
}
|
}
|
||||||
else if (root_context->IMC.cfCompForm.dwStyle == CFS_RECT)
|
else if (root_context->IMC.cfCompForm.dwStyle == CFS_RECT)
|
||||||
{
|
{
|
||||||
POINT cpt;
|
rect = root_context->IMC.cfCompForm.rcArea;
|
||||||
cpt.x = root_context->IMC.cfCompForm.rcArea.left;
|
MapWindowPoints( root_context->IMC.hWnd, 0, (POINT *)&rect, 2 );
|
||||||
cpt.y = root_context->IMC.cfCompForm.rcArea.top;
|
monitor = MonitorFromRect(&rect, MONITOR_DEFAULTTOPRIMARY);
|
||||||
ClientToScreen(root_context->IMC.hWnd,&cpt);
|
|
||||||
rect.left = cpt.x;
|
|
||||||
rect.top = cpt.y;
|
|
||||||
cpt.x = root_context->IMC.cfCompForm.rcArea.right;
|
|
||||||
cpt.y = root_context->IMC.cfCompForm.rcArea.bottom;
|
|
||||||
ClientToScreen(root_context->IMC.hWnd,&cpt);
|
|
||||||
rect.right = cpt.x;
|
|
||||||
rect.bottom = cpt.y;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/* Windows places the default IME window in the bottom left */
|
||||||
|
HWND target = root_context->IMC.hWnd;
|
||||||
|
if (!target) target = GetFocus();
|
||||||
|
|
||||||
|
GetWindowRect(target,&rect);
|
||||||
|
rect.top = rect.bottom;
|
||||||
rect.right = rect.left + pt.x + 20;
|
rect.right = rect.left + pt.x + 20;
|
||||||
rect.bottom = rect.top + pt.y + 20;
|
rect.bottom = rect.top + pt.y + 20;
|
||||||
|
monitor = MonitorFromWindow(target, MONITOR_DEFAULTTOPRIMARY);
|
||||||
}
|
}
|
||||||
MoveWindow(hwnd, rect.left, rect.top, rect.right - rect.left ,
|
|
||||||
rect.bottom - rect.top, FALSE);
|
/* make sure we are on the desktop */
|
||||||
|
mon_info.cbSize = sizeof(mon_info);
|
||||||
|
GetMonitorInfoW(monitor, &mon_info);
|
||||||
|
|
||||||
|
if (rect.bottom > mon_info.rcWork.bottom)
|
||||||
|
{
|
||||||
|
int shift = rect.bottom - mon_info.rcWork.bottom;
|
||||||
|
rect.top -= shift;
|
||||||
|
rect.bottom -= shift;
|
||||||
|
}
|
||||||
|
if (rect.left < 0)
|
||||||
|
{
|
||||||
|
rect.right -= rect.left;
|
||||||
|
rect.left = 0;
|
||||||
|
}
|
||||||
|
if (rect.right > mon_info.rcWork.right)
|
||||||
|
{
|
||||||
|
int shift = rect.right - mon_info.rcWork.right;
|
||||||
|
rect.left -= shift;
|
||||||
|
rect.right -= shift;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetWindowPos(hwnd, HWND_TOPMOST, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOACTIVATE);
|
||||||
|
|
||||||
TextOutW(hdc, 10,10, CompString, compstr->dwCompStrLen);
|
TextOutW(hdc, 10,10, CompString, compstr->dwCompStrLen);
|
||||||
|
|
||||||
if (oldfont)
|
if (oldfont)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user