mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 16:35:49 +00:00
[User32]
- Start creeping in more Left to Right support, readying up for the next wine User32 controls port and test sync. Code is based on wine, credit them for any breakages. 8^P Our positions are off by 103 x 122 in some test cases, anyone having an idea please chime in. svn path=/trunk/; revision=50247
This commit is contained in:
parent
f9a750c9c0
commit
1f1bdb7dd4
1 changed files with 70 additions and 23 deletions
|
@ -129,25 +129,66 @@ WindowFromPoint(POINT Point)
|
||||||
int WINAPI
|
int WINAPI
|
||||||
MapWindowPoints(HWND hWndFrom, HWND hWndTo, LPPOINT lpPoints, UINT cPoints)
|
MapWindowPoints(HWND hWndFrom, HWND hWndTo, LPPOINT lpPoints, UINT cPoints)
|
||||||
{
|
{
|
||||||
PWND FromWnd, ToWnd;
|
PWND FromWnd = NULL, ToWnd = NULL;
|
||||||
|
BOOL mirror_from, mirror_to;
|
||||||
POINT Delta;
|
POINT Delta;
|
||||||
UINT i;
|
UINT i;
|
||||||
|
|
||||||
FromWnd = ValidateHwndOrDesk(hWndFrom);
|
if (hWndFrom)
|
||||||
if (!FromWnd)
|
{
|
||||||
return 0;
|
FromWnd = ValidateHwnd(hWndFrom);
|
||||||
|
if (!FromWnd)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (hWndTo)
|
||||||
|
{
|
||||||
|
ToWnd = ValidateHwnd(hWndTo);
|
||||||
|
if (!ToWnd)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
ToWnd = ValidateHwndOrDesk(hWndTo);
|
/* Note: Desktop Top and Left is always 0! */
|
||||||
if (!ToWnd)
|
Delta.x = Delta.y = 0;
|
||||||
return 0;
|
mirror_from = mirror_to = FALSE;
|
||||||
|
|
||||||
Delta.x = FromWnd->rcClient.left - ToWnd->rcClient.left;
|
if (FromWnd && FromWnd->fnid != FNID_DESKTOP)
|
||||||
Delta.y = FromWnd->rcClient.top - ToWnd->rcClient.top;
|
{
|
||||||
|
if (FromWnd->ExStyle & WS_EX_LAYOUTRTL)
|
||||||
|
{
|
||||||
|
mirror_from = TRUE;
|
||||||
|
Delta.x = FromWnd->rcClient.right - FromWnd->rcClient.left;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Delta.x = FromWnd->rcClient.left;
|
||||||
|
Delta.y = FromWnd->rcClient.top;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ToWnd && ToWnd->fnid != FNID_DESKTOP)
|
||||||
|
{
|
||||||
|
if (ToWnd->ExStyle & WS_EX_LAYOUTRTL)
|
||||||
|
{
|
||||||
|
mirror_to = TRUE;
|
||||||
|
Delta.x -= ToWnd->rcClient.right - ToWnd->rcClient.left;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Delta.x -= ToWnd->rcClient.left;
|
||||||
|
Delta.y -= ToWnd->rcClient.top;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mirror_from) Delta.x = -Delta.x;
|
||||||
|
|
||||||
for (i = 0; i != cPoints; i++)
|
for (i = 0; i != cPoints; i++)
|
||||||
{
|
{
|
||||||
lpPoints[i].x += Delta.x;
|
lpPoints[i].x += Delta.x;
|
||||||
lpPoints[i].y += Delta.y;
|
lpPoints[i].y += Delta.y;
|
||||||
|
if (mirror_from || mirror_to) lpPoints[i].x = -lpPoints[i].x;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((mirror_from || mirror_to) && cPoints == 2) /* special case for rectangle */
|
||||||
|
{
|
||||||
|
int tmp = lpPoints[0].x;
|
||||||
|
lpPoints[0].x = lpPoints[1].x;
|
||||||
|
lpPoints[1].x = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
return MAKELONG(LOWORD(Delta.x), LOWORD(Delta.y));
|
return MAKELONG(LOWORD(Delta.x), LOWORD(Delta.y));
|
||||||
|
@ -160,17 +201,20 @@ MapWindowPoints(HWND hWndFrom, HWND hWndTo, LPPOINT lpPoints, UINT cPoints)
|
||||||
BOOL WINAPI
|
BOOL WINAPI
|
||||||
ScreenToClient(HWND hWnd, LPPOINT lpPoint)
|
ScreenToClient(HWND hWnd, LPPOINT lpPoint)
|
||||||
{
|
{
|
||||||
PWND Wnd, DesktopWnd;
|
PWND Wnd;
|
||||||
|
/* Note: Desktop Top and Left is always 0! */
|
||||||
Wnd = ValidateHwnd(hWnd);
|
Wnd = ValidateHwnd(hWnd);
|
||||||
if (!Wnd)
|
if (!Wnd)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
DesktopWnd = GetThreadDesktopWnd();
|
if (Wnd->fnid != FNID_DESKTOP)
|
||||||
|
{
|
||||||
lpPoint->x += DesktopWnd->rcClient.left - Wnd->rcClient.left;
|
if (Wnd->ExStyle & WS_EX_LAYOUTRTL)
|
||||||
lpPoint->y += DesktopWnd->rcClient.top - Wnd->rcClient.top;
|
lpPoint->x = Wnd->rcClient.right - lpPoint->x;
|
||||||
|
else
|
||||||
|
lpPoint->x -= Wnd->rcClient.left;
|
||||||
|
lpPoint->y -= Wnd->rcClient.top;
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,17 +225,20 @@ ScreenToClient(HWND hWnd, LPPOINT lpPoint)
|
||||||
BOOL WINAPI
|
BOOL WINAPI
|
||||||
ClientToScreen(HWND hWnd, LPPOINT lpPoint)
|
ClientToScreen(HWND hWnd, LPPOINT lpPoint)
|
||||||
{
|
{
|
||||||
PWND Wnd, DesktopWnd;
|
PWND Wnd;
|
||||||
|
/* Note: Desktop Top and Left is always 0! */
|
||||||
Wnd = ValidateHwnd(hWnd);
|
Wnd = ValidateHwnd(hWnd);
|
||||||
if (!Wnd)
|
if (!Wnd)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
DesktopWnd = GetThreadDesktopWnd();
|
if (Wnd->fnid != FNID_DESKTOP)
|
||||||
|
{
|
||||||
lpPoint->x += Wnd->rcClient.left - DesktopWnd->rcClient.left;
|
if (Wnd->ExStyle & WS_EX_LAYOUTRTL)
|
||||||
lpPoint->y += Wnd->rcClient.top - DesktopWnd->rcClient.top;
|
lpPoint->x = Wnd->rcClient.right - lpPoint->x;
|
||||||
|
else
|
||||||
|
lpPoint->x += Wnd->rcClient.left;
|
||||||
|
lpPoint->y += Wnd->rcClient.top;
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue