Clear the internal paint flag in the server before returning a
WM_PAINT message to avoid an extra server round-trip.
diff --git a/server/window.c b/server/window.c
index 5143808..6b7222d 100644
--- a/server/window.c
+++ b/server/window.c
@@ -589,20 +589,22 @@
}
-/* 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;
}