[PATCH] user32: Fix return value of ScrollWindowEx for invisible windows.

Myah Caron qsniyg at protonmail.com
Thu Jul 30 09:19:34 CDT 2020


From: Dmitry Timoshkov <dmitry at baikal.ru>

Signed-off-by: Myah Caron <qsniyg at protonmail.com>
---
This is a staging patch.
I've added a test, but left the patch otherwise untouched.

 dlls/user32/painting.c  | 4 ++--
 dlls/user32/tests/win.c | 7 +++++++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/dlls/user32/painting.c b/dlls/user32/painting.c
index 313c5fa1e6..2b4b7937aa 100644
--- a/dlls/user32/painting.c
+++ b/dlls/user32/painting.c
@@ -1484,10 +1484,10 @@ static INT scroll_window( HWND hwnd, INT dx, INT dy, const RECT *rect, const REC
     rdw_flags = (flags & SW_ERASE) && (flags & SW_INVALIDATE) ?
                                 RDW_INVALIDATE | RDW_ERASE  : RDW_INVALIDATE ;

-    if (!WIN_IsWindowDrawable( hwnd, TRUE )) return ERROR;
     hwnd = WIN_GetFullHandle( hwnd );

-    GetClientRect(hwnd, &rc);
+    if (!WIN_IsWindowDrawable( hwnd, TRUE )) SetRectEmpty(&rc);
+    else GetClientRect(hwnd, &rc);

     if (clipRect) IntersectRect(&cliprc,&rc,clipRect);
     else cliprc = rc;
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index 700e60db17..354ed5a2c1 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -4920,6 +4920,7 @@ static void test_scrollwindow( HWND hwnd)
     HDC hdc;
     RECT rc, rc2, rc3;
     COLORREF colr;
+    INT ret;

     ShowWindow( hwnd, SW_SHOW);
     UpdateWindow( hwnd);
@@ -4964,6 +4965,12 @@ static void test_scrollwindow( HWND hwnd)
     colr = GetPixel( hdc, (rc2.left+rc2.right)/ 2,  rc2.bottom / 4 );
     ok ( colr == 0, "pixel should be black, color is %08x\n", colr);

+    ShowWindow(hwnd, SW_HIDE);
+    UpdateWindow( hwnd);
+    flush_events( TRUE );
+    ret = ScrollWindowEx( hwnd, 0, - rc2.top, &rc2, &rc3, NULL, NULL, SW_ERASE);
+    ok(ret == NULLREGION, "got ret %d\n", ret);
+
     /* clean up */
     ReleaseDC( hwnd, hdc);
 }
--
2.27.0





More information about the wine-devel mailing list