Handle posted internal messages directly in PeekMessageW to avoid

having to return them to the application.
Call NtYieldExecution for nicer behavior when PM_NOYIELD is not
specified.
This commit is contained in:
Alexandre Julliard 2005-04-20 18:53:53 +00:00
parent d1a36e1929
commit fc2bd2324e
1 changed files with 17 additions and 12 deletions

View File

@ -2672,15 +2672,26 @@ BOOL WINAPI PeekMessageW( MSG *msg_out, HWND hwnd, UINT first, UINT last, UINT f
hwnd = WIN_GetFullHandle( hwnd );
if (!peek_message( &msg, hwnd, first, last, (flags & PM_REMOVE) ? GET_MSG_REMOVE : 0 ))
for (;;)
{
if (!(flags & PM_NOYIELD))
if (!peek_message( &msg, hwnd, first, last, (flags & PM_REMOVE) ? GET_MSG_REMOVE : 0 ))
{
DWORD count;
ReleaseThunkLock(&count);
if (count) RestoreThunkLock(count);
if (!(flags & PM_NOYIELD))
{
DWORD count;
ReleaseThunkLock(&count);
NtYieldExecution();
if (count) RestoreThunkLock(count);
}
return FALSE;
}
return FALSE;
if (msg.message & 0x80000000)
{
handle_internal_message( msg.hwnd, msg.message, msg.wParam, msg.lParam );
if (!(flags & PM_REMOVE)) /* have to remove it explicitly */
peek_message( &msg, msg.hwnd, msg.message, msg.message, GET_MSG_REMOVE );
}
else break;
}
if ((queue = QUEUE_Current()))
@ -2863,9 +2874,6 @@ LONG WINAPI DispatchMessageA( const MSG* msg )
msg->message, msg->wParam, GetTickCount() );
}
if (msg->message & 0x80000000)
return handle_internal_message( msg->hwnd, msg->message, msg->wParam, msg->lParam );
if (!(wndPtr = WIN_GetPtr( msg->hwnd )))
{
if (msg->hwnd) SetLastError( ERROR_INVALID_WINDOW_HANDLE );
@ -2938,9 +2946,6 @@ LONG WINAPI DispatchMessageW( const MSG* msg )
msg->message, msg->wParam, GetTickCount() );
}
if (msg->message & 0x80000000)
return handle_internal_message( msg->hwnd, msg->message, msg->wParam, msg->lParam );
if (!(wndPtr = WIN_GetPtr( msg->hwnd )))
{
if (msg->hwnd) SetLastError( ERROR_INVALID_WINDOW_HANDLE );