* dispnew.c (scrolling_window): Return 1 if we scrolled,
[bpt/emacs.git] / src / dispnew.c
index 1408bea..0457d65 100644 (file)
@@ -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.  */
@@ -383,7 +385,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;
@@ -1021,7 +1023,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)
 {
@@ -1297,13 +1299,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)
+row_equal_p (struct glyph_row *a, struct glyph_row *b, int mouse_face_p)
 {
   if (a == b)
     return 1;
@@ -3202,21 +3202,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);
-}
-
-
 \f
 /***********************************************************************
                             Frame Update
@@ -3592,7 +3577,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 +3633,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 +4239,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)
+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 +4315,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;
@@ -4381,8 +4368,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 +4429,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 +4440,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;
@@ -4590,8 +4576,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 +4805,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 +5556,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 +6073,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 +6124,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 +6155,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;
 }