]> code.delx.au - gnu-emacs/blobdiff - src/dispnew.c
Move window resize code from window.c to window.el.
[gnu-emacs] / src / dispnew.c
index 5b8eaf4fa340cf5f61d8e822ea5c5d4fffaf2754..2dffc0dce25aaf3865ef54734bedec97e178dd7a 100644 (file)
@@ -290,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);
 \f
 /* Add to the redisplay history how window W has been displayed.
    MSG is a trace containing the information how W's glyph matrix
@@ -298,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;
 
@@ -861,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;
     }
 }
 
@@ -1099,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;
@@ -1115,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];
@@ -1136,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);
@@ -1302,7 +1303,7 @@ line_draw_cost (struct glyph_matrix *matrix, int vpos)
    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
+static inline int
 row_equal_p (struct glyph_row *a, struct glyph_row *b, int mouse_face_p)
 {
   if (a == b)
@@ -1339,8 +1340,11 @@ row_equal_p (struct glyph_row *a, struct glyph_row *b, int mouse_face_p)
          || 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
@@ -1929,13 +1933,13 @@ adjust_frame_glyphs_initially (void)
 
   /* Do it for the root window.  */
   XSETFASTINT (root->top_line, top_margin);
+  XSETFASTINT (root->total_lines, frame_lines - 1 - top_margin);
   XSETFASTINT (root->total_cols, frame_cols);
-  set_window_height (sf->root_window, frame_lines - 1 - top_margin, 0);
 
   /* Do it for the mini-buffer window.  */
   XSETFASTINT (mini->top_line, frame_lines - 1);
+  XSETFASTINT (mini->total_lines, 1);
   XSETFASTINT (mini->total_cols, frame_cols);
-  set_window_height (root->next, 1, 0);
 
   adjust_frame_glyphs (sf);
   glyphs_initialized_initially_p = 1;
@@ -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);
@@ -4241,7 +4245,7 @@ static struct run **runs;
 
 /* Add glyph row ROW to the scrolling hash table.  */
 
-static INLINE struct row_entry *
+static inline struct row_entry *
 add_row_entry (struct glyph_row *row)
 {
   struct row_entry *entry;
@@ -4330,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)
     {
@@ -4559,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;
@@ -4576,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;
 }
 
 
@@ -5711,24 +5715,7 @@ change_frame_size_1 (register struct frame *f, int newheight, int newwidth, int
 
   if (newheight != FRAME_LINES (f))
     {
-      if (FRAME_HAS_MINIBUF_P (f) && !FRAME_MINIBUF_ONLY_P (f))
-       {
-         /* Frame has both root and mini-buffer.  */
-         XSETFASTINT (XWINDOW (FRAME_ROOT_WINDOW (f))->top_line,
-                      FRAME_TOP_MARGIN (f));
-         set_window_height (FRAME_ROOT_WINDOW (f),
-                            (newheight
-                             - 1
-                             - FRAME_TOP_MARGIN (f)),
-                            2);
-         XSETFASTINT (XWINDOW (FRAME_MINIBUF_WINDOW (f))->top_line,
-                      newheight - 1);
-         set_window_height (FRAME_MINIBUF_WINDOW (f), 1, 0);
-       }
-      else
-       /* Frame has just one top-level window.  */
-       set_window_height (FRAME_ROOT_WINDOW (f),
-                          newheight - FRAME_TOP_MARGIN (f), 2);
+      resize_frame_windows (f, newheight, 0);
 
       /* MSDOS frames cannot PRETEND, as they change frame size by
         manipulating video hardware.  */
@@ -5738,9 +5725,7 @@ change_frame_size_1 (register struct frame *f, int newheight, int newwidth, int
 
   if (new_frame_total_cols != FRAME_TOTAL_COLS (f))
     {
-      set_window_width (FRAME_ROOT_WINDOW (f), new_frame_total_cols, 2);
-      if (FRAME_HAS_MINIBUF_P (f))
-       set_window_width (FRAME_MINIBUF_WINDOW (f), new_frame_total_cols, 0);
+      resize_frame_windows (f, new_frame_total_cols, 1);
 
       /* MSDOS frames cannot PRETEND, as they change frame size by
         manipulating video hardware.  */
@@ -6073,7 +6058,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)
     {
@@ -6124,8 +6109,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);
@@ -6155,11 +6140,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;
 }
@@ -6229,11 +6214,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