Some games, e.g., Project CARS waits for WM_ACTIVATE when restoring from iconic state.
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/winex11.drv/event.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index 6054f645c4..5c465aa033 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -1266,6 +1266,8 @@ static void handle_wm_state_notify( HWND hwnd, XPropertyEvent *event, BOOL updat { TRACE( "restoring win %p/%lx\n", data->hwnd, data->whole_window ); release_win_data( data ); + if ((style & (WS_MINIMIZE | WS_VISIBLE)) == (WS_MINIMIZE | WS_VISIBLE)) + SetActiveWindow( hwnd ); SendMessageW( hwnd, WM_SYSCOMMAND, SC_RESTORE, 0 ); return; }
Zhiyi Zhang zzhang@codeweavers.com wrote:
@@ -1266,6 +1266,8 @@ static void handle_wm_state_notify( HWND hwnd, XPropertyEvent *event, BOOL updat { TRACE( "restoring win %p/%lx\n", data->hwnd, data->whole_window ); release_win_data( data );
if ((style & (WS_MINIMIZE | WS_VISIBLE)) == (WS_MINIMIZE | WS_VISIBLE))
SetActiveWindow( hwnd ); SendMessageW( hwnd, WM_SYSCOMMAND, SC_RESTORE, 0 ); return; }
Your test doesn't contain the code to check the (WS_MINIMIZE | WS_VISIBLE) statement, I'd guess a not visible window won't receive an activation event before window pos messages, but that should be verified with a test that calls ShowWindow(SW_RESTORE) instead of Alt-tabbing. Also from your test it looks like that it's the Explorer who actually activates the window before restoring it, probably you should add similar code to programs/explorer/systray.c to make your app work also in desktop mode.
On 6/4/19 4:19 PM, Dmitry Timoshkov wrote:
Zhiyi Zhang zzhang@codeweavers.com wrote:
@@ -1266,6 +1266,8 @@ static void handle_wm_state_notify( HWND hwnd, XPropertyEvent *event, BOOL updat { TRACE( "restoring win %p/%lx\n", data->hwnd, data->whole_window ); release_win_data( data );
if ((style & (WS_MINIMIZE | WS_VISIBLE)) == (WS_MINIMIZE | WS_VISIBLE))
SetActiveWindow( hwnd ); SendMessageW( hwnd, WM_SYSCOMMAND, SC_RESTORE, 0 ); return; }
Your test doesn't contain the code to check the (WS_MINIMIZE | WS_VISIBLE) statement, I'd guess a not visible window won't receive an activation event before window pos messages, but that should be verified with a test that calls ShowWindow(SW_RESTORE) instead of Alt-tabbing. Also from your test it looks like that it's the Explorer who actually activates the window before restoring it, probably you should add similar code to programs/explorer/systray.c to make your app work also in desktop mode.
ShowWindow(SW_RESTORE) with invisible minimized window is already tested in user32/tests/msg.c#L5135 with WmShowRestoreMinOverlappedSeq message sequence.
Thanks. I will add it to explorer as well.
Zhiyi Zhang zzhang@codeweavers.com wrote:
@@ -1266,6 +1266,8 @@ static void handle_wm_state_notify( HWND hwnd, XPropertyEvent *event, BOOL updat { TRACE( "restoring win %p/%lx\n", data->hwnd, data->whole_window ); release_win_data( data );
if ((style & (WS_MINIMIZE | WS_VISIBLE)) == (WS_MINIMIZE | WS_VISIBLE))
SetActiveWindow( hwnd ); SendMessageW( hwnd, WM_SYSCOMMAND, SC_RESTORE, 0 ); return; }
Your test doesn't contain the code to check the (WS_MINIMIZE | WS_VISIBLE) statement, I'd guess a not visible window won't receive an activation event before window pos messages, but that should be verified with a test that calls ShowWindow(SW_RESTORE) instead of Alt-tabbing. Also from your test it looks like that it's the Explorer who actually activates the window before restoring it, probably you should add similar code to programs/explorer/systray.c to make your app work also in desktop mode.
ShowWindow(SW_RESTORE) with invisible minimized window is already tested in user32/tests/msg.c#L5135 with WmShowRestoreMinOverlappedSeq message sequence.
I see, thanks. However there is no an existing sequence for calling DefWindowProc(WM_SYSCOMMAND, SC_RESTORE) for a minimized visible window to compare it with, so that it could be more clear when and how the window gets activated. Could you please add it as well?
On 6/4/19 5:30 PM, Dmitry Timoshkov wrote:
Zhiyi Zhang zzhang@codeweavers.com wrote:
@@ -1266,6 +1266,8 @@ static void handle_wm_state_notify( HWND hwnd, XPropertyEvent *event, BOOL updat { TRACE( "restoring win %p/%lx\n", data->hwnd, data->whole_window ); release_win_data( data );
if ((style & (WS_MINIMIZE | WS_VISIBLE)) == (WS_MINIMIZE | WS_VISIBLE))
SetActiveWindow( hwnd ); SendMessageW( hwnd, WM_SYSCOMMAND, SC_RESTORE, 0 ); return; }
Your test doesn't contain the code to check the (WS_MINIMIZE | WS_VISIBLE) statement, I'd guess a not visible window won't receive an activation event before window pos messages, but that should be verified with a test that calls ShowWindow(SW_RESTORE) instead of Alt-tabbing. Also from your test it looks like that it's the Explorer who actually activates the window before restoring it, probably you should add similar code to programs/explorer/systray.c to make your app work also in desktop mode.
ShowWindow(SW_RESTORE) with invisible minimized window is already tested in user32/tests/msg.c#L5135 with WmShowRestoreMinOverlappedSeq message sequence.
I see, thanks. However there is no an existing sequence for calling DefWindowProc(WM_SYSCOMMAND, SC_RESTORE) for a minimized visible window to compare it with, so that it could be more clear when and how the window gets activated. Could you please add it as well?
Sure. My pleasure.