Commit 1b6d127a authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

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.
parent ec57871f
......@@ -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 {
......
......@@ -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 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment