]> code.delx.au - gnu-emacs/blobdiff - src/fringe.c
Merge from emacs-23
[gnu-emacs] / src / fringe.c
index 4a6d898d97f5ba2becb8e61fb964ed8a73e79298..45d6ecfa4b719a26645f7f94aaf04ceb94268693 100644 (file)
@@ -32,10 +32,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #ifdef HAVE_WINDOW_SYSTEM
 
-extern Lisp_Object Qfringe;
-extern Lisp_Object Qtop, Qbottom, Qcenter;
-extern Lisp_Object Qup, Qdown, Qleft, Qright;
-
 /* Non-nil means that newline may flow into the right fringe.  */
 
 Lisp_Object Voverflow_newline_into_fringe;
@@ -83,10 +79,8 @@ Lisp_Object Vfringe_bitmaps;
    must specify physical bitmap symbols.
 */
 
-extern Lisp_Object Qunknown;
 Lisp_Object Qtruncation, Qcontinuation, Qoverlay_arrow;
 Lisp_Object Qempty_line, Qtop_bottom;
-extern Lisp_Object Qbar, Qhbar, Qbox, Qhollow;
 Lisp_Object Qhollow_small;
 
 enum fringe_bitmap_align
@@ -490,8 +484,7 @@ int max_used_fringe_bitmap = MAX_STANDARD_FRINGE_BITMAPS;
    Return 0 if not a bitmap.  */
 
 int
