[SQUASH] symbol
[bpt/emacs.git] / src / fringe.c
index 492edda..d70bc71 100644 (file)
@@ -1,5 +1,5 @@
 /* Fringe handling (split from xdisp.c).
-   Copyright (C) 1985-1988, 1993-1995, 1997-2013 Free Software
+   Copyright (C) 1985-1988, 1993-1995, 1997-2014 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -20,6 +20,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <config.h>
 #include <stdio.h>
 
+#include <byteswap.h>
+
 #include "lisp.h"
 #include "frame.h"
 #include "window.h"
@@ -29,8 +31,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "blockinput.h"
 #include "termhooks.h"
 
-#ifdef HAVE_WINDOW_SYSTEM
-
 /* Fringe bitmaps are represented in three different ways:
 
    Logical bitmaps are used internally to denote things like
@@ -83,7 +83,7 @@ struct fringe_bitmap
   unsigned width : 8;
   unsigned period : 8;
   unsigned align : 2;
-  unsigned dynamic : 1;
+  bool_bf dynamic : 1;
 };
 
 \f
@@ -474,15 +474,12 @@ static struct fringe_bitmap standard_bitmaps[] =
 
 #define NO_FRINGE_BITMAP 0
 #define UNDEF_FRINGE_BITMAP 1
-#define MAX_STANDARD_FRINGE_BITMAPS (sizeof (standard_bitmaps)/sizeof (standard_bitmaps[0]))
+#define MAX_STANDARD_FRINGE_BITMAPS ARRAYELTS (standard_bitmaps)
 
 static struct fringe_bitmap **fringe_bitmaps;
 static Lisp_Object *fringe_faces;
 static int max_fringe_bitmaps;
 
-#ifndef HAVE_NS
-static
-#endif
 int max_used_fringe_bitmap = MAX_STANDARD_FRINGE_BITMAPS;
 
 
@@ -637,7 +634,7 @@ draw_fringe_bitmap_1 (struct window *w, struct glyph_row *row, int left_p, int o
       return;
     }
 
-  PREPARE_FACE_FOR_DISPLAY (f, p.face);
+  prepare_face_for_display (f, p.face);
 
   /* Clear left fringe if no bitmap to draw or if bitmap doesn't fill
      the fringe.  */
@@ -659,6 +656,10 @@ draw_fringe_bitmap_1 (struct window *w, struct glyph_row *row, int left_p, int o
        {
          /* If W has a vertical border to its left, don't draw over it.  */
          wd -= ((!WINDOW_LEFTMOST_P (w)
+                 /* This could be wrong when we allow window local
+                    right dividers - but the window on the left is hard
+                    to get.  */
+                 && !FRAME_RIGHT_DIVIDER_WIDTH (f)
                  && !WINDOW_HAS_VERTICAL_SCROLL_BAR (w)
                  /* But don't reduce the fringe width if the window
                     has a left margin, because that means we are not
@@ -691,7 +692,9 @@ draw_fringe_bitmap_1 (struct window *w, struct glyph_row *row, int left_p, int o
        }
     }
 
-  FRAME_RIF (f)->draw_fringe_bitmap (w, row, &p);
+  if (p.x >= WINDOW_BOX_LEFT_EDGE_X (w)
+      && (p.x + p.wd) <= WINDOW_BOX_LEFT_EDGE_X (w) + WINDOW_PIXEL_WIDTH (w))
+    FRAME_RIF (f)->draw_fringe_bitmap (w, row, &p);
 }
 
 static int
@@ -1521,7 +1524,7 @@ init_fringe_bitmap (int which, struct fringe_bitmap *fb, int once_p)
                                   | (swap_nibble[(b>>12) & 0xf]));
              b >>= (16 - fb->width);
 #ifdef WORDS_BIGENDIAN
-             b = ((b >> 8) | (b << 8));
+             b = bswap_16 (b);
 #endif
              *bits++ = b;
            }
@@ -1660,7 +1663,7 @@ If BITMAP already exists, the existing definition is replaced.  */)
       Fput (bitmap, Qfringe, make_number (n));
     }
 
-  fb.dynamic = 1;
+  fb.dynamic = true;
 
   xfb = xmalloc (sizeof fb + fb.height * BYTES_PER_BITMAP_ROW);
   fb.bits = b = (unsigned short *) (xfb + 1);
@@ -1690,6 +1693,8 @@ If BITMAP already exists, the existing definition is replaced.  */)
 DEFUN ("set-fringe-bitmap-face", Fset_fringe_bitmap_face, Sset_fringe_bitmap_face,
        1, 2, 0,
        doc: /* Set face for fringe bitmap BITMAP to FACE.
+FACE is merged with the `fringe' face, so normally FACE should specify
+only the foreground color.
 If FACE is nil, reset face to default fringe face.  */)
   (Lisp_Object bitmap, Lisp_Object face)
 {
@@ -1768,6 +1773,8 @@ Return nil if POS is not visible in WINDOW.  */)
 void
 syms_of_fringe (void)
 {
+#include "fringe.x"
+
   DEFSYM (Qtruncation, "truncation");
   DEFSYM (Qcontinuation, "continuation");
   DEFSYM (Qoverlay_arrow, "overlay-arrow");
@@ -1775,11 +1782,6 @@ syms_of_fringe (void)
   DEFSYM (Qtop_bottom, "top-bottom");
   DEFSYM (Qhollow_small, "hollow-small");
 
-  defsubr (&Sdestroy_fringe_bitmap);
-  defsubr (&Sdefine_fringe_bitmap);
-  defsubr (&Sfringe_bitmaps_at_pos);
-  defsubr (&Sset_fringe_bitmap_face);
-
   DEFVAR_LISP ("overflow-newline-into-fringe", Voverflow_newline_into_fringe,
     doc: /* Non-nil means that newline may flow into the right fringe.
 This means that display lines which are exactly as wide as the window
@@ -1794,18 +1796,6 @@ If nil, also continue lines which are exactly as wide as the window.  */);
   Vfringe_bitmaps = Qnil;
 }
 
-/* Garbage collection hook */
-
-void
-mark_fringe_data (void)
-{
-  int i;
-
-  for (i = 0; i < max_fringe_bitmaps; i++)
-    if (!NILP (fringe_faces[i]))
-      mark_object (fringe_faces[i]);
-}
-
 /* Initialize this module when Emacs starts.  */
 
 void
@@ -1863,5 +1853,3 @@ w32_reset_fringes (void)
 }
 
 #endif /* HAVE_NTGUI */
-
-#endif /* HAVE_WINDOW_SYSTEM */