/* xfaces.c -- "Face" primitives.
-Copyright (C) 1993-1994, 1998-2013 Free Software Foundation, Inc.
+Copyright (C) 1993-1994, 1998-2014 Free Software Foundation, Inc.
This file is part of GNU Emacs.
static Lisp_Object QCfont, QCbold, QCitalic;
static Lisp_Object QCreverse_video;
static Lisp_Object QCoverline, QCstrike_through, QCbox, QCinherit;
-static Lisp_Object QCfontset;
+static Lisp_Object QCfontset, QCdistant_foreground;
/* Symbols used for attribute values. */
static Lisp_Object Qborder, Qmouse, Qmenu;
Lisp_Object Qmode_line_inactive;
static Lisp_Object Qvertical_border;
+static Lisp_Object Qwindow_divider;
+static Lisp_Object Qwindow_divider_first_pixel;
+static Lisp_Object Qwindow_divider_last_pixel;
/* The symbol `face-alias'. A symbols having that property is an
alias for another face. Value of the property is the name of
static void free_face_cache (struct face_cache *);
static int merge_face_ref (struct frame *, Lisp_Object, Lisp_Object *,
int, struct named_merge_point *);
+static int color_distance (XColor *x, XColor *y);
#ifdef HAVE_WINDOW_SYSTEM
static void set_font_frame_param (Lisp_Object, Lisp_Object);
is called. */
void
-x_free_colors (struct frame *f, long unsigned int *pixels, int npixels)
+x_free_colors (struct frame *f, unsigned long *pixels, int npixels)
{
int class = FRAME_DISPLAY_INFO (f)->visual->class;
void
x_free_dpy_colors (Display *dpy, Screen *screen, Colormap cmap,
- long unsigned int *pixels, int npixels)
+ unsigned long *pixels, int npixels)
{
struct x_display_info *dpyinfo = x_display_info_for_display (dpy);
int class = dpyinfo->visual->class;
are given by XGCV and MASK. */
static GC
-x_create_gc (struct frame *f, long unsigned int mask, XGCValues *xgcv)
+x_create_gc (struct frame *f, unsigned long mask, XGCValues *xgcv)
{
GC gc;
block_input ();
}
-/* Free face cache of frame F. Called from delete_frame. */
+/* Free face cache of frame F. Called from frame-dependent
+ resource freeing function, e.g. (x|tty)_free_frame_resources. */
void
free_frame_faces (struct frame *f)
{
clear_face_cache (!NILP (thoroughly));
++face_change_count;
- ++windows_or_buffers_changed;
+ windows_or_buffers_changed = 53;
return Qnil;
}
pixmap spec) for use on frame F. Value is the bitmap_id (see
xfns.c). If NAME is nil, return with a bitmap id of zero. If
bitmap cannot be loaded, display a message saying so, and return
- zero. Store the bitmap width in *W_PTR and its height in *H_PTR,
- if these pointers are not null. */
+ zero. */
static ptrdiff_t
-load_pixmap (struct frame *f, Lisp_Object name, unsigned int *w_ptr,
- unsigned int *h_ptr)
+load_pixmap (struct frame *f, Lisp_Object name)
{
ptrdiff_t bitmap_id;
{
add_to_log ("Invalid or undefined bitmap `%s'", name, Qnil);
bitmap_id = 0;
-
- if (w_ptr)
- *w_ptr = 0;
- if (h_ptr)
- *h_ptr = 0;
}
else
{
#ifdef GLYPH_DEBUG
++npixmaps_allocated;
#endif
- if (w_ptr)
- *w_ptr = x_bitmap_width (f, bitmap_id);
-
- if (h_ptr)
- *h_ptr = x_bitmap_height (f, bitmap_id);
}
return bitmap_id;
}
-/* Load color with name NAME for use by face FACE on frame F.
- TARGET_INDEX must be one of LFACE_FOREGROUND_INDEX,
- LFACE_BACKGROUND_INDEX, LFACE_UNDERLINE_INDEX, LFACE_OVERLINE_INDEX,
- LFACE_STRIKE_THROUGH_INDEX, or LFACE_BOX_INDEX. Value is the
- pixel color. If color cannot be loaded, display a message, and
- return the foreground, background or underline color of F, but
- record that fact in flags of the face so that we don't try to free
- these colors. */
-
-#ifndef MSDOS
-static
-#endif
-unsigned long
-load_color (struct frame *f, struct face *face, Lisp_Object name,
- enum lface_attribute_index target_index)
+static unsigned long
+load_color2 (struct frame *f, struct face *face, Lisp_Object name,
+ enum lface_attribute_index target_index, XColor *color)
{
- XColor color;
-
eassert (STRINGP (name));
eassert (target_index == LFACE_FOREGROUND_INDEX
|| target_index == LFACE_BACKGROUND_INDEX
/* if the color map is full, defined_color will return a best match
to the values in an existing cell. */
- if (!defined_color (f, SSDATA (name), &color, 1))
+ if (!defined_color (f, SSDATA (name), color, 1))
{
add_to_log ("Unable to load color \"%s\"", name, Qnil);
{
case LFACE_FOREGROUND_INDEX:
face->foreground_defaulted_p = 1;
- color.pixel = FRAME_FOREGROUND_PIXEL (f);
+ color->pixel = FRAME_FOREGROUND_PIXEL (f);
break;
case LFACE_BACKGROUND_INDEX:
face->background_defaulted_p = 1;
- color.pixel = FRAME_BACKGROUND_PIXEL (f);
+ color->pixel = FRAME_BACKGROUND_PIXEL (f);
break;
case LFACE_UNDERLINE_INDEX:
face->underline_defaulted_p = 1;
- color.pixel = FRAME_FOREGROUND_PIXEL (f);
+ color->pixel = FRAME_FOREGROUND_PIXEL (f);
break;
case LFACE_OVERLINE_INDEX:
face->overline_color_defaulted_p = 1;
- color.pixel = FRAME_FOREGROUND_PIXEL (f);
+ color->pixel = FRAME_FOREGROUND_PIXEL (f);
break;
case LFACE_STRIKE_THROUGH_INDEX:
face->strike_through_color_defaulted_p = 1;
- color.pixel = FRAME_FOREGROUND_PIXEL (f);
+ color->pixel = FRAME_FOREGROUND_PIXEL (f);
break;
case LFACE_BOX_INDEX:
face->box_color_defaulted_p = 1;
- color.pixel = FRAME_FOREGROUND_PIXEL (f);
+ color->pixel = FRAME_FOREGROUND_PIXEL (f);
break;
default:
++ncolors_allocated;
#endif
- return color.pixel;
+ return color->pixel;
+}
+
+/* Load color with name NAME for use by face FACE on frame F.
+ TARGET_INDEX must be one of LFACE_FOREGROUND_INDEX,
+ LFACE_BACKGROUND_INDEX, LFACE_UNDERLINE_INDEX, LFACE_OVERLINE_INDEX,
+ LFACE_STRIKE_THROUGH_INDEX, or LFACE_BOX_INDEX. Value is the
+ pixel color. If color cannot be loaded, display a message, and
+ return the foreground, background or underline color of F, but
+ record that fact in flags of the face so that we don't try to free
+ these colors. */
+
+#ifndef MSDOS
+static
+#endif
+unsigned long
+load_color (struct frame *f, struct face *face, Lisp_Object name,
+ enum lface_attribute_index target_index)
+{
+ XColor color;
+ return load_color2 (f, face, name, target_index, &color);
}
#ifdef HAVE_WINDOW_SYSTEM
+#define NEAR_SAME_COLOR_THRESHOLD 30000
+
/* Load colors for face FACE which is used on frame F. Colors are
specified by slots LFACE_BACKGROUND_INDEX and LFACE_FOREGROUND_INDEX
of ATTRS. If the background color specified is not supported on F,
load_face_colors (struct frame *f, struct face *face,
Lisp_Object attrs[LFACE_VECTOR_SIZE])
{
- Lisp_Object fg, bg;
+ Lisp_Object fg, bg, dfg;
+ XColor xfg, xbg;
bg = attrs[LFACE_BACKGROUND_INDEX];
fg = attrs[LFACE_FOREGROUND_INDEX];
&& !NILP (Fbitmap_spec_p (Vface_default_stipple)))
{
x_destroy_bitmap (f, face->stipple);
- face->stipple = load_pixmap (f, Vface_default_stipple,
- &face->pixmap_w, &face->pixmap_h);
+ face->stipple = load_pixmap (f, Vface_default_stipple);
}
- face->background = load_color (f, face, bg, LFACE_BACKGROUND_INDEX);
- face->foreground = load_color (f, face, fg, LFACE_FOREGROUND_INDEX);
+ face->background = load_color2 (f, face, bg, LFACE_BACKGROUND_INDEX, &xbg);
+ face->foreground = load_color2 (f, face, fg, LFACE_FOREGROUND_INDEX, &xfg);
+
+ dfg = attrs[LFACE_DISTANT_FOREGROUND_INDEX];
+ if (!NILP (dfg) && !UNSPECIFIEDP (dfg)
+ && color_distance (&xbg, &xfg) < NEAR_SAME_COLOR_THRESHOLD)
+ {
+ if (EQ (attrs[LFACE_INVERSE_INDEX], Qt))
+ face->background = load_color (f, face, dfg, LFACE_BACKGROUND_INDEX);
+ else
+ face->foreground = load_color (f, face, dfg, LFACE_FOREGROUND_INDEX);
+ }
}
+#ifdef HAVE_X_WINDOWS
/* Free color PIXEL on frame F. */
void
-unload_color (struct frame *f, long unsigned int pixel)
+unload_color (struct frame *f, unsigned long pixel)
{
-#ifdef HAVE_X_WINDOWS
if (pixel != -1)
{
block_input ();
x_free_colors (f, &pixel, 1);
unblock_input ();
}
-#endif
}
-
/* Free colors allocated for FACE. */
static void
free_face_colors (struct frame *f, struct face *face)
{
-/* PENDING(NS): need to do something here? */
-#ifdef HAVE_X_WINDOWS
+ /* PENDING(NS): need to do something here? */
+
if (face->colors_copied_bitwise_p)
return;
}
unblock_input ();
-#endif /* HAVE_X_WINDOWS */
}
+#endif /* HAVE_X_WINDOWS */
+
#endif /* HAVE_WINDOW_SYSTEM */
vec = Fvconcat (ndrivers, drivers);
nfonts = ASIZE (vec);
- qsort (XVECTOR (vec)->u.contents, nfonts, word_size,
+ qsort (XVECTOR (vec)->contents, nfonts, word_size,
compare_fonts_by_sort_order);
result = Qnil;
#define LFACE_FONT(LFACE) AREF ((LFACE), LFACE_FONT_INDEX)
#define LFACE_INHERIT(LFACE) AREF ((LFACE), LFACE_INHERIT_INDEX)
#define LFACE_FONTSET(LFACE) AREF ((LFACE), LFACE_FONTSET_INDEX)
+#define LFACE_DISTANT_FOREGROUND(LFACE) \
+ AREF ((LFACE), LFACE_DISTANT_FOREGROUND_INDEX)
/* Non-zero if LFACE is a Lisp face. A Lisp face is a vector of size
LFACE_VECTOR_SIZE which has the symbol `face' in slot 0. */
eassert (UNSPECIFIEDP (attrs[LFACE_FOREGROUND_INDEX])
|| IGNORE_DEFFACE_P (attrs[LFACE_FOREGROUND_INDEX])
|| STRINGP (attrs[LFACE_FOREGROUND_INDEX]));
+ eassert (UNSPECIFIEDP (attrs[LFACE_DISTANT_FOREGROUND_INDEX])
+ || IGNORE_DEFFACE_P (attrs[LFACE_DISTANT_FOREGROUND_INDEX])
+ || STRINGP (attrs[LFACE_DISTANT_FOREGROUND_INDEX]));
eassert (UNSPECIFIEDP (attrs[LFACE_BACKGROUND_INDEX])
|| IGNORE_DEFFACE_P (attrs[LFACE_BACKGROUND_INDEX])
|| STRINGP (attrs[LFACE_BACKGROUND_INDEX]));
if (!NILP (lface))
{
eassert (LFACEP (lface));
- check_lface_attrs (XVECTOR (lface)->u.contents);
+ check_lface_attrs (XVECTOR (lface)->contents);
}
}
lface = lface_from_face_name_no_resolve (f, face_name, signal_p);
if (! NILP (lface))
- memcpy (attrs, XVECTOR (lface)->u.contents,
+ memcpy (attrs, XVECTOR (lface)->contents,
LFACE_VECTOR_SIZE * sizeof *attrs);
return !NILP (lface);
int i;
for (i = 1; i < LFACE_VECTOR_SIZE; ++i)
- if (i != LFACE_FONT_INDEX && i != LFACE_INHERIT_INDEX)
+ if (i != LFACE_FONT_INDEX && i != LFACE_INHERIT_INDEX
+ && i != LFACE_DISTANT_FOREGROUND_INDEX)
if ((UNSPECIFIEDP (attrs[i]) || IGNORE_DEFFACE_P (attrs[i])))
break;
else
err = 1;
}
+ else if (EQ (keyword, QCdistant_foreground))
+ {
+ if (STRINGP (value))
+ to[LFACE_DISTANT_FOREGROUND_INDEX] = value;
+ else
+ err = 1;
+ }
else if (EQ (keyword, QCbackground))
{
if (STRINGP (value))
if (NILP (Fget (face, Qface_no_inherit)))
{
++face_change_count;
- ++windows_or_buffers_changed;
+ windows_or_buffers_changed = 54;
}
eassert (LFACEP (lface));
copy = Finternal_make_lisp_face (to, new_frame);
}
- vcopy (copy, 0, XVECTOR (lface)->u.contents, LFACE_VECTOR_SIZE);
+ vcopy (copy, 0, XVECTOR (lface)->contents, LFACE_VECTOR_SIZE);
/* Changing a named face means that all realized faces depending on
that face are invalid. Since we cannot tell which realized faces
if (NILP (Fget (to, Qface_no_inherit)))
{
++face_change_count;
- ++windows_or_buffers_changed;
+ windows_or_buffers_changed = 55;
}
return to;
old_value = LFACE_FOREGROUND (lface);
ASET (lface, LFACE_FOREGROUND_INDEX, value);
}
+ else if (EQ (attr, QCdistant_foreground))
+ {
+ /* Compatibility with 20.x. */
+ if (NILP (value))
+ value = Qunspecified;
+ if (!UNSPECIFIEDP (value) && !IGNORE_DEFFACE_P (value))
+ {
+ /* Don't check for valid color names here because it depends
+ on the frame (display) whether the color will be valid
+ when the face is realized. */
+ CHECK_STRING (value);
+ if (SCHARS (value) == 0)
+ signal_error ("Empty distant-foreground color value", value);
+ }
+ old_value = LFACE_DISTANT_FOREGROUND (lface);
+ ASET (lface, LFACE_DISTANT_FOREGROUND_INDEX, value);
+ }
else if (EQ (attr, QCbackground))
{
/* Compatibility with 20.x. */
f = XFRAME (frame);
if (! FONT_OBJECT_P (value))
{
- Lisp_Object *attrs = XVECTOR (lface)->u.contents;
+ Lisp_Object *attrs = XVECTOR (lface)->contents;
Lisp_Object font_object;
font_object = font_load_for_lface (f, attrs, value);
the font to nil so that the font selector doesn't think that
the attribute is mandatory. Also, clear the average
width. */
- font_clear_prop (XVECTOR (lface)->u.contents, prop_index);
+ font_clear_prop (XVECTOR (lface)->contents, prop_index);
}
/* Changing a named face means that all realized faces depending on
&& NILP (Fequal (old_value, value)))
{
++face_change_count;
- ++windows_or_buffers_changed;
+ windows_or_buffers_changed = 56;
}
if (!UNSPECIFIEDP (value) && !IGNORE_DEFFACE_P (value)
{
#ifdef HAVE_WINDOW_SYSTEM
/* Changed font-related attributes of the `default' face are
- reflected in changed `font' frame parameters. */
+ reflected in changed `font' frame parameters. */
if (FRAMEP (frame)
&& (prop_index || EQ (attr, QCfont))
- && lface_fully_specified_p (XVECTOR (lface)->u.contents))
+ && lface_fully_specified_p (XVECTOR (lface)->contents))
set_font_frame_param (frame, lface);
else
#endif /* HAVE_WINDOW_SYSTEM */
&& NILP (Fget (face, Qface_no_inherit)))
{
++face_change_count;
- ++windows_or_buffers_changed;
+ windows_or_buffers_changed = 57;
}
}
{
if (FONT_SPEC_P (font))
{
- font = font_load_for_lface (f, XVECTOR (lface)->u.contents, font);
+ font = font_load_for_lface (f, XVECTOR (lface)->contents, font);
if (NILP (font))
return;
ASET (lface, LFACE_FONT_INDEX, font);
value = LFACE_INVERSE (lface);
else if (EQ (keyword, QCforeground))
value = LFACE_FOREGROUND (lface);
+ else if (EQ (keyword, QCdistant_foreground))
+ value = LFACE_DISTANT_FOREGROUND (lface);
else if (EQ (keyword, QCbackground))
value = LFACE_BACKGROUND (lface);
else if (EQ (keyword, QCstipple))
the local frame is defined from default specs in `face-defface-spec'
and those should be overridden by global settings. Hence the strange
"global before local" priority. */
- lvec = XVECTOR (local_lface)->u.contents;
- gvec = XVECTOR (global_lface)->u.contents;
+ lvec = XVECTOR (local_lface)->contents;
+ gvec = XVECTOR (global_lface)->contents;
for (i = 1; i < LFACE_VECTOR_SIZE; ++i)
if (IGNORE_DEFFACE_P (gvec[i]))
ASET (local_lface, i, Qunspecified);
lface1 = lface_from_face_name (f, face1, 1);
lface2 = lface_from_face_name (f, face2, 1);
- equal_p = lface_equal_p (XVECTOR (lface1)->u.contents,
- XVECTOR (lface2)->u.contents);
+ equal_p = lface_equal_p (XVECTOR (lface1)->contents,
+ XVECTOR (lface2)->contents);
return equal_p ? Qt : Qnil;
}
static struct face *
make_realized_face (Lisp_Object *attr)
{
- struct face *face = xzalloc (sizeof *face);
- face->ascii_face = face;
+ enum { off = offsetof (struct face, id) };
+ struct face *face = xmalloc (sizeof *face);
+
memcpy (face->lface, attr, sizeof face->lface);
+ memset (&face->id, 0, sizeof *face - off);
+ face->ascii_face = face;
+
return face;
}
face->gc = 0;
unblock_input ();
}
-
+#ifdef HAVE_X_WINDOWS
free_face_colors (f, face);
+#endif /* HAVE_X_WINDOWS */
x_destroy_bitmap (f, face->stipple);
}
#endif /* HAVE_WINDOW_SYSTEM */
if (WINDOWP (f->root_window))
{
clear_current_matrices (f);
- ++windows_or_buffers_changed;
+ windows_or_buffers_changed = 58;
}
unblock_input ();
Lisp_Object lface;
lface = Fmake_vector (make_number (LFACE_VECTOR_SIZE),
Qunspecified);
- merge_face_ref (XFRAME (selected_frame), plist, XVECTOR (lface)->u.contents,
+ merge_face_ref (XFRAME (selected_frame), plist, XVECTOR (lface)->contents,
1, 0);
return lface;
}
#ifdef HAVE_WINDOW_SYSTEM
-/* Return non-zero if all the face attributes in ATTRS are supported
+/* Return true if all the face attributes in ATTRS are supported
on the window-system frame F.
The definition of `supported' is somewhat heuristic, but basically means
\(1) different in appearance than the default face, and
\(2) `close in spirit' to what the attributes specify, if not exact. */
-static int
+static bool
x_supports_face_attributes_p (struct frame *f,
Lisp_Object attrs[LFACE_VECTOR_SIZE],
struct face *def_face)
|| (!UNSPECIFIEDP (attrs[LFACE_FOREGROUND_INDEX])
&& face_attr_equal_p (attrs[LFACE_FOREGROUND_INDEX],
def_attrs[LFACE_FOREGROUND_INDEX]))
+ || (!UNSPECIFIEDP (attrs[LFACE_DISTANT_FOREGROUND_INDEX])
+ && face_attr_equal_p (attrs[LFACE_DISTANT_FOREGROUND_INDEX],
+ def_attrs[LFACE_DISTANT_FOREGROUND_INDEX]))
|| (!UNSPECIFIEDP (attrs[LFACE_BACKGROUND_INDEX])
&& face_attr_equal_p (attrs[LFACE_BACKGROUND_INDEX],
def_attrs[LFACE_BACKGROUND_INDEX]))
#endif /* HAVE_WINDOW_SYSTEM */
-/* Return non-zero if all the face attributes in ATTRS are supported
+/* Return true if all the face attributes in ATTRS are supported
on the tty frame F.
The definition of `supported' is somewhat heuristic, but basically means
will _not_ be satisfied by the tty display code's automatic
substitution of a `dim' face for italic. */
-static int
+static bool
tty_supports_face_attributes_p (struct frame *f,
Lisp_Object attrs[LFACE_VECTOR_SIZE],
struct face *def_face)
/* Color testing. */
- /* Default the color indices in FG_TTY_COLOR and BG_TTY_COLOR, since
- we use them when calling `tty_capable_p' below, even if the face
- specifies no colors. */
- fg_tty_color.pixel = FACE_TTY_DEFAULT_FG_COLOR;
- bg_tty_color.pixel = FACE_TTY_DEFAULT_BG_COLOR;
-
/* Check if foreground color is close enough. */
fg = attrs[LFACE_FOREGROUND_INDEX];
if (STRINGP (fg))
/* See if the capabilities we selected above are supported, with the
given colors. */
- if (test_caps != 0 &&
- ! tty_capable_p (FRAME_TTY (f), test_caps, fg_tty_color.pixel,
- bg_tty_color.pixel))
- return 0;
-
-
- /* Hmmm, everything checks out, this terminal must support this face. */
- return 1;
+ return tty_capable_p (FRAME_TTY (f), test_caps);
}
face for italic. */)
(Lisp_Object attributes, Lisp_Object display)
{
- int supports = 0, i;
+ bool supports = 0;
+ int i;
Lisp_Object frame;
struct frame *f;
struct face *def_face;
realize_named_face (f, Qmouse, MOUSE_FACE_ID);
realize_named_face (f, Qmenu, MENU_FACE_ID);
realize_named_face (f, Qvertical_border, VERTICAL_BORDER_FACE_ID);
+ realize_named_face (f, Qwindow_divider, WINDOW_DIVIDER_FACE_ID);
+ realize_named_face (f, Qwindow_divider_first_pixel,
+ WINDOW_DIVIDER_FIRST_PIXEL_FACE_ID);
+ realize_named_face (f, Qwindow_divider_last_pixel,
+ WINDOW_DIVIDER_LAST_PIXEL_FACE_ID);
/* Reflect changes in the `menu' face in menu bars. */
if (FRAME_FACE_CACHE (f)->menu_face_changed_p)
ASET (lface, LFACE_STIPPLE_INDEX, Qnil);
/* Realize the face; it must be fully-specified now. */
- eassert (lface_fully_specified_p (XVECTOR (lface)->u.contents));
+ eassert (lface_fully_specified_p (XVECTOR (lface)->contents));
check_lface (lface);
- memcpy (attrs, XVECTOR (lface)->u.contents, sizeof attrs);
+ memcpy (attrs, XVECTOR (lface)->contents, sizeof attrs);
face = realize_face (c, attrs, DEFAULT_FACE_ID);
#ifdef HAVE_WINDOW_SYSTEM
stipple = attrs[LFACE_STIPPLE_INDEX];
if (!NILP (stipple))
- face->stipple = load_pixmap (f, stipple, &face->pixmap_w, &face->pixmap_h);
+ face->stipple = load_pixmap (f, stipple);
#endif /* HAVE_WINDOW_SYSTEM */
return face;
int
face_at_buffer_position (struct window *w, ptrdiff_t pos,
- ptrdiff_t region_beg, ptrdiff_t region_end,
ptrdiff_t *endptr, ptrdiff_t limit,
int mouse, int base_face_id)
{
XSETFASTINT (position, pos);
endpos = ZV;
- if (pos < region_beg && region_beg < endpos)
- endpos = region_beg;
/* Get the `face' or `mouse_face' text property at POS, and
determine the next position at which the property changes. */
/* Optimize common cases where we can use the default face. */
if (noverlays == 0
- && NILP (prop)
- && !(pos >= region_beg && pos < region_end))
+ && NILP (prop))
return default_face->id;
/* Begin with attributes from the default face. */
endpos = oendpos;
}
- /* If in the region, merge in the region face. */
- if (pos >= region_beg && pos < region_end)
- {
- merge_named_face (f, Qregion, attrs, 0);
-
- if (region_end < endpos)
- endpos = region_end;
- }
-
*endptr = endpos;
/* Look up a realized face with the given face attributes,
int
face_for_overlay_string (struct window *w, ptrdiff_t pos,
- ptrdiff_t region_beg, ptrdiff_t region_end,
ptrdiff_t *endptr, ptrdiff_t limit,
int mouse, Lisp_Object overlay)
{
XSETFASTINT (position, pos);
endpos = ZV;
- if (pos < region_beg && region_beg < endpos)
- endpos = region_beg;
/* Get the `face' or `mouse_face' text property at POS, and
determine the next position at which the property changes. */
/* Optimize common case where we can use the default face. */
if (NILP (prop)
- && !(pos >= region_beg && pos < region_end)
&& NILP (Vface_remapping_alist))
return DEFAULT_FACE_ID;
if (!NILP (prop))
merge_face_ref (f, prop, attrs, 1, 0);
- /* If in the region, merge in the region face. */
- if (pos >= region_beg && pos < region_end)
- {
- merge_named_face (f, Qregion, attrs, 0);
-
- if (region_end < endpos)
- endpos = region_end;
- }
-
*endptr = endpos;
/* Look up a realized face with the given face attributes,
int
face_at_string_position (struct window *w, Lisp_Object string,
ptrdiff_t pos, ptrdiff_t bufpos,
- ptrdiff_t region_beg, ptrdiff_t region_end,
ptrdiff_t *endptr, enum face_id base_face_id,
int mouse_p)
{
base_face = FACE_FROM_ID (f, base_face_id);
eassert (base_face);
- /* Optimize the default case that there is no face property and we
- are not in the region. */
+ /* Optimize the default case that there is no face property. */
if (NILP (prop)
- && (base_face_id != DEFAULT_FACE_ID
- /* BUFPOS <= 0 means STRING is not an overlay string, so
- that the region doesn't have to be taken into account. */
- || bufpos <= 0
- || bufpos < region_beg
- || bufpos >= region_end)
&& (multibyte_p
/* We can't realize faces for different charsets differently
if we don't have fonts, so we can stop here if not working
if (!NILP (prop))
merge_face_ref (f, prop, attrs, 1, 0);
- /* If in the region, merge in the region face. */
- if (bufpos
- && bufpos >= region_beg
- && bufpos < region_end)
- merge_named_face (f, Qregion, attrs, 0);
-
/* Look up a realized face with the given face attributes,
or realize a new one for ASCII characters. */
return lookup_face (f, attrs);
DEFSYM (QCwidth, ":width");
DEFSYM (QCfont, ":font");
DEFSYM (QCfontset, ":fontset");
+ DEFSYM (QCdistant_foreground, ":distant-foreground");
DEFSYM (QCbold, ":bold");
DEFSYM (QCitalic, ":italic");
DEFSYM (QCoverline, ":overline");
DEFSYM (Qmouse, "mouse");
DEFSYM (Qmode_line_inactive, "mode-line-inactive");
DEFSYM (Qvertical_border, "vertical-border");
+ DEFSYM (Qwindow_divider, "window-divider");
+ DEFSYM (Qwindow_divider_first_pixel, "window-divider-first-pixel");
+ DEFSYM (Qwindow_divider_last_pixel, "window-divider-last-pixel");
DEFSYM (Qtty_color_desc, "tty-color-desc");
DEFSYM (Qtty_color_standard_values, "tty-color-standard-values");
DEFSYM (Qtty_color_by_index, "tty-color-by-index");