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
This commit is contained in:
Paul Eggert 2015-01-28 11:11:14 -08:00
parent 9a17d246ea
commit cdee38ab61
8 changed files with 44 additions and 36 deletions

View file

@ -1,3 +1,11 @@
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>
* dired.c (directory_files_internal) [WINDOWSNT]: If readdir

View file

@ -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. */

View file

@ -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;
}
}

View file

@ -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);
}

View file

@ -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);

View file

@ -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))

View file

@ -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;
}

View file

@ -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);