Instead of calling SendMessage, similarly to the SW_HIDE case.
Based on a patch by Kimmo Myllyvirta kimmo.myllyvirta@gmail.com. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=39731
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/user32/tests/msg.c | 22 ++++++++++++++++++++-- dlls/user32/winpos.c | 3 +++ 2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index f84525a0bf9..bf20c5c7f20 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -5085,7 +5085,7 @@ static void test_WM_DEVICECHANGE(HWND hwnd) } }
-static DWORD CALLBACK show_window_thread(LPVOID arg) +static DWORD CALLBACK hide_window_thread( LPVOID arg ) { HWND hwnd = arg;
@@ -5095,6 +5095,16 @@ static DWORD CALLBACK show_window_thread(LPVOID arg) return 0; }
+static DWORD CALLBACK show_window_thread( LPVOID arg ) +{ + HWND hwnd = arg; + + /* function will not return if ShowWindow(SW_SHOW) calls SendMessage() */ + ok( ShowWindow( hwnd, SW_SHOW ), "ShowWindow(SW_SHOW) expected TRUE\n" ); /* actually it's 24... */ + + return 0; +} + /* Helper function to easier test SetWindowPos messages */ #define test_msg_setpos( expected_list, flags, todo ) \ test_msg_setpos_( (expected_list), (flags), (todo), __FILE__, __LINE__) @@ -5156,7 +5166,7 @@ static void test_messages(void) ok_sequence(WmEmptySeq, "ShowWindow(SW_HIDE):overlapped", FALSE);
/* test ShowWindow(SW_HIDE) on a hidden window - multi-threaded */ - hthread = CreateThread(NULL, 0, show_window_thread, hwnd, 0, &tid); + hthread = CreateThread( NULL, 0, hide_window_thread, hwnd, 0, &tid ); ok(hthread != NULL, "CreateThread failed, error %d\n", GetLastError()); ok(WaitForSingleObject(hthread, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n"); CloseHandle(hthread); @@ -5167,6 +5177,14 @@ static void test_messages(void) flush_events(); ok_sequence(WmShowOverlappedSeq, "ShowWindow(SW_SHOW):overlapped", TRUE);
+ /* test ShowWindow(SW_SHOW) on a visible window - multi-threaded */ + hthread = CreateThread( NULL, 0, show_window_thread, hwnd, 0, &tid ); + ok( hthread != NULL, "CreateThread failed, error %d\n", GetLastError() ); + ok( WaitForSingleObject( hthread, INFINITE ) == WAIT_OBJECT_0, "WaitForSingleObject failed\n" ); + CloseHandle( hthread ); + flush_events(); + ok_sequence( WmEmptySeq, "ShowWindow(SW_SHOW):overlapped", FALSE ); + ShowWindow(hwnd, SW_HIDE); flush_events(); ok_sequence(WmHideOverlappedSeq, "ShowWindow(SW_HIDE):overlapped", FALSE); diff --git a/dlls/user32/winpos.c b/dlls/user32/winpos.c index b45b74ce82e..e3c3f5c5c6a 100644 --- a/dlls/user32/winpos.c +++ b/dlls/user32/winpos.c @@ -1231,6 +1231,9 @@ BOOL WINAPI ShowWindow( HWND hwnd, INT cmd ) if ((cmd == SW_HIDE) && !(GetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE)) return FALSE;
+ if ((cmd == SW_SHOW) && (GetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE)) + return TRUE; + return SendMessageW( hwnd, WM_WINE_SHOWWINDOW, cmd, 0 ); }
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=78551
Your paranoid android.
=== w8 (32 bit report) ===
user32: msg.c:14749: Test failed: unexpected message 31f msg.c:14750: Test failed: bad wparam 1 msg.c:14756: Test failed: unicode WM_CHAR: 0: the msg sequence is not complete: expected 0102 - actual 0000
=== w10pro64_2scr (64 bit report) ===
user32: msg.c:13904: Test failed: CreateDialogParam_1: 15: the msg 0x001c was expected, but got msg 0x0047 instead msg.c:13904: Test failed: CreateDialogParam_1: 16: the msg 0x0086 was expected, but got msg 0x001c instead msg.c:13904: Test failed: CreateDialogParam_1: 17: the msg 0x0006 was expected, but got msg 0x0086 instead msg.c:13904: Test failed: CreateDialogParam_1: 18: the msg 0x0007 was expected, but got msg 0x0006 instead msg.c:13904: Test failed: CreateDialogParam_1: 20: the msg sequence is not complete: expected 0000 - actual 0007
=== debiant (32 bit report) ===
user32: monitor: Timeout
=== debiant (32 bit Chinese:China report) ===
user32: monitor: Timeout
=== debiant (32 bit WoW report) ===
user32: monitor: Timeout win.c:11534: Test failed: got normal pos (200,88)-(400,288) win.c:11537: Test failed: got window rect (200,88)-(400,288) win.c:11550: Test failed: got normal pos (200,88)-(400,288)
=== debiant (64 bit WoW report) ===
user32: monitor: Timeout