From: Paul Eggert Date: Wed, 28 Jan 2015 19:11:14 +0000 (-0800) Subject: Use bool, not int, to track face changes X-Git-Tag: emacs-25.0.90~2572^2~32 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=cdee38ab61b383f1190d29470319bce3693c7dd9;p=emacs.git 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 --- diff --git a/src/ChangeLog b/src/ChangeLog index 1df4f6ae0ba..9378c9df4e2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2015-01-28 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 + 2015-01-27 Eli Zaretskii * dired.c (directory_files_internal) [WINDOWSNT]: If readdir diff --git a/src/dispextern.h b/src/dispextern.h index 31e7262d6ec..413947991ec 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 2ce5a623853..e4adfe8f08f 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 3c2277e6955..8b05b34795d 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 777819edd52..8435270438d 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 18e27e705c9..68c0fa54572 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 7c9f62683fd..6e01ab08cef 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 234915a8ce2..65eb6b497f2 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);