ScrollWindowEx: add update region to hrgnUpdate
Rein Klazes
wijn at wanadoo.nl
Fri Apr 1 09:54:15 CST 2005
Hi,
Not a fix for bug 1091.
Changelog:
windows : scroll.c
dlls/user/tests : win.c
In ScrollWindowEx, if the window already has an update region then add
this to hrgnUpdate. With a conformance test.
Rein.
-------------- next part --------------
--- wine/windows/scroll.c 2005-04-01 13:33:06.000000000 +0200
+++ mywine/windows/scroll.c 2005-04-01 16:39:07.000000000 +0200
@@ -77,6 +77,7 @@ INT WINAPI ScrollWindowEx( HWND hwnd, IN
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, IN
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, IN
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);
--- wine/dlls/user/tests/win.c 2005-04-01 13:32:17.000000000 +0200
+++ mywine/dlls/user/tests/win.c 2005-04-01 16:13:33.000000000 +0200
@@ -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);
More information about the wine-patches
mailing list