Commit bd5d5e97 authored by Alexandre Julliard's avatar Alexandre Julliard

user32: Start checking for driver events more often when the app doesn't consume messages properly.

parent a283b986
...@@ -3671,6 +3671,16 @@ void WINAPI PostQuitMessage( INT exit_code ) ...@@ -3671,6 +3671,16 @@ void WINAPI PostQuitMessage( INT exit_code )
SERVER_END_REQ; SERVER_END_REQ;
} }
/* check for driver events if we detect that the app is not properly consuming messages */
static inline void check_for_driver_events(void)
{
if (get_user_thread_info()->message_count > 200)
{
flush_window_surfaces( FALSE );
USER_Driver->pMsgWaitForMultipleObjectsEx( 0, NULL, 0, QS_ALLINPUT, 0 );
}
else get_user_thread_info()->message_count++;
}
/*********************************************************************** /***********************************************************************
* PeekMessageW (USER32.@) * PeekMessageW (USER32.@)
...@@ -3680,6 +3690,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH PeekMessageW( MSG *msg_out, HWND hwnd, UINT first, ...@@ -3680,6 +3690,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH PeekMessageW( MSG *msg_out, HWND hwnd, UINT first,
MSG msg; MSG msg;
USER_CheckNotLock(); USER_CheckNotLock();
check_for_driver_events();
if (!peek_message( &msg, hwnd, first, last, flags, 0 )) if (!peek_message( &msg, hwnd, first, last, flags, 0 ))
{ {
...@@ -3726,6 +3737,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetMessageW( MSG *msg, HWND hwnd, UINT first, UINT ...@@ -3726,6 +3737,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetMessageW( MSG *msg, HWND hwnd, UINT first, UINT
unsigned int mask = QS_POSTMESSAGE | QS_SENDMESSAGE; /* Always selected */ unsigned int mask = QS_POSTMESSAGE | QS_SENDMESSAGE; /* Always selected */
USER_CheckNotLock(); USER_CheckNotLock();
check_for_driver_events();
if (first || last) if (first || last)
{ {
......
...@@ -172,7 +172,8 @@ struct wm_char_mapping_data ...@@ -172,7 +172,8 @@ struct wm_char_mapping_data
struct user_thread_info struct user_thread_info
{ {
HANDLE server_queue; /* Handle to server-side queue */ HANDLE server_queue; /* Handle to server-side queue */
DWORD recursion_count; /* SendMessage recursion counter */ WORD recursion_count; /* SendMessage recursion counter */
WORD message_count; /* Get/PeekMessage loop counter */
BOOL hook_unicode; /* Is current hook unicode? */ BOOL hook_unicode; /* Is current hook unicode? */
HHOOK hook; /* Current hook */ HHOOK hook; /* Current hook */
struct received_message_info *receive_info; /* Message being currently received */ struct received_message_info *receive_info; /* Message being currently received */
......
...@@ -1126,6 +1126,7 @@ static DWORD wait_message( DWORD count, CONST HANDLE *handles, DWORD timeout, DW ...@@ -1126,6 +1126,7 @@ static DWORD wait_message( DWORD count, CONST HANDLE *handles, DWORD timeout, DW
{ {
DWORD ret = USER_Driver->pMsgWaitForMultipleObjectsEx( count, handles, timeout, mask, flags ); DWORD ret = USER_Driver->pMsgWaitForMultipleObjectsEx( count, handles, timeout, mask, flags );
if (ret == WAIT_TIMEOUT && !count && !timeout) NtYieldExecution(); if (ret == WAIT_TIMEOUT && !count && !timeout) NtYieldExecution();
if ((mask & QS_INPUT) == QS_INPUT) get_user_thread_info()->message_count = 0;
return ret; return ret;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment