aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2015-01-28 11:11:14 -0800
committerPaul Eggert2015-01-28 11:15:23 -0800
commitcdee38ab61b383f1190d29470319bce3693c7dd9 (patch)
tree1cf1e3d4528349e497f6281ae55b5ec24d6b4c13 /src
parent9a17d246eabeb5a365bfebce5ec3862e42c8b132 (diff)
downloademacs-cdee38ab61b383f1190d29470319bce3693c7dd9.tar.gz
emacs-cdee38ab61b383f1190d29470319bce3693c7dd9.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog8
-rw-r--r--src/dispextern.h4
-rw-r--r--src/frame.c2
-rw-r--r--src/msdos.c2
-rw-r--r--src/w32fns.c8
-rw-r--r--src/xdisp.c12
-rw-r--r--src/xfaces.c32
-rw-r--r--src/xfns.c12
8 files changed, 44 insertions, 36 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 1df4f6ae0ba..9378c9df4e2 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
12015-01-28 Paul Eggert <eggert@cs.ucla.edu>
2
3 Use bool, not int, to track face changes
4 * xfaces.c (face_change): Rename from face_change_count, and
5 change from int to bool. The var is now true (instead of nonzero)
6 if attributes have changed; this is simpler. All uses changed.
7 Fixes: bug#19698
8
12015-01-27 Eli Zaretskii <eliz@gnu.org> 92015-01-27 Eli Zaretskii <eliz@gnu.org>
2 10
3 * dired.c (directory_files_internal) [WINDOWSNT]: If readdir 11 * 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)
1850 : TYPE_MAXIMUM (EMACS_INT))))); 1850 : TYPE_MAXIMUM (EMACS_INT)))));
1851} 1851}
1852 1852
1853/* Non-zero means face attributes have been changed since the last 1853/* True means face attributes have been changed since the last
1854 redisplay. Used in redisplay_internal. */ 1854 redisplay. Used in redisplay_internal. */
1855 1855
1856extern int face_change_count; 1856extern bool face_change;
1857 1857
1858/* For reordering of bidirectional text. */ 1858/* For reordering of bidirectional text. */
1859 1859
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
3632 3632
3633 XSETFRAME (frame, f); 3633 XSETFRAME (frame, f);
3634 x_set_font (f, Fframe_parameter (frame, Qfont), Qnil); 3634 x_set_font (f, Fframe_parameter (frame, Qfont), Qnil);
3635 ++face_change_count; 3635 face_change = true;
3636 windows_or_buffers_changed = 18; 3636 windows_or_buffers_changed = 18;
3637 } 3637 }
3638} 3638}
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)
1733 1733
1734 if (redraw) 1734 if (redraw)
1735 { 1735 {
1736 face_change_count++; /* forces xdisp.c to recompute basic faces */ 1736 face_change = true; /* forces xdisp.c to recompute basic faces */
1737 if (f == SELECTED_FRAME ()) 1737 if (f == SELECTED_FRAME ())
1738 redraw_frame (f); 1738 redraw_frame (f);
1739 } 1739 }
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,
5668 ptrdiff_t count = SPECPDL_INDEX (); 5668 ptrdiff_t count = SPECPDL_INDEX ();
5669 struct gcpro gcpro1, gcpro2, gcpro3; 5669 struct gcpro gcpro1, gcpro2, gcpro3;
5670 struct kboard *kb; 5670 struct kboard *kb;
5671 int face_change_count_before = face_change_count; 5671 bool face_change_before = face_change;
5672 Lisp_Object buffer; 5672 Lisp_Object buffer;
5673 struct buffer *old_buffer; 5673 struct buffer *old_buffer;
5674 5674
@@ -5880,11 +5880,11 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
5880 f->can_x_set_window_size = true; 5880 f->can_x_set_window_size = true;
5881 5881
5882 /* Setting attributes of faces of the tooltip frame from resources 5882 /* Setting attributes of faces of the tooltip frame from resources
5883 and similar will increment face_change_count, which leads to the 5883 and similar will set face_change, which leads to the
5884 clearing of all current matrices. Since this isn't necessary 5884 clearing of all current matrices. Since this isn't necessary
5885 here, avoid it by resetting face_change_count to the value it 5885 here, avoid it by resetting face_change to the value it
5886 had before we created the tip frame. */ 5886 had before we created the tip frame. */
5887 face_change_count = face_change_count_before; 5887 face_change = face_change_before;
5888 5888
5889 /* Discard the unwind_protect. */ 5889 /* Discard the unwind_protect. */
5890 return unbind_to (count, frame); 5890 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,
2724 free realized faces now because they depend on face definitions 2724 free realized faces now because they depend on face definitions
2725 that might have changed. Don't free faces while there might be 2725 that might have changed. Don't free faces while there might be
2726 desired matrices pending which reference these faces. */ 2726 desired matrices pending which reference these faces. */
2727 if (face_change_count && !inhibit_free_realized_faces) 2727 if (face_change && !inhibit_free_realized_faces)
2728 { 2728 {
2729 face_change_count = 0; 2729 face_change = false;
2730 free_all_realized_faces (Qnil); 2730 free_all_realized_faces (Qnil);
2731 } 2731 }
2732 2732
@@ -13373,10 +13373,10 @@ redisplay_internal (void)
13373 last_glyphless_glyph_frame = NULL; 13373 last_glyphless_glyph_frame = NULL;
13374 last_glyphless_glyph_face_id = (1 << FACE_ID_BITS); 13374 last_glyphless_glyph_face_id = (1 << FACE_ID_BITS);
13375 13375
13376 /* If face_change_count is non-zero, init_iterator will free all 13376 /* If face_change, init_iterator will free all realized faces, which
13377 realized faces, which includes the faces referenced from current 13377 includes the faces referenced from current matrices. So, we
13378 matrices. So, we can't reuse current matrices in this case. */ 13378 can't reuse current matrices in this case. */
13379 if (face_change_count) 13379 if (face_change)
13380 windows_or_buffers_changed = 47; 13380 windows_or_buffers_changed = 47;
13381 13381
13382 if ((FRAME_TERMCAP_P (sf) || FRAME_MSDOS_P (sf)) 13382 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;
313 313
314#endif /* HAVE_WINDOW_SYSTEM */ 314#endif /* HAVE_WINDOW_SYSTEM */
315 315
316/* Non-zero means face attributes have been changed since the last 316/* True means face attributes have been changed since the last
317 redisplay. Used in redisplay_internal. */ 317 redisplay. Used in redisplay_internal. */
318 318
319int face_change_count; 319bool face_change;
320 320
321/* True means don't display bold text if a face's foreground 321/* True means don't display bold text if a face's foreground
322 and background colors are the inverse of the default colors of the 322 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 (Lisp_Object thoroughly) 694 (Lisp_Object thoroughly)
695{ 695{
696 clear_face_cache (!NILP (thoroughly)); 696 clear_face_cache (!NILP (thoroughly));
697 ++face_change_count; 697 face_change = true;
698 windows_or_buffers_changed = 53; 698 windows_or_buffers_changed = 53;
699 return Qnil; 699 return Qnil;
700} 700}
@@ -2530,11 +2530,11 @@ Value is a vector of face attributes. */)
2530 /* Changing a named face means that all realized faces depending on 2530 /* Changing a named face means that all realized faces depending on
2531 that face are invalid. Since we cannot tell which realized faces 2531 that face are invalid. Since we cannot tell which realized faces
2532 depend on the face, make sure they are all removed. This is done 2532 depend on the face, make sure they are all removed. This is done
2533 by incrementing face_change_count. The next call to 2533 by setting face_change. The next call to init_iterator will then
2534 init_iterator will then free realized faces. */ 2534 free realized faces. */
2535 if (NILP (Fget (face, Qface_no_inherit))) 2535 if (NILP (Fget (face, Qface_no_inherit)))
2536 { 2536 {
2537 ++face_change_count; 2537 face_change = true;
2538 windows_or_buffers_changed = 54; 2538 windows_or_buffers_changed = 54;
2539 } 2539 }
2540 2540
@@ -2609,11 +2609,11 @@ The value is TO. */)
2609 /* Changing a named face means that all realized faces depending on 2609 /* Changing a named face means that all realized faces depending on
2610 that face are invalid. Since we cannot tell which realized faces 2610 that face are invalid. Since we cannot tell which realized faces
2611 depend on the face, make sure they are all removed. This is done 2611 depend on the face, make sure they are all removed. This is done
2612 by incrementing face_change_count. The next call to 2612 by setting face_change. The next call to init_iterator will then
2613 init_iterator will then free realized faces. */ 2613 free realized faces. */
2614 if (NILP (Fget (to, Qface_no_inherit))) 2614 if (NILP (Fget (to, Qface_no_inherit)))
2615 { 2615 {
2616 ++face_change_count; 2616 face_change = true;
2617 windows_or_buffers_changed = 55; 2617 windows_or_buffers_changed = 55;
2618 } 2618 }
2619 2619
@@ -3107,13 +3107,13 @@ FRAME 0 means change the face on all frames, and change the default
3107 /* Changing a named face means that all realized faces depending on 3107 /* Changing a named face means that all realized faces depending on
3108 that face are invalid. Since we cannot tell which realized faces 3108 that face are invalid. Since we cannot tell which realized faces
3109 depend on the face, make sure they are all removed. This is done 3109 depend on the face, make sure they are all removed. This is done
3110 by incrementing face_change_count. The next call to 3110 by setting face_change. The next call to init_iterator will then
3111 init_iterator will then free realized faces. */ 3111 free realized faces. */
3112 if (!EQ (frame, Qt) 3112 if (!EQ (frame, Qt)
3113 && NILP (Fget (face, Qface_no_inherit)) 3113 && NILP (Fget (face, Qface_no_inherit))
3114 && NILP (Fequal (old_value, value))) 3114 && NILP (Fequal (old_value, value)))
3115 { 3115 {
3116 ++face_change_count; 3116 face_change = true;
3117 windows_or_buffers_changed = 56; 3117 windows_or_buffers_changed = 56;
3118 } 3118 }
3119 3119
@@ -3281,12 +3281,12 @@ update_face_from_frame_parameter (struct frame *f, Lisp_Object param,
3281 /* Changing a named face means that all realized faces depending on 3281 /* Changing a named face means that all realized faces depending on
3282 that face are invalid. Since we cannot tell which realized faces 3282 that face are invalid. Since we cannot tell which realized faces
3283 depend on the face, make sure they are all removed. This is done 3283 depend on the face, make sure they are all removed. This is done
3284 by incrementing face_change_count. The next call to 3284 by setting face_change. The next call to init_iterator will then
3285 init_iterator will then free realized faces. */ 3285 free realized faces. */
3286 if (!NILP (face) 3286 if (!NILP (face)
3287 && NILP (Fget (face, Qface_no_inherit))) 3287 && NILP (Fget (face, Qface_no_inherit)))
3288 { 3288 {
3289 ++face_change_count; 3289 face_change = true;
3290 windows_or_buffers_changed = 57; 3290 windows_or_buffers_changed = 57;
3291 } 3291 }
3292} 3292}
@@ -5820,7 +5820,7 @@ is non-nil. */)
5820 (Lisp_Object suppress) 5820 (Lisp_Object suppress)
5821{ 5821{
5822 tty_suppress_bold_inverse_default_colors_p = !NILP (suppress); 5822 tty_suppress_bold_inverse_default_colors_p = !NILP (suppress);
5823 ++face_change_count; 5823 face_change = true;
5824 return suppress; 5824 return suppress;
5825} 5825}
5826 5826
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,
4932 int width, height; 4932 int width, height;
4933 ptrdiff_t count = SPECPDL_INDEX (); 4933 ptrdiff_t count = SPECPDL_INDEX ();
4934 struct gcpro gcpro1, gcpro2, gcpro3; 4934 struct gcpro gcpro1, gcpro2, gcpro3;
4935 int face_change_count_before = face_change_count; 4935 bool face_change_before = face_change;
4936 Lisp_Object buffer; 4936 Lisp_Object buffer;
4937 struct buffer *old_buffer; 4937 struct buffer *old_buffer;
4938 4938
@@ -5229,11 +5229,11 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
5229 f->can_x_set_window_size = true; 5229 f->can_x_set_window_size = true;
5230 5230
5231 /* Setting attributes of faces of the tooltip frame from resources 5231 /* Setting attributes of faces of the tooltip frame from resources
5232 and similar will increment face_change_count, which leads to the 5232 and similar will set face_change, which leads to the clearing of
5233 clearing of all current matrices. Since this isn't necessary 5233 all current matrices. Since this isn't necessary here, avoid it
5234 here, avoid it by resetting face_change_count to the value it 5234 by resetting face_change to the value it had before we created
5235 had before we created the tip frame. */ 5235 the tip frame. */
5236 face_change_count = face_change_count_before; 5236 face_change = face_change_before;
5237 5237
5238 /* Discard the unwind_protect. */ 5238 /* Discard the unwind_protect. */
5239 return unbind_to (count, frame); 5239 return unbind_to (count, frame);