changeset 24695:2fe2c743ce68

(w32_strict_painting): New variable. (w32_wnd_proc): Use it to select repaint rules. (syms_of_w32fns): Defvar it.
author Andrew Innes <andrewi@gnu.org>
date Wed, 05 May 1999 11:18:31 +0000
parents acea52613a04
children c28f1c2e8339
files src/w32fns.c
diffstat 1 files changed, 25 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/w32fns.c	Tue May 04 18:42:26 1999 +0000
+++ b/src/w32fns.c	Wed May 05 11:18:31 1999 +0000
@@ -146,6 +146,10 @@
 /* A flag to control whether fonts are matched strictly or not.  */
 int w32_strict_fontnames;
 
+/* A flag to control whether we should only repaint if GetUpdateRect
+   indicates there is an update region.  */
+int w32_strict_painting;
+
 /* Evaluate this expression to rebuild the section of syms_of_w32fns
    that initializes and staticpros the symbols declared below.  Note
    that Emacs 18 has a bug that keeps C-x C-e from being able to
@@ -3723,15 +3727,18 @@
         /* MSDN Docs say not to call BeginPaint if GetUpdateRect
            fails.  Apparently this can happen under some
            circumstances.  */
-        if (GetUpdateRect (hwnd, &update_rect, FALSE))
+        if (!w32_strict_painting || GetUpdateRect (hwnd, &update_rect, FALSE))
           {
             enter_crit ();
             BeginPaint (hwnd, &paintStruct);
 
-            /* 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;
+	    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;
 
 #if defined (W32_DEBUG_DISPLAY)
             DebPrint (("WM_PAINT: painting %d,%d-%d,%d\n", wmsg.rect.left,
@@ -3747,7 +3754,12 @@
           
             return 0;
           }
-        return 1;
+
+	/* If GetUpdateRect returns 0 (meaning there is no update
+           region), assume the whole window needs to be repainted.  */
+	GetClientRect(hwnd, &wmsg.rect);
+	my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
+        return 0;
       }
 
     case WM_INPUTLANGCHANGE:
@@ -7529,6 +7541,13 @@
 fontsets are automatically created.");
   w32_strict_fontnames = 0;
 
+  DEFVAR_BOOL ("w32-strict-painting",
+               &w32_strict_painting,
+  "Non-nil means use strict rules for repainting frames.\n\
+Set this to nil to get the old behaviour for repainting; this should\n\
+only be necessary if the default setting causes problems.");
+  w32_strict_painting = 1;
+
   DEFVAR_LISP ("w32-system-coding-system",
                &Vw32_system_coding_system,
   "Coding system used by Windows system functions, such as for font names.");