user32: Add some error checking in ScreenToClient and ClientToScreen.

This commit is contained in:
Alexandre Julliard 2012-11-14 16:29:39 +01:00
parent 5dea654317
commit 7fc61f6fea
1 changed files with 42 additions and 20 deletions

View File

@ -235,26 +235,6 @@ BOOL WINAPI GetClientRect( HWND hwnd, LPRECT rect )
}
/*******************************************************************
* ClientToScreen (USER32.@)
*/
BOOL WINAPI ClientToScreen( HWND hwnd, LPPOINT lppnt )
{
MapWindowPoints( hwnd, 0, lppnt, 1 );
return TRUE;
}
/*******************************************************************
* ScreenToClient (USER32.@)
*/
BOOL WINAPI ScreenToClient( HWND hwnd, LPPOINT lppnt )
{
MapWindowPoints( 0, hwnd, lppnt, 1 );
return TRUE;
}
/***********************************************************************
* list_children_from_point
*
@ -588,6 +568,48 @@ INT WINAPI MapWindowPoints( HWND hwndFrom, HWND hwndTo, LPPOINT lppt, UINT count
}
/*******************************************************************
* ClientToScreen (USER32.@)
*/
BOOL WINAPI ClientToScreen( HWND hwnd, LPPOINT lppnt )
{
POINT offset;
BOOL mirrored;
if (!hwnd)
{
SetLastError( ERROR_INVALID_WINDOW_HANDLE );
return FALSE;
}
if (!WINPOS_GetWinOffset( hwnd, 0, &mirrored, &offset )) return FALSE;
lppnt->x += offset.x;
lppnt->y += offset.y;
if (mirrored) lppnt->x = -lppnt->x;
return TRUE;
}
/*******************************************************************
* ScreenToClient (USER32.@)
*/
BOOL WINAPI ScreenToClient( HWND hwnd, LPPOINT lppnt )
{
POINT offset;
BOOL mirrored;
if (!hwnd)
{
SetLastError( ERROR_INVALID_WINDOW_HANDLE );
return FALSE;
}
if (!WINPOS_GetWinOffset( 0, hwnd, &mirrored, &offset )) return FALSE;
lppnt->x += offset.x;
lppnt->y += offset.y;
if (mirrored) lppnt->x = -lppnt->x;
return TRUE;
}
/***********************************************************************
* IsIconic (USER32.@)
*/