joy.cpl: Process messages while waiting for the input threads.

Instead of interrupting the wait on any message.
This commit is contained in:
Rémi Bernon 2023-02-11 16:26:57 +01:00 committed by Alexandre Julliard
parent 39dc9d09f3
commit 37025bdabd
2 changed files with 20 additions and 2 deletions

View file

@ -792,7 +792,16 @@ INT_PTR CALLBACK test_di_dialog_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM
case PSN_RESET:
case PSN_KILLACTIVE:
SetEvent( thread_stop );
MsgWaitForMultipleObjects( 1, &thread, FALSE, INFINITE, 0 );
/* wait for the input thread to stop, processing any WM_USER message from it */
while (MsgWaitForMultipleObjects( 1, &thread, FALSE, INFINITE, QS_ALLINPUT ) == 1)
{
MSG msg;
while (PeekMessageW( &msg, 0, 0, 0, PM_REMOVE ))
{
TranslateMessage( &msg );
DispatchMessageW( &msg );
}
}
CloseHandle( state_event );
CloseHandle( thread_stop );
CloseHandle( thread );

View file

@ -428,7 +428,16 @@ extern INT_PTR CALLBACK test_xi_dialog_proc( HWND hwnd, UINT msg, WPARAM wparam,
case PSN_RESET:
case PSN_KILLACTIVE:
SetEvent( thread_stop );
MsgWaitForMultipleObjects( 1, &thread, FALSE, INFINITE, 0 );
/* wait for the input thread to stop, processing any WM_USER message from it */
while (MsgWaitForMultipleObjects( 1, &thread, FALSE, INFINITE, QS_ALLINPUT ) == 1)
{
MSG msg;
while (PeekMessageW( &msg, 0, 0, 0, PM_REMOVE ))
{
TranslateMessage( &msg );
DispatchMessageW( &msg );
}
}
CloseHandle( thread_stop );
CloseHandle( thread );
dialog_hwnd = 0;