changeset 42935:20a21fb23284

(w32_wnd_proc) <WM_PAINT>: Initialize update_rect. Combine the regions returned by BeginPaint and GetUpdateRect.
author Jason Rumney <jasonr@gnu.org>
date Thu, 24 Jan 2002 20:46:32 +0000
parents b3ee5e92548a
children cfda21cc3efd
files src/w32fns.c
diffstat 1 files changed, 6 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/w32fns.c	Thu Jan 24 20:41:46 2002 +0000
+++ b/src/w32fns.c	Thu Jan 24 20:46:32 2002 +0000
@@ -4157,6 +4157,7 @@
       {
   	PAINTSTRUCT paintStruct;
         RECT update_rect;
+	bzero (&update_rect, sizeof (update_rect));
 
 	f = x_window_to_frame (dpyinfo, hwnd);
 	if (f == 0)
@@ -4168,18 +4169,15 @@
         /* MSDN Docs say not to call BeginPaint if GetUpdateRect
            fails.  Apparently this can happen under some
            circumstances.  */
-        if (!w32_strict_painting || GetUpdateRect (hwnd, &update_rect, FALSE))
+        if (GetUpdateRect (hwnd, &update_rect, FALSE) || !w32_strict_painting)
           {
             enter_crit ();
             BeginPaint (hwnd, &paintStruct);
 
-	    if (w32_strict_painting)
-	      /* The rectangles returned by GetUpdateRect and BeginPaint
-		 do not always match.  GetUpdateRect seems to be the
-		 more reliable of the two.  */
-	      wmsg.rect = update_rect;
-	    else
-	      wmsg.rect = paintStruct.rcPaint;
+	    /* The rectangles returned by GetUpdateRect and BeginPaint
+	       do not always match.  Play it safe by assuming both areas
+	       are invalid.  */
+	    UnionRect (&(wmsg.rect), &update_rect, &(paintStruct.rcPaint));
 
 #if defined (W32_DEBUG_DISPLAY)
             DebPrint (("WM_PAINT (frame %p): painting %d,%d-%d,%d\n",