Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54949
-- v3: server: Update parent window region when exposing previously invisible window.
From: Jinoh Kang jinoh.kang.kr@gmail.com
--- dlls/user32/tests/msg.c | 160 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index 624d86899b3..5caf845d215 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -9430,6 +9430,164 @@ static void test_swp_paint_regions(void) subtest_swp_paint_regions( 0, "SimpleWindowClassWithParentDC", "SimpleWindowClass" ); }
+static void test_swp_paint_region_on_show(void) +{ + HRGN hrgn_actual_child = CreateRectRgn( 0, 0, 0, 0 ); + HRGN hrgn_actual = CreateRectRgn( 0, 0, 0, 0 ); + const RECT rect_1 = { 10, 10, 100, 100 }; + const RECT rect_2 = { 20, 20, 120, 120 }; + RECT rect_expect_child, rect_expect; + RECT rect_actual_child, rect_actual; + HWND hparent, hchild; + int result; + + hparent = CreateWindowExA( 0, "SimpleWindowClass", "Test parent", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 80, 80, 200, 200, NULL, 0, 0, NULL ); + ok( hparent != 0, "Creating parent window returned error %lu\n", GetLastError() ); + + hchild = CreateWindowExA( 0, "SimpleWindowClass", "Test child", WS_CHILD | WS_BORDER, + 0, 0, 100, 100, hparent, 0, 0, NULL ); + ok( hchild != 0, "Creating child window returned error %lu\n", GetLastError() ); + + if (winetest_debug > 1) trace("testing show window (no move / size)\n"); + + SetWindowPos( hchild, HWND_TOP, + rect_1.left, rect_1.top, rect_1.right - rect_1.left, rect_1.bottom - rect_1.top, + SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOZORDER ); + + UpdateWindow( hparent ); + flush_events(); + + SetWindowPos( hchild, HWND_TOP, 0, 0, 0, 0, + SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE ); + + ok( GetUpdateRgn( hparent, hrgn_actual, FALSE ) != ERROR, + "GetUpdateRgn on parent shall succeed\n" ); + ok( GetUpdateRgn( hchild, hrgn_actual_child, FALSE ) != ERROR, + "GetUpdateRgn on child shall succeed\n" ); + + result = GetRgnBox( hrgn_actual, &rect_actual ); + todo_wine_if (result == NULLREGION) + ok( result == SIMPLEREGION, "GetRgnBox (on parent) returned %d\n", result ); + if (result == COMPLEXREGION) dump_region( hrgn_actual ); + + rect_expect = rect_1; + todo_wine_if (IsRectEmpty( &rect_actual )) + ok( EqualRect( &rect_actual, &rect_expect ), "parent update region: got %s, expected %s\n", + wine_dbgstr_rect( &rect_actual ), wine_dbgstr_rect( &rect_expect ) ); + + result = GetRgnBox( hrgn_actual_child, &rect_actual_child ); + ok( result == SIMPLEREGION, "GetRgnBox (on child) returned %d\n", result ); + if (result == COMPLEXREGION) dump_region( hrgn_actual_child ); + + ok( GetClientRect( hchild, &rect_expect_child ), "GetClientRect failed\n" ); + ok( EqualRect( &rect_actual_child, &rect_expect_child ), "child update region: got %s, expected %s\n", + wine_dbgstr_rect( &rect_actual_child ), wine_dbgstr_rect( &rect_expect_child ) ); + + if (winetest_debug > 1) trace("testing show window (with move / resize)\n"); + + SetWindowPos( hchild, HWND_TOP, + rect_1.left, rect_1.top, rect_1.right - rect_1.left, rect_1.bottom - rect_1.top, + SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOZORDER ); + + UpdateWindow( hparent ); + flush_events(); + + SetWindowPos( hchild, HWND_TOP, + rect_2.left, + rect_2.top, + rect_2.right - rect_2.left, + rect_2.bottom - rect_2.top, + SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER ); + + ok( GetUpdateRgn( hparent, hrgn_actual, FALSE ) != ERROR, + "GetUpdateRgn on parent shall succeed\n" ); + ok( GetUpdateRgn( hchild, hrgn_actual_child, FALSE ) != ERROR, + "GetUpdateRgn on child shall succeed\n" ); + + result = GetRgnBox( hrgn_actual, &rect_actual ); + todo_wine_if (result == NULLREGION) + ok( result == SIMPLEREGION, "GetRgnBox (on parent) returned %d\n", result ); + if (result == COMPLEXREGION) dump_region( hrgn_actual ); + + rect_expect = rect_2; + todo_wine_if (IsRectEmpty( &rect_actual )) + ok( EqualRect( &rect_actual, &rect_expect ), "parent update region: got %s, expected %s\n", + wine_dbgstr_rect( &rect_actual ), wine_dbgstr_rect( &rect_expect ) ); + + result = GetRgnBox( hrgn_actual_child, &rect_actual_child ); + ok( result == SIMPLEREGION, "GetRgnBox (on child) returned %d\n", result ); + if (result == COMPLEXREGION) dump_region( hrgn_actual_child ); + + ok( GetClientRect( hchild, &rect_expect_child ), "GetClientRect failed\n" ); + ok( EqualRect( &rect_actual_child, &rect_expect_child ), "child update region: got %s, expected %s\n", + wine_dbgstr_rect( &rect_actual_child ), wine_dbgstr_rect( &rect_expect_child ) ); + + DestroyWindow( hchild ); + DestroyWindow( hparent ); + DeleteObject( hrgn_actual_child ); + DeleteObject( hrgn_actual ); +} + +static void test_swp_paint_region_on_extend_zerosize(void) +{ + HRGN hrgn_actual_child = CreateRectRgn( 0, 0, 0, 0 ); + HRGN hrgn_actual = CreateRectRgn( 0, 0, 0, 0 ); + const RECT rect_1 = { 10, 10, 100, 100 }; + RECT rect_expect_child, rect_expect; + RECT rect_actual_child, rect_actual; + HWND hparent, hchild; + int result; + + hparent = CreateWindowExA( 0, "SimpleWindowClass", "Test parent", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 80, 80, 200, 200, NULL, 0, 0, NULL ); + ok( hparent != 0, "Creating parent window returned error %lu\n", GetLastError() ); + + hchild = CreateWindowExA( 0, "SimpleWindowClass", "Test child (no border)", WS_CHILD | WS_VISIBLE, + 10, 10, 0, 0, hparent, 0, 0, NULL ); + ok( hchild != 0, "Creating child window returned error %lu\n", GetLastError() ); + + if (winetest_debug > 1) trace("testing extending zero-size window\n"); + + UpdateWindow( hparent ); + flush_events(); + + SetWindowPos( hchild, HWND_TOP, + rect_1.left, + rect_1.top, + rect_1.right - rect_1.left, + rect_1.bottom - rect_1.top, + SWP_NOACTIVATE | SWP_NOZORDER ); + + ok( GetUpdateRgn( hparent, hrgn_actual, FALSE ) != ERROR, + "GetUpdateRgn on parent shall succeed\n" ); + ok( GetUpdateRgn( hchild, hrgn_actual_child, FALSE ) != ERROR, + "GetUpdateRgn on child shall succeed\n" ); + + result = GetRgnBox( hrgn_actual, &rect_actual ); + todo_wine_if (result == NULLREGION) + ok( result == SIMPLEREGION, "GetRgnBox (on parent) returned %d\n", result ); + if (result == COMPLEXREGION) dump_region( hrgn_actual ); + + rect_expect = rect_1; + todo_wine_if (IsRectEmpty( &rect_actual )) + ok( EqualRect( &rect_actual, &rect_expect ), "parent update region: got %s, expected %s\n", + wine_dbgstr_rect( &rect_actual ), wine_dbgstr_rect( &rect_expect ) ); + + result = GetRgnBox( hrgn_actual_child, &rect_actual_child ); + ok( result == SIMPLEREGION, "GetRgnBox (on child) returned %d\n", result ); + if (result == COMPLEXREGION) dump_region( hrgn_actual_child ); + + ok( GetClientRect( hchild, &rect_expect_child ), "GetClientRect failed\n" ); + ok( EqualRect( &rect_actual_child, &rect_expect_child ), "child update region: got %s, expected %s\n", + wine_dbgstr_rect( &rect_actual_child ), wine_dbgstr_rect( &rect_expect_child ) ); + + DestroyWindow( hchild ); + DestroyWindow( hparent ); + DeleteObject( hrgn_actual_child ); + DeleteObject( hrgn_actual ); +} + static void subtest_hvredraw(HWND hparent, const char *classname, DWORD style) { static const struct movesize_test { @@ -19693,6 +19851,8 @@ START_TEST(msg) test_wmime_keydown_message(); test_paint_messages(); test_swp_paint_regions(); + test_swp_paint_region_on_show(); + test_swp_paint_region_on_extend_zerosize(); test_hvredraw(); test_interthread_messages(); test_message_conversion();
From: Jinoh Kang jinoh.kang.kr@gmail.com
Fixes: 33617af8145b6fadfe41d48968a728ff57b3064b Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54949 --- dlls/user32/tests/msg.c | 8 +------- server/window.c | 5 +++-- 2 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index 5caf845d215..a7c1cf802e0 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -5793,7 +5793,7 @@ static void test_messages(void) test_WM_SETREDRAW(hchild);
ShowWindow(hchild, SW_SHOW); - ok_sequence(WmShowChildSeq, "ShowWindow(SW_SHOW):child", TRUE); + ok_sequence(WmShowChildSeq, "ShowWindow(SW_SHOW):child", FALSE);
/* check parent messages too */ log_all_parent_messages++; @@ -9467,12 +9467,10 @@ static void test_swp_paint_region_on_show(void) "GetUpdateRgn on child shall succeed\n" );
result = GetRgnBox( hrgn_actual, &rect_actual ); - todo_wine_if (result == NULLREGION) ok( result == SIMPLEREGION, "GetRgnBox (on parent) returned %d\n", result ); if (result == COMPLEXREGION) dump_region( hrgn_actual );
rect_expect = rect_1; - todo_wine_if (IsRectEmpty( &rect_actual )) ok( EqualRect( &rect_actual, &rect_expect ), "parent update region: got %s, expected %s\n", wine_dbgstr_rect( &rect_actual ), wine_dbgstr_rect( &rect_expect ) );
@@ -9506,12 +9504,10 @@ static void test_swp_paint_region_on_show(void) "GetUpdateRgn on child shall succeed\n" );
result = GetRgnBox( hrgn_actual, &rect_actual ); - todo_wine_if (result == NULLREGION) ok( result == SIMPLEREGION, "GetRgnBox (on parent) returned %d\n", result ); if (result == COMPLEXREGION) dump_region( hrgn_actual );
rect_expect = rect_2; - todo_wine_if (IsRectEmpty( &rect_actual )) ok( EqualRect( &rect_actual, &rect_expect ), "parent update region: got %s, expected %s\n", wine_dbgstr_rect( &rect_actual ), wine_dbgstr_rect( &rect_expect ) );
@@ -9565,12 +9561,10 @@ static void test_swp_paint_region_on_extend_zerosize(void) "GetUpdateRgn on child shall succeed\n" );
result = GetRgnBox( hrgn_actual, &rect_actual ); - todo_wine_if (result == NULLREGION) ok( result == SIMPLEREGION, "GetRgnBox (on parent) returned %d\n", result ); if (result == COMPLEXREGION) dump_region( hrgn_actual );
rect_expect = rect_1; - todo_wine_if (IsRectEmpty( &rect_actual )) ok( EqualRect( &rect_actual, &rect_expect ), "parent update region: got %s, expected %s\n", wine_dbgstr_rect( &rect_actual ), wine_dbgstr_rect( &rect_expect ) );
diff --git a/server/window.c b/server/window.c index f713ed224aa..01082b90b69 100644 --- a/server/window.c +++ b/server/window.c @@ -1766,8 +1766,9 @@ static struct region *expose_window( struct window *win, const rectangle_t *old_ offset_region( new_vis_rgn, win->window_rect.left - old_window_rect->left, win->window_rect.top - old_window_rect->top );
- if (is_composited ? union_region( new_vis_rgn, old_vis_rgn, new_vis_rgn ) - : subtract_region( new_vis_rgn, old_vis_rgn, new_vis_rgn )) + if (is_region_empty( old_vis_rgn ) || + (is_composited ? union_region( new_vis_rgn, old_vis_rgn, new_vis_rgn ) + : subtract_region( new_vis_rgn, old_vis_rgn, new_vis_rgn ))) { if (!is_region_empty( new_vis_rgn )) {
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=132904
Your paranoid android.
=== w864 (32 bit report) ===
user32: msg.c:15472: Test failed: EndDialog2: 9: the msg 0x0009 was expected, but got msg 0x0047 instead msg.c:15472: Test failed: EndDialog2: 10: the msg 0x0008 was expected, but got msg 0x0009 instead msg.c:15472: Test failed: EndDialog2: 11: the msg 0x8005 was expected, but got msg 0x0008 instead msg.c:15472: Test failed: EndDialog2: 12: the msg 0x0007 was expected, but got msg 0x8005 instead msg.c:15472: Test failed: EndDialog2: 13: the msg sequence is not complete: expected 0000 - actual 0007
=== w10pro64 (64 bit report) ===
user32: msg.c:5015: Test failed: ShowWindow(SW_SHOWNA) on visible top level window: 0: the msg 0x0018 was expected, but got msg 0x0088 instead msg.c:5015: Test failed: ShowWindow(SW_SHOWNA) on visible top level window: 1: the msg 0x0046 was expected, but got msg 0x0018 instead msg.c:5015: Test failed: ShowWindow(SW_SHOWNA) on visible top level window: 6: the msg sequence is not complete: expected 0000 - actual 0046
=== debian11 (32 bit ar:MA report) ===
user32: msg.c:6897: Test failed: SetFocus(hwnd) on a button: 4: the msg 0x0007 was expected, but got msg 0x0005 instead msg.c:6897: Test failed: SetFocus(hwnd) on a button: 5: the msg 0x0135 was expected, but got msg 0x030f instead msg.c:6897: Test failed: SetFocus(hwnd) on a button: 6: the msg 0x002b was expected, but got msg 0x001c instead msg.c:6897: Test failed: SetFocus(hwnd) on a button: 7: the msg 0x0111 was expected, but got msg 0x0086 instead msg.c:6897: Test failed: SetFocus(hwnd) on a button: 8: the msg 0x8000 was expected, but got msg 0x0006 instead msg.c:6897: Test failed: SetFocus(hwnd) on a button: 9: the msg sequence is not complete: expected 0000 - actual 0009
v1 -> v2: Omit unnecessary `SWP_SHOWWINDOW`
v2 -> v3: add Fixes: trailer
This merge request was approved by Huw Davies.