user32: Add support for RTL window layouts in GetUpdateRgn and GetUpdateRect.

This commit is contained in:
Alexandre Julliard 2010-09-23 15:51:10 +02:00
parent 024521190a
commit 9bbfcb5b07
3 changed files with 39 additions and 5 deletions

View file

@ -1289,8 +1289,6 @@ INT WINAPI GetUpdateRgn( HWND hwnd, HRGN hrgn, BOOL erase )
if ((update_rgn = send_ncpaint( hwnd, NULL, &flags )))
{
POINT offset;
retval = CombineRgn( hrgn, update_rgn, 0, RGN_COPY );
if (send_erase( hwnd, flags, update_rgn, NULL, NULL ))
{
@ -1298,9 +1296,7 @@ INT WINAPI GetUpdateRgn( HWND hwnd, HRGN hrgn, BOOL erase )
get_update_flags( hwnd, NULL, &flags );
}
/* map region to client coordinates */
offset.x = offset.y = 0;
ScreenToClient( hwnd, &offset );
OffsetRgn( hrgn, offset.x, offset.y );
map_window_region( 0, hwnd, hrgn );
}
return retval;
}
@ -1324,8 +1320,10 @@ BOOL WINAPI GetUpdateRect( HWND hwnd, LPRECT rect, BOOL erase )
if (GetRgnBox( update_rgn, rect ) != NULLREGION)
{
HDC hdc = GetDCEx( hwnd, 0, DCX_USESTYLE );
DWORD layout = SetLayout( hdc, 0 ); /* MapWindowPoints mirrors already */
MapWindowPoints( 0, hwnd, (LPPOINT)rect, 2 );
DPtoLP( hdc, (LPPOINT)rect, 2 );
SetLayout( hdc, layout );
ReleaseDC( hwnd, hdc );
}
}

View file

@ -83,6 +83,7 @@ extern HWND WIN_IsCurrentThread( HWND hwnd ) DECLSPEC_HIDDEN;
extern HWND WIN_SetOwner( HWND hwnd, HWND owner ) DECLSPEC_HIDDEN;
extern ULONG WIN_SetStyle( HWND hwnd, ULONG set_bits, ULONG clear_bits ) DECLSPEC_HIDDEN;
extern BOOL WIN_GetRectangles( HWND hwnd, enum coords_relative relative, RECT *rectWindow, RECT *rectClient ) DECLSPEC_HIDDEN;
extern void map_window_region( HWND from, HWND to, HRGN hrgn ) DECLSPEC_HIDDEN;
extern LRESULT WIN_DestroyWindow( HWND hwnd ) DECLSPEC_HIDDEN;
extern void WIN_DestroyThreadWindows( HWND hwnd ) DECLSPEC_HIDDEN;
extern HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module, BOOL unicode ) DECLSPEC_HIDDEN;

View file

@ -501,6 +501,41 @@ static POINT WINPOS_GetWinOffset( HWND hwndFrom, HWND hwndTo, BOOL *mirrored )
return offset;
}
/* map coordinates of a window region */
void map_window_region( HWND from, HWND to, HRGN hrgn )
{
BOOL mirrored;
POINT offset = WINPOS_GetWinOffset( from, to, &mirrored );
UINT i, size;
RGNDATA *data;
HRGN new_rgn;
RECT *rect;
if (!mirrored)
{
OffsetRgn( hrgn, offset.x, offset.y );
return;
}
if (!(size = GetRegionData( hrgn, 0, NULL ))) return;
if (!(data = HeapAlloc( GetProcessHeap(), 0, size ))) return;
GetRegionData( hrgn, size, data );
rect = (RECT *)data->Buffer;
for (i = 0; i < data->rdh.nCount; i++)
{
int tmp = -(rect[i].left + offset.x);
rect[i].left = -(rect[i].right + offset.x);
rect[i].right = tmp;
rect[i].top += offset.y;
rect[i].bottom += offset.y;
}
if ((new_rgn = ExtCreateRegion( NULL, data->rdh.nCount, data )))
{
CombineRgn( hrgn, new_rgn, 0, RGN_COPY );
DeleteObject( new_rgn );
}
HeapFree( GetProcessHeap(), 0, data );
}
/*******************************************************************
* MapWindowPoints (USER32.@)