ValidateRect/Rgn fix with test

Rein Klazes wijn at wanadoo.nl
Tue Feb 15 13:11:04 CST 2005


Hi,

The recent wm changes fix the update problem in the declaration programs
from the Dutch tax office that I reported a long time ago. Together with
this fix, that is.

Changelog:
	dlls/user	: painting.c
	dlls/user/tests	: win.c

	Calling ValidateRect or ValidateRgn on a windows also validates
	the children. Add a test to show the behavior.

Rein.
-------------- next part --------------
--- wine/dlls/user/painting.c	2005-01-28 19:21:20.000000000 +0100
+++ mywine/dlls/user/painting.c	2005-02-15 18:35:02.000000000 +0100
@@ -492,7 +492,7 @@ BOOL WINAPI InvalidateRect( HWND hwnd, c
  */
 BOOL WINAPI ValidateRgn( HWND hwnd, HRGN hrgn )
 {
-    return RedrawWindow( hwnd, NULL, hrgn, RDW_VALIDATE | RDW_NOCHILDREN );
+    return RedrawWindow( hwnd, NULL, hrgn, RDW_VALIDATE );
 }
 
 
@@ -501,7 +501,7 @@ BOOL WINAPI ValidateRgn( HWND hwnd, HRGN
  */
 BOOL WINAPI ValidateRect( HWND hwnd, const RECT *rect )
 {
-    return RedrawWindow( hwnd, rect, 0, RDW_VALIDATE | RDW_NOCHILDREN );
+    return RedrawWindow( hwnd, rect, 0, RDW_VALIDATE );
 }
 
 
--- wine/dlls/user/tests/win.c	2005-02-03 14:30:05.000000000 +0100
+++ mywine/dlls/user/tests/win.c	2005-02-15 18:51:13.000000000 +0100
@@ -2194,6 +2194,43 @@ static void test_mouse_input(HWND hwnd)
     DestroyWindow(popup);
 }
 
+static void test_validatergn(HWND hwnd)
+{
+    HWND child;
+    RECT rc, rc2;
+    HRGN rgn;
+    int ret;
+    child = CreateWindowExA(0, "static", NULL, WS_CHILD| WS_VISIBLE, 10, 10, 10, 10, hwnd, 0, 0, NULL);
+    ShowWindow(hwnd, SW_SHOW);
+    UpdateWindow( hwnd);
+    /* test that ValidateRect validates children*/
+    InvalidateRect( child, NULL, 1);
+    GetWindowRect( child, &rc);
+    MapWindowPoints( NULL, hwnd, (POINT*) &rc, 2);
+    ret = GetUpdateRect( child, &rc2, 0);
+    ok( rc2.right > rc2.left && rc2.bottom > rc2.top,
+            "Update rectangle is empty!\n");
+    ValidateRect( hwnd, &rc);
+    ret = GetUpdateRect( child, &rc2, 0);
+    ok( rc2.left == 0 && rc2.top == 0 && rc2.right == 0 && rc2.bottom == 0,
+            "Update rectangle %ld,%ld-%ld,%ld is not empty!\n", rc2.left, rc2.top,
+            rc2.right, rc2.bottom);
+
+    /* now test ValidateRgn */
+    InvalidateRect( child, NULL, 1);
+    GetWindowRect( child, &rc);
+    MapWindowPoints( NULL, hwnd, (POINT*) &rc, 2);
+    rgn = CreateRectRgnIndirect( &rc);
+    ValidateRgn( hwnd, rgn);
+    ret = GetUpdateRect( child, &rc2, 0);
+    ok( rc2.left == 0 && rc2.top == 0 && rc2.right == 0 && rc2.bottom == 0,
+            "Update rectangle %ld,%ld-%ld,%ld is not empty!\n", rc2.left, rc2.top,
+            rc2.right, rc2.bottom);
+
+    DeleteObject( rgn);
+    DestroyWindow( child );
+}
+
 START_TEST(win)
 {
     pGetAncestor = (void *)GetProcAddress( GetModuleHandleA("user32.dll"), "GetAncestor" );
@@ -2231,6 +2268,8 @@ START_TEST(win)
                                 0, 0, 0, NULL);
     assert( hwndMain );
     assert( hwndMain2 );
+    
+    test_validatergn(hwndMain);
 
     test_capture_1();
     test_capture_2();


More information about the wine-patches mailing list