/* 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 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
}
-/* 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;
}
X Colors
***********************************************************************/
-#define NEAR_SAME_COLOR_THRESHOLD 30000
-
/* Parse RGB_LIST, and fill in the RGB fields of COLOR.
RGB_LIST should contain (at least) 3 lisp integers.
Return 0 if there's a problem with RGB_LIST, otherwise return 1. */
#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,
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;
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;
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;
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);
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;
}
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)
#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)
emacs_abort ();
}
- if (UNSPECIFIEDP (LFACE_DISTANT_FOREGROUND (lface)))
- ASET (lface, LFACE_DISTANT_FOREGROUND_INDEX, Qnil);
-
if (UNSPECIFIEDP (LFACE_BACKGROUND (lface)))
{
/* This function is called so early that colors are not yet
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
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");