Alexandre Julliard : user32: Check for driver events more quickly once we start getting timer messages.

Alexandre Julliard julliard at winehq.org
Tue Jul 2 14:31:29 CDT 2013


Module: wine
Branch: master
Commit: fa311c57bf6c972b854772962b89b45c8ead5c06
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=fa311c57bf6c972b854772962b89b45c8ead5c06

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Jul  2 15:06:16 2013 +0200

user32: Check for driver events more quickly once we start getting timer messages.

---

 dlls/user32/message.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/dlls/user32/message.c b/dlls/user32/message.c
index a6a839c..27e3441 100644
--- a/dlls/user32/message.c
+++ b/dlls/user32/message.c
@@ -3683,13 +3683,18 @@ void WINAPI PostQuitMessage( INT exit_code )
 }
 
 /* check for driver events if we detect that the app is not properly consuming messages */
-static inline void check_for_driver_events(void)
+static inline void check_for_driver_events( UINT msg )
 {
     if (get_user_thread_info()->message_count > 200)
     {
         flush_window_surfaces( FALSE );
         USER_Driver->pMsgWaitForMultipleObjectsEx( 0, NULL, 0, QS_ALLINPUT, 0 );
     }
+    else if (msg == WM_TIMER || msg == WM_SYSTIMER)
+    {
+        /* driver events should have priority over timers, so make sure we'll check for them soon */
+        get_user_thread_info()->message_count += 100;
+    }
     else get_user_thread_info()->message_count++;
 }
 
@@ -3701,7 +3706,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH PeekMessageW( MSG *msg_out, HWND hwnd, UINT first,
     MSG msg;
 
     USER_CheckNotLock();
-    check_for_driver_events();
+    check_for_driver_events( 0 );
 
     if (!peek_message( &msg, hwnd, first, last, flags, 0 ))
     {
@@ -3713,6 +3718,8 @@ BOOL WINAPI DECLSPEC_HOTPATCH PeekMessageW( MSG *msg_out, HWND hwnd, UINT first,
         if (ret == WAIT_TIMEOUT || !peek_message( &msg, hwnd, first, last, flags, 0 )) return FALSE;
     }
 
+    check_for_driver_events( msg.message );
+
     /* copy back our internal safe copy of message data to msg_out.
      * msg_out is a variable from the *program*, so it can't be used
      * internally as it can get "corrupted" by our use of SendMessage()
@@ -3748,7 +3755,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();
+    check_for_driver_events( 0 );
 
     if (first || last)
     {
@@ -3766,6 +3773,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetMessageW( MSG *msg, HWND hwnd, UINT first, UINT
         flush_window_surfaces( TRUE );
         wow_handlers.wait_message( 1, &server_queue, INFINITE, mask, 0 );
     }
+    check_for_driver_events( msg->message );
 
     return (msg->message != WM_QUIT);
 }




More information about the wine-cvs mailing list