X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/ba46f4d85a6938273f52a8cdf7e09d9afee61d7f..af3c30cb283811135d9a1136fa5072e6922410a9:/src/dispnew.c diff --git a/src/dispnew.c b/src/dispnew.c index 1408bea2fc..501dc4ffd8 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -121,11 +121,12 @@ static int required_matrix_width (struct window *); static void allocate_matrices_for_window_redisplay (struct window *); static int realloc_glyph_pool (struct glyph_pool *, struct dim); static void adjust_frame_glyphs (struct frame *); -struct glyph_matrix *new_glyph_matrix (struct glyph_pool *); +static struct glyph_matrix *new_glyph_matrix (struct glyph_pool *); static void free_glyph_matrix (struct glyph_matrix *); static void adjust_glyph_matrix (struct window *, struct glyph_matrix *, int, int, struct dim); static void change_frame_size_1 (struct frame *, int, int, int, int, int); +static void increment_row_positions (struct glyph_row *, EMACS_INT, EMACS_INT); static void swap_glyph_pointers (struct glyph_row *, struct glyph_row *); #if GLYPH_DEBUG static int glyph_row_slice_p (struct glyph_row *, struct glyph_row *); @@ -163,6 +164,7 @@ static void mirror_line_dance (struct window *, int, int, int *, char *); static int update_window_tree (struct window *, int); static int update_window (struct window *, int); static int update_frame_1 (struct frame *, int, int); +static int scrolling (struct frame *); static void set_window_cursor_after_update (struct window *); static void adjust_frame_glyphs_for_window_redisplay (struct frame *); static void adjust_frame_glyphs_for_frame_redisplay (struct frame *); @@ -212,7 +214,7 @@ struct frame *last_nonminibuf_frame; /* 1 means SIGWINCH happened when not safe. */ -int delayed_size_change; +static int delayed_size_change; /* 1 means glyph initialization has been completed at startup. */ @@ -234,8 +236,8 @@ struct glyph space_glyph; /* Counts of allocated structures. These counts serve to diagnose memory leaks and double frees. */ -int glyph_matrix_count; -int glyph_pool_count; +static int glyph_matrix_count; +static int glyph_pool_count; /* If non-null, the frame whose frame matrices are manipulated. If null, window matrices are worked on. */ @@ -288,7 +290,6 @@ static int history_idx; static unsigned history_tick; static void add_frame_display_history (struct frame *, int); -static void add_window_display_history (struct window *, char *, int); /* Add to the redisplay history how window W has been displayed. MSG is a trace containing the information how W's glyph matrix @@ -296,7 +297,7 @@ static void add_window_display_history (struct window *, char *, int); has been interrupted for pending input. */ static void -add_window_display_history (struct window *w, char *msg, int paused_p) +add_window_display_history (struct window *w, const char *msg, int paused_p) { char *buf; @@ -383,7 +384,7 @@ safe_bcopy (const char *from, char *to, int size) member `pool' of the glyph matrix structure returned is set to POOL, the structure is otherwise zeroed. */ -struct glyph_matrix * +static struct glyph_matrix * new_glyph_matrix (struct glyph_pool *pool) { struct glyph_matrix *result; @@ -859,6 +860,8 @@ shift_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int start, in row->visible_height -= min_y - row->y; if (row->y + row->height > max_y) row->visible_height -= row->y + row->height - max_y; + if (row->fringe_bitmap_periodic_p) + row->redraw_fringe_bitmaps_p = 1; } } @@ -1021,7 +1024,7 @@ blank_row (struct window *w, struct glyph_row *row, int y) the used count of the text area is zero. Such rows display line ends. */ -void +static void increment_row_positions (struct glyph_row *row, EMACS_INT delta, EMACS_INT delta_bytes) { @@ -1097,7 +1100,7 @@ swap_glyphs_in_rows (a, b) /* Exchange pointers to glyph memory between glyph rows A and B. */ -static INLINE void +static inline void swap_glyph_pointers (struct glyph_row *a, struct glyph_row *b) { int i; @@ -1113,7 +1116,7 @@ swap_glyph_pointers (struct glyph_row *a, struct glyph_row *b) /* Copy glyph row structure FROM to glyph row structure TO, except that glyph pointers in the structures are left unchanged. */ -static INLINE void +static inline void copy_row_except_pointers (struct glyph_row *to, struct glyph_row *from) { struct glyph *pointers[1 + LAST_AREA]; @@ -1134,7 +1137,7 @@ copy_row_except_pointers (struct glyph_row *to, struct glyph_row *from) exchanged between TO and FROM. Pointers must be exchanged to avoid a memory leak. */ -static INLINE void +static inline void assign_row (struct glyph_row *to, struct glyph_row *from) { swap_glyph_pointers (to, from); @@ -1297,13 +1300,11 @@ line_draw_cost (struct glyph_matrix *matrix, int vpos) /* Test two glyph rows A and B for equality. Value is non-zero if A - and B have equal contents. W is the window to which the glyphs - rows A and B belong. It is needed here to test for partial row - visibility. MOUSE_FACE_P non-zero means compare the mouse_face_p - flags of A and B, too. */ + and B have equal contents. MOUSE_FACE_P non-zero means compare the + mouse_face_p flags of A and B, too. */ -static INLINE int -row_equal_p (struct window *w, struct glyph_row *a, struct glyph_row *b, int mouse_face_p) +static inline int +row_equal_p (struct glyph_row *a, struct glyph_row *b, int mouse_face_p) { if (a == b) return 1; @@ -1339,8 +1340,11 @@ row_equal_p (struct window *w, struct glyph_row *a, struct glyph_row *b, int mou || a->cursor_in_fringe_p != b->cursor_in_fringe_p || a->left_fringe_bitmap != b->left_fringe_bitmap || a->left_fringe_face_id != b->left_fringe_face_id + || a->left_fringe_offset != b->left_fringe_offset || a->right_fringe_bitmap != b->right_fringe_bitmap || a->right_fringe_face_id != b->right_fringe_face_id + || a->right_fringe_offset != b->right_fringe_offset + || a->fringe_bitmap_periodic_p != b->fringe_bitmap_periodic_p || a->overlay_arrow_bitmap != b->overlay_arrow_bitmap || a->exact_window_width_line_p != b->exact_window_width_line_p || a->overlapped_p != b->overlapped_p @@ -2724,7 +2728,7 @@ fill_up_frame_row_with_spaces (struct glyph_row *row, int upto) function must be called before updates to make explicit that we are working on frame matrices or not. */ -static INLINE void +static inline void set_frame_matrix_frame (struct frame *f) { frame_matrix_frame = f; @@ -2739,7 +2743,7 @@ set_frame_matrix_frame (struct frame *f) done in frame matrices, and that we have to perform analogous operations in window matrices of frame_matrix_frame. */ -static INLINE void +static inline void make_current (struct glyph_matrix *desired_matrix, struct glyph_matrix *current_matrix, int row) { struct glyph_row *current_row = MATRIX_ROW (current_matrix, row); @@ -3202,21 +3206,6 @@ DEFUN ("redraw-display", Fredraw_display, Sredraw_display, 0, 0, "", } -/* This is used when frame_garbaged is set. Call Fredraw_frame on all - visible frames marked as garbaged. */ - -void -redraw_garbaged_frames (void) -{ - Lisp_Object tail, frame; - - FOR_EACH_FRAME (tail, frame) - if (FRAME_VISIBLE_P (XFRAME (frame)) - && FRAME_GARBAGED_P (XFRAME (frame))) - Fredraw_frame (frame); -} - - /*********************************************************************** Frame Update @@ -3592,7 +3581,10 @@ update_window (struct window *w, int force_p) struct glyph_row *row, *end; struct glyph_row *mode_line_row; struct glyph_row *header_line_row; - int yb, changed_p = 0, mouse_face_overwritten_p = 0, n_updated; + int yb, changed_p = 0, mouse_face_overwritten_p = 0; +#if ! PERIODIC_PREEMPTION_CHECKING + int n_updated = 0; +#endif rif->update_window_begin_hook (w); yb = window_text_bottom_y (w); @@ -3645,7 +3637,7 @@ update_window (struct window *w, int force_p) } /* Update the rest of the lines. */ - for (n_updated = 0; row < end && (force_p || !input_pending); ++row) + for (; row < end && (force_p || !input_pending); ++row) if (row->enabled_p) { int vpos = MATRIX_ROW_VPOS (row, desired_matrix); @@ -4251,17 +4243,16 @@ static int runs_size; static struct run **runs; -/* Add glyph row ROW to the scrolling hash table during the scrolling - of window W. */ +/* Add glyph row ROW to the scrolling hash table. */ -static INLINE struct row_entry * -add_row_entry (struct window *w, struct glyph_row *row) +static inline struct row_entry * +add_row_entry (struct glyph_row *row) { struct row_entry *entry; int i = row->hash % row_table_size; entry = row_table[i]; - while (entry && !row_equal_p (w, entry->row, row, 1)) + while (entry && !row_equal_p (entry->row, row, 1)) entry = entry->next; if (entry == NULL) @@ -4328,7 +4319,7 @@ scrolling_window (struct window *w, int header_line_p) && c->y == d->y && MATRIX_ROW_BOTTOM_Y (c) <= yb && MATRIX_ROW_BOTTOM_Y (d) <= yb - && row_equal_p (w, c, d, 1)) + && row_equal_p (c, d, 1)) { assign_row (c, d); d->enabled_p = 0; @@ -4343,23 +4334,29 @@ scrolling_window (struct window *w, int header_line_p) first_old = first_new = i; - /* Set last_new to the index + 1 of the last enabled row in the - desired matrix. */ + /* Set last_new to the index + 1 of the row that reaches the + bottom boundary in the desired matrix. Give up if we find a + disabled row before we reach the bottom boundary. */ i = first_new + 1; - while (i < desired_matrix->nrows - 1 - && MATRIX_ROW (desired_matrix, i)->enabled_p - && MATRIX_ROW_BOTTOM_Y (MATRIX_ROW (desired_matrix, i)) <= yb) - ++i; + while (i < desired_matrix->nrows - 1) + { + int bottom; - if (!MATRIX_ROW (desired_matrix, i)->enabled_p) - return 0; + if (!MATRIX_ROW (desired_matrix, i)->enabled_p) + return 0; + bottom = MATRIX_ROW_BOTTOM_Y (MATRIX_ROW (desired_matrix, i)); + if (bottom <= yb) + ++i; + if (bottom >= yb) + break; + } last_new = i; - /* Set last_old to the index + 1 of the last enabled row in the - current matrix. We don't look at the enabled flag here because - we plan to reuse part of the display even if other parts are - disabled. */ + /* Set last_old to the index + 1 of the row that reaches the bottom + boundary in the current matrix. We don't look at the enabled + flag here because we plan to reuse part of the display even if + other parts are disabled. */ i = first_old + 1; while (i < current_matrix->nrows - 1) { @@ -4381,8 +4378,7 @@ scrolling_window (struct window *w, int header_line_p) && (MATRIX_ROW (current_matrix, i - 1)->y == MATRIX_ROW (desired_matrix, j - 1)->y) && !MATRIX_ROW (desired_matrix, j - 1)->redraw_fringe_bitmaps_p - && row_equal_p (w, - MATRIX_ROW (desired_matrix, i - 1), + && row_equal_p (MATRIX_ROW (desired_matrix, i - 1), MATRIX_ROW (current_matrix, j - 1), 1)) --i, --j; last_new = i; @@ -4443,7 +4439,7 @@ scrolling_window (struct window *w, int header_line_p) { if (MATRIX_ROW (current_matrix, i)->enabled_p) { - entry = add_row_entry (w, MATRIX_ROW (current_matrix, i)); + entry = add_row_entry (MATRIX_ROW (current_matrix, i)); old_lines[i] = entry; ++entry->old_uses; } @@ -4454,7 +4450,7 @@ scrolling_window (struct window *w, int header_line_p) for (i = first_new; i < last_new; ++i) { xassert (MATRIX_ROW_ENABLED_P (desired_matrix, i)); - entry = add_row_entry (w, MATRIX_ROW (desired_matrix, i)); + entry = add_row_entry (MATRIX_ROW (desired_matrix, i)); ++entry->new_uses; entry->new_line_number = i; new_lines[i] = entry; @@ -4573,13 +4569,7 @@ scrolling_window (struct window *w, int header_line_p) to = MATRIX_ROW (current_matrix, r->desired_vpos + j); from = MATRIX_ROW (desired_matrix, r->desired_vpos + j); to_overlapped_p = to->overlapped_p; - if (!from->mode_line_p && !w->pseudo_window_p - && (to->left_fringe_bitmap != from->left_fringe_bitmap - || to->right_fringe_bitmap != from->right_fringe_bitmap - || to->left_fringe_face_id != from->left_fringe_face_id - || to->right_fringe_face_id != from->right_fringe_face_id - || to->overlay_arrow_bitmap != from->overlay_arrow_bitmap)) - from->redraw_fringe_bitmaps_p = 1; + from->redraw_fringe_bitmaps_p = from->fringe_bitmap_periodic_p; assign_row (to, from); to->enabled_p = 1, from->enabled_p = 0; to->overlapped_p = to_overlapped_p; @@ -4590,8 +4580,8 @@ scrolling_window (struct window *w, int header_line_p) for (i = 0; i < row_entry_idx; ++i) row_table[row_entry_pool[i].bucket] = NULL; - /* Value is > 0 to indicate that we scrolled the display. */ - return nruns; + /* Value is 1 to indicate that we scrolled the display. */ + return 0 < nruns; } @@ -4819,7 +4809,7 @@ update_frame_1 (struct frame *f, int force_p, int inhibit_id_p) /* Do line insertions/deletions on frame F for frame-based redisplay. */ -int +static int scrolling (struct frame *frame) { int unchanged_at_top, unchanged_at_bottom; @@ -5570,7 +5560,7 @@ marginal_area_string (struct window *w, enum window_part part, #ifdef SIGWINCH -static SIGTYPE +static void window_change_signal (int signalnum) /* If we don't have an argument, */ /* some compilers complain in signal calls. */ { @@ -6087,7 +6077,7 @@ pass nil for VARIABLE. */) state = frame_and_buffer_state; vecp = XVECTOR (state)->contents; - end = vecp + XVECTOR (state)->size; + end = vecp + ASIZE (state); FOR_EACH_FRAME (tail, frame) { @@ -6138,8 +6128,8 @@ pass nil for VARIABLE. */) /* Reallocate the vector if data has grown to need it, or if it has shrunk a lot. */ if (! VECTORP (state) - || n > XVECTOR (state)->size - || n + 20 < XVECTOR (state)->size / 2) + || n > ASIZE (state) + || n + 20 < ASIZE (state) / 2) /* Add 20 extra so we grow it less often. */ { state = Fmake_vector (make_number (n + 20), Qlambda); @@ -6169,11 +6159,11 @@ pass nil for VARIABLE. */) /* Fill up the vector with lambdas (always at least one). */ *vecp++ = Qlambda; while (vecp - XVECTOR (state)->contents - < XVECTOR (state)->size) + < ASIZE (state)) *vecp++ = Qlambda; /* Make sure we didn't overflow the vector. */ if (vecp - XVECTOR (state)->contents - > XVECTOR (state)->size) + > ASIZE (state)) abort (); return Qt; } @@ -6243,11 +6233,7 @@ init_display (void) } } - if (!inhibit_window_system && display_arg -#ifndef CANNOT_DUMP - && initialized -#endif - ) + if (!inhibit_window_system && display_arg) { Vinitial_window_system = Qx; #ifdef HAVE_X11