Commit cdee38ab authored by Paul Eggert's avatar Paul Eggert

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
parent 9a17d246
2015-01-28 Paul Eggert <eggert@cs.ucla.edu>
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 <eliz@gnu.org> 2015-01-27 Eli Zaretskii <eliz@gnu.org>
* dired.c (directory_files_internal) [WINDOWSNT]: If readdir * dired.c (directory_files_internal) [WINDOWSNT]: If readdir
......
...@@ -1850,10 +1850,10 @@ GLYPH_CODE_P (Lisp_Object gc) ...@@ -1850,10 +1850,10 @@ GLYPH_CODE_P (Lisp_Object gc)
: TYPE_MAXIMUM (EMACS_INT))))); : 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. */ redisplay. Used in redisplay_internal. */
extern int face_change_count; extern bool face_change;
/* For reordering of bidirectional text. */ /* For reordering of bidirectional text. */
......
...@@ -3632,7 +3632,7 @@ x_set_font_backend (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu ...@@ -3632,7 +3632,7 @@ x_set_font_backend (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu
XSETFRAME (frame, f); XSETFRAME (frame, f);
x_set_font (f, Fframe_parameter (frame, Qfont), Qnil); x_set_font (f, Fframe_parameter (frame, Qfont), Qnil);
++face_change_count; face_change = true;
windows_or_buffers_changed = 18; windows_or_buffers_changed = 18;
} }
} }
......
...@@ -1733,7 +1733,7 @@ IT_set_frame_parameters (struct frame *f, Lisp_Object alist) ...@@ -1733,7 +1733,7 @@ IT_set_frame_parameters (struct frame *f, Lisp_Object alist)
if (redraw) 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 ()) if (f == SELECTED_FRAME ())
redraw_frame (f); redraw_frame (f);
} }
......
...@@ -5668,7 +5668,7 @@ x_create_tip_frame (struct w32_display_info *dpyinfo, ...@@ -5668,7 +5668,7 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
ptrdiff_t count = SPECPDL_INDEX (); ptrdiff_t count = SPECPDL_INDEX ();
struct gcpro gcpro1, gcpro2, gcpro3; struct gcpro gcpro1, gcpro2, gcpro3;
struct kboard *kb; struct kboard *kb;
int face_change_count_before = face_change_count; bool face_change_before = face_change;
Lisp_Object buffer; Lisp_Object buffer;
struct buffer *old_buffer; struct buffer *old_buffer;
...@@ -5880,11 +5880,11 @@ x_create_tip_frame (struct w32_display_info *dpyinfo, ...@@ -5880,11 +5880,11 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
f->can_x_set_window_size = true; f->can_x_set_window_size = true;
/* Setting attributes of faces of the tooltip frame from resources /* 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 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. */ had before we created the tip frame. */
face_change_count = face_change_count_before; face_change = face_change_before;
/* Discard the unwind_protect. */ /* Discard the unwind_protect. */
return unbind_to (count, frame); return unbind_to (count, frame);
......
...@@ -2724,9 +2724,9 @@ init_iterator (struct it *it, struct window *w, ...@@ -2724,9 +2724,9 @@ init_iterator (struct it *it, struct window *w,
free realized faces now because they depend on face definitions free realized faces now because they depend on face definitions
that might have changed. Don't free faces while there might be that might have changed. Don't free faces while there might be
desired matrices pending which reference these faces. */ 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); free_all_realized_faces (Qnil);
} }
...@@ -13373,10 +13373,10 @@ redisplay_internal (void) ...@@ -13373,10 +13373,10 @@ redisplay_internal (void)
last_glyphless_glyph_frame = NULL; last_glyphless_glyph_frame = NULL;
last_glyphless_glyph_face_id = (1 << FACE_ID_BITS); last_glyphless_glyph_face_id = (1 << FACE_ID_BITS);
/* If face_change_count is non-zero, init_iterator will free all /* If face_change, init_iterator will free all realized faces, which
realized faces, which includes the faces referenced from current includes the faces referenced from current matrices. So, we
matrices. So, we can't reuse current matrices in this case. */ can't reuse current matrices in this case. */
if (face_change_count) if (face_change)
windows_or_buffers_changed = 47; windows_or_buffers_changed = 47;
if ((FRAME_TERMCAP_P (sf) || FRAME_MSDOS_P (sf)) if ((FRAME_TERMCAP_P (sf) || FRAME_MSDOS_P (sf))
......
...@@ -313,10 +313,10 @@ static int clear_font_table_count; ...@@ -313,10 +313,10 @@ static int clear_font_table_count;
#endif /* HAVE_WINDOW_SYSTEM */ #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. */ redisplay. Used in redisplay_internal. */
int face_change_count; bool face_change;
/* True means don't display bold text if a face's foreground /* True means don't display bold text if a face's foreground
and background colors are the inverse of the default colors of the 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. */) ...@@ -694,7 +694,7 @@ Optional THOROUGHLY non-nil means try to free unused fonts, too. */)
(Lisp_Object thoroughly) (Lisp_Object thoroughly)
{ {
clear_face_cache (!NILP (thoroughly)); clear_face_cache (!NILP (thoroughly));
++face_change_count; face_change = true;
windows_or_buffers_changed = 53; windows_or_buffers_changed = 53;
return Qnil; return Qnil;
} }
...@@ -2530,11 +2530,11 @@ Value is a vector of face attributes. */) ...@@ -2530,11 +2530,11 @@ Value is a vector of face attributes. */)
/* Changing a named face means that all realized faces depending on /* Changing a named face means that all realized faces depending on
that face are invalid. Since we cannot tell which realized faces that face are invalid. Since we cannot tell which realized faces
depend on the face, make sure they are all removed. This is done depend on the face, make sure they are all removed. This is done
by incrementing face_change_count. The next call to by setting face_change. The next call to init_iterator will then
init_iterator will then free realized faces. */ free realized faces. */
if (NILP (Fget (face, Qface_no_inherit))) if (NILP (Fget (face, Qface_no_inherit)))
{ {
++face_change_count; face_change = true;
windows_or_buffers_changed = 54; windows_or_buffers_changed = 54;
} }
...@@ -2609,11 +2609,11 @@ The value is TO. */) ...@@ -2609,11 +2609,11 @@ The value is TO. */)
/* Changing a named face means that all realized faces depending on /* Changing a named face means that all realized faces depending on
that face are invalid. Since we cannot tell which realized faces that face are invalid. Since we cannot tell which realized faces
depend on the face, make sure they are all removed. This is done depend on the face, make sure they are all removed. This is done
by incrementing face_change_count. The next call to by setting face_change. The next call to init_iterator will then
init_iterator will then free realized faces. */ free realized faces. */
if (NILP (Fget (to, Qface_no_inherit))) if (NILP (Fget (to, Qface_no_inherit)))
{ {
++face_change_count; face_change = true;
windows_or_buffers_changed = 55; windows_or_buffers_changed = 55;
} }
...@@ -3107,13 +3107,13 @@ FRAME 0 means change the face on all frames, and change the default ...@@ -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 /* Changing a named face means that all realized faces depending on
that face are invalid. Since we cannot tell which realized faces that face are invalid. Since we cannot tell which realized faces
depend on the face, make sure they are all removed. This is done depend on the face, make sure they are all removed. This is done
by incrementing face_change_count. The next call to by setting face_change. The next call to init_iterator will then
init_iterator will then free realized faces. */ free realized faces. */
if (!EQ (frame, Qt) if (!EQ (frame, Qt)
&& NILP (Fget (face, Qface_no_inherit)) && NILP (Fget (face, Qface_no_inherit))
&& NILP (Fequal (old_value, value))) && NILP (Fequal (old_value, value)))
{ {
++face_change_count; face_change = true;
windows_or_buffers_changed = 56; windows_or_buffers_changed = 56;
} }
...@@ -3281,12 +3281,12 @@ update_face_from_frame_parameter (struct frame *f, Lisp_Object param, ...@@ -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 /* Changing a named face means that all realized faces depending on
that face are invalid. Since we cannot tell which realized faces that face are invalid. Since we cannot tell which realized faces
depend on the face, make sure they are all removed. This is done depend on the face, make sure they are all removed. This is done
by incrementing face_change_count. The next call to by setting face_change. The next call to init_iterator will then
init_iterator will then free realized faces. */ free realized faces. */
if (!NILP (face) if (!NILP (face)
&& NILP (Fget (face, Qface_no_inherit))) && NILP (Fget (face, Qface_no_inherit)))
{ {
++face_change_count; face_change = true;
windows_or_buffers_changed = 57; windows_or_buffers_changed = 57;
} }
} }
...@@ -5820,7 +5820,7 @@ is non-nil. */) ...@@ -5820,7 +5820,7 @@ is non-nil. */)
(Lisp_Object suppress) (Lisp_Object suppress)
{ {
tty_suppress_bold_inverse_default_colors_p = !NILP (suppress); tty_suppress_bold_inverse_default_colors_p = !NILP (suppress);
++face_change_count; face_change = true;
return suppress; return suppress;
} }
......
...@@ -4932,7 +4932,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo, ...@@ -4932,7 +4932,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
int width, height; int width, height;
ptrdiff_t count = SPECPDL_INDEX (); ptrdiff_t count = SPECPDL_INDEX ();
struct gcpro gcpro1, gcpro2, gcpro3; struct gcpro gcpro1, gcpro2, gcpro3;
int face_change_count_before = face_change_count; bool face_change_before = face_change;
Lisp_Object buffer; Lisp_Object buffer;
struct buffer *old_buffer; struct buffer *old_buffer;
...@@ -5229,11 +5229,11 @@ x_create_tip_frame (struct x_display_info *dpyinfo, ...@@ -5229,11 +5229,11 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
f->can_x_set_window_size = true; f->can_x_set_window_size = true;
/* Setting attributes of faces of the tooltip frame from resources /* 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
clearing of all current matrices. Since this isn't necessary all current matrices. Since this isn't necessary here, avoid it
here, avoid it by resetting face_change_count to the value it by resetting face_change to the value it had before we created
had before we created the tip frame. */ the tip frame. */
face_change_count = face_change_count_before; face_change = face_change_before;
/* Discard the unwind_protect. */ /* Discard the unwind_protect. */
return unbind_to (count, frame); return unbind_to (count, frame);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment