user32: Scroll window fix.

Fix the case where the scrolling amount exceeds the window but still
falls within the clipping rect. This generates an additional update
region that needs to be invalidated.
oldstable
Aric Stewart 2007-02-13 07:38:06 -06:00 committed by Alexandre Julliard
parent ec57871f4f
commit 1b6d127aee
2 changed files with 28 additions and 0 deletions

View File

@ -870,6 +870,25 @@ INT WINAPI ScrollWindowEx( HWND hwnd, INT dx, INT dy,
CombineRgn( hrgnWinupd, hrgnWinupd, hrgnTemp, RGN_OR );
RedrawWindow( hwnd, NULL, hrgnTemp, rdw_flags);
DeleteObject( hrgnClip );
/* Catch the case where the scolling amount exceeds the size of the
* original window. This generated a second update area that is the
* location where the original scrolled content would end up.
* This second region is not returned by the ScrollDC and sets
* ScrollWindowEx apart from just a ScrollDC.
*
* This has been verified with testing on windows.
*/
if (abs(dx) > abs(rc.right - rc.left) ||
abs(dy) > abs(rc.bottom - rc.top))
{
SetRectRgn( hrgnTemp, rc.left + dx, rc.top + dy, rc.right+dx, rc.bottom + dy);
CombineRgn( hrgnTemp, hrgnTemp, hrgnClip, RGN_AND );
CombineRgn( hrgnUpdate, hrgnUpdate, hrgnTemp, RGN_OR );
if( !bOwnRgn)
CombineRgn( hrgnWinupd, hrgnWinupd, hrgnTemp, RGN_OR );
}
}
DeleteObject( hrgnTemp );
} else {

View File

@ -2991,6 +2991,15 @@ static void test_scrollvalidate( HWND parent)
CombineRgn( exprgn, exprgn, tmprgn, RGN_OR);
ok( EqualRgn( exprgn, hrgn), "wrong update region\n");
SetRect( &rc, 0,40, 100,60);
SetRect( &cliprc, 0,0, 100,100);
ScrollWindowEx( hwnd1, 0, -25, &rc, &cliprc, hrgn, &rcu, SW_INVALIDATE);
SetRectRgn( tmprgn, 0,15,98,35);
CombineRgn( exprgn, exprgn, tmprgn, RGN_OR);
SetRectRgn( tmprgn, 0, 40, 98, 60);
CombineRgn( exprgn, exprgn, tmprgn, RGN_OR);
ok( EqualRgn( exprgn, hrgn), "wrong update region in excessive scroll\n");
/* now test ScrollWindowEx with a combination of
* WS_CLIPCHILDREN style and SW_SCROLLCHILDREN flag */
/* make hwnd2 the child of hwnd1 */