emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master cdee38a: Use bool, not int, to track face changes


From: Paul Eggert
Subject: [Emacs-diffs] master cdee38a: Use bool, not int, to track face changes
Date: Wed, 28 Jan 2015 19:15:28 +0000

branch: master
commit cdee38ab61b383f1190d29470319bce3693c7dd9
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Use bool, not int, to track face changes
    
    * xfaces.c (face_change): Rename from face_change_count, and
    change from int to bool.  The var is now true (instead of nonzero)
    if attributes have changed; this is simpler.  All uses changed.
    Fixes: bug#19698
---
 src/ChangeLog    |    8 ++++++++
 src/dispextern.h |    4 ++--
 src/frame.c      |    2 +-
 src/msdos.c      |    2 +-
 src/w32fns.c     |    8 ++++----
 src/xdisp.c      |   12 ++++++------
 src/xfaces.c     |   32 ++++++++++++++++----------------
 src/xfns.c       |   12 ++++++------
 8 files changed, 44 insertions(+), 36 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index 1df4f6a..9378c9d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
+2015-01-28  Paul Eggert  <address@hidden>
+
+       Use bool, not int, to track face changes
+       * xfaces.c (face_change): Rename from face_change_count, and
+       change from int to bool.  The var is now true (instead of nonzero)
+       if attributes have changed; this is simpler.  All uses changed.
+       Fixes: bug#19698
+
 2015-01-27  Eli Zaretskii  <address@hidden>
 
        * dired.c (directory_files_internal) [WINDOWSNT]: If readdir
diff --git a/src/dispextern.h b/src/dispextern.h
index 31e7262..4139479 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -1850,10 +1850,10 @@ GLYPH_CODE_P (Lisp_Object gc)
               : TYPE_MAXIMUM (EMACS_INT)))));
 }
 
-/* Non-zero means face attributes have been changed since the last
+/* True means face attributes have been changed since the last
    redisplay.  Used in redisplay_internal.  */
 
-extern int face_change_count;
+extern bool face_change;
 
 /* For reordering of bidirectional text.  */
 
diff --git a/src/frame.c b/src/frame.c
index 2ce5a62..e4adfe8 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -3632,7 +3632,7 @@ x_set_font_backend (struct frame *f, Lisp_Object 
new_value, Lisp_Object old_valu
 
       XSETFRAME (frame, f);
       x_set_font (f, Fframe_parameter (frame, Qfont), Qnil);
-      ++face_change_count;
+      face_change = true;
       windows_or_buffers_changed = 18;
     }
 }
diff --git a/src/msdos.c b/src/msdos.c
index 3c2277e..8b05b34 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -1733,7 +1733,7 @@ IT_set_frame_parameters (struct frame *f, Lisp_Object 
alist)
 
   if (redraw)
     {
-      face_change_count++;     /* forces xdisp.c to recompute basic faces */
+      face_change = true;      /* forces xdisp.c to recompute basic faces */
       if (f == SELECTED_FRAME ())
        redraw_frame (f);
     }
diff --git a/src/w32fns.c b/src/w32fns.c
index 777819e..8435270 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -5668,7 +5668,7 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
   ptrdiff_t count = SPECPDL_INDEX ();
   struct gcpro gcpro1, gcpro2, gcpro3;
   struct kboard *kb;
-  int face_change_count_before = face_change_count;
+  bool face_change_before = face_change;
   Lisp_Object buffer;
   struct buffer *old_buffer;
 
@@ -5880,11 +5880,11 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
   f->can_x_set_window_size = true;
 
   /* Setting attributes of faces of the tooltip frame from resources
-     and similar will increment face_change_count, which leads to the
+     and similar will set face_change, which leads to the
      clearing of all current matrices.  Since this isn't necessary
-     here, avoid it by resetting face_change_count to the value it
+     here, avoid it by resetting face_change to the value it
      had before we created the tip frame.  */
-  face_change_count = face_change_count_before;
+  face_change = face_change_before;
 
   /* Discard the unwind_protect.  */
   return unbind_to (count, frame);
