win32u: Move NtUserWaitForInputIdle implementation from user32.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2db1fea630
commit
2a833a1c86
|
@ -2974,53 +2974,9 @@ DWORD WINAPI MsgWaitForMultipleObjects( DWORD count, const HANDLE *handles,
|
|||
/***********************************************************************
|
||||
* WaitForInputIdle (USER32.@)
|
||||
*/
|
||||
DWORD WINAPI WaitForInputIdle( HANDLE hProcess, DWORD dwTimeOut )
|
||||
DWORD WINAPI WaitForInputIdle( HANDLE process, DWORD timeout )
|
||||
{
|
||||
DWORD start_time, elapsed, ret;
|
||||
HANDLE handles[2];
|
||||
|
||||
handles[0] = hProcess;
|
||||
SERVER_START_REQ( get_process_idle_event )
|
||||
{
|
||||
req->handle = wine_server_obj_handle( hProcess );
|
||||
wine_server_call_err( req );
|
||||
handles[1] = wine_server_ptr_handle( reply->event );
|
||||
}
|
||||
SERVER_END_REQ;
|
||||
if (!handles[1]) return WAIT_FAILED; /* no event to wait on */
|
||||
|
||||
start_time = GetTickCount();
|
||||
elapsed = 0;
|
||||
|
||||
TRACE("waiting for %p\n", handles[1] );
|
||||
do
|
||||
{
|
||||
ret = MsgWaitForMultipleObjects ( 2, handles, FALSE, dwTimeOut - elapsed, QS_SENDMESSAGE );
|
||||
switch (ret)
|
||||
{
|
||||
case WAIT_OBJECT_0:
|
||||
return 0;
|
||||
case WAIT_OBJECT_0+2:
|
||||
process_sent_messages();
|
||||
break;
|
||||
case WAIT_TIMEOUT:
|
||||
case WAIT_FAILED:
|
||||
TRACE("timeout or error\n");
|
||||
return ret;
|
||||
default:
|
||||
TRACE("finished\n");
|
||||
return 0;
|
||||
}
|
||||
if (dwTimeOut != INFINITE)
|
||||
{
|
||||
elapsed = GetTickCount() - start_time;
|
||||
if (elapsed > dwTimeOut)
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (1);
|
||||
|
||||
return WAIT_TIMEOUT;
|
||||
return NtUserWaitForInputIdle( process, timeout, FALSE );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -172,7 +172,6 @@ static const struct user_callbacks user_funcs =
|
|||
SendNotifyMessageW,
|
||||
SetSystemMenu,
|
||||
ShowCaret,
|
||||
WaitForInputIdle,
|
||||
free_menu_items,
|
||||
free_win_ptr,
|
||||
MENU_IsMenuActive,
|
||||
|
|
|
@ -1226,6 +1226,7 @@ static struct unix_funcs unix_funcs =
|
|||
NtUserUnregisterHotKey,
|
||||
NtUserUpdateLayeredWindow,
|
||||
NtUserVkKeyScanEx,
|
||||
NtUserWaitForInputIdle,
|
||||
NtUserWindowFromPoint,
|
||||
|
||||
SetDIBits,
|
||||
|
|
|
@ -481,15 +481,6 @@ LRESULT handle_internal_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpar
|
|||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NtUserWaitForInputIdle (win32u.@)
|
||||
*/
|
||||
DWORD WINAPI NtUserWaitForInputIdle( HANDLE process, DWORD timeout, BOOL wow )
|
||||
{
|
||||
if (!user_callbacks) return 0;
|
||||
return user_callbacks->pWaitForInputIdle( process, timeout );
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* NtUserGetGUIThreadInfo (win32u.@)
|
||||
*/
|
||||
|
@ -980,6 +971,58 @@ DWORD WINAPI NtUserMsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handl
|
|||
(flags & MWMO_INPUTAVAILABLE) ? mask : 0, mask, flags );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NtUserWaitForInputIdle (win32u.@)
|
||||
*/
|
||||
DWORD WINAPI NtUserWaitForInputIdle( HANDLE process, DWORD timeout, BOOL wow )
|
||||
{
|
||||
DWORD start_time, elapsed, ret;
|
||||
HANDLE handles[2];
|
||||
|
||||
handles[0] = process;
|
||||
SERVER_START_REQ( get_process_idle_event )
|
||||
{
|
||||
req->handle = wine_server_obj_handle( process );
|
||||
wine_server_call_err( req );
|
||||
handles[1] = wine_server_ptr_handle( reply->event );
|
||||
}
|
||||
SERVER_END_REQ;
|
||||
if (!handles[1]) return WAIT_FAILED; /* no event to wait on */
|
||||
|
||||
start_time = NtGetTickCount();
|
||||
elapsed = 0;
|
||||
|
||||
TRACE("waiting for %p\n", handles[1] );
|
||||
|
||||
for (;;)
|
||||
{
|
||||
ret = NtUserMsgWaitForMultipleObjectsEx( 2, handles, timeout - elapsed, QS_SENDMESSAGE, 0 );
|
||||
switch (ret)
|
||||
{
|
||||
case WAIT_OBJECT_0:
|
||||
return 0;
|
||||
case WAIT_OBJECT_0+2:
|
||||
process_sent_messages();
|
||||
break;
|
||||
case WAIT_TIMEOUT:
|
||||
case WAIT_FAILED:
|
||||
TRACE("timeout or error\n");
|
||||
return ret;
|
||||
default:
|
||||
TRACE("finished\n");
|
||||
return 0;
|
||||
}
|
||||
if (timeout != INFINITE)
|
||||
{
|
||||
elapsed = NtGetTickCount() - start_time;
|
||||
if (elapsed > timeout)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return WAIT_TIMEOUT;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NtUserPeekMessage (win32u.@)
|
||||
*/
|
||||
|
|
|
@ -45,7 +45,6 @@ struct user_callbacks
|
|||
BOOL (WINAPI *pSendNotifyMessageW)( HWND, UINT, WPARAM, LPARAM );
|
||||
BOOL (WINAPI *pSetSystemMenu)( HWND hwnd, HMENU menu );
|
||||
BOOL (WINAPI *pShowCaret)( HWND hwnd );
|
||||
DWORD (WINAPI *pWaitForInputIdle)( HANDLE, DWORD );
|
||||
void (CDECL *free_menu_items)( void *ptr );
|
||||
void (CDECL *free_win_ptr)( struct tagWND *win );
|
||||
HWND (CDECL *is_menu_active)(void);
|
||||
|
|
|
@ -1305,7 +1305,7 @@
|
|||
@ stdcall NtUserVkKeyScanEx(long long)
|
||||
@ stub NtUserWOWCleanup
|
||||
@ stub NtUserWaitAvailableMessageEx
|
||||
@ stub NtUserWaitForInputIdle
|
||||
@ stdcall NtUserWaitForInputIdle(long long long)
|
||||
@ stub NtUserWaitForMsgAndEvent
|
||||
@ stub NtUserWaitForRedirectionStartComplete
|
||||
@ stub NtUserWaitMessage
|
||||
|
|
|
@ -286,6 +286,7 @@ struct unix_funcs
|
|||
COLORREF key, const BLENDFUNCTION *blend,
|
||||
DWORD flags, const RECT *dirty );
|
||||
WORD (WINAPI *pNtUserVkKeyScanEx)( WCHAR chr, HKL layout );
|
||||
DWORD (WINAPI *pNtUserWaitForInputIdle)( HANDLE process, DWORD timeout, BOOL wow );
|
||||
HWND (WINAPI *pNtUserWindowFromPoint)( LONG x, LONG y );
|
||||
|
||||
/* Wine-specific functions */
|
||||
|
|
|
@ -1184,6 +1184,12 @@ WORD WINAPI NtUserVkKeyScanEx( WCHAR chr, HKL layout )
|
|||
return unix_funcs->pNtUserVkKeyScanEx( chr, layout );
|
||||
}
|
||||
|
||||
DWORD WINAPI NtUserWaitForInputIdle( HANDLE process, DWORD timeout, BOOL wow )
|
||||
{
|
||||
if (!unix_funcs) return 0;
|
||||
return unix_funcs->pNtUserWaitForInputIdle( process, timeout, wow );
|
||||
}
|
||||
|
||||
HWND WINAPI NtUserWindowFromPoint( LONG x, LONG y )
|
||||
{
|
||||
if (!unix_funcs) return 0;
|
||||
|
|
Loading…
Reference in New Issue