]> code.delx.au - gnu-emacs/blobdiff - src/fringe.c
Merge from emacs-23; up to 2010-06-12T08:59:37Z!albinus@detlef.
[gnu-emacs] / src / fringe.c
index f2d61225be792eed4b4216384df3a733f2044306..75c65bbcd879ff87c786dd15ae78c5e5f6ed7522 100644 (file)
@@ -521,6 +521,20 @@ get_fringe_bitmap_name (int bn)
   return num;
 }
 
+/* Get fringe bitmap data for bitmap number BN.  */
+
+static struct fringe_bitmap *
+get_fringe_bitmap_data (int bn)
+{
+  struct fringe_bitmap *fb;
+
+  fb = fringe_bitmaps[bn];
+  if (fb == NULL)
+    fb = &standard_bitmaps[bn < MAX_STANDARD_FRINGE_BITMAPS
+                          ? bn : UNDEF_FRINGE_BITMAP];
+
+  return fb;
+}
 
 /* Draw the bitmap WHICH in one of the left or right fringes of
    window W.  ROW is the glyph row for which to display the bitmap; it
@@ -568,10 +582,7 @@ draw_fringe_bitmap_1 (struct window *w, struct glyph_row *row, int left_p, int o
        face_id = FRINGE_FACE_ID;
     }
 
-  fb = fringe_bitmaps[which];
-  if (fb == NULL)
-    fb = &standard_bitmaps[which < MAX_STANDARD_FRINGE_BITMAPS
-                          ? which : UNDEF_FRINGE_BITMAP];
+  fb = get_fringe_bitmap_data (which);
 
   period = fb->period;
 
@@ -1041,12 +1052,8 @@ update_window_fringes (struct window *w, int keep_current_p)
 
       if (bn != NO_FRINGE_BITMAP)
        {
-         struct fringe_bitmap *fb;
+         struct fringe_bitmap *fb = get_fringe_bitmap_data (bn);
 
-         fb = fringe_bitmaps[bn];
-         if (fb == NULL)
-           fb = &standard_bitmaps[bn < MAX_STANDARD_FRINGE_BITMAPS
-                                  ? bn : UNDEF_FRINGE_BITMAP];
          if (fb->align == ALIGN_BITMAP_TOP && fb->period == 0)
            {
              struct glyph_row *row1;
@@ -1100,12 +1107,8 @@ update_window_fringes (struct window *w, int keep_current_p)
 
       if (bn != NO_FRINGE_BITMAP)
        {
-         struct fringe_bitmap *fb;
+         struct fringe_bitmap *fb = get_fringe_bitmap_data (bn);
 
-         fb = fringe_bitmaps[bn];
-         if (fb == NULL)
-           fb = &standard_bitmaps[bn < MAX_STANDARD_FRINGE_BITMAPS
-                                  ? bn : UNDEF_FRINGE_BITMAP];
          if (fb->align == ALIGN_BITMAP_BOTTOM && fb->period == 0)
            {
              struct glyph_row *row1;
@@ -1141,6 +1144,7 @@ update_window_fringes (struct window *w, int keep_current_p)
       int left, right;
       unsigned left_face_id, right_face_id;
       int left_offset, right_offset;
+      int periodic_p;
 
       row = w->desired_matrix->rows + rn;
       cur = w->current_matrix->rows + rn;
@@ -1149,6 +1153,7 @@ update_window_fringes (struct window *w, int keep_current_p)
 
       left_face_id = right_face_id = DEFAULT_FACE_ID;
       left_offset = right_offset = 0;
+      periodic_p = 0;
 
       /* Decide which bitmap to draw in the left fringe.  */
       if (WINDOW_LEFT_FRINGE_WIDTH (w) == 0)
@@ -1240,6 +1245,9 @@ update_window_fringes (struct window *w, int keep_current_p)
       else
        right = NO_FRINGE_BITMAP;
 
+      periodic_p = (get_fringe_bitmap_data (left)->period != 0
+                   || get_fringe_bitmap_data (right)->period != 0);
+
       if (row->y != cur->y
          || row->visible_height != cur->visible_height
          || row->ends_at_zv_p != cur->ends_at_zv_p
@@ -1249,6 +1257,7 @@ update_window_fringes (struct window *w, int keep_current_p)
          || right_face_id != cur->right_fringe_face_id
          || left_offset != cur->left_fringe_offset
          || right_offset != cur->right_fringe_offset
+         || periodic_p != cur->fringe_bitmap_periodic_p
          || cur->redraw_fringe_bitmaps_p)
        {
          redraw_p = row->redraw_fringe_bitmaps_p = 1;
@@ -1261,6 +1270,7 @@ update_window_fringes (struct window *w, int keep_current_p)
              cur->right_fringe_face_id = right_face_id;
              cur->left_fringe_offset = left_offset;
              cur->right_fringe_offset = right_offset;
+             cur->fringe_bitmap_periodic_p = periodic_p;
            }
        }
 
@@ -1279,6 +1289,7 @@ update_window_fringes (struct window *w, int keep_current_p)
       row->right_fringe_face_id = right_face_id;
       row->left_fringe_offset = left_offset;
       row->right_fringe_offset = right_offset;
+      row->fringe_bitmap_periodic_p = periodic_p;
     }
 
   return redraw_p && !keep_current_p;