(assq FACE-NAME global-face-data) returns a vector describing the
global parameters for that face.
- Let PARAM-FACE be FRAME->display.x->param_faces[Faref (FACE-VECTOR, 2)].
+ Let PARAM-FACE be FRAME->output_data.x->param_faces[Faref (FACE-VECTOR, 2)].
PARAM_FACE is a struct face whose members are the Xlib analogues of
the parameters in FACE-VECTOR. If an element of FACE-VECTOR is
nil, then the corresponding member of PARAM_FACE is FACE_DEFAULT.
These faces are called "parameter faces", because they're the ones
lisp manipulates to control what gets displayed. Elements 0 and 1
- of FRAME->display.x->param_faces are special - they describe the
+ of FRAME->output_data.x->param_faces are special - they describe the
default and mode line faces. None of the faces in param_faces have
GC's. (See src/dispextern.h for the definiton of struct face.
lisp/faces.el maintains the isomorphism between face_alist and
properties. The resulting faces are called "computed faces"; none
of their members are FACE_DEFAULT; they are completely specified.
They then call intern_compute_face to search
- FRAME->display.x->computed_faces for a matching face, add one if
+ FRAME->output_data.x->computed_faces for a matching face, add one if
none is found, and return the index into
- FRAME->display.x->computed_faces. FRAME's glyph matrices use these
+ FRAME->output_data.x->computed_faces. FRAME's glyph matrices use these
indices to record the faces of the matrix characters, and the X
display hooks consult compute_faces to decide how to display these
characters. Elements 0 and 1 of computed_faces always describe the
/* Definitions and declarations. */
/* The number of face-id's in use (same for all frames). */
-int next_face_id;
+static int next_face_id;
/* The number of the face to use to indicate the region. */
-int region_face;
+static int region_face;
/* This is what appears in a slot in a face to signify that the face
does not specify that display aspect. */
if (face->foreground != FACE_DEFAULT)
xgcv.foreground = face->foreground;
else
- xgcv.foreground = f->display.x->foreground_pixel;
+ xgcv.foreground = f->output_data.x->foreground_pixel;
if (face->background != FACE_DEFAULT)
xgcv.background = face->background;
else
- xgcv.background = f->display.x->background_pixel;
+ xgcv.background = f->output_data.x->background_pixel;
- if (face->font && (int) face->font != FACE_DEFAULT)
+ if (face->font && face->font != (XFontStruct *) FACE_DEFAULT)
xgcv.font = face->font->fid;
else
- xgcv.font = f->display.x->font->fid;
+ xgcv.font = f->output_data.x->font->fid;
xgcv.graphics_exposures = 0;
struct frame *f;
Lisp_Object name;
{
- Display *dpy = FRAME_X_DISPLAY (f);
- Colormap cmap;
XColor color;
int result;
if (NILP (name))
return FACE_DEFAULT;
- cmap = DefaultColormapOfScreen (DefaultScreenOfDisplay (dpy));
-
CHECK_STRING (name, 0);
- BLOCK_INPUT;
- result = XParseColor (dpy, cmap, (char *) XSTRING (name)->data, &color);
- UNBLOCK_INPUT;
+ /* if the colormap is full, defined_color will return a best match
+ to the values in an an existing cell. */
+ result = defined_color(f, (char *) XSTRING (name)->data, &color, 1);
if (! result)
Fsignal (Qerror, Fcons (build_string ("undefined color"),
Fcons (name, Qnil)));
- BLOCK_INPUT;
- result = XAllocColor (dpy, cmap, &color);
- UNBLOCK_INPUT;
- if (! result)
- Fsignal (Qerror, Fcons (build_string ("X server cannot allocate color"),
- Fcons (name, Qnil)));
return (unsigned long) color.pixel;
}
{
Colormap cmap;
Display *dpy = FRAME_X_DISPLAY (f);
+ int class = FRAME_X_DISPLAY_INFO (f)->visual->class;
+
if (pixel == FACE_DEFAULT
|| pixel == BLACK_PIX_DEFAULT (f)
|| pixel == WHITE_PIX_DEFAULT (f))
return;
cmap = DefaultColormapOfScreen (DefaultScreenOfDisplay (dpy));
- BLOCK_INPUT;
- XFreeColors (dpy, cmap, &pixel, 1, 0);
- UNBLOCK_INPUT;
+
+ /* If display has an immutable color map, freeing colors is not
+ necessary and some servers don't allow it. So don't do it. */
+ if (! (class == StaticColor || class == StaticGray || class == TrueColor))
+ {
+ BLOCK_INPUT;
+ XFreeColors (dpy, cmap, &pixel, 1, (unsigned long)0);
+ UNBLOCK_INPUT;
+ }
}
DEFUN ("pixmap-spec-p", Fpixmap_spec_p, Spixmap_spec_p, 1, 1, 0,
/* No action. */
}
-static void
-build_face (f, face)
- struct frame *f;
- struct face *face;
-{
- face->gc = 1;
-}
-
#ifdef MSDOS
unsigned long
load_color (f, name)
FRAME_PTR f;
{
int i;
- int biggest = FONT_HEIGHT (f->display.x->font);
+ int biggest = FONT_HEIGHT (f->output_data.x->font);
- for (i = 0; i < f->display.x->n_param_faces; i++)
- if (f->display.x->param_faces[i] != 0
- && f->display.x->param_faces[i]->font != (XFontStruct *) FACE_DEFAULT)
+ for (i = 0; i < f->output_data.x->n_param_faces; i++)
+ if (f->output_data.x->param_faces[i] != 0
+ && f->output_data.x->param_faces[i]->font != (XFontStruct *) FACE_DEFAULT)
{
- int height = FONT_HEIGHT (f->display.x->param_faces[i]->font);
+ int height = FONT_HEIGHT (f->output_data.x->param_faces[i]->font);
if (height > biggest)
biggest = height;
}
- if (biggest == f->display.x->line_height)
+ if (biggest == f->output_data.x->line_height)
return 0;
- f->display.x->line_height = biggest;
+ f->output_data.x->line_height = biggest;
return 1;
}
#endif /* not HAVE_X_WINDOWS */
len = 40;
overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
- noverlays = overlays_at (pos, 0, &overlay_vec, &len, &next_overlay, NULL);
+ noverlays = overlays_at (pos, 0, &overlay_vec, &len,
+ &next_overlay, (int *) 0);
/* If there are more than 40,
make enough space for all, and try again. */
len = noverlays;
overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
noverlays = overlays_at (pos, 0, &overlay_vec, &len,
- &next_overlay, NULL);
+ &next_overlay, (int *) 0);
}
if (next_overlay < endpos)
if (CONSP (prop))
{
/* We have a list of faces, merge them in reverse order */
- Lisp_Object length = Flength (prop);
- int len = XINT (length);
+ Lisp_Object length;
+ int len;
Lisp_Object *faces;
+ length = Fsafe_length (prop);
+ len = XFASTINT (length);
+
/* Put them into an array */
faces = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
for (j = 0; j < len; j++)
if (CONSP (prop))
{
/* We have a list of faces, merge them in reverse order */
- Lisp_Object length = Flength (prop);
- int len = XINT (length);
+ Lisp_Object length;
+ int len;
Lisp_Object *faces;
- int i;
+
+ length = Fsafe_length (prop);
+ len = XFASTINT (length);
/* Put them into an array */
faces = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
face->font = 0; /* The one and only font. */
#else
XFontStruct *font = load_font (f, attr_value);
- if (face->font != f->display.x->font)
+ if (face->font != f->output_data.x->font)
unload_font (f, face->font);
face->font = font;
if (frame_update_line_height (f))