/* Fringe handling (split from xdisp.c).
- Copyright (C) 1985-1988, 1993-1995, 1997-2014 Free Software
+ Copyright (C) 1985-1988, 1993-1995, 1997-2016 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, either version 3 of the License, or (at
+your option) any later version.
GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
#include "frame.h"
#include "window.h"
#include "dispextern.h"
-#include "character.h"
#include "buffer.h"
#include "blockinput.h"
#include "termhooks.h"
must specify physical bitmap symbols.
*/
-static Lisp_Object Qtruncation, Qcontinuation, Qoverlay_arrow;
-static Lisp_Object Qempty_line, Qtop_bottom;
-static Lisp_Object Qhollow_small;
-
enum fringe_bitmap_align
{
ALIGN_BITMAP_CENTER = 0,
static Lisp_Object *fringe_faces;
static int max_fringe_bitmaps;
-#ifndef HAVE_NS
-static
-#endif
int max_used_fringe_bitmap = MAX_STANDARD_FRINGE_BITMAPS;
if (face_id == DEFAULT_FACE_ID)
{
Lisp_Object face = fringe_faces[which];
- face_id = NILP (face) ? lookup_named_face (f, Qfringe, 0)
+ face_id = NILP (face) ? lookup_named_face (f, Qfringe, false)
: lookup_derived_face (f, face, FRINGE_FACE_ID, 0);
if (face_id < 0)
face_id = FRINGE_FACE_ID;
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. */
}
-/* Compute actual fringe widths for frame F.
-
- If REDRAW is 1, redraw F if the fringe settings was actually
- modified and F is visible.
-
- Since the combined left and right fringe must occupy an integral
- number of columns, we may need to add some pixels to each fringe.
- Typically, we add an equal amount (+/- 1 pixel) to each fringe,
- but a negative width value is taken literally (after negating it).
-
- We never make the fringes narrower than specified.
-*/
-
-void
-compute_fringe_widths (struct frame *f, bool redraw_p)
-{
- int o_left = FRAME_LEFT_FRINGE_WIDTH (f);
- int o_right = FRAME_RIGHT_FRINGE_WIDTH (f);
- int o_cols = FRAME_FRINGE_COLS (f);
-
- Lisp_Object left_fringe = Fassq (Qleft_fringe, f->param_alist);
- Lisp_Object right_fringe = Fassq (Qright_fringe, f->param_alist);
- int left_fringe_width, right_fringe_width;
-
- if (!NILP (left_fringe))
- left_fringe = Fcdr (left_fringe);
- if (!NILP (right_fringe))
- right_fringe = Fcdr (right_fringe);
-
- left_fringe_width = ((NILP (left_fringe) || !INTEGERP (left_fringe)) ? 8 :
- XINT (left_fringe));
- right_fringe_width = ((NILP (right_fringe) || !INTEGERP (right_fringe)) ? 8 :
- XINT (right_fringe));
-
- if (left_fringe_width || right_fringe_width)
- {
- int left_wid = eabs (left_fringe_width);
- int right_wid = eabs (right_fringe_width);
- int conf_wid = left_wid + right_wid;
- int font_wid = FRAME_COLUMN_WIDTH (f);
- int cols = (left_wid + right_wid + font_wid-1) / font_wid;
- int real_wid = cols * font_wid;
- if (left_wid && right_wid)
- {
- if (left_fringe_width < 0)
- {
- /* Left fringe width is fixed, adjust right fringe if necessary */
- FRAME_LEFT_FRINGE_WIDTH (f) = left_wid;
- FRAME_RIGHT_FRINGE_WIDTH (f) = real_wid - left_wid;
- }
- else if (right_fringe_width < 0)
- {
- /* Right fringe width is fixed, adjust left fringe if necessary */
- FRAME_LEFT_FRINGE_WIDTH (f) = real_wid - right_wid;
- FRAME_RIGHT_FRINGE_WIDTH (f) = right_wid;
- }
- else
- {
- /* Adjust both fringes with an equal amount.
- Note that we are doing integer arithmetic here, so don't
- lose a pixel if the total width is an odd number. */
- int fill = real_wid - conf_wid;
- FRAME_LEFT_FRINGE_WIDTH (f) = left_wid + fill/2;
- FRAME_RIGHT_FRINGE_WIDTH (f) = right_wid + fill - fill/2;
- }
- }
- else if (left_fringe_width)
- {
- FRAME_LEFT_FRINGE_WIDTH (f) = real_wid;
- FRAME_RIGHT_FRINGE_WIDTH (f) = 0;
- }
- else
- {
- FRAME_LEFT_FRINGE_WIDTH (f) = 0;
- FRAME_RIGHT_FRINGE_WIDTH (f) = real_wid;
- }
- FRAME_FRINGE_COLS (f) = cols;
- }
- else
- {
- FRAME_LEFT_FRINGE_WIDTH (f) = 0;
- FRAME_RIGHT_FRINGE_WIDTH (f) = 0;
- FRAME_FRINGE_COLS (f) = 0;
- }
-
- if (redraw_p && FRAME_VISIBLE_P (f))
- if (o_left != FRAME_LEFT_FRINGE_WIDTH (f) ||
- o_right != FRAME_RIGHT_FRINGE_WIDTH (f) ||
- o_cols != FRAME_FRINGE_COLS (f))
- redraw_frame (f);
-}
-
/* Free resources used by a user-defined bitmap. */
unsigned short *bits = fb->bits;
int j;
+#ifdef USE_CAIRO
+ for (j = 0; j < fb->height; j++)
+ {
+ unsigned short b = *bits;
+#ifdef WORDS_BIGENDIAN
+ *bits++ = (b << (16 - fb->width));
+#else
+ b = (unsigned short)((swap_nibble[b & 0xf] << 12)
+ | (swap_nibble[(b>>4) & 0xf] << 8)
+ | (swap_nibble[(b>>8) & 0xf] << 4)
+ | (swap_nibble[(b>>12) & 0xf]));
+ *bits++ = (b >> (16 - fb->width));
+#endif
+ }
+#else /* not USE_CAIRO */
if (fb->width <= 8)
{
unsigned char *cbits = (unsigned char *)fb->bits;
*bits++ = b;
}
}
+#endif /* not USE_CAIRO */
#endif /* HAVE_X_WINDOWS */
}
int fill1 = 0, fill2 = 0;
CHECK_SYMBOL (bitmap);
-
- if (STRINGP (bits))
- h = SCHARS (bits);
- else if (VECTORP (bits))
- h = ASIZE (bits);
- else
- wrong_type_argument (Qsequencep, bits);
+ h = CHECK_VECTOR_OR_STRING (bits);
if (NILP (height))
fb.height = h;
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
-(not counting the final newline) will only occupy one screen line, by
+\(not counting the final newline) will only occupy one screen line, by
showing (or hiding) the final newline in the right fringe; when point
is at the final newline, the cursor is shown in the right fringe.
If nil, also continue lines which are exactly as wide as the window. */);
void
init_fringe (void)
{
- int i;
-
max_fringe_bitmaps = MAX_STANDARD_FRINGE_BITMAPS + 20;
fringe_bitmaps = xzalloc (max_fringe_bitmaps * sizeof *fringe_bitmaps);
- fringe_faces = xmalloc (max_fringe_bitmaps * sizeof *fringe_faces);
- for (i = 0; i < max_fringe_bitmaps; i++)
- fringe_faces[i] = Qnil;
+ verify (NIL_IS_ZERO);
+ fringe_faces = xzalloc (max_fringe_bitmaps * sizeof *fringe_faces);
}
-#ifdef HAVE_NTGUI
+#if defined (HAVE_NTGUI) || defined (USE_CAIRO)
void
+#ifdef HAVE_NTGUI
w32_init_fringe (struct redisplay_interface *rif)
+#else
+x_cr_init_fringe (struct redisplay_interface *rif)
+#endif
{
int bt;
rif->define_fringe_bitmap (bt, fb->bits, fb->height, fb->width);
}
}
+#endif
+#ifdef HAVE_NTGUI
void
w32_reset_fringes (void)
{