From b9a9de6eb9f4356f9d12e5f1daa64d45ec4a851c Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 10 Mar 2005 17:19:33 +0000 Subject: [PATCH] Clear the internal paint flag in the server before returning a WM_PAINT message to avoid an extra server round-trip. --- dlls/user/message.c | 7 ++----- server/window.c | 12 +++++++----- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/dlls/user/message.c b/dlls/user/message.c index 417cbd345cf..e6bac74a50f 100644 --- a/dlls/user/message.c +++ b/dlls/user/message.c @@ -2692,11 +2692,6 @@ BOOL WINAPI PeekMessageW( MSG *msg_out, HWND hwnd, UINT first, UINT last, UINT f return FALSE; } - WIN_RestoreWndsLock( locks ); - - if (msg.message == WM_PAINT) /* clear internal paint flag */ - RedrawWindow( msg.hwnd, NULL, 0, RDW_NOINTERNALPAINT | RDW_NOCHILDREN ); - if ((queue = QUEUE_Current())) { queue->GetMessageTimeVal = msg.time; @@ -2706,6 +2701,8 @@ BOOL WINAPI PeekMessageW( MSG *msg_out, HWND hwnd, UINT first, UINT last, UINT f HOOK_CallHooks( WH_GETMESSAGE, HC_ACTION, flags & PM_REMOVE, (LPARAM)&msg, TRUE ); + WIN_RestoreWndsLock( locks ); + /* 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() diff --git a/server/window.c b/server/window.c index 514380872a8..6b7222dec82 100644 --- a/server/window.c +++ b/server/window.c @@ -589,20 +589,22 @@ static struct window *find_child_to_repaint( struct window *parent, struct threa } -/* find a window that needs to receive a WM_PAINT */ +/* find a window that needs to receive a WM_PAINT; also clear its internal paint flag */ user_handle_t find_window_to_repaint( user_handle_t parent, struct thread *thread ) { struct window *ptr, *win = find_child_to_repaint( top_window, thread ); - if (win) + if (win && parent) { - if (!parent) return win->handle; /* check that it is a child of the specified parent */ for (ptr = win; ptr; ptr = ptr->parent) - if (ptr->handle == parent) return win->handle; + if (ptr->handle == parent) break; /* otherwise don't return any window, we don't repaint a child before its parent */ + if (!ptr) win = NULL; } - return 0; + if (!win) return 0; + win->paint_flags &= ~PAINT_INTERNAL; + return win->handle; }