From 8b1df960131a173779e88df605a21ebc0443634a Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 30 Sep 2015 10:00:13 -0400 Subject: [PATCH] Try to avoid redisplaying all frames when creating a new one * src/xfns.c (x_set_menu_bar_lines, x_change_tool_bar_height): * src/xfaces.c (Finternal_make_lisp_face, Finternal_copy_lisp_face) (Finternal_set_lisp_face_attribute, update_face_from_frame_parameter): * src/frame.c (x_set_screen_gamma): Set the specific frame's `redisplay' bit rather than windows_or_buffers_changed. * src/window.c (apply_window_adjustment): Remove redundant setting of windows_or_buffers_changed. * src/xdisp.c (redisplay_internal): Set the specific frame's `redisplay' bit rather than update_mode_lines in response to cursor_type_changed. (syms_of_xdisp): Use hash-tables for redisplay_*_cause tables. (AINC): Adjust accordingly. --- src/frame.c | 4 ++-- src/window.c | 1 - src/xdisp.c | 17 +++++++++-------- src/xfaces.c | 28 +++++++++++++++++++--------- src/xfns.c | 5 ++--- 5 files changed, 32 insertions(+), 23 deletions(-) diff --git a/src/frame.c b/src/frame.c index 121c55fdb20..f1a78fbdbf8 100644 --- a/src/frame.c +++ b/src/frame.c @@ -3539,8 +3539,8 @@ x_set_screen_gamma (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu (f, bgcolor, Qnil); } - clear_face_cache (true); - windows_or_buffers_changed = 70; + clear_face_cache (true); /* FIXME: Why of all frames? */ + fset_redisplay (f); } diff --git a/src/window.c b/src/window.c index d61f586a7fb..6d06e548094 100644 --- a/src/window.c +++ b/src/window.c @@ -6609,7 +6609,6 @@ apply_window_adjustment (struct window *w) eassert (w); clear_glyph_matrix (w->current_matrix); w->window_end_valid = false; - windows_or_buffers_changed = 30; wset_redisplay (w); adjust_frame_glyphs (XFRAME (WINDOW_FRAME (w))); } diff --git a/src/xdisp.c b/src/xdisp.c index 863d891c2de..259c36373bf 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -13432,7 +13432,7 @@ redisplay_internal (void) /* If cursor type has been changed on the frame other than selected, consider all frames. */ if (f != sf && f->cursor_type_changed) - update_mode_lines = 31; + fset_redisplay (f); } clear_desired_matrices (f); } @@ -13530,9 +13530,12 @@ redisplay_internal (void) consider_all_windows_p = (update_mode_lines || windows_or_buffers_changed); -#define AINC(a,i) \ - if (VECTORP (a) && i >= 0 && i < ASIZE (a) && INTEGERP (AREF (a, i))) \ - ASET (a, i, make_number (1 + XINT (AREF (a, i)))) +#define AINC(a,i) \ + { \ + Lisp_Object entry = Fgethash (make_number (i), a, make_number (0)); \ + if (INTEGERP (entry)) \ + Fputhash (make_number (i), make_number (1 + XINT (entry)), a); \ + } AINC (Vredisplay__all_windows_cause, windows_or_buffers_changed); AINC (Vredisplay__mode_lines_cause, update_mode_lines); @@ -31387,13 +31390,11 @@ display table takes effect; in this case, Emacs does not consult DEFVAR_LISP ("redisplay--all-windows-cause", Vredisplay__all_windows_cause, doc: /* */); - Vredisplay__all_windows_cause - = Fmake_vector (make_number (100), make_number (0)); + Vredisplay__all_windows_cause = Fmake_hash_table (0, NULL); DEFVAR_LISP ("redisplay--mode-lines-cause", Vredisplay__mode_lines_cause, doc: /* */); - Vredisplay__mode_lines_cause - = Fmake_vector (make_number (100), make_number (0)); + Vredisplay__mode_lines_cause = Fmake_hash_table (0, NULL); } diff --git a/src/xfaces.c b/src/xfaces.c index 40713f167ff..8cf0b427799 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -631,7 +631,7 @@ free_frame_faces (struct frame *f) /* Clear face caches, and recompute basic faces for frame F. Call this after changing frame parameters on which those faces depend, or when realized faces have been freed due to changing attributes - of named faces. */ + of named faces. */ void recompute_basic_faces (struct frame *f) @@ -2528,10 +2528,15 @@ Value is a vector of face attributes. */) if (NILP (Fget (face, Qface_no_inherit))) { if (f) - f->face_change = 1; + { + f->face_change = true; + fset_redisplay (f); + } else - face_change = true; - windows_or_buffers_changed = 54; + { + face_change = true; + windows_or_buffers_changed = 54; + } } eassert (LFACEP (lface)); @@ -2613,10 +2618,15 @@ The value is TO. */) if (NILP (Fget (to, Qface_no_inherit))) { if (f) - f->face_change = 1; + { + f->face_change = true; + fset_redisplay (f); + } else - face_change = true; - windows_or_buffers_changed = 55; + { + face_change = true; + windows_or_buffers_changed = 55; + } } return to; @@ -3120,7 +3130,7 @@ FRAME 0 means change the face on all frames, and change the default && NILP (Fequal (old_value, value))) { f->face_change = true; - windows_or_buffers_changed = 56; + fset_redisplay (f); } if (!UNSPECIFIEDP (value) && !IGNORE_DEFFACE_P (value) @@ -3293,7 +3303,7 @@ update_face_from_frame_parameter (struct frame *f, Lisp_Object param, && NILP (Fget (face, Qface_no_inherit))) { f->face_change = true; - windows_or_buffers_changed = 57; + fset_redisplay (f); } } diff --git a/src/xfns.c b/src/xfns.c index d6a3d76e948..fc6111c4fab 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -1041,7 +1041,7 @@ x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) nlines = 0; /* Make sure we redisplay all windows in this frame. */ - windows_or_buffers_changed = 59; + fset_redisplay (f); #if defined (USE_X_TOOLKIT) || defined (USE_GTK) FRAME_MENU_BAR_LINES (f) = 0; @@ -1160,8 +1160,7 @@ x_change_tool_bar_height (struct frame *f, int height) Lisp_Object fullscreen; /* Make sure we redisplay all windows in this frame. */ - windows_or_buffers_changed = 60; - + fset_redisplay (f); /* Recalculate tool bar and frame text sizes. */ FRAME_TOOL_BAR_HEIGHT (f) = height; -- 2.39.2