]> code.delx.au - gnu-emacs/blobdiff - src/fringe.c
Replace LUCID_LIBW, MOTIF_LIBW with TOOLKIT_LIBW.
[gnu-emacs] / src / fringe.c
index 57a1861446bd3791eb97cc9acd61957901a91af8..cfb944d58d172524cb387b7bb8845f5a3cdf8d80 100644 (file)
@@ -1,7 +1,7 @@
 /* Fringe handling (split from xdisp.c).
    Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1997,
                  1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-                 2006, 2007, 2008  Free Software Foundation, Inc.
+                 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -20,6 +20,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 #include <stdio.h>
+#include <setjmp.h>
 
 #include "lisp.h"
 #include "frame.h"
@@ -482,7 +483,7 @@ static struct fringe_bitmap **fringe_bitmaps;
 static Lisp_Object *fringe_faces;
 static int max_fringe_bitmaps;
 
-static int max_used_fringe_bitmap = MAX_STANDARD_FRINGE_BITMAPS;
+int max_used_fringe_bitmap = MAX_STANDARD_FRINGE_BITMAPS;
 
 
 /* Lookup bitmap number for symbol BITMAP.
@@ -824,7 +825,7 @@ draw_fringe_bitmap (w, row, 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;
 
@@ -856,7 +857,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;
            }
        }
@@ -1089,7 +1090,8 @@ update_window_fringes (w, keep_current_p)
                : LEFT_FRINGE (2, Qtop, 0));
       else if (row->indicate_eob_p && EQ (boundary_bot, Qleft))
        left = LEFT_FRINGE (3, Qbottom, row->ends_at_zv_p);
-      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);
@@ -1116,7 +1118,8 @@ update_window_fringes (w, keep_current_p)
                 : RIGHT_FRINGE (2, Qtop, 0));
       else if (row->indicate_eob_p && EQ (boundary_bot, Qright))
        right = RIGHT_FRINGE (3, Qbottom, row->ends_at_zv_p);
-      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))
        right = RIGHT_FRINGE (6, Qup, 0);
@@ -1329,7 +1332,7 @@ If BITMAP overrides a standard fringe bitmap, the original bitmap is restored.
 */
 
 #if defined (HAVE_X_WINDOWS)
-static unsigned char swap_nibble[16] = {
+static const unsigned char swap_nibble[16] = {
   0x0, 0x8, 0x4, 0xc,           /* 0000 1000 0100 1100 */
   0x2, 0xa, 0x6, 0xe,           /* 0010 1010 0110 1110 */
   0x1, 0x9, 0x5, 0xd,           /* 0001 1001 0101 1101 */
@@ -1369,20 +1372,15 @@ init_fringe_bitmap (which, fb, once_p)
                                   | (swap_nibble[(b>>4) & 0xf] << 8)
                                   | (swap_nibble[(b>>8) & 0xf] << 4)
                                   | (swap_nibble[(b>>12) & 0xf]));
-             *bits++ = (b >> (16 - fb->width));
+             b >>= (16 - fb->width);
+#ifdef WORDS_BIG_ENDIAN
+             b = ((b >> 8) | (b << 8));
+#endif
+             *bits++ = b;
            }
        }
 #endif /* HAVE_X_WINDOWS */
 
-#if defined (MAC_OS) && defined (WORDS_BIG_ENDIAN)
-      unsigned short *bits = fb->bits;
-      int j;
-      for (j = 0; j < fb->height; j++)
-       {
-         unsigned short b = *bits;
-         *bits++ = ((b >> 8) & 0xff) | ((b & 0xff) << 8);
-       }
-#endif /* MAC_OS && WORDS_BIG_ENDIAN */
     }
 
   if (!once_p)
@@ -1622,17 +1620,17 @@ Return nil if POS is not visible in WINDOW.  */)
 void
 syms_of_fringe ()
 {
-  Qtruncation = intern ("truncation");
+  Qtruncation = intern_c_string ("truncation");
   staticpro (&Qtruncation);
-  Qcontinuation = intern ("continuation");
+  Qcontinuation = intern_c_string ("continuation");
   staticpro (&Qcontinuation);
-  Qoverlay_arrow = intern ("overlay-arrow");
+  Qoverlay_arrow = intern_c_string ("overlay-arrow");
   staticpro (&Qoverlay_arrow);
-  Qempty_line = intern ("empty-line");
+  Qempty_line = intern_c_string ("empty-line");
   staticpro (&Qempty_line);
-  Qtop_bottom = intern ("top-bottom");
+  Qtop_bottom = intern_c_string ("top-bottom");
   staticpro (&Qtop_bottom);
-  Qhollow_small = intern ("hollow-small");
+  Qhollow_small = intern_c_string ("hollow-small");
   staticpro (&Qhollow_small);
 
   defsubr (&Sdestroy_fringe_bitmap);
@@ -1696,15 +1694,10 @@ init_fringe ()
     }
 }
 
-#if defined (HAVE_NTGUI) || defined (MAC_OS)
+#ifdef HAVE_NTGUI
 
 void
-#ifdef HAVE_NTGUI
-w32_init_fringe (rif)
-#else  /* MAC_OS */
-mac_init_fringe (rif)
-#endif
-     struct redisplay_interface *rif;
+w32_init_fringe (struct redisplay_interface *rif)
 {
   int bt;
 
@@ -1717,9 +1710,7 @@ mac_init_fringe (rif)
       rif->define_fringe_bitmap (bt, fb->bits, fb->height, fb->width);
     }
 }
-#endif
 
-#ifdef HAVE_NTGUI
 void
 w32_reset_fringes ()
 {