Alexandre Julliard : user32: Start checking for driver events more often when the app doesn' t consume messages properly.
Alexandre Julliard
julliard at winehq.org
Wed Dec 12 15:14:55 CST 2012
Module: wine
Branch: master
Commit: bd5d5e97767eaa9827a464195be50fdd036d72d2
URL: http://source.winehq.org/git/wine.git/?a=commit;h=bd5d5e97767eaa9827a464195be50fdd036d72d2
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Dec 12 20:17:21 2012 +0100
user32: Start checking for driver events more often when the app doesn't consume messages properly.
---
dlls/user32/message.c | 12 ++++++++++++
dlls/user32/user_private.h | 3 ++-
dlls/user32/winproc.c | 1 +
3 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/dlls/user32/message.c b/dlls/user32/message.c
index 3f0312a..79066a8 100644
--- a/dlls/user32/message.c
+++ b/dlls/user32/message.c
@@ -3671,6 +3671,16 @@ void WINAPI PostQuitMessage( INT exit_code )
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.@)
@@ -3680,6 +3690,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH PeekMessageW( MSG *msg_out, HWND hwnd, UINT first,
MSG msg;
USER_CheckNotLock();
+ check_for_driver_events();
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
unsigned int mask = QS_POSTMESSAGE | QS_SENDMESSAGE; /* Always selected */
USER_CheckNotLock();
+ check_for_driver_events();
if (first || last)
{
diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h
index 3dc68c3..d743062 100644
--- a/dlls/user32/user_private.h
+++ b/dlls/user32/user_private.h
@@ -172,7 +172,8 @@ struct wm_char_mapping_data
struct user_thread_info
{
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? */
HHOOK hook; /* Current hook */
struct received_message_info *receive_info; /* Message being currently received */
diff --git a/dlls/user32/winproc.c b/dlls/user32/winproc.c
index 3b13b82..e6b5194 100644
--- a/dlls/user32/winproc.c
+++ b/dlls/user32/winproc.c
@@ -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 );
if (ret == WAIT_TIMEOUT && !count && !timeout) NtYieldExecution();
+ if ((mask & QS_INPUT) == QS_INPUT) get_user_thread_info()->message_count = 0;
return ret;
}
More information about the wine-cvs
mailing list