diff --git a/windows/painting.c b/windows/painting.c
index af15f71cdab680eb2d14cc446a5c61e091e7a9ff..c3c9187ee86d449fca6c62e90b80611bb2f03b0c 100644
--- a/windows/painting.c
+++ b/windows/painting.c
@@ -712,6 +712,8 @@ static HRGN RDW_Paint( WND* wndPtr, HRGN hrgn, UINT flags, UINT ex )
 
     if (flags & RDW_UPDATENOW)
     {
+        /* process pending events and messages before painting */
+        MsgWaitForMultipleObjects( 0, NULL, FALSE, 0, QS_ALLINPUT );
         if (wndPtr->hrgnUpdate) /* wm_painticon wparam is 1 */
             SendMessageW( hWnd, (bIcon) ? WM_PAINTICON : WM_PAINT, bIcon, 0 );
     }