In ScrollWindowEx, if the window already has an update region then add

this to hrgnUpdate. With a conformance test.
This commit is contained in:
Rein Klazes 2005-04-11 12:47:01 +00:00 committed by Alexandre Julliard
parent f042209c3b
commit 8db7b53359
2 changed files with 30 additions and 3 deletions

View File

@ -2647,10 +2647,24 @@ void test_scrollvalidate( HWND parent)
rcu.left,rcu.top,rcu.right,rcu.bottom);
ReleaseDC( hwnd1, hdc);
/* test scrolling a window with an update region */
DestroyWindow( hwnd2);
ValidateRect( hwnd1, NULL);
SetRect( &rc, 40,40, 50,50);
InvalidateRect( hwnd1, &rc, 1);
GetClientRect( hwnd1, &rc);
cliprc=rc;
ScrollWindowEx( hwnd1, -10, 0, &rc, &cliprc, hrgn, &rcu,
SW_SCROLLCHILDREN | SW_INVALIDATE);
if (winetest_debug > 0) dump_region(hrgn);
exprgn = CreateRectRgn( 88,0,98,98);
tmprgn = CreateRectRgn( 30, 40, 50, 50);
CombineRgn( exprgn, exprgn, tmprgn, RGN_OR);
ok( EqualRgn( exprgn, hrgn), "wrong update region\n");
/* now test ScrollWindowEx with a combination of
* WS_CLIPCHILDREN style and SW_SCROLLCHILDREN flag */
/* make hwnd2 the child of hwnd1 */
DestroyWindow( hwnd2);
hwnd2 = CreateWindowExA(0, "static", NULL,
WS_CHILD| WS_VISIBLE | WS_BORDER ,
50, 50, 100, 100, hwnd1, 0, 0, NULL);

View File

@ -77,6 +77,7 @@ INT WINAPI ScrollWindowEx( HWND hwnd, INT dx, INT dy,
BOOL bUpdate = (rcUpdate || hrgnUpdate || flags & (SW_INVALIDATE | SW_ERASE));
int rdw_flags;
HRGN hrgnTemp;
HRGN hrgnWinupd = 0;
HDC hDC;
RECT rc, cliprc;
RECT caretrc;
@ -125,15 +126,22 @@ INT WINAPI ScrollWindowEx( HWND hwnd, INT dx, INT dy,
RedrawWindow( hwnd, NULL, hrgnUpdate, rdw_flags);
}
/* Take into account the fact that some damage may have occurred during
* the scroll */
/* If the windows has an update region, this must be
* scrolled as well. Keep a copy in hrgnWinupd
* to be added to hrngUpdate at the end. */
hrgnTemp = CreateRectRgn( 0, 0, 0, 0 );
retVal = GetUpdateRgn( hwnd, hrgnTemp, FALSE );
if (retVal != NULLREGION)
{
HRGN hrgnClip = CreateRectRgnIndirect(&cliprc);
if( !bOwnRgn) {
hrgnWinupd = CreateRectRgn( 0, 0, 0, 0);
CombineRgn( hrgnWinupd, hrgnTemp, 0, RGN_COPY);
}
OffsetRgn( hrgnTemp, dx, dy );
CombineRgn( hrgnTemp, hrgnTemp, hrgnClip, RGN_AND );
if( !bOwnRgn)
CombineRgn( hrgnWinupd, hrgnWinupd, hrgnTemp, RGN_OR );
RedrawWindow( hwnd, NULL, hrgnTemp, rdw_flags);
DeleteObject( hrgnClip );
}
@ -169,6 +177,11 @@ INT WINAPI ScrollWindowEx( HWND hwnd, INT dx, INT dy,
RedrawWindow( hwnd, NULL, hrgnUpdate, rdw_flags |
((flags & SW_SCROLLCHILDREN) ? RDW_ALLCHILDREN : 0 ) );
if( hrgnWinupd) {
CombineRgn( hrgnUpdate, hrgnUpdate, hrgnWinupd, RGN_OR);
DeleteObject( hrgnWinupd);
}
if( hwndCaret ) {
SetCaretPos( caretrc.left + dx, caretrc.top + dy );
ShowCaret(hwndCaret);