From 1775ab4a114fd646d2820ff7ed83394ba82910f5 Mon Sep 17 00:00:00 2001 From: Rein Klazes Date: Thu, 24 Sep 2009 11:17:26 +0200 Subject: [PATCH] user32: In ScrollWindowEx do not clip the clipping rectangle with the scrolling rectangle. --- dlls/user32/painting.c | 3 ++- dlls/user32/tests/win.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/dlls/user32/painting.c b/dlls/user32/painting.c index 6c15ec6e22c..4af522d3d85 100644 --- a/dlls/user32/painting.c +++ b/dlls/user32/painting.c @@ -1404,11 +1404,12 @@ INT WINAPI ScrollWindowEx( HWND hwnd, INT dx, INT dy, hwnd = WIN_GetFullHandle( hwnd ); GetClientRect(hwnd, &rc); - if (rect) IntersectRect(&rc, &rc, rect); if (clipRect) IntersectRect(&cliprc,&rc,clipRect); else cliprc = rc; + if (rect) IntersectRect(&rc, &rc, rect); + if( hrgnUpdate ) bOwnRgn = FALSE; else if( bUpdate ) hrgnUpdate = CreateRectRgn( 0, 0, 0, 0 ); diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index cf1de2562df..94e1d2b63f8 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -3218,6 +3218,56 @@ static void test_window_styles(void) check_window_style(0, WS_EX_APPWINDOW, WS_CLIPSIBLINGS|WS_CAPTION, WS_EX_APPWINDOW|WS_EX_WINDOWEDGE); } +static void test_scrollwindow( HWND hwnd) +{ + HDC hdc; + RECT rc, rc2, rc3; + COLORREF colr; + + ShowWindow( hwnd, SW_SHOW); + UpdateWindow( hwnd); + GetClientRect( hwnd, &rc); + hdc = GetDC( hwnd); + /* test ScrollWindow(Ex) with no clip rectangle */ + /* paint the lower half of the window black */ + rc2 = rc; + rc2.top = ( rc2.top + rc2.bottom) / 2; + FillRect( hdc, &rc2, GetStockObject(BLACK_BRUSH)); + /* paint the upper half of the window white */ + rc2.bottom = rc2.top; + rc2.top =0; + FillRect( hdc, &rc2, GetStockObject(WHITE_BRUSH)); + /* scroll lower half up */ + rc2 = rc; + rc2.top = ( rc2.top + rc2.bottom) / 2; + ScrollWindowEx( hwnd, 0, - rc2.top, &rc2, NULL, NULL, NULL, SW_ERASE); + /* expected: black should have scrolled to the upper half */ + colr = GetPixel( hdc, (rc2.left+rc2.right)/ 2, rc2.bottom / 4 ); + ok ( colr == 0, "pixel should be black, color is %08x\n", colr); + /* Repeat that test of ScrollWindow(Ex) now with clip rectangle */ + /* paint the lower half of the window black */ + rc2 = rc; + rc2.top = ( rc2.top + rc2.bottom) / 2; + FillRect( hdc, &rc2, GetStockObject(BLACK_BRUSH)); + /* paint the upper half of the window white */ + rc2.bottom = rc2.top; + rc2.top =0; + FillRect( hdc, &rc2, GetStockObject(WHITE_BRUSH)); + /* scroll lower half up */ + rc2 = rc; + rc2.top = ( rc2.top + rc2.bottom) / 2; + rc3 = rc; + rc3.left = rc3.right / 4; + rc3.right -= rc3.right / 4; + ScrollWindowEx( hwnd, 0, - rc2.top, &rc2, &rc3, NULL, NULL, SW_ERASE); + /* expected: black should have scrolled to the upper half */ + colr = GetPixel( hdc, (rc2.left+rc2.right)/ 2, rc2.bottom / 4 ); + ok ( colr == 0, "pixel should be black, color is %08x\n", colr); + + /* clean up */ + ReleaseDC( hwnd, hdc); +} + static void test_scrollvalidate( HWND parent) { HDC hdc; @@ -5724,6 +5774,7 @@ START_TEST(win) test_mouse_input(hwndMain); test_validatergn(hwndMain); test_nccalcscroll( hwndMain); + test_scrollwindow( hwndMain); test_scrollvalidate( hwndMain); test_scrolldc( hwndMain); test_scroll(); -- 2.11.4.GIT