diff --git a/src/xdisp.c b/src/xdisp.c
index 18e27e7..68c0fa5 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -2724,9 +2724,9 @@ init_iterator (struct it *it, struct window *w,
      free realized faces now because they depend on face definitions
      that might have changed.  Don't free faces while there might be
      desired matrices pending which reference these faces.  */
-  if (face_change_count && !inhibit_free_realized_faces)
+  if (face_change && !inhibit_free_realized_faces)
     {
-      face_change_count = 0;
+      face_change = false;
       free_all_realized_faces (Qnil);
     }
 
@@ -13373,10 +13373,10 @@ redisplay_internal (void)
   last_glyphless_glyph_frame = NULL;
   last_glyphless_glyph_face_id = (1 << FACE_ID_BITS);
 
-  /* If face_change_count is non-zero, init_iterator will free all
-     realized faces, which includes the faces referenced from current
-     matrices.  So, we can't reuse current matrices in this case.  */
-  if (face_change_count)
+  /* If face_change, init_iterator will free all realized faces, which
+     includes the faces referenced from current matrices.  So, we
+     can't reuse current matrices in this case.  */
+  if (face_change)
     windows_or_buffers_changed = 47;
 
   if ((FRAME_TERMCAP_P (sf) || FRAME_MSDOS_P (sf))
diff --git a/src/xfaces.c b/src/xfaces.c
index 7c9f626..6e01ab0 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -313,10 +313,10 @@ static int clear_font_table_count;
 
 #endif /* HAVE_WINDOW_SYSTEM */
 
-/* Non-zero means face attributes have been changed since the last
+/* True means face attributes have been changed since the last
    redisplay.  Used in redisplay_internal.  */
 
-int face_change_count;
+bool face_change;
 
 /* True means don't display bold text if a face's foreground
    and background colors are the inverse of the default colors of the
@@ -694,7 +694,7 @@ Optional THOROUGHLY non-nil means try to free unused fonts, 
too.  */)
   (Lisp_Object thoroughly)
 {
   clear_face_cache (!NILP (thoroughly));
-  ++face_change_count;
+  face_change = true;
   windows_or_buffers_changed = 53;
   return Qnil;
 }
@@ -2530,11 +2530,11 @@ Value is a vector of face attributes.  */)
   /* Changing a named face means that all realized faces depending on
      that face are invalid.  Since we cannot tell which realized faces
      depend on the face, make sure they are all removed.  This is done
-     by incrementing face_change_count.  The next call to
-     init_iterator will then free realized faces.  */
+     by setting face_change.  The next call to init_iterator will then
+     free realized faces.  */
   if (NILP (Fget (face, Qface_no_inherit)))
     {
-      ++face_change_count;
+      face_change = true;
       windows_or_buffers_changed = 54;
     }
 
@@ -2609,11 +2609,11 @@ The value is TO.  */)
   /* Changing a named face means that all realized faces depending on
      that face are invalid.  Since we cannot tell which realized faces
      depend on the face, make sure they are all removed.  This is done
-     by incrementing face_change_count.  The next call to
-     init_iterator will then free realized faces.  */
+     by setting face_change.  The next call to init_iterator will then
+     free realized faces.  */
   if (NILP (Fget (to, Qface_no_inherit)))
     {
-      ++face_change_count;
+      face_change = true;
       windows_or_buffers_changed = 55;
     }
 
@@ -3107,13 +3107,13 @@ FRAME 0 means change the face on all frames, and change 
the default
   /* Changing a named face means that all realized faces depending on
      that face are invalid.  Since we cannot tell which realized faces
      depend on the face, make sure they are all removed.  This is done
-     by incrementing face_change_count.  The next call to
-     init_iterator will then free realized faces.  */
+     by setting face_change.  The next call to init_iterator will then
+     free realized faces.  */
   if (!EQ (frame, Qt)
       && NILP (Fget (face, Qface_no_inherit))
       && NILP (Fequal (old_value, value)))
     {
-      ++face_change_count;
+      face_change = true;
       windows_or_buffers_changed = 56;
     }
 
@@ -3281,12 +3281,12 @@ update_face_from_frame_parameter (struct frame *f, 
Lisp_Object param,
   /* Changing a named face means that all realized faces depending on
      that face are invalid.  Since we cannot tell which realized faces
      depend on the face, make sure they are all removed.  This is done
-     by incrementing face_change_count.  The next call to
-     init_iterator will then free realized faces.  */
+     by setting face_change.  The next call to init_iterator will then
+     free realized faces.  */
   if (!NILP (face)
       && NILP (Fget (face, Qface_no_inherit)))
     {
-      ++face_change_count;
+      face_change = true;
       windows_or_buffers_changed = 57;
     }
 }
@@ -5820,7 +5820,7 @@ is non-nil.  */)
   (Lisp_Object suppress)
 {
   tty_suppress_bold_inverse_default_colors_p = !NILP (suppress);
-  ++face_change_count;
+  face_change = true;
   return suppress;
 }
 
diff --git a/src/xfns.c b/src/xfns.c
index 234915a..65eb6b4 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -4932,7 +4932,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
   int width, height;
   ptrdiff_t count = SPECPDL_INDEX ();
   struct gcpro gcpro1, gcpro2, gcpro3;
-  int face_change_count_before = face_change_count;
+  bool face_change_before = face_change;
   Lisp_Object buffer;
   struct buffer *old_buffer;
 
@@ -5229,11 +5229,11 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
   f->can_x_set_window_size = true;
 
   /* Setting attributes of faces of the tooltip frame from resources
-     and similar will increment face_change_count, which leads to the
-     clearing of all current matrices.  Since this isn't necessary
-     here, avoid it by resetting face_change_count to the value it
-     had before we created the tip frame.  */
-  face_change_count = face_change_count_before;
+     and similar will set face_change, which leads to the clearing of
+     all current matrices.  Since this isn't necessary here, avoid it
+     by resetting face_change to the value it had before we created
+     the tip frame.  */
+  face_change = face_change_before;
 
   /* Discard the unwind_protect.  */
   return unbind_to (count, frame);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]