user32: Use WIN_GetRectangles where possible instead of mapping coordinates explicitly.

This commit is contained in:
Alexandre Julliard 2010-09-07 15:11:24 +02:00
parent 141defbd54
commit 9b693ddadb
6 changed files with 7 additions and 19 deletions

View File

@ -3109,8 +3109,7 @@ static void EDIT_WM_ContextMenu(EDITSTATE *es, INT x, INT y)
{
RECT rc;
/* Windows places the menu at the edit's center in this case */
GetClientRect(es->hwndSelf, &rc);
MapWindowPoints(es->hwndSelf, 0, (POINT *)&rc, 2);
WIN_GetRectangles( es->hwndSelf, COORDS_SCREEN, NULL, &rc );
x = rc.left + (rc.right - rc.left) / 2;
y = rc.top + (rc.bottom - rc.top) / 2;
}

View File

@ -1720,13 +1720,12 @@ void WINAPI CalcChildScroll( HWND hwnd, INT scroll )
if (style & WS_VISIBLE)
{
RECT rect;
GetWindowRect( list[i], &rect );
WIN_GetRectangles( list[i], COORDS_PARENT, &rect, NULL );
UnionRect( &childRect, &rect, &childRect );
}
}
HeapFree( GetProcessHeap(), 0, list );
}
MapWindowPoints( 0, hwnd, (POINT *)&childRect, 2 );
UnionRect( &childRect, &clientRect, &childRect );
/* set common info values */

View File

@ -3632,8 +3632,7 @@ BOOL WINAPI EnableMenuItem( HMENU hMenu, UINT wItemID, UINT wFlags )
return (UINT)-1;
/* Refresh the frame to reflect the change */
GetWindowRect(parentMenu->hWnd, &rc);
MapWindowPoints(0, parentMenu->hWnd, (POINT *)&rc, 2);
WIN_GetRectangles( parentMenu->hWnd, COORDS_CLIENT, &rc, NULL );
rc.bottom = 0;
RedrawWindow(parentMenu->hWnd, &rc, 0, RDW_FRAME | RDW_INVALIDATE | RDW_NOCHILDREN);
}

View File

@ -637,8 +637,7 @@ static HRGN send_ncpaint( HWND hwnd, HWND *child, UINT *flags )
/* check if update rgn overlaps with nonclient area */
type = GetRgnBox( whole_rgn, &update );
GetClientRect( hwnd, &client );
MapWindowPoints( hwnd, 0, (POINT *)&client, 2 );
WIN_GetRectangles( hwnd, COORDS_SCREEN, 0, &client );
if ((*flags & UPDATE_NONCLIENT) ||
update.left < client.left || update.top < client.top ||
@ -1486,8 +1485,7 @@ INT WINAPI ScrollWindowEx( HWND hwnd, INT dx, INT dy,
RECT r, dummy;
for (i = 0; list[i]; i++)
{
GetWindowRect( list[i], &r );
MapWindowPoints( 0, hwnd, (POINT *)&r, 2 );
WIN_GetRectangles( list[i], COORDS_PARENT, &r, NULL );
if (!rect || IntersectRect(&dummy, &r, rect))
SetWindowPos( list[i], 0, r.left + dx, r.top + dy, 0, 0,
SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE |

View File

@ -3350,12 +3350,7 @@ UINT WINAPI GetWindowModuleFileNameW( HWND hwnd, LPWSTR module, UINT size )
BOOL WINAPI GetWindowInfo( HWND hwnd, PWINDOWINFO pwi)
{
if (!pwi) return FALSE;
if (!IsWindow(hwnd)) return FALSE;
GetWindowRect(hwnd, &pwi->rcWindow);
GetClientRect(hwnd, &pwi->rcClient);
/* translate to screen coordinates */
MapWindowPoints(hwnd, 0, (LPPOINT)&pwi->rcClient, 2);
if (!WIN_GetRectangles( hwnd, COORDS_SCREEN, &pwi->rcWindow, &pwi->rcClient )) return FALSE;
pwi->dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
pwi->dwExStyle = GetWindowLongW(hwnd, GWL_EXSTYLE);

View File

@ -2428,12 +2428,10 @@ void WINPOS_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
/* Get min/max info */
WINPOS_GetMinMaxInfo( hwnd, NULL, NULL, &minTrack, &maxTrack );
GetWindowRect( hwnd, &sizingRect );
WIN_GetRectangles( hwnd, COORDS_PARENT, &sizingRect, NULL );
if (style & WS_CHILD)
{
parent = GetParent(hwnd);
/* make sizing rect relative to parent */
MapWindowPoints( 0, parent, (POINT*)&sizingRect, 2 );
GetClientRect( parent, &mouseRect );
}
else