server: Set the queue mask directly in get_message to avoid an extra server call.

This commit is contained in:
Alexandre Julliard 2007-08-29 18:13:13 +02:00
parent b4edb573fd
commit 2896540a34
5 changed files with 18 additions and 26 deletions

View File

@ -2017,9 +2017,12 @@ static BOOL peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags
ULONG_PTR extra_info = 0;
struct user_thread_info *thread_info = get_user_thread_info();
struct received_message_info info, *old_info;
unsigned int wake_mask, changed_mask = HIWORD(flags);
unsigned int hw_id = 0; /* id of previous hardware message */
if (!first && !last) last = ~0;
if (!changed_mask) changed_mask = QS_ALLINPUT;
wake_mask = changed_mask & (QS_SENDMESSAGE | QS_SMRESULT);
for (;;)
{
@ -2038,6 +2041,8 @@ static BOOL peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags
req->get_first = first;
req->get_last = last;
req->hw_id = hw_id;
req->wake_mask = wake_mask;
req->changed_mask = changed_mask;
if (buffer_size) wine_server_set_reply( req, buffer, buffer_size );
if (!(res = wine_server_call( req )))
{
@ -2933,35 +2938,14 @@ BOOL WINAPI GetMessageW( MSG *msg, HWND hwnd, UINT first, UINT last )
if ((first <= WM_SYSTIMER) && (last >= WM_SYSTIMER)) mask |= QS_TIMER;
if ((first <= WM_PAINT) && (last >= WM_PAINT)) mask |= QS_PAINT;
}
else mask |= QS_MOUSE | QS_KEY | QS_TIMER | QS_PAINT;
else mask = QS_ALLINPUT;
while (!PeekMessageW( msg, hwnd, first, last, PM_REMOVE ))
while (!PeekMessageW( msg, hwnd, first, last, PM_REMOVE | PM_NOYIELD | (mask << 16) ))
{
/* wait until one of the bits is set */
unsigned int wake_bits = 0, changed_bits = 0;
DWORD dwlc;
SERVER_START_REQ( set_queue_mask )
{
req->wake_mask = QS_SENDMESSAGE;
req->changed_mask = mask;
req->skip_wait = 1;
if (!wine_server_call( req ))
{
wake_bits = reply->wake_bits;
changed_bits = reply->changed_bits;
}
}
SERVER_END_REQ;
if (changed_bits & mask) continue;
if (wake_bits & QS_SENDMESSAGE) continue;
TRACE( "(%04x) mask=%08x, bits=%08x, changed=%08x, waiting\n",
GetCurrentThreadId(), mask, wake_bits, changed_bits );
ReleaseThunkLock( &dwlc );
USER_Driver->pMsgWaitForMultipleObjectsEx( 1, &server_queue, INFINITE, QS_ALLINPUT, 0 );
USER_Driver->pMsgWaitForMultipleObjectsEx( 1, &server_queue, INFINITE, mask, 0 );
if (dwlc) RestoreThunkLock( dwlc );
}

View File

@ -2499,6 +2499,8 @@ struct get_message_request
unsigned int get_first;
unsigned int get_last;
unsigned int hw_id;
unsigned int wake_mask;
unsigned int changed_mask;
};
struct get_message_reply
{
@ -4731,6 +4733,6 @@ union generic_reply
struct make_process_system_reply make_process_system_reply;
};
#define SERVER_PROTOCOL_VERSION 311
#define SERVER_PROTOCOL_VERSION 312
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View File

@ -1859,6 +1859,8 @@ enum message_type
unsigned int get_first; /* first message code to get */
unsigned int get_last; /* last message code to get */
unsigned int hw_id; /* id of the previous hardware message (or 0) */
unsigned int wake_mask; /* wakeup bits mask */
unsigned int changed_mask; /* changed bits mask */
@REPLY
user_handle_t win; /* window handle */
int type; /* message type */

View File

@ -1828,6 +1828,8 @@ DECL_HANDLER(get_message)
return;
}
queue->wake_mask = req->wake_mask;
queue->changed_mask = req->changed_mask;
set_error( STATUS_PENDING ); /* FIXME */
}

View File

@ -2304,7 +2304,9 @@ static void dump_get_message_request( const struct get_message_request *req )
fprintf( stderr, " get_win=%p,", req->get_win );
fprintf( stderr, " get_first=%08x,", req->get_first );
fprintf( stderr, " get_last=%08x,", req->get_last );
fprintf( stderr, " hw_id=%08x", req->hw_id );
fprintf( stderr, " hw_id=%08x,", req->hw_id );
fprintf( stderr, " wake_mask=%08x,", req->wake_mask );
fprintf( stderr, " changed_mask=%08x", req->changed_mask );
}
static void dump_get_message_reply( const struct get_message_reply *req )