-lookup_fringe_bitmap (bitmap)
-     Lisp_Object bitmap;
+lookup_fringe_bitmap (Lisp_Object bitmap)
 {
   int bn;
 
@@ -517,8 +510,7 @@ lookup_fringe_bitmap (bitmap)
    Return BN if not found in Vfringe_bitmaps.  */
 
 static Lisp_Object
-get_fringe_bitmap_name (bn)
-     int bn;
+get_fringe_bitmap_name (int bn)
 {
   Lisp_Object bitmaps;
   Lisp_Object num;
@@ -550,11 +542,7 @@ get_fringe_bitmap_name (bn)
 */
 
 static void
-draw_fringe_bitmap_1 (w, row, left_p, overlay, which)
-     struct window *w;
-     struct glyph_row *row;
-     int left_p, overlay;
-     int which;
+draw_fringe_bitmap_1 (struct window *w, struct glyph_row *row, int left_p, int overlay, int which)
 {
   struct frame *f = XFRAME (WINDOW_FRAME (w));
   struct draw_fringe_bitmap_params p;
@@ -585,11 +573,10 @@ draw_fringe_bitmap_1 (w, row, left_p, overlay, which)
 
   if (face_id == DEFAULT_FACE_ID)
     {
-      Lisp_Object face;
-
-      if ((face = fringe_faces[which], NILP (face))
-         || (face_id = lookup_derived_face (f, face, FRINGE_FACE_ID, 0),
-             face_id < 0))
+      Lisp_Object face = fringe_faces[which];
+      face_id = NILP (face) ? lookup_named_face (f, Qfringe, 0)
+       : lookup_derived_face (f, face, FRINGE_FACE_ID, 0);
+      if (face_id < 0)
        face_id = FRINGE_FACE_ID;
     }
 
@@ -684,9 +671,7 @@ draw_fringe_bitmap_1 (w, row, left_p, overlay, which)
 }
 
 static int
-get_logical_cursor_bitmap (w, cursor)
-     struct window *w;
-     Lisp_Object cursor;
+get_logical_cursor_bitmap (struct window *w, Lisp_Object cursor)
 {
   Lisp_Object cmap, bm = Qnil;
 
@@ -709,10 +694,7 @@ get_logical_cursor_bitmap (w, cursor)
 }
 
 static int
-get_logical_fringe_bitmap (w, bitmap, right_p, partial_p)
-     struct window *w;
-     Lisp_Object bitmap;
-     int right_p, partial_p;
+get_logical_fringe_bitmap (struct window *w, Lisp_Object bitmap, int right_p, int partial_p)
 {
   Lisp_Object cmap, bm1 = Qnil, bm2 = Qnil, bm;
   int ln1 = 0, ln2 = 0;
@@ -812,14 +794,11 @@ get_logical_fringe_bitmap (w, bitmap, right_p, partial_p)
 
 
 void
-draw_fringe_bitmap (w, row, left_p)
-     struct window *w;
-     struct glyph_row *row;
-     int left_p;
+draw_fringe_bitmap (struct window *w, struct glyph_row *row, int left_p)
 {
   int overlay = 0;
 
-  if (!left_p && row->cursor_in_fringe_p)
+  if (left_p == row->reversed_p && row->cursor_in_fringe_p)
     {
       Lisp_Object cursor = Qnil;
 
@@ -851,7 +830,7 @@ draw_fringe_bitmap (w, row, left_p)
          int bm = get_logical_cursor_bitmap (w, cursor);
          if (bm != NO_FRINGE_BITMAP)
            {
-             draw_fringe_bitmap_1 (w, row, 0, 2, bm);
+             draw_fringe_bitmap_1 (w, row, left_p, 2, bm);
              overlay = EQ (cursor, Qbox) ? 3 : 1;
            }
        }
@@ -868,9 +847,7 @@ draw_fringe_bitmap (w, row, left_p)
    function with input blocked.  */
 
 void
-draw_row_fringe_bitmaps (w, row)
-     struct window *w;
-     struct glyph_row *row;
+draw_row_fringe_bitmaps (struct window *w, struct glyph_row *row)
 {
   xassert (interrupt_input_blocked);
 
@@ -898,9 +875,7 @@ draw_row_fringe_bitmaps (w, row)
 */
 
 int
-draw_window_fringes (w, no_fringe)
-     struct window *w;
-     int no_fringe;
+draw_window_fringes (struct window *w, int no_fringe)
 {
   struct glyph_row *row;
   int yb = window_text_bottom_y (w);
@@ -938,9 +913,7 @@ draw_window_fringes (w, no_fringe)
    If KEEP_CURRENT_P is 0, update current_matrix too.  */
 
 int
-update_window_fringes (w, keep_current_p)
-     struct window *w;
-     int keep_current_p;
+update_window_fringes (struct window *w, int keep_current_p)
 {
   struct glyph_row *row, *cur = 0;
   int yb = window_text_bottom_y (w);
@@ -1200,7 +1173,8 @@ update_window_fringes (w, keep_current_p)
          left = row->left_user_fringe_bitmap;
          left_face_id = row->left_user_fringe_face_id;
        }
-      else if (row->truncated_on_left_p)
+      else if ((!row->reversed_p && row->truncated_on_left_p)
+              || (row->reversed_p && row->truncated_on_right_p))
        left = LEFT_FRINGE(0, Qtruncation, 0);
       else if (row->indicate_bob_p && EQ (boundary_top, Qleft))
        {
@@ -1216,7 +1190,8 @@ update_window_fringes (w, keep_current_p)
          if (bot_ind_max_y >= 0)
            left_offset = bot_ind_max_y - (row->y + row->visible_height);
        }
-      else if (MATRIX_ROW_CONTINUATION_LINE_P (row))
+      else if ((!row->reversed_p && MATRIX_ROW_CONTINUATION_LINE_P (row))
+              || (row->reversed_p && row->continued_p))
        left = LEFT_FRINGE (4, Qcontinuation, 0);
       else if (row->indicate_empty_line_p && EQ (empty_pos, Qleft))
        left = LEFT_FRINGE (5, Qempty_line, 0);
@@ -1243,7 +1218,8 @@ update_window_fringes (w, keep_current_p)
          right = row->right_user_fringe_bitmap;
          right_face_id = row->right_user_fringe_face_id;
        }
-      else if (row->truncated_on_right_p)
+      else if ((!row->reversed_p && row->truncated_on_right_p)
+              || (row->reversed_p && row->truncated_on_left_p))
        right = RIGHT_FRINGE (0, Qtruncation, 0);
       else if (row->indicate_bob_p && EQ (boundary_top, Qright))
        {
@@ -1259,7 +1235,8 @@ update_window_fringes (w, keep_current_p)
          if (bot_ind_max_y >= 0)
            right_offset = bot_ind_max_y - (row->y + row->visible_height);
        }
-      else if (row->continued_p)
+      else if ((!row->reversed_p && row->continued_p)
+              || (row->reversed_p && MATRIX_ROW_CONTINUATION_LINE_P (row)))
        right = RIGHT_FRINGE (4, Qcontinuation, 0);
       else if (row->indicate_top_line_p && EQ (arrow_top, Qright))
        {
@@ -1337,9 +1314,7 @@ update_window_fringes (w, keep_current_p)
 */
 
 void
-compute_fringe_widths (f, redraw)
-     struct frame *f;
-     int redraw;
+compute_fringe_widths (struct frame *f, int redraw)
 {
   int o_left = FRAME_LEFT_FRINGE_WIDTH (f);
   int o_right = FRAME_RIGHT_FRINGE_WIDTH (f);
@@ -1421,8 +1396,7 @@ compute_fringe_widths (f, redraw)
 /* Free resources used by a user-defined bitmap.  */
 
 void
-destroy_fringe_bitmap (n)
-     int n;
+destroy_fringe_bitmap (int n)
 {
   struct fringe_bitmap **fbp;
 
@@ -1449,8 +1423,7 @@ DEFUN ("destroy-fringe-bitmap", Fdestroy_fringe_bitmap, Sdestroy_fringe_bitmap,
        1, 1, 0,
        doc: /* Destroy fringe bitmap BITMAP.
 If BITMAP overrides a standard fringe bitmap, the original bitmap is restored.  */)
-  (bitmap)
-     Lisp_Object bitmap;
+  (Lisp_Object bitmap)
 {
   int n;
 
@@ -1491,10 +1464,7 @@ static const unsigned char swap_nibble[16] = {
 #endif                          /* HAVE_X_WINDOWS */
 
 void
-init_fringe_bitmap (which, fb, once_p)
-     int which;
-     struct fringe_bitmap *fb;
-     int once_p;
+init_fringe_bitmap (int which, struct fringe_bitmap *fb, int once_p)
 {
   if (once_p || fb->dynamic)
     {
@@ -1524,7 +1494,7 @@ init_fringe_bitmap (which, fb, once_p)
                                   | (swap_nibble[(b>>8) & 0xf] << 4)
                                   | (swap_nibble[(b>>12) & 0xf]));
              b >>= (16 - fb->width);
-#ifdef WORDS_BIG_ENDIAN
+#ifdef WORDS_BIGENDIAN
              b = ((b >> 8) | (b << 8));
 #endif
              *bits++ = b;
@@ -1564,8 +1534,7 @@ is used; the default is to center the bitmap.  Fifth arg may also be a
 list (ALIGN PERIODIC) where PERIODIC non-nil specifies that the bitmap
 should be repeated.
 If BITMAP already exists, the existing definition is replaced.  */)
-  (bitmap, bits, height, width, align)
-     Lisp_Object bitmap, bits, height, width, align;
+  (Lisp_Object bitmap, Lisp_Object bits, Lisp_Object height, Lisp_Object width, Lisp_Object align)
 {
   int n, h, i, j;
   unsigned short *b;
@@ -1669,7 +1638,7 @@ If BITMAP already exists, the existing definition is replaced.  */)
   xfb = (struct fringe_bitmap *) xmalloc (sizeof fb
                                          + fb.height * BYTES_PER_BITMAP_ROW);
   fb.bits = b = (unsigned short *) (xfb + 1);
-  bzero (b, fb.height);
+  memset (b, 0, fb.height);
 
   j = 0;
   while (j < fb.height)
@@ -1696,8 +1665,7 @@ DEFUN ("set-fringe-bitmap-face", Fset_fringe_bitmap_face, Sset_fringe_bitmap_fac
        1, 2, 0,
        doc: /* Set face for fringe bitmap BITMAP to FACE.
 If FACE is nil, reset face to default fringe face.  */)
-  (bitmap, face)
-     Lisp_Object bitmap, face;
+  (Lisp_Object bitmap, Lisp_Object face)
 {
   int n;
   int face_id;
@@ -1729,8 +1697,7 @@ is the symbol for the bitmap in the left fringe (or nil if no bitmap),
 RIGHT is similar for the right fringe, and OV is non-nil if there is an
 overlay arrow in the left fringe.
 Return nil if POS is not visible in WINDOW.  */)
-  (pos, window)
-     Lisp_Object pos, window;
+  (Lisp_Object pos, Lisp_Object window)
 {
   struct window *w;
   struct glyph_row *row;
@@ -1769,7 +1736,7 @@ Return nil if POS is not visible in WINDOW.  */)
  ***********************************************************************/
 
 void
-syms_of_fringe ()
+syms_of_fringe (void)
 {
   Qtruncation = intern_c_string ("truncation");
   staticpro (&Qtruncation);
@@ -1806,7 +1773,7 @@ If nil, also continue lines which are exactly as wide as the window.  */);
 /* Garbage collection hook */
 
 void
-mark_fringe_data ()
+mark_fringe_data (void)
 {
   int i;
 
@@ -1818,7 +1785,7 @@ mark_fringe_data ()
 /* Initialize this module when Emacs starts.  */
 
 void
-init_fringe_once ()
+init_fringe_once (void)
 {
   int bt;
 
@@ -1827,7 +1794,7 @@ init_fringe_once ()
 }
 
 void
-init_fringe ()
+init_fringe (void)
 {
   int i;
 
@@ -1863,7 +1830,7 @@ w32_init_fringe (struct redisplay_interface *rif)
 }
 
 void
-w32_reset_fringes ()
+w32_reset_fringes (void)
 {
   /* Destroy row bitmaps.  */
   int bt;