Jacek Caban : win32u: Move NtUserWaitForInputIdle implementation from user32.
Alexandre Julliard
julliard at winehq.org
Fri Apr 1 16:04:28 CDT 2022
Module: wine
Branch: master
Commit: 2a833a1c862e7ec421978540ad83aadc16cdda8a
URL: https://source.winehq.org/git/wine.git/?a=commit;h=2a833a1c862e7ec421978540ad83aadc16cdda8a
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri Apr 1 14:46:04 2022 +0200
win32u: Move NtUserWaitForInputIdle implementation from user32.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/user32/message.c | 48 ++--------------------------------
dlls/user32/user_main.c | 1 -
dlls/win32u/gdiobj.c | 1 +
dlls/win32u/message.c | 61 +++++++++++++++++++++++++++++++++++++-------
dlls/win32u/ntuser_private.h | 1 -
dlls/win32u/win32u.spec | 2 +-
dlls/win32u/win32u_private.h | 1 +
dlls/win32u/wrappers.c | 6 +++++
8 files changed, 63 insertions(+), 58 deletions(-)
diff --git a/dlls/user32/message.c b/dlls/user32/message.c
index c5f55bf11c9..0df521a5a47 100644
--- a/dlls/user32/message.c
+++ b/dlls/user32/message.c
@@ -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 );
}
diff --git a/dlls/user32/user_main.c b/dlls/user32/user_main.c
index 599bc3f636f..8eb60232c2f 100644
--- a/dlls/user32/user_main.c
+++ b/dlls/user32/user_main.c
@@ -172,7 +172,6 @@ static const struct user_callbacks user_funcs =
SendNotifyMessageW,
SetSystemMenu,
ShowCaret,
- WaitForInputIdle,
free_menu_items,
free_win_ptr,
MENU_IsMenuActive,
diff --git a/dlls/win32u/gdiobj.c b/dlls/win32u/gdiobj.c
index ccab4beeaf4..5f3c7bdf7b1 100644
--- a/dlls/win32u/gdiobj.c
+++ b/dlls/win32u/gdiobj.c
@@ -1226,6 +1226,7 @@ static struct unix_funcs unix_funcs =
NtUserUnregisterHotKey,
NtUserUpdateLayeredWindow,
NtUserVkKeyScanEx,
+ NtUserWaitForInputIdle,
NtUserWindowFromPoint,
SetDIBits,
diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c
index 0a311f5a6ef..24813fac66f 100644
--- a/dlls/win32u/message.c
+++ b/dlls/win32u/message.c
@@ -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.@)
*/
diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h
index 3b6b6badfdc..4dade6c78a5 100644
--- a/dlls/win32u/ntuser_private.h
+++ b/dlls/win32u/ntuser_private.h
@@ -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);
diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec
index 47e2afb315f..3e4b3ab5e30 100644
--- a/dlls/win32u/win32u.spec
+++ b/dlls/win32u/win32u.spec
@@ -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
diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h
index 83fdecc9348..80cae3dad35 100644
--- a/dlls/win32u/win32u_private.h
+++ b/dlls/win32u/win32u_private.h
@@ -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 */
diff --git a/dlls/win32u/wrappers.c b/dlls/win32u/wrappers.c
index 74677a969db..6348093e1fc 100644
--- a/dlls/win32u/wrappers.c
+++ b/dlls/win32u/wrappers.c
@@ -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;
More information about the wine-cvs
mailing list