annotate src/xfaces.c @ 22317:9a847e9cabfa

(LOCAL_FLAGS): Define HAVE_CONFIG_H.
author Andrew Innes <andrewi@gnu.org>
date Mon, 01 Jun 1998 14:09:53 +0000
parents 915b4091ede1
children c71c3ac4b80a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
1 /* "Face" primitives.
7307
cd81dba38a49 Update copyright.
Karl Heuer <kwzh@gnu.org>
parents: 6879
diff changeset
2 Copyright (C) 1993, 1994 Free Software Foundation.
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
3
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4 This file is part of GNU Emacs.
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6 GNU Emacs is free software; you can redistribute it and/or modify
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
7 it under the terms of the GNU General Public License as published by
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
8 the Free Software Foundation; either version 2, or (at your option)
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
9 any later version.
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
10
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
11 GNU Emacs is distributed in the hope that it will be useful,
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14 GNU General Public License for more details.
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
15
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
17 along with GNU Emacs; see the file COPYING. If not, write to
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 14090
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 14090
diff changeset
19 Boston, MA 02111-1307, USA. */
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
20
2438
b513de4de386 * xfaces.c: Doc fixes.
Jim Blandy <jimb@redhat.com>
parents: 2391
diff changeset
21 /* This is derived from work by Lucid (some parts very loosely so). */
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
22
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
23 #include <sys/types.h>
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
24 #include <sys/stat.h>
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
25
4696
1fc792473491 Include <config.h> instead of "config.h".
Roland McGrath <roland@gnu.org>
parents: 4258
diff changeset
26 #include <config.h>
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
27 #include "lisp.h"
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
28
17047
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
29 #include "charset.h"
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
30
18083
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
31 #include "frame.h"
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
32
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
33 /* The number of face-id's in use (same for all frames). */
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
34 static int next_face_id;
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
35
9572
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
36 #ifdef HAVE_FACES
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
37
9572
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
38 #ifdef HAVE_X_WINDOWS
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
39 #include "xterm.h"
17047
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
40 #include "fontset.h"
9572
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
41 #endif
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
42 #ifdef MSDOS
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
43 #include "dosfns.h"
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
44 #endif
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
45 #include "buffer.h"
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
46 #include "dispextern.h"
2438
b513de4de386 * xfaces.c: Doc fixes.
Jim Blandy <jimb@redhat.com>
parents: 2391
diff changeset
47 #include "blockinput.h"
2767
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
48 #include "window.h"
8848
48b3ac951c53 Add #include "intervals.h"
Karl Heuer <kwzh@gnu.org>
parents: 8472
diff changeset
49 #include "intervals.h"
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
50
9572
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
51 #ifdef HAVE_X_WINDOWS
3997
d968bcba16af * xfaces.c [XOS_NEEDS_TIME_H]: #undef USG while #including
Jim Blandy <jimb@redhat.com>
parents: 3882
diff changeset
52 /* Compensate for bug in Xos.h on some systems, on which it requires
d968bcba16af * xfaces.c [XOS_NEEDS_TIME_H]: #undef USG while #including
Jim Blandy <jimb@redhat.com>
parents: 3882
diff changeset
53 time.h. On some such systems, Xos.h tries to redefine struct
d968bcba16af * xfaces.c [XOS_NEEDS_TIME_H]: #undef USG while #including
Jim Blandy <jimb@redhat.com>
parents: 3882
diff changeset
54 timeval and struct timezone if USG is #defined while it is
d968bcba16af * xfaces.c [XOS_NEEDS_TIME_H]: #undef USG while #including
Jim Blandy <jimb@redhat.com>
parents: 3882
diff changeset
55 #included. */
3436
291f28da7ea1 Test XOS_NEEDS_TIME_H, not HPUX, for including time.hj.
Richard M. Stallman <rms@gnu.org>
parents: 3401
diff changeset
56 #ifdef XOS_NEEDS_TIME_H
3277
564f748751ea [HPUX]: Include time.h and define __TIMEVAL__.
Richard M. Stallman <rms@gnu.org>
parents: 3074
diff changeset
57
3997
d968bcba16af * xfaces.c [XOS_NEEDS_TIME_H]: #undef USG while #including
Jim Blandy <jimb@redhat.com>
parents: 3882
diff changeset
58 #include <time.h>
d968bcba16af * xfaces.c [XOS_NEEDS_TIME_H]: #undef USG while #including
Jim Blandy <jimb@redhat.com>
parents: 3882
diff changeset
59 #undef USG
d968bcba16af * xfaces.c [XOS_NEEDS_TIME_H]: #undef USG while #including
Jim Blandy <jimb@redhat.com>
parents: 3882
diff changeset
60 #include <X11/Xos.h>
d968bcba16af * xfaces.c [XOS_NEEDS_TIME_H]: #undef USG while #including
Jim Blandy <jimb@redhat.com>
parents: 3882
diff changeset
61 #define USG
d968bcba16af * xfaces.c [XOS_NEEDS_TIME_H]: #undef USG while #including
Jim Blandy <jimb@redhat.com>
parents: 3882
diff changeset
62 #define __TIMEVAL__
d968bcba16af * xfaces.c [XOS_NEEDS_TIME_H]: #undef USG while #including
Jim Blandy <jimb@redhat.com>
parents: 3882
diff changeset
63
d968bcba16af * xfaces.c [XOS_NEEDS_TIME_H]: #undef USG while #including
Jim Blandy <jimb@redhat.com>
parents: 3882
diff changeset
64 #else
3316
9857db8aa4cd * xfaces.c (unload_color): Don't #include <X11/Intrinsic.h>,
Jim Blandy <jimb@redhat.com>
parents: 3302
diff changeset
65
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
66 #include <X11/Xos.h>
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
67
3997
d968bcba16af * xfaces.c [XOS_NEEDS_TIME_H]: #undef USG while #including
Jim Blandy <jimb@redhat.com>
parents: 3882
diff changeset
68 #endif
9572
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
69 #endif /* HAVE_X_WINDOWS */
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
70
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
71 /* An explanation of the face data structures. */
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
72
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
73 /* ========================= Face Data Structures =========================
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
74
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
75 Let FACE-NAME be a symbol naming a face.
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
76
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
77 Let FACE-VECTOR be (assq FACE-NAME (frame-face-alist FRAME))
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
78 FACE-VECTOR is either nil, or a vector of the form
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
79 [face NAME ID FONT FOREGROUND BACKGROUND BACKGROUND-PIXMAP UNDERLINE-P]
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
80 where
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
81 face is the symbol `face',
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
82 NAME is the symbol with which this vector is associated (a backpointer),
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
83 ID is the face ID, an integer used internally by the C code to identify
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
84 the face,
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
85 FONT, FOREGROUND, and BACKGROUND are strings naming the fonts and colors
17047
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
86 to use with the face, FONT may name fontsets,
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
87 BACKGROUND-PIXMAP is the name of an x bitmap filename, which we don't
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
88 use right now, and
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
89 UNDERLINE-P is non-nil if the face should be underlined.
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
90 If any of these elements are nil, that parameter is considered
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
91 unspecified; parameters from faces specified by lower-priority
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
92 overlays or text properties, or the parameters of the frame itself,
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
93 can show through. (lisp/faces.el maintains these lists.)
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
94
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
95 (assq FACE-NAME global-face-data) returns a vector describing the
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
96 global parameters for that face.
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
97
12667
a3466dad7d6d Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents: 12608
diff changeset
98 Let PARAM-FACE be FRAME->output_data.x->param_faces[Faref (FACE-VECTOR, 2)].
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
99 PARAM_FACE is a struct face whose members are the Xlib analogues of
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
100 the parameters in FACE-VECTOR. If an element of FACE-VECTOR is
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
101 nil, then the corresponding member of PARAM_FACE is FACE_DEFAULT.
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
102 These faces are called "parameter faces", because they're the ones
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
103 lisp manipulates to control what gets displayed. Elements 0 and 1
12667
a3466dad7d6d Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents: 12608
diff changeset
104 of FRAME->output_data.x->param_faces are special - they describe the
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
105 default and mode line faces. None of the faces in param_faces have
14036
621a575db6f7 Comment fixes.
Karl Heuer <kwzh@gnu.org>
parents: 13626
diff changeset
106 GC's. (See src/dispextern.h for the definition of struct face.
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
107 lisp/faces.el maintains the isomorphism between face_alist and
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
108 param_faces.)
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
109
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
110 The functions compute_char_face and compute_glyph_face find and
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
111 combine the parameter faces associated with overlays and text
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
112 properties. The resulting faces are called "computed faces"; none
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
113 of their members are FACE_DEFAULT; they are completely specified.
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
114 They then call intern_compute_face to search
12667
a3466dad7d6d Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents: 12608
diff changeset
115 FRAME->output_data.x->computed_faces for a matching face, add one if
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
116 none is found, and return the index into
12667
a3466dad7d6d Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents: 12608
diff changeset
117 FRAME->output_data.x->computed_faces. FRAME's glyph matrices use these
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
118 indices to record the faces of the matrix characters, and the X
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
119 display hooks consult compute_faces to decide how to display these
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
120 characters. Elements 0 and 1 of computed_faces always describe the
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
121 default and mode-line faces.
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
122
9564
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
123 Each computed face belongs to a particular frame.
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
124
9529
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
125 Computed faces have graphics contexts some of the time.
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
126 intern_face builds a GC for a specified computed face
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
127 if it doesn't have one already.
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
128 clear_face_cache clears out the GCs of all computed faces.
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
129 This is done from time to time so that we don't hold on to
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
130 lots of GCs that are no longer needed.
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
131
13460
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
132 If a computed face has 0 as its font,
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
133 it is unused, and can be reused by new_computed_face.
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
134
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
135 Constraints:
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
136
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
137 Symbols naming faces must have associations on all frames; for any
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
138 FRAME, for all FACE-NAME, if (assq FACE-NAME (frame-face-alist
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
139 FRAME)) is non-nil, it must be non-nil for all frames.
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
140
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
141 Analogously, indices into param_faces must be valid on all frames;
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
142 if param_faces[i] is a non-zero face pointer on one frame, then it
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
143 must be filled in on all frames. Code assumes that face ID's can
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
144 be used on any frame.
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
145
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
146 Some subtleties:
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
147
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
148 Why do we keep param_faces and computed_faces separate?
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
149 computed_faces contains an element for every combination of facial
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
150 parameters we have ever displayed. indices into param_faces have
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
151 to be valid on all frames. If they were the same array, then that
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
152 array would grow very large on all frames, because any facial
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
153 combination displayed on any frame would need to be a valid entry
9529
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
154 on all frames. */
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
155
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
156 /* Definitions and declarations. */
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
157
2795
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
158 /* The number of the face to use to indicate the region. */
11737
9b62959880f4 (region_face, next_face_id): Make static.
Richard M. Stallman <rms@gnu.org>
parents: 11420
diff changeset
159 static int region_face;
2795
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
160
2838
5f6a2d52d2ef (compute_char_face): Pass 0 as EXTEND arg to overlays_at.
Richard M. Stallman <rms@gnu.org>
parents: 2821
diff changeset
161 /* This is what appears in a slot in a face to signify that the face
5f6a2d52d2ef (compute_char_face): Pass 0 as EXTEND arg to overlays_at.
Richard M. Stallman <rms@gnu.org>
parents: 2821
diff changeset
162 does not specify that display aspect. */
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
163 #define FACE_DEFAULT (~0)
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
164
6615
96ddf85642d1 (compute_char_face): New arg MOUSE.
Richard M. Stallman <rms@gnu.org>
parents: 5858
diff changeset
165 Lisp_Object Qface, Qmouse_face;
9564
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
166 Lisp_Object Qpixmap_spec_p;
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
167
3830
205d69567177 * xfaces.c: Add forward declaration for recompute_basic_faces.
Jim Blandy <jimb@redhat.com>
parents: 3811
diff changeset
168 int face_name_id_number ( /* FRAME_PTR, Lisp_Object name */ );
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
169
3830
205d69567177 * xfaces.c: Add forward declaration for recompute_basic_faces.
Jim Blandy <jimb@redhat.com>
parents: 3811
diff changeset
170 struct face *intern_face ( /* FRAME_PTR, struct face * */ );
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
171 static int new_computed_face ( /* FRAME_PTR, struct face * */ );
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
172 static int intern_computed_face ( /* FRAME_PTR, struct face * */ );
3830
205d69567177 * xfaces.c: Add forward declaration for recompute_basic_faces.
Jim Blandy <jimb@redhat.com>
parents: 3811
diff changeset
173 static void ensure_face_ready ( /* FRAME_PTR, int id */ );
3843
18892e151d53 * xfaces.c (recompute_basic_faces): This shouldn't be declared static.
Jim Blandy <jimb@redhat.com>
parents: 3830
diff changeset
174 void recompute_basic_faces ( /* FRAME_PTR f */ );
19128
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
175 static void merge_face_list ( /* FRAME_PTR, struct face *, Lisp_Object */ );
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
176
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
177 extern Lisp_Object Qforeground_color, Qbackground_color;
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
178
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
179 /* Allocating, copying, and comparing struct faces. */
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
180
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
181 /* Allocate a new face */
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
182 static struct face *
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
183 allocate_face ()
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
184 {
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
185 struct face *result = (struct face *) xmalloc (sizeof (struct face));
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
186 bzero (result, sizeof (struct face));
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
187 result->font = (XFontStruct *) FACE_DEFAULT;
17047
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
188 result->fontset = -1;
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
189 result->foreground = FACE_DEFAULT;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
190 result->background = FACE_DEFAULT;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
191 result->stipple = FACE_DEFAULT;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
192 return result;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
193 }
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
194
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
195 /* Make a new face that's a copy of an existing one. */
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
196 static struct face *
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
197 copy_face (face)
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
198 struct face *face;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
199 {
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
200 struct face *result = allocate_face ();
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
201
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
202 result->font = face->font;
17047
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
203 result->fontset = face->fontset;
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
204 result->foreground = face->foreground;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
205 result->background = face->background;
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
206 result->stipple = face->stipple;
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
207 result->underline = face->underline;
9564
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
208 result->pixmap_h = face->pixmap_h;
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
209 result->pixmap_w = face->pixmap_w;
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
210
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
211 return result;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
212 }
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
213
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
214 static int
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
215 face_eql (face1, face2)
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
216 struct face *face1, *face2;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
217 {
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
218 return ( face1->font == face2->font
17047
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
219 && face1->fontset == face2->fontset
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
220 && face1->foreground == face2->foreground
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
221 && face1->background == face2->background
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
222 && face1->stipple == face2->stipple
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
223 && face1->underline == face2->underline);
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
224 }
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
225
9529
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
226 /* Managing graphics contexts of faces. */
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
227
9572
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
228 #ifdef HAVE_X_WINDOWS
9529
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
229 /* Given a computed face, construct its graphics context if necessary. */
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
230
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
231 struct face *
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
232 intern_face (f, face)
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
233 struct frame *f;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
234 struct face *face;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
235 {
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
236 GC gc;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
237 XGCValues xgcv;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
238 unsigned long mask;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
239
9529
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
240 if (face->gc)
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
241 return face;
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
242
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
243 BLOCK_INPUT;
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
244
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
245 if (face->foreground != FACE_DEFAULT)
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
246 xgcv.foreground = face->foreground;
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
247 else
12667
a3466dad7d6d Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents: 12608
diff changeset
248 xgcv.foreground = f->output_data.x->foreground_pixel;
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
249
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
250 if (face->background != FACE_DEFAULT)
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
251 xgcv.background = face->background;
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
252 else
12667
a3466dad7d6d Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents: 12608
diff changeset
253 xgcv.background = f->output_data.x->background_pixel;
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
254
11238
747eeabdbbcb (intern_face): Cast FONT_DEFAULT to (XFontStruct *)
Richard M. Stallman <rms@gnu.org>
parents: 10919
diff changeset
255 if (face->font && face->font != (XFontStruct *) FACE_DEFAULT)
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
256 xgcv.font = face->font->fid;
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
257 else
12667
a3466dad7d6d Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents: 12608
diff changeset
258 xgcv.font = f->output_data.x->font->fid;
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
259
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
260 xgcv.graphics_exposures = 0;
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
261
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
262 mask = GCForeground | GCBackground | GCFont | GCGraphicsExposures;
9564
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
263 if (face->stipple && face->stipple != FACE_DEFAULT)
9566
fef2cfcbbe37 (intern_face): Update mask properly to set stipple
Richard M. Stallman <rms@gnu.org>
parents: 9564
diff changeset
264 {
fef2cfcbbe37 (intern_face): Update mask properly to set stipple
Richard M. Stallman <rms@gnu.org>
parents: 9564
diff changeset
265 xgcv.fill_style = FillStippled;
fef2cfcbbe37 (intern_face): Update mask properly to set stipple
Richard M. Stallman <rms@gnu.org>
parents: 9564
diff changeset
266 xgcv.stipple = x_bitmap_pixmap (f, face->stipple);
fef2cfcbbe37 (intern_face): Update mask properly to set stipple
Richard M. Stallman <rms@gnu.org>
parents: 9564
diff changeset
267 mask |= GCFillStyle | GCStipple;
fef2cfcbbe37 (intern_face): Update mask properly to set stipple
Richard M. Stallman <rms@gnu.org>
parents: 9564
diff changeset
268 }
9564
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
269
9529
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
270 gc = XCreateGC (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
271 mask, &xgcv);
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
272
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
273 face->gc = gc;
17047
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
274 /* We used the following GC for all non-ASCII characters by changing
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
275 only GCfont each time. */
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
276 face->non_ascii_gc = XCreateGC (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
277 mask, &xgcv);
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
278
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
279 UNBLOCK_INPUT;
9529
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
280
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
281 return face;
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
282 }
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
283
9529
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
284 /* Clear out all graphics contexts for all computed faces
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
285 except for the default and mode line faces.
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
286 This should be done from time to time just to avoid
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
287 keeping too many graphics contexts that are no longer needed. */
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
288
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
289 void
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
290 clear_face_cache ()
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
291 {
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
292 Lisp_Object tail, frame;
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
293
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
294 BLOCK_INPUT;
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
295 FOR_EACH_FRAME (tail, frame)
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
296 {
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
297 FRAME_PTR f = XFRAME (frame);
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
298 if (FRAME_X_P (f))
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
299 {
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
300 int i;
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
301 Display *dpy = FRAME_X_DISPLAY (f);
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
302
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
303 for (i = 2; i < FRAME_N_COMPUTED_FACES (f); i++)
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
304 {
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
305 struct face *face = FRAME_COMPUTED_FACES (f) [i];
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
306 if (face->gc)
17047
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
307 {
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
308 XFreeGC (dpy, face->gc);
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
309 XFreeGC (dpy, face->non_ascii_gc);
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
310 }
9529
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
311 face->gc = 0;
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
312 }
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
313 }
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
314 }
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
315
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
316 UNBLOCK_INPUT;
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
317 }
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
318
9564
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
319 /* Allocating, freeing, and duplicating fonts, colors, and pixmaps.
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
320
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
321 These functions operate on param faces only.
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
322 Computed faces get their fonts, colors and pixmaps
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
323 by merging param faces. */
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
324
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
325 static XFontStruct *
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
326 load_font (f, name)
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
327 struct frame *f;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
328 Lisp_Object name;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
329 {
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
330 XFontStruct *font;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
331
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
332 if (NILP (name))
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
333 return (XFontStruct *) FACE_DEFAULT;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
334
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
335 CHECK_STRING (name, 0);
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
336 BLOCK_INPUT;
9529
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
337 font = XLoadQueryFont (FRAME_X_DISPLAY (f), (char *) XSTRING (name)->data);
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
338 UNBLOCK_INPUT;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
339
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
340 if (! font)
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
341 Fsignal (Qerror, Fcons (build_string ("undefined font"),
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
342 Fcons (name, Qnil)));
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
343 return font;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
344 }
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
345
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
346 static void
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
347 unload_font (f, font)
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
348 struct frame *f;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
349 XFontStruct *font;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
350 {
13460
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
351 int len = FRAME_N_COMPUTED_FACES (f);
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
352 int i;
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
353
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
354 if (!font || font == ((XFontStruct *) FACE_DEFAULT))
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
355 return;
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
356
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
357 BLOCK_INPUT;
13460
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
358 /* Invalidate any computed faces which use this font,
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
359 and free their GC's if they have any. */
13622
67c2ba47a729 (unload_color, unload_font): Never invalidate computed faces 0 and 1.
Richard M. Stallman <rms@gnu.org>
parents: 13460
diff changeset
360 for (i = 2; i < len; i++)
13460
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
361 {
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
362 struct face *face = FRAME_COMPUTED_FACES (f)[i];
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
363 if (face->font == font)
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
364 {
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
365 Display *dpy = FRAME_X_DISPLAY (f);
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
366 if (face->gc)
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
367 XFreeGC (dpy, face->gc);
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
368 face->gc = 0;
13622
67c2ba47a729 (unload_color, unload_font): Never invalidate computed faces 0 and 1.
Richard M. Stallman <rms@gnu.org>
parents: 13460
diff changeset
369 /* This marks the computed face as available to reuse. */
13460
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
370 face->font = 0;
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
371 }
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
372 }
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
373
9529
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
374 XFreeFont (FRAME_X_DISPLAY (f), font);
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
375 UNBLOCK_INPUT;
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
376 }
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
377
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
378 static unsigned long
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
379 load_color (f, name)
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
380 struct frame *f;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
381 Lisp_Object name;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
382 {
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
383 XColor color;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
384 int result;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
385
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
386 if (NILP (name))
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
387 return FACE_DEFAULT;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
388
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
389 CHECK_STRING (name, 0);
12077
74b296435fd9 (load_color): misleading comment rewritten.
Karl Heuer <kwzh@gnu.org>
parents: 11883
diff changeset
390 /* if the colormap is full, defined_color will return a best match
74b296435fd9 (load_color): misleading comment rewritten.
Karl Heuer <kwzh@gnu.org>
parents: 11883
diff changeset
391 to the values in an an existing cell. */
19128
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
392 result = defined_color (f, (char *) XSTRING (name)->data, &color, 1);
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
393 if (! result)
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
394 Fsignal (Qerror, Fcons (build_string ("undefined color"),
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
395 Fcons (name, Qnil)));
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
396 return (unsigned long) color.pixel;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
397 }
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
398
21766
915b4091ede1 (unload_color): No longer static.
Richard M. Stallman <rms@gnu.org>
parents: 19128
diff changeset
399 void
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
400 unload_color (f, pixel)
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
401 struct frame *f;
3316
9857db8aa4cd * xfaces.c (unload_color): Don't #include <X11/Intrinsic.h>,
Jim Blandy <jimb@redhat.com>
parents: 3302
diff changeset
402 unsigned long pixel;
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
403 {
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
404 Colormap cmap;
9529
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
405 Display *dpy = FRAME_X_DISPLAY (f);
12608
c6215ec3f536 (unload_color): Don't free colors if immutable colormap.
Richard M. Stallman <rms@gnu.org>
parents: 12468
diff changeset
406 int class = FRAME_X_DISPLAY_INFO (f)->visual->class;
c6215ec3f536 (unload_color): Don't free colors if immutable colormap.
Richard M. Stallman <rms@gnu.org>
parents: 12468
diff changeset
407
2818
d1cfc6cbdbf7 * xfaces.c (unload_color): Don't try to unload the standard black
Jim Blandy <jimb@redhat.com>
parents: 2795
diff changeset
408 if (pixel == FACE_DEFAULT
9671
5c7a3709e81a (unload_color): Pass arg f to WHITE_PIX_DEFAULT and BLACK_PIX_DEFAULT.
Richard M. Stallman <rms@gnu.org>
parents: 9572
diff changeset
409 || pixel == BLACK_PIX_DEFAULT (f)
5c7a3709e81a (unload_color): Pass arg f to WHITE_PIX_DEFAULT and BLACK_PIX_DEFAULT.
Richard M. Stallman <rms@gnu.org>
parents: 9572
diff changeset
410 || pixel == WHITE_PIX_DEFAULT (f))
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
411 return;
9529
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
412 cmap = DefaultColormapOfScreen (DefaultScreenOfDisplay (dpy));
12608
c6215ec3f536 (unload_color): Don't free colors if immutable colormap.
Richard M. Stallman <rms@gnu.org>
parents: 12468
diff changeset
413
c6215ec3f536 (unload_color): Don't free colors if immutable colormap.
Richard M. Stallman <rms@gnu.org>
parents: 12468
diff changeset
414 /* If display has an immutable color map, freeing colors is not
c6215ec3f536 (unload_color): Don't free colors if immutable colormap.
Richard M. Stallman <rms@gnu.org>
parents: 12468
diff changeset
415 necessary and some servers don't allow it. So don't do it. */
c6215ec3f536 (unload_color): Don't free colors if immutable colormap.
Richard M. Stallman <rms@gnu.org>
parents: 12468
diff changeset
416 if (! (class == StaticColor || class == StaticGray || class == TrueColor))
c6215ec3f536 (unload_color): Don't free colors if immutable colormap.
Richard M. Stallman <rms@gnu.org>
parents: 12468
diff changeset
417 {
13460
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
418 int len = FRAME_N_COMPUTED_FACES (f);
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
419 int i;
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
420
12608
c6215ec3f536 (unload_color): Don't free colors if immutable colormap.
Richard M. Stallman <rms@gnu.org>
parents: 12468
diff changeset
421 BLOCK_INPUT;
13460
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
422 /* Invalidate any computed faces which use this color,
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
423 and free their GC's if they have any. */
13622
67c2ba47a729 (unload_color, unload_font): Never invalidate computed faces 0 and 1.
Richard M. Stallman <rms@gnu.org>
parents: 13460
diff changeset
424 for (i = 2; i < len; i++)
13460
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
425 {
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
426 struct face *face = FRAME_COMPUTED_FACES (f)[i];
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
427 if (face->foreground == pixel
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
428 || face->background == pixel)
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
429 {
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
430 Display *dpy = FRAME_X_DISPLAY (f);
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
431 if (face->gc)
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
432 XFreeGC (dpy, face->gc);
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
433 face->gc = 0;
13622
67c2ba47a729 (unload_color, unload_font): Never invalidate computed faces 0 and 1.
Richard M. Stallman <rms@gnu.org>
parents: 13460
diff changeset
434 /* This marks the computed face as available to reuse. */
13460
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
435 face->font = 0;
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
436 }
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
437 }
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
438
12608
c6215ec3f536 (unload_color): Don't free colors if immutable colormap.
Richard M. Stallman <rms@gnu.org>
parents: 12468
diff changeset
439 XFreeColors (dpy, cmap, &pixel, 1, (unsigned long)0);
c6215ec3f536 (unload_color): Don't free colors if immutable colormap.
Richard M. Stallman <rms@gnu.org>
parents: 12468
diff changeset
440 UNBLOCK_INPUT;
c6215ec3f536 (unload_color): Don't free colors if immutable colormap.
Richard M. Stallman <rms@gnu.org>
parents: 12468
diff changeset
441 }
9564
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
442 }
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
443
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
444 DEFUN ("pixmap-spec-p", Fpixmap_spec_p, Spixmap_spec_p, 1, 1, 0,
14090
24b93860d392 (Fpixmap_spec_p): Harmonize arguments with documentation.
Erik Naggum <erik@naggum.no>
parents: 14036
diff changeset
445 "Return t if OBJECT is a valid pixmap specification.")
24b93860d392 (Fpixmap_spec_p): Harmonize arguments with documentation.
Erik Naggum <erik@naggum.no>
parents: 14036
diff changeset
446 (object)
24b93860d392 (Fpixmap_spec_p): Harmonize arguments with documentation.
Erik Naggum <erik@naggum.no>
parents: 14036
diff changeset
447 Lisp_Object object;
9564
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
448 {
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
449 Lisp_Object height, width;
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
450
14090
24b93860d392 (Fpixmap_spec_p): Harmonize arguments with documentation.
Erik Naggum <erik@naggum.no>
parents: 14036
diff changeset
451 return ((STRINGP (object)
24b93860d392 (Fpixmap_spec_p): Harmonize arguments with documentation.
Erik Naggum <erik@naggum.no>
parents: 14036
diff changeset
452 || (CONSP (object)
24b93860d392 (Fpixmap_spec_p): Harmonize arguments with documentation.
Erik Naggum <erik@naggum.no>
parents: 14036
diff changeset
453 && CONSP (XCONS (object)->cdr)
24b93860d392 (Fpixmap_spec_p): Harmonize arguments with documentation.
Erik Naggum <erik@naggum.no>
parents: 14036
diff changeset
454 && CONSP (XCONS (XCONS (object)->cdr)->cdr)
24b93860d392 (Fpixmap_spec_p): Harmonize arguments with documentation.
Erik Naggum <erik@naggum.no>
parents: 14036
diff changeset
455 && NILP (XCONS (XCONS (XCONS (object)->cdr)->cdr)->cdr)
24b93860d392 (Fpixmap_spec_p): Harmonize arguments with documentation.
Erik Naggum <erik@naggum.no>
parents: 14036
diff changeset
456 && (width = XCONS (object)->car, INTEGERP (width))
24b93860d392 (Fpixmap_spec_p): Harmonize arguments with documentation.
Erik Naggum <erik@naggum.no>
parents: 14036
diff changeset
457 && (height = XCONS (XCONS (object)->cdr)->car, INTEGERP (height))
24b93860d392 (Fpixmap_spec_p): Harmonize arguments with documentation.
Erik Naggum <erik@naggum.no>
parents: 14036
diff changeset
458 && STRINGP (XCONS (XCONS (XCONS (object)->cdr)->cdr)->car)
9564
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
459 && XINT (width) > 0
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
460 && XINT (height) > 0
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
461 /* The string must have enough bits for width * height. */
14090
24b93860d392 (Fpixmap_spec_p): Harmonize arguments with documentation.
Erik Naggum <erik@naggum.no>
parents: 14036
diff changeset
462 && ((XSTRING (XCONS (XCONS (XCONS (object)->cdr)->cdr)->car)->size
13363
941c37982f37 (BITS_PER_SHORT, BITS_PER_INT, BITS_PER_LONG):
Karl Heuer <kwzh@gnu.org>
parents: 12667
diff changeset
463 * (BITS_PER_INT / sizeof (int)))
9944
dd9afae74baf (Fpixmap_spec_p): Avoid function calls and assignments as arguments to a
Karl Heuer <kwzh@gnu.org>
parents: 9902
diff changeset
464 >= XFASTINT (width) * XFASTINT (height))))
9564
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
465 ? Qt : Qnil);
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
466 }
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
467
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
468 /* Load a bitmap according to NAME (which is either a file name
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
469 or a pixmap spec). Return the bitmap_id (see xfns.c)
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
470 or get an error if NAME is invalid.
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
471
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
472 Store the bitmap width in *W_PTR and height in *H_PTR. */
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
473
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
474 static long
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
475 load_pixmap (f, name, w_ptr, h_ptr)
9902
32ed712a45a3 (load_pixmap): Handle bitmap_id < 0. F is a FRAME_PTR.
Richard M. Stallman <rms@gnu.org>
parents: 9671
diff changeset
476 FRAME_PTR f;
9564
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
477 Lisp_Object name;
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
478 unsigned int *w_ptr, *h_ptr;
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
479 {
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
480 int bitmap_id;
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
481 Lisp_Object tem;
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
482
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
483 if (NILP (name))
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
484 return FACE_DEFAULT;
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
485
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
486 tem = Fpixmap_spec_p (name);
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
487 if (NILP (tem))
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
488 wrong_type_argument (Qpixmap_spec_p, name);
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
489
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
490 BLOCK_INPUT;
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
491
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
492 if (CONSP (name))
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
493 {
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
494 /* Decode a bitmap spec into a bitmap. */
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
495
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
496 int h, w;
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
497 Lisp_Object bits;
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
498
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
499 w = XINT (Fcar (name));
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
500 h = XINT (Fcar (Fcdr (name)));
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
501 bits = Fcar (Fcdr (Fcdr (name)));
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
502
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
503 bitmap_id = x_create_bitmap_from_data (f, XSTRING (bits)->data,
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
504 w, h);
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
505 }
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
506 else
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
507 {
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
508 /* It must be a string -- a file name. */
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
509 bitmap_id = x_create_bitmap_from_file (f, name);
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
510 }
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
511 UNBLOCK_INPUT;
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
512
9902
32ed712a45a3 (load_pixmap): Handle bitmap_id < 0. F is a FRAME_PTR.
Richard M. Stallman <rms@gnu.org>
parents: 9671
diff changeset
513 if (bitmap_id < 0)
32ed712a45a3 (load_pixmap): Handle bitmap_id < 0. F is a FRAME_PTR.
Richard M. Stallman <rms@gnu.org>
parents: 9671
diff changeset
514 Fsignal (Qerror, Fcons (build_string ("invalid or undefined bitmap"),
9564
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
515 Fcons (name, Qnil)));
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
516
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
517 *w_ptr = x_bitmap_width (f, bitmap_id);
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
518 *h_ptr = x_bitmap_height (f, bitmap_id);
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
519
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
520 return bitmap_id;
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
521 }
9572
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
522
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
523 #else /* !HAVE_X_WINDOWS */
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
524
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
525 /* Stubs for MSDOS when not under X. */
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
526
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
527 struct face *
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
528 intern_face (f, face)
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
529 struct frame *f;
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
530 struct face *face;
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
531 {
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
532 return face;
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
533 }
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
534
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
535 void
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
536 clear_face_cache ()
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
537 {
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
538 /* No action. */
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
539 }
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
540
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
541 #ifdef MSDOS
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
542 unsigned long
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
543 load_color (f, name)
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
544 FRAME_PTR f;
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
545 Lisp_Object name;
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
546 {
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
547 Lisp_Object result;
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
548
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
549 if (NILP (name))
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
550 return FACE_DEFAULT;
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
551
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
552 CHECK_STRING (name, 0);
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
553 result = call1 (Qmsdos_color_translate, name);
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
554 if (INTEGERP (result))
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
555 return XINT (result);
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
556 else
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
557 Fsignal (Qerror, Fcons (build_string ("undefined color"),
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
558 Fcons (name, Qnil)));
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
559 }
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
560 #endif
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
561 #endif /* !HAVE_X_WINDOWS */
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
562
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
563
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
564 /* Managing parameter face arrays for frames. */
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
565
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
566 void
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
567 init_frame_faces (f)
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
568 FRAME_PTR f;
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
569 {
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
570 ensure_face_ready (f, 0);
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
571 ensure_face_ready (f, 1);
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
572
5801
af397aaa8e6b (init_frame_faces): Clear FRAME_N_COMPUTED_FACES
Richard M. Stallman <rms@gnu.org>
parents: 5084
diff changeset
573 FRAME_N_COMPUTED_FACES (f) = 0;
af397aaa8e6b (init_frame_faces): Clear FRAME_N_COMPUTED_FACES
Richard M. Stallman <rms@gnu.org>
parents: 5084
diff changeset
574 FRAME_SIZE_COMPUTED_FACES (f) = 0;
af397aaa8e6b (init_frame_faces): Clear FRAME_N_COMPUTED_FACES
Richard M. Stallman <rms@gnu.org>
parents: 5084
diff changeset
575
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
576 new_computed_face (f, FRAME_PARAM_FACES (f)[0]);
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
577 new_computed_face (f, FRAME_PARAM_FACES (f)[1]);
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
578 recompute_basic_faces (f);
3299
6fab7c7bb1f1 * xfaces.c (init_frame_faces): We have to make sure that face ID's
Jim Blandy <jimb@redhat.com>
parents: 3277
diff changeset
579
3583
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
580 /* Find another X frame. */
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
581 {
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
582 Lisp_Object tail, frame, result;
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
583
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
584 result = Qnil;
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
585 FOR_EACH_FRAME (tail, frame)
15383
9a6c8d10ac5f (init_frame_faces): Build faces for an MSDOS frame like for X frame.
Richard M. Stallman <rms@gnu.org>
parents: 15340
diff changeset
586 if ((FRAME_MSDOS_P (XFRAME (frame)) || FRAME_X_P (XFRAME (frame)))
3583
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
587 && XFRAME (frame) != f)
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
588 {
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
589 result = frame;
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
590 break;
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
591 }
3299
6fab7c7bb1f1 * xfaces.c (init_frame_faces): We have to make sure that face ID's
Jim Blandy <jimb@redhat.com>
parents: 3277
diff changeset
592
3583
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
593 /* If we didn't find any X frames other than f, then we don't need
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
594 any faces other than 0 and 1, so we're okay. Otherwise, make
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
595 sure that all faces valid on the selected frame are also valid
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
596 on this new frame. */
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
597 if (FRAMEP (result))
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
598 {
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
599 int i;
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
600 int n_faces = FRAME_N_PARAM_FACES (XFRAME (result));
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
601 struct face **faces = FRAME_PARAM_FACES (XFRAME (result));
3299
6fab7c7bb1f1 * xfaces.c (init_frame_faces): We have to make sure that face ID's
Jim Blandy <jimb@redhat.com>
parents: 3277
diff changeset
602
3583
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
603 for (i = 2; i < n_faces; i++)
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
604 if (faces[i])
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
605 ensure_face_ready (f, i);
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
606 }
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
607 }
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
608 }
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
609
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
610
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
611 /* Called from Fdelete_frame. */
9564
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
612
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
613 void
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
614 free_frame_faces (f)
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
615 struct frame *f;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
616 {
9529
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
617 Display *dpy = FRAME_X_DISPLAY (f);
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
618 int i;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
619
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
620 BLOCK_INPUT;
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
621
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
622 for (i = 0; i < FRAME_N_PARAM_FACES (f); i++)
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
623 {
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
624 struct face *face = FRAME_PARAM_FACES (f) [i];
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
625 if (face)
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
626 {
17047
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
627 if (face->fontset < 0)
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
628 unload_font (f, face->font);
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
629 unload_color (f, face->foreground);
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
630 unload_color (f, face->background);
9564
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
631 x_destroy_bitmap (f, face->stipple);
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
632 xfree (face);
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
633 }
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
634 }
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
635 xfree (FRAME_PARAM_FACES (f));
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
636 FRAME_PARAM_FACES (f) = 0;
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
637 FRAME_N_PARAM_FACES (f) = 0;
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
638
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
639 /* All faces in FRAME_COMPUTED_FACES use resources copied from
9529
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
640 FRAME_PARAM_FACES; we can free them without fuss.
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
641 But we do free the GCs and the face objects themselves. */
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
642 for (i = 0; i < FRAME_N_COMPUTED_FACES (f); i++)
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
643 {
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
644 struct face *face = FRAME_COMPUTED_FACES (f) [i];
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
645 if (face)
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
646 {
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
647 if (face->gc)
17047
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
648 {
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
649 XFreeGC (dpy, face->gc);
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
650 XFreeGC (dpy, face->non_ascii_gc);
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
651 }
9529
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
652 xfree (face);
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
653 }
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
654 }
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
655 xfree (FRAME_COMPUTED_FACES (f));
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
656 FRAME_COMPUTED_FACES (f) = 0;
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
657 FRAME_N_COMPUTED_FACES (f) = 0;
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
658
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
659 UNBLOCK_INPUT;
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
660 }
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
661
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
662 /* Interning faces in a frame's face array. */
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
663
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
664 static int
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
665 new_computed_face (f, new_face)
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
666 struct frame *f;
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
667 struct face *new_face;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
668 {
13460
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
669 int len = FRAME_N_COMPUTED_FACES (f);
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
670 int i;
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
671
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
672 /* Search for an unused computed face in the middle of the table. */
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
673 for (i = 0; i < len; i++)
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
674 {
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
675 struct face *face = FRAME_COMPUTED_FACES (f)[i];
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
676 if (face->font == 0)
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
677 {
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
678 FRAME_COMPUTED_FACES (f)[i] = copy_face (new_face);
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
679 return i;
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
680 }
5513606156bc (unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
681 }
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
682
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
683 if (i >= FRAME_SIZE_COMPUTED_FACES (f))
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
684 {
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
685 int new_size = i + 32;
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
686
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
687 FRAME_COMPUTED_FACES (f)
5801
af397aaa8e6b (init_frame_faces): Clear FRAME_N_COMPUTED_FACES
Richard M. Stallman <rms@gnu.org>
parents: 5084
diff changeset
688 = (struct face **) (FRAME_SIZE_COMPUTED_FACES (f) == 0
af397aaa8e6b (init_frame_faces): Clear FRAME_N_COMPUTED_FACES
Richard M. Stallman <rms@gnu.org>
parents: 5084
diff changeset
689 ? xmalloc (new_size * sizeof (struct face *))
af397aaa8e6b (init_frame_faces): Clear FRAME_N_COMPUTED_FACES
Richard M. Stallman <rms@gnu.org>
parents: 5084
diff changeset
690 : xrealloc (FRAME_COMPUTED_FACES (f),
af397aaa8e6b (init_frame_faces): Clear FRAME_N_COMPUTED_FACES
Richard M. Stallman <rms@gnu.org>
parents: 5084
diff changeset
691 new_size * sizeof (struct face *)));
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
692 FRAME_SIZE_COMPUTED_FACES (f) = new_size;
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
693 }
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
694
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
695 i = FRAME_N_COMPUTED_FACES (f)++;
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
696 FRAME_COMPUTED_FACES (f)[i] = copy_face (new_face);
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
697 return i;
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
698 }
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
699
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
700
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
701 /* Find a match for NEW_FACE in a FRAME's computed face array, and add
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
702 it if we don't find one. */
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
703 static int
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
704 intern_computed_face (f, new_face)
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
705 struct frame *f;
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
706 struct face *new_face;
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
707 {
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
708 int len = FRAME_N_COMPUTED_FACES (f);
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
709 int i;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
710
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
711 /* Search for a computed face already on F equivalent to FACE. */
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
712 for (i = 0; i < len; i++)
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
713 {
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
714 if (! FRAME_COMPUTED_FACES (f)[i])
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
715 abort ();
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
716 if (face_eql (new_face, FRAME_COMPUTED_FACES (f)[i]))
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
717 return i;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
718 }
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
719
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
720 /* We didn't find one; add a new one. */
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
721 return new_computed_face (f, new_face);
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
722 }
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
723
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
724 /* Make parameter face id ID valid on frame F. */
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
725
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
726 static void
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
727 ensure_face_ready (f, id)
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
728 struct frame *f;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
729 int id;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
730 {
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
731 if (FRAME_N_PARAM_FACES (f) <= id)
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
732 {
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
733 int n = id + 10;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
734 int i;
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
735 if (!FRAME_N_PARAM_FACES (f))
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
736 FRAME_PARAM_FACES (f)
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
737 = (struct face **) xmalloc (sizeof (struct face *) * n);
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
738 else
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
739 FRAME_PARAM_FACES (f)
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
740 = (struct face **) xrealloc (FRAME_PARAM_FACES (f),
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
741 sizeof (struct face *) * n);
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
742
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
743 bzero (FRAME_PARAM_FACES (f) + FRAME_N_PARAM_FACES (f),
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
744 (n - FRAME_N_PARAM_FACES (f)) * sizeof (struct face *));
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
745 FRAME_N_PARAM_FACES (f) = n;
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
746 }
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
747
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
748 if (FRAME_PARAM_FACES (f) [id] == 0)
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
749 FRAME_PARAM_FACES (f) [id] = allocate_face ();
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
750 }
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
751
9572
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
752 #ifdef HAVE_X_WINDOWS
6784
d41c216ccd27 (frame_update_line_height): Check param_faces[i] not null.
Richard M. Stallman <rms@gnu.org>
parents: 6768
diff changeset
753 /* Return non-zero if FONT1 and FONT2 have the same width.
d41c216ccd27 (frame_update_line_height): Check param_faces[i] not null.
Richard M. Stallman <rms@gnu.org>
parents: 6768
diff changeset
754 We do not check the height, because we can now deal with
d41c216ccd27 (frame_update_line_height): Check param_faces[i] not null.
Richard M. Stallman <rms@gnu.org>
parents: 6768
diff changeset
755 different heights.
d41c216ccd27 (frame_update_line_height): Check param_faces[i] not null.
Richard M. Stallman <rms@gnu.org>
parents: 6768
diff changeset
756 We assume that they're both character-cell fonts. */
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
757
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
758 int
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
759 same_size_fonts (font1, font2)
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
760 XFontStruct *font1, *font2;
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
761 {
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
762 XCharStruct *bounds1 = &font1->min_bounds;
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
763 XCharStruct *bounds2 = &font2->min_bounds;
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
764
3528
aad9fd004281 (same_size_fonts): Compare only the width.
Richard M. Stallman <rms@gnu.org>
parents: 3436
diff changeset
765 return (bounds1->width == bounds2->width);
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
766 }
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
767
6768
0b61d2b74e64 (frame_update_line_height): New function.
Richard M. Stallman <rms@gnu.org>
parents: 6615
diff changeset
768 /* Update the line_height of frame F according to the biggest font in
6879
471aebc1b151 (frame_update_line_height): Don't call x_set_window_size.
Richard M. Stallman <rms@gnu.org>
parents: 6784
diff changeset
769 any face. Return nonzero if if line_height changes. */
6768
0b61d2b74e64 (frame_update_line_height): New function.
Richard M. Stallman <rms@gnu.org>
parents: 6615
diff changeset
770
6879
471aebc1b151 (frame_update_line_height): Don't call x_set_window_size.
Richard M. Stallman <rms@gnu.org>
parents: 6784
diff changeset
771 int
6768
0b61d2b74e64 (frame_update_line_height): New function.
Richard M. Stallman <rms@gnu.org>
parents: 6615
diff changeset
772 frame_update_line_height (f)
0b61d2b74e64 (frame_update_line_height): New function.
Richard M. Stallman <rms@gnu.org>
parents: 6615
diff changeset
773 FRAME_PTR f;
0b61d2b74e64 (frame_update_line_height): New function.
Richard M. Stallman <rms@gnu.org>
parents: 6615
diff changeset
774 {
0b61d2b74e64 (frame_update_line_height): New function.
Richard M. Stallman <rms@gnu.org>
parents: 6615
diff changeset
775 int i;
17047
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
776 int fontset = f->output_data.x->fontset;
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
777 int biggest = (fontset > 0
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
778 ? FRAME_FONTSET_DATA (f)->fontset_table[fontset]->height
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
779 : FONT_HEIGHT (f->output_data.x->font));
6768
0b61d2b74e64 (frame_update_line_height): New function.
Richard M. Stallman <rms@gnu.org>
parents: 6615
diff changeset
780
12667
a3466dad7d6d Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents: 12608
diff changeset
781 for (i = 0; i < f->output_data.x->n_param_faces; i++)
a3466dad7d6d Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents: 12608
diff changeset
782 if (f->output_data.x->param_faces[i] != 0
a3466dad7d6d Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents: 12608
diff changeset
783 && f->output_data.x->param_faces[i]->font != (XFontStruct *) FACE_DEFAULT)
6768
0b61d2b74e64 (frame_update_line_height): New function.
Richard M. Stallman <rms@gnu.org>
parents: 6615
diff changeset
784 {
17047
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
785 int height = ((fontset = f->output_data.x->param_faces[i]->fontset) > 0
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
786 ? FRAME_FONTSET_DATA (f)->fontset_table[fontset]->height
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
787 : FONT_HEIGHT (f->output_data.x->param_faces[i]->font));
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
788
6768
0b61d2b74e64 (frame_update_line_height): New function.
Richard M. Stallman <rms@gnu.org>
parents: 6615
diff changeset
789 if (height > biggest)
0b61d2b74e64 (frame_update_line_height): New function.
Richard M. Stallman <rms@gnu.org>
parents: 6615
diff changeset
790 biggest = height;
0b61d2b74e64 (frame_update_line_height): New function.
Richard M. Stallman <rms@gnu.org>
parents: 6615
diff changeset
791 }
0b61d2b74e64 (frame_update_line_height): New function.
Richard M. Stallman <rms@gnu.org>
parents: 6615
diff changeset
792
12667
a3466dad7d6d Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents: 12608
diff changeset
793 if (biggest == f->output_data.x->line_height)
6879
471aebc1b151 (frame_update_line_height): Don't call x_set_window_size.
Richard M. Stallman <rms@gnu.org>
parents: 6784
diff changeset
794 return 0;
6768
0b61d2b74e64 (frame_update_line_height): New function.
Richard M. Stallman <rms@gnu.org>
parents: 6615
diff changeset
795
12667
a3466dad7d6d Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents: 12608
diff changeset
796 f->output_data.x->line_height = biggest;
6879
471aebc1b151 (frame_update_line_height): Don't call x_set_window_size.
Richard M. Stallman <rms@gnu.org>
parents: 6784
diff changeset
797 return 1;
6768
0b61d2b74e64 (frame_update_line_height): New function.
Richard M. Stallman <rms@gnu.org>
parents: 6615
diff changeset
798 }
9572
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
799 #endif /* not HAVE_X_WINDOWS */
6784
d41c216ccd27 (frame_update_line_height): Check param_faces[i] not null.
Richard M. Stallman <rms@gnu.org>
parents: 6768
diff changeset
800
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
801 /* Modify face TO by copying from FROM all properties which have
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
802 nondefault settings. */
6784
d41c216ccd27 (frame_update_line_height): Check param_faces[i] not null.
Richard M. Stallman <rms@gnu.org>
parents: 6768
diff changeset
803
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
804 static void
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
805 merge_faces (from, to)
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
806 struct face *from, *to;
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
807 {
6784
d41c216ccd27 (frame_update_line_height): Check param_faces[i] not null.
Richard M. Stallman <rms@gnu.org>
parents: 6768
diff changeset
808 /* Only merge the font if it's the same width as the base font.
d41c216ccd27 (frame_update_line_height): Check param_faces[i] not null.
Richard M. Stallman <rms@gnu.org>
parents: 6768
diff changeset
809 Otherwise ignore it, since we can't handle it properly. */
2883
b8a3b11892dc Make sure that all the display faces use fonts of the
Jim Blandy <jimb@redhat.com>
parents: 2875
diff changeset
810 if (from->font != (XFontStruct *) FACE_DEFAULT
b8a3b11892dc Make sure that all the display faces use fonts of the
Jim Blandy <jimb@redhat.com>
parents: 2875
diff changeset
811 && same_size_fonts (from->font, to->font))
b8a3b11892dc Make sure that all the display faces use fonts of the
Jim Blandy <jimb@redhat.com>
parents: 2875
diff changeset
812 to->font = from->font;
17047
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
813 if (from->fontset != -1)
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
814 to->fontset = from->fontset;
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
815 if (from->foreground != FACE_DEFAULT)
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
816 to->foreground = from->foreground;
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
817 if (from->background != FACE_DEFAULT)
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
818 to->background = from->background;
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
819 if (from->stipple != FACE_DEFAULT)
9564
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
820 {
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
821 to->stipple = from->stipple;
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
822 to->pixmap_h = from->pixmap_h;
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
823 to->pixmap_w = from->pixmap_w;
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
824 }
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
825 if (from->underline)
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
826 to->underline = from->underline;
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
827 }
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
828
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
829 /* Set up the basic set of facial parameters, based on the frame's
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
830 data; all faces are deltas applied to this. */
6784
d41c216ccd27 (frame_update_line_height): Check param_faces[i] not null.
Richard M. Stallman <rms@gnu.org>
parents: 6768
diff changeset
831
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
832 static void
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
833 compute_base_face (f, face)
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
834 FRAME_PTR f;
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
835 struct face *face;
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
836 {
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
837 face->gc = 0;
9564
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
838 face->foreground = FRAME_FOREGROUND_PIXEL (f);
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
839 face->background = FRAME_BACKGROUND_PIXEL (f);
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
840 face->font = FRAME_FONT (f);
17047
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
841 face->fontset = -1;
3811
48b1ef149180 * xfaces.c (compute_base_face): Initialize the face's stipple.
Jim Blandy <jimb@redhat.com>
parents: 3583
diff changeset
842 face->stipple = 0;
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
843 face->underline = 0;
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
844 }
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
845
6784
d41c216ccd27 (frame_update_line_height): Check param_faces[i] not null.
Richard M. Stallman <rms@gnu.org>
parents: 6768
diff changeset
846 /* Return the face ID to use to display a special glyph which selects
d41c216ccd27 (frame_update_line_height): Check param_faces[i] not null.
Richard M. Stallman <rms@gnu.org>
parents: 6768
diff changeset
847 FACE_CODE as the face ID, assuming that ordinarily the face would
d41c216ccd27 (frame_update_line_height): Check param_faces[i] not null.
Richard M. Stallman <rms@gnu.org>
parents: 6768
diff changeset
848 be CURRENT_FACE. F is the frame. */
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
849
6784
d41c216ccd27 (frame_update_line_height): Check param_faces[i] not null.
Richard M. Stallman <rms@gnu.org>
parents: 6768
diff changeset
850 int
d41c216ccd27 (frame_update_line_height): Check param_faces[i] not null.
Richard M. Stallman <rms@gnu.org>
parents: 6768
diff changeset
851 compute_glyph_face (f, face_code, current_face)
d41c216ccd27 (frame_update_line_height): Check param_faces[i] not null.
Richard M. Stallman <rms@gnu.org>
parents: 6768
diff changeset
852 struct frame *f;
d41c216ccd27 (frame_update_line_height): Check param_faces[i] not null.
Richard M. Stallman <rms@gnu.org>
parents: 6768
diff changeset
853 int face_code, current_face;
d41c216ccd27 (frame_update_line_height): Check param_faces[i] not null.
Richard M. Stallman <rms@gnu.org>
parents: 6768
diff changeset
854 {
d41c216ccd27 (frame_update_line_height): Check param_faces[i] not null.
Richard M. Stallman <rms@gnu.org>
parents: 6768
diff changeset
855 struct face face;
d41c216ccd27 (frame_update_line_height): Check param_faces[i] not null.
Richard M. Stallman <rms@gnu.org>
parents: 6768
diff changeset
856
d41c216ccd27 (frame_update_line_height): Check param_faces[i] not null.
Richard M. Stallman <rms@gnu.org>
parents: 6768
diff changeset
857 face = *FRAME_COMPUTED_FACES (f)[current_face];
d41c216ccd27 (frame_update_line_height): Check param_faces[i] not null.
Richard M. Stallman <rms@gnu.org>
parents: 6768
diff changeset
858
d41c216ccd27 (frame_update_line_height): Check param_faces[i] not null.
Richard M. Stallman <rms@gnu.org>
parents: 6768
diff changeset
859 if (face_code >= 0 && face_code < FRAME_N_PARAM_FACES (f)
d41c216ccd27 (frame_update_line_height): Check param_faces[i] not null.
Richard M. Stallman <rms@gnu.org>
parents: 6768
diff changeset
860 && FRAME_PARAM_FACES (f) [face_code] != 0)
d41c216ccd27 (frame_update_line_height): Check param_faces[i] not null.
Richard M. Stallman <rms@gnu.org>
parents: 6768
diff changeset
861 merge_faces (FRAME_PARAM_FACES (f) [face_code], &face);
d41c216ccd27 (frame_update_line_height): Check param_faces[i] not null.
Richard M. Stallman <rms@gnu.org>
parents: 6768
diff changeset
862
d41c216ccd27 (frame_update_line_height): Check param_faces[i] not null.
Richard M. Stallman <rms@gnu.org>
parents: 6768
diff changeset
863 return intern_computed_face (f, &face);
d41c216ccd27 (frame_update_line_height): Check param_faces[i] not null.
Richard M. Stallman <rms@gnu.org>
parents: 6768
diff changeset
864 }
8472
0d0b32e78a5b (compute_glyph_face_1): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8119
diff changeset
865
0d0b32e78a5b (compute_glyph_face_1): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8119
diff changeset
866 /* Return the face ID to use to display a special glyph which selects
0d0b32e78a5b (compute_glyph_face_1): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8119
diff changeset
867 FACE_CODE as the face ID, assuming that ordinarily the face would
0d0b32e78a5b (compute_glyph_face_1): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8119
diff changeset
868 be CURRENT_FACE. F is the frame. */
0d0b32e78a5b (compute_glyph_face_1): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8119
diff changeset
869
0d0b32e78a5b (compute_glyph_face_1): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8119
diff changeset
870 int
0d0b32e78a5b (compute_glyph_face_1): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8119
diff changeset
871 compute_glyph_face_1 (f, face_name, current_face)
0d0b32e78a5b (compute_glyph_face_1): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8119
diff changeset
872 struct frame *f;
0d0b32e78a5b (compute_glyph_face_1): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8119
diff changeset
873 Lisp_Object face_name;
0d0b32e78a5b (compute_glyph_face_1): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8119
diff changeset
874 int current_face;
0d0b32e78a5b (compute_glyph_face_1): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8119
diff changeset
875 {
0d0b32e78a5b (compute_glyph_face_1): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8119
diff changeset
876 struct face face;
0d0b32e78a5b (compute_glyph_face_1): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8119
diff changeset
877
0d0b32e78a5b (compute_glyph_face_1): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8119
diff changeset
878 face = *FRAME_COMPUTED_FACES (f)[current_face];
0d0b32e78a5b (compute_glyph_face_1): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8119
diff changeset
879
0d0b32e78a5b (compute_glyph_face_1): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8119
diff changeset
880 if (!NILP (face_name))
0d0b32e78a5b (compute_glyph_face_1): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8119
diff changeset
881 {
0d0b32e78a5b (compute_glyph_face_1): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8119
diff changeset
882 int facecode = face_name_id_number (f, face_name);
0d0b32e78a5b (compute_glyph_face_1): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8119
diff changeset
883 if (facecode >= 0 && facecode < FRAME_N_PARAM_FACES (f)
0d0b32e78a5b (compute_glyph_face_1): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8119
diff changeset
884 && FRAME_PARAM_FACES (f) [facecode] != 0)
0d0b32e78a5b (compute_glyph_face_1): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8119
diff changeset
885 merge_faces (FRAME_PARAM_FACES (f) [facecode], &face);
0d0b32e78a5b (compute_glyph_face_1): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8119
diff changeset
886 }
0d0b32e78a5b (compute_glyph_face_1): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8119
diff changeset
887
0d0b32e78a5b (compute_glyph_face_1): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8119
diff changeset
888 return intern_computed_face (f, &face);
0d0b32e78a5b (compute_glyph_face_1): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8119
diff changeset
889 }
6784
d41c216ccd27 (frame_update_line_height): Check param_faces[i] not null.
Richard M. Stallman <rms@gnu.org>
parents: 6768
diff changeset
890
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
891 /* Return the face ID associated with a buffer position POS.
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
892 Store into *ENDPTR the position at which a different face is needed.
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
893 This does not take account of glyphs that specify their own face codes.
2784
f8c6796b7777 * xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents: 2767
diff changeset
894 F is the frame in use for display, and W is a window displaying
2795
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
895 the current buffer.
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
896
5084
863e092a5891 (compute_char_face): Accept new arg LIMIT.
Richard M. Stallman <rms@gnu.org>
parents: 4696
diff changeset
897 REGION_BEG, REGION_END delimit the region, so it can be highlighted.
863e092a5891 (compute_char_face): Accept new arg LIMIT.
Richard M. Stallman <rms@gnu.org>
parents: 4696
diff changeset
898
863e092a5891 (compute_char_face): Accept new arg LIMIT.
Richard M. Stallman <rms@gnu.org>
parents: 4696
diff changeset
899 LIMIT is a position not to scan beyond. That is to limit
6615
96ddf85642d1 (compute_char_face): New arg MOUSE.
Richard M. Stallman <rms@gnu.org>
parents: 5858
diff changeset
900 the time this function can take.
96ddf85642d1 (compute_char_face): New arg MOUSE.
Richard M. Stallman <rms@gnu.org>
parents: 5858
diff changeset
901
96ddf85642d1 (compute_char_face): New arg MOUSE.
Richard M. Stallman <rms@gnu.org>
parents: 5858
diff changeset
902 If MOUSE is nonzero, use the character's mouse-face, not its face. */
2795
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
903
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
904 int
6615
96ddf85642d1 (compute_char_face): New arg MOUSE.
Richard M. Stallman <rms@gnu.org>
parents: 5858
diff changeset
905 compute_char_face (f, w, pos, region_beg, region_end, endptr, limit, mouse)
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
906 struct frame *f;
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
907 struct window *w;
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
908 int pos;
2795
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
909 int region_beg, region_end;
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
910 int *endptr;
5084
863e092a5891 (compute_char_face): Accept new arg LIMIT.
Richard M. Stallman <rms@gnu.org>
parents: 4696
diff changeset
911 int limit;
6615
96ddf85642d1 (compute_char_face): New arg MOUSE.
Richard M. Stallman <rms@gnu.org>
parents: 5858
diff changeset
912 int mouse;
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
913 {
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
914 struct face face;
2767
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
915 Lisp_Object prop, position;
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
916 int i, j, noverlays;
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
917 int facecode;
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
918 Lisp_Object *overlay_vec;
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
919 Lisp_Object frame;
2784
f8c6796b7777 * xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents: 2767
diff changeset
920 int endpos;
6615
96ddf85642d1 (compute_char_face): New arg MOUSE.
Richard M. Stallman <rms@gnu.org>
parents: 5858
diff changeset
921 Lisp_Object propname;
2784
f8c6796b7777 * xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents: 2767
diff changeset
922
f8c6796b7777 * xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents: 2767
diff changeset
923 /* W must display the current buffer. We could write this function
f8c6796b7777 * xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents: 2767
diff changeset
924 to use the frame and buffer of W, but right now it doesn't. */
f8c6796b7777 * xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents: 2767
diff changeset
925 if (XBUFFER (w->buffer) != current_buffer)
f8c6796b7777 * xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents: 2767
diff changeset
926 abort ();
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
927
9284
a969e0eefaf5 (compute_char_face): Use new accessor macros instead of calling XSET directly.
Karl Heuer <kwzh@gnu.org>
parents: 9186
diff changeset
928 XSETFRAME (frame, f);
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
929
2784
f8c6796b7777 * xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents: 2767
diff changeset
930 endpos = ZV;
2795
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
931 if (pos < region_beg && region_beg < endpos)
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
932 endpos = region_beg;
2784
f8c6796b7777 * xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents: 2767
diff changeset
933
9326
bcf42f7e049a (compute_char_face): Don't use XFASTINT as an lvalue.
Karl Heuer <kwzh@gnu.org>
parents: 9284
diff changeset
934 XSETFASTINT (position, pos);
6615
96ddf85642d1 (compute_char_face): New arg MOUSE.
Richard M. Stallman <rms@gnu.org>
parents: 5858
diff changeset
935
96ddf85642d1 (compute_char_face): New arg MOUSE.
Richard M. Stallman <rms@gnu.org>
parents: 5858
diff changeset
936 if (mouse)
96ddf85642d1 (compute_char_face): New arg MOUSE.
Richard M. Stallman <rms@gnu.org>
parents: 5858
diff changeset
937 propname = Qmouse_face;
96ddf85642d1 (compute_char_face): New arg MOUSE.
Richard M. Stallman <rms@gnu.org>
parents: 5858
diff changeset
938 else
96ddf85642d1 (compute_char_face): New arg MOUSE.
Richard M. Stallman <rms@gnu.org>
parents: 5858
diff changeset
939 propname = Qface;
96ddf85642d1 (compute_char_face): New arg MOUSE.
Richard M. Stallman <rms@gnu.org>
parents: 5858
diff changeset
940
96ddf85642d1 (compute_char_face): New arg MOUSE.
Richard M. Stallman <rms@gnu.org>
parents: 5858
diff changeset
941 prop = Fget_text_property (position, propname, w->buffer);
96ddf85642d1 (compute_char_face): New arg MOUSE.
Richard M. Stallman <rms@gnu.org>
parents: 5858
diff changeset
942
2767
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
943 {
5084
863e092a5891 (compute_char_face): Accept new arg LIMIT.
Richard M. Stallman <rms@gnu.org>
parents: 4696
diff changeset
944 Lisp_Object limit1, end;
2767
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
945
9326
bcf42f7e049a (compute_char_face): Don't use XFASTINT as an lvalue.
Karl Heuer <kwzh@gnu.org>
parents: 9284
diff changeset
946 XSETFASTINT (limit1, (limit < endpos ? limit : endpos));
6615
96ddf85642d1 (compute_char_face): New arg MOUSE.
Richard M. Stallman <rms@gnu.org>
parents: 5858
diff changeset
947 end = Fnext_single_property_change (position, propname, w->buffer, limit1);
2767
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
948 if (INTEGERP (end))
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
949 endpos = XINT (end);
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
950 }
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
951
2767
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
952 {
2784
f8c6796b7777 * xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents: 2767
diff changeset
953 int next_overlay;
2838
5f6a2d52d2ef (compute_char_face): Pass 0 as EXTEND arg to overlays_at.
Richard M. Stallman <rms@gnu.org>
parents: 2821
diff changeset
954 int len;
2767
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
955
2838
5f6a2d52d2ef (compute_char_face): Pass 0 as EXTEND arg to overlays_at.
Richard M. Stallman <rms@gnu.org>
parents: 2821
diff changeset
956 /* First try with room for 40 overlays. */
5f6a2d52d2ef (compute_char_face): Pass 0 as EXTEND arg to overlays_at.
Richard M. Stallman <rms@gnu.org>
parents: 2821
diff changeset
957 len = 40;
5f6a2d52d2ef (compute_char_face): Pass 0 as EXTEND arg to overlays_at.
Richard M. Stallman <rms@gnu.org>
parents: 2821
diff changeset
958 overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
5f6a2d52d2ef (compute_char_face): Pass 0 as EXTEND arg to overlays_at.
Richard M. Stallman <rms@gnu.org>
parents: 2821
diff changeset
959
11420
8ab99c3646a7 (compute_char_face): Don't use NULL.
Richard M. Stallman <rms@gnu.org>
parents: 11416
diff changeset
960 noverlays = overlays_at (pos, 0, &overlay_vec, &len,
8ab99c3646a7 (compute_char_face): Don't use NULL.
Richard M. Stallman <rms@gnu.org>
parents: 11416
diff changeset
961 &next_overlay, (int *) 0);
2838
5f6a2d52d2ef (compute_char_face): Pass 0 as EXTEND arg to overlays_at.
Richard M. Stallman <rms@gnu.org>
parents: 2821
diff changeset
962
5f6a2d52d2ef (compute_char_face): Pass 0 as EXTEND arg to overlays_at.
Richard M. Stallman <rms@gnu.org>
parents: 2821
diff changeset
963 /* If there are more than 40,
5f6a2d52d2ef (compute_char_face): Pass 0 as EXTEND arg to overlays_at.
Richard M. Stallman <rms@gnu.org>
parents: 2821
diff changeset
964 make enough space for all, and try again. */
5f6a2d52d2ef (compute_char_face): Pass 0 as EXTEND arg to overlays_at.
Richard M. Stallman <rms@gnu.org>
parents: 2821
diff changeset
965 if (noverlays > len)
5f6a2d52d2ef (compute_char_face): Pass 0 as EXTEND arg to overlays_at.
Richard M. Stallman <rms@gnu.org>
parents: 2821
diff changeset
966 {
5f6a2d52d2ef (compute_char_face): Pass 0 as EXTEND arg to overlays_at.
Richard M. Stallman <rms@gnu.org>
parents: 2821
diff changeset
967 len = noverlays;
5f6a2d52d2ef (compute_char_face): Pass 0 as EXTEND arg to overlays_at.
Richard M. Stallman <rms@gnu.org>
parents: 2821
diff changeset
968 overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
8965
a7947f88d558 (compute_char_face): Pass new arg to overlays_at.
Richard M. Stallman <rms@gnu.org>
parents: 8848
diff changeset
969 noverlays = overlays_at (pos, 0, &overlay_vec, &len,
11420
8ab99c3646a7 (compute_char_face): Don't use NULL.
Richard M. Stallman <rms@gnu.org>
parents: 11416
diff changeset
970 &next_overlay, (int *) 0);
2838
5f6a2d52d2ef (compute_char_face): Pass 0 as EXTEND arg to overlays_at.
Richard M. Stallman <rms@gnu.org>
parents: 2821
diff changeset
971 }
5f6a2d52d2ef (compute_char_face): Pass 0 as EXTEND arg to overlays_at.
Richard M. Stallman <rms@gnu.org>
parents: 2821
diff changeset
972
2784
f8c6796b7777 * xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents: 2767
diff changeset
973 if (next_overlay < endpos)
f8c6796b7777 * xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents: 2767
diff changeset
974 endpos = next_overlay;
2767
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
975 }
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
976
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
977 *endptr = endpos;
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
978
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
979 /* Optimize the default case. */
2795
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
980 if (noverlays == 0 && NILP (prop)
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
981 && !(pos >= region_beg && pos < region_end))
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
982 return 0;
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
983
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
984 compute_base_face (f, &face);
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
985
19128
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
986 merge_face_list (f, &face, prop);
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
987
5858
021e58905963 (compute_char_face): Extract overlay-sorting code as a separate function,
Karl Heuer <kwzh@gnu.org>
parents: 5801
diff changeset
988 noverlays = sort_overlays (overlay_vec, noverlays, w);
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
989
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
990 /* Now merge the overlay data in that order. */
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
991 for (i = 0; i < noverlays; i++)
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
992 {
19128
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
993 Lisp_Object oend;
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
994 int oendpos;
9186
45bac5feb065 (compute_char_face): Handle list as overlay face property.
Richard M. Stallman <rms@gnu.org>
parents: 9184
diff changeset
995
19128
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
996 prop = Foverlay_get (overlay_vec[i], propname);
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
997 merge_face_list (f, &face, prop);
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
998
19128
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
999 oend = OVERLAY_END (overlay_vec[i]);
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1000 oendpos = OVERLAY_POSITION (oend);
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1001 if (oendpos < endpos)
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1002 endpos = oendpos;
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
1003 }
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
1004
2795
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
1005 if (pos >= region_beg && pos < region_end)
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
1006 {
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
1007 if (region_end < endpos)
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
1008 endpos = region_end;
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
1009 if (region_face >= 0 && region_face < next_face_id)
6615
96ddf85642d1 (compute_char_face): New arg MOUSE.
Richard M. Stallman <rms@gnu.org>
parents: 5858
diff changeset
1010 merge_faces (FRAME_PARAM_FACES (f)[region_face], &face);
2795
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
1011 }
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
1012
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
1013 *endptr = endpos;
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
1014
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
1015 return intern_computed_face (f, &face);
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
1016 }
19128
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1017
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1018 static void
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1019 merge_face_list (f, face, prop)
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1020 FRAME_PTR f;
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1021 struct face *face;
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1022 Lisp_Object prop;
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1023 {
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1024 Lisp_Object length;
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1025 int len;
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1026 Lisp_Object *faces;
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1027 int j;
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1028
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1029 if (CONSP (prop)
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1030 && ! STRINGP (XCONS (prop)->cdr))
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1031 {
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1032 /* We have a list of faces, merge them in reverse order. */
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1033
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1034 length = Fsafe_length (prop);
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1035 len = XFASTINT (length);
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1036
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1037 /* Put them into an array. */
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1038 faces = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1039 for (j = 0; j < len; j++)
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1040 {
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1041 faces[j] = Fcar (prop);
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1042 prop = Fcdr (prop);
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1043 }
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1044 /* So that we can merge them in the reverse order. */
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1045 }
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1046 else
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1047 {
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1048 faces = (Lisp_Object *) alloca (sizeof (Lisp_Object));
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1049 faces[0] = prop;
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1050 len = 1;
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1051 }
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1052
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1053 for (j = len - 1; j >= 0; j--)
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1054 {
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1055 if (CONSP (faces[j]))
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1056 {
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1057 if (EQ (XCONS (faces[j])->car, Qbackground_color))
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1058 face->background = load_color (f, XCONS (faces[j])->cdr);
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1059 if (EQ (XCONS (faces[j])->car, Qforeground_color))
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1060 face->foreground = load_color (f, XCONS (faces[j])->cdr);
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1061 }
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1062 else
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1063 {
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1064 int facecode = face_name_id_number (f, faces[j]);
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1065 if (facecode >= 0 && facecode < FRAME_N_PARAM_FACES (f)
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1066 && FRAME_PARAM_FACES (f) [facecode] != 0)
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1067 merge_faces (FRAME_PARAM_FACES (f) [facecode], face);
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1068 }
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1069 }
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1070 }
e789b647f15b (merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18723
diff changeset
1071
6784
d41c216ccd27 (frame_update_line_height): Check param_faces[i] not null.
Richard M. Stallman <rms@gnu.org>
parents: 6768
diff changeset
1072
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
1073 /* Recompute the GC's for the default and modeline faces.
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
1074 We call this after changing frame parameters on which those GC's
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
1075 depend. */
5801
af397aaa8e6b (init_frame_faces): Clear FRAME_N_COMPUTED_FACES
Richard M. Stallman <rms@gnu.org>
parents: 5084
diff changeset
1076
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
1077 void
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
1078 recompute_basic_faces (f)
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
1079 FRAME_PTR f;
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
1080 {
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
1081 /* If the frame's faces haven't been initialized yet, don't worry about
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
1082 this stuff. */
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
1083 if (FRAME_N_PARAM_FACES (f) < 2)
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
1084 return;
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
1085
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
1086 BLOCK_INPUT;
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
1087
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
1088 if (FRAME_DEFAULT_FACE (f)->gc)
17047
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1089 {
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1090 XFreeGC (FRAME_X_DISPLAY (f), FRAME_DEFAULT_FACE (f)->gc);
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1091 XFreeGC (FRAME_X_DISPLAY (f), FRAME_DEFAULT_FACE (f)->non_ascii_gc);
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1092 }
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
1093 if (FRAME_MODE_LINE_FACE (f)->gc)
17047
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1094 {
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1095 XFreeGC (FRAME_X_DISPLAY (f), FRAME_MODE_LINE_FACE (f)->gc);
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1096 XFreeGC (FRAME_X_DISPLAY (f), FRAME_MODE_LINE_FACE (f)->non_ascii_gc);
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1097 }
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
1098 compute_base_face (f, FRAME_DEFAULT_FACE (f));
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
1099 compute_base_face (f, FRAME_MODE_LINE_FACE (f));
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
1100
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
1101 merge_faces (FRAME_DEFAULT_PARAM_FACE (f), FRAME_DEFAULT_FACE (f));
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
1102 merge_faces (FRAME_MODE_LINE_PARAM_FACE (f), FRAME_MODE_LINE_FACE (f));
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
1103
9529
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
1104 intern_face (f, FRAME_DEFAULT_FACE (f));
8e610355cb29 Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents: 9326
diff changeset
1105 intern_face (f, FRAME_MODE_LINE_FACE (f));
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
1106
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
1107 UNBLOCK_INPUT;
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
1108 }
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
1109
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
1110
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1111
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
1112 /* Lisp interface. */
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1113
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1114 DEFUN ("make-face-internal", Fmake_face_internal, Smake_face_internal, 1, 1, 0,
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1115 "Create face number FACE-ID on all frames.")
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1116 (face_id)
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1117 Lisp_Object face_id;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1118 {
9572
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
1119 Lisp_Object rest, frame;
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1120 int id = XINT (face_id);
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1121
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1122 CHECK_NUMBER (face_id, 0);
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1123 if (id < 0 || id >= next_face_id)
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1124 error ("Face id out of range");
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1125
9572
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
1126 FOR_EACH_FRAME (rest, frame)
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1127 {
15383
9a6c8d10ac5f (init_frame_faces): Build faces for an MSDOS frame like for X frame.
Richard M. Stallman <rms@gnu.org>
parents: 15340
diff changeset
1128 if (FRAME_MSDOS_P (XFRAME (frame)) || FRAME_X_P (XFRAME (frame)))
9572
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
1129 ensure_face_ready (XFRAME (frame), id);
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1130 }
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1131 return Qnil;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1132 }
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1133
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1134
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1135 DEFUN ("set-face-attribute-internal", Fset_face_attribute_internal,
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1136 Sset_face_attribute_internal, 4, 4, 0, "")
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1137 (face_id, attr_name, attr_value, frame)
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1138 Lisp_Object face_id, attr_name, attr_value, frame;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1139 {
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1140 struct face *face;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1141 struct frame *f;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1142 int magic_p;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1143 int id;
9184
d50d31da6c8d (Fset_face_attribute_internal): Mark frame garbaged whenever
Richard M. Stallman <rms@gnu.org>
parents: 8965
diff changeset
1144 int garbaged = 0;
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1145
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1146 CHECK_FRAME (frame, 0);
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1147 CHECK_NUMBER (face_id, 0);
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1148 CHECK_SYMBOL (attr_name, 0);
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1149
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1150 f = XFRAME (frame);
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1151 id = XINT (face_id);
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1152 if (id < 0 || id >= next_face_id)
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1153 error ("Face id out of range");
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1154
15383
9a6c8d10ac5f (init_frame_faces): Build faces for an MSDOS frame like for X frame.
Richard M. Stallman <rms@gnu.org>
parents: 15340
diff changeset
1155 if (! FRAME_X_P (f) && ! FRAME_MSDOS_P (f))
7583
7bfbe20f7686 (Fset_face_attribute_internal): Always return valid data.
Richard M. Stallman <rms@gnu.org>
parents: 7307
diff changeset
1156 return Qnil;
2767
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
1157
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1158 ensure_face_ready (f, id);
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
1159 face = FRAME_PARAM_FACES (f) [XFASTINT (face_id)];
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1160
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1161 if (EQ (attr_name, intern ("font")))
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1162 {
9572
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
1163 #if defined (MSDOS) && !defined (HAVE_X_WINDOWS)
13626
177fbffc7359 (Fset_face_attribute_internal) [MSDOS]: Set font field to 1.
Richard M. Stallman <rms@gnu.org>
parents: 13622
diff changeset
1164 /* The one and only font. Must *not* be zero (which
177fbffc7359 (Fset_face_attribute_internal) [MSDOS]: Set font field to 1.
Richard M. Stallman <rms@gnu.org>
parents: 13622
diff changeset
1165 is taken to mean an unused face nowadays). */
177fbffc7359 (Fset_face_attribute_internal) [MSDOS]: Set font field to 1.
Richard M. Stallman <rms@gnu.org>
parents: 13622
diff changeset
1166 face->font = (XFontStruct *)1 ;
9572
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
1167 #else
17047
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1168 XFontStruct *font;
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1169 int fontset;
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1170
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1171 if (NILP (attr_value))
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1172 {
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1173 font = (XFontStruct *) FACE_DEFAULT;
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1174 fontset = -1;
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1175 }
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1176 else
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1177 {
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1178 CHECK_STRING (attr_value, 0);
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1179 fontset = fs_query_fontset (f, XSTRING (attr_value)->data);
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1180 if (fontset >= 0)
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1181 {
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1182 struct font_info *fontp;
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1183
18348
157cdb505495 (Fset_face_attribute_internal): Use FS_LOAD_FONT
Kenichi Handa <handa@m17n.org>
parents: 18083
diff changeset
1184 if (!(fontp = FS_LOAD_FONT (f, FRAME_X_FONT_TABLE (f),
17047
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1185 CHARSET_ASCII, NULL, fontset)))
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1186 Fsignal (Qerror,
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1187 Fcons (build_string ("ASCII font can't be loaded"),
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1188 Fcons (attr_value, Qnil)));
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1189 font = (XFontStruct *) (fontp->font);
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1190 }
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1191 else
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1192 font = load_font (f, attr_value);
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1193 }
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1194
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1195 if (face->fontset == -1 && face->font != f->output_data.x->font)
2998
885e08ef0577 (Fset_face_attribute_internal): Don't call unload_font
Richard M. Stallman <rms@gnu.org>
parents: 2981
diff changeset
1196 unload_font (f, face->font);
17047
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1197
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1198 face->font = font;
17047
6c586afaa572 Include charset.h.
Karl Heuer <kwzh@gnu.org>
parents: 16051
diff changeset
1199 face->fontset = fontset;
6879
471aebc1b151 (frame_update_line_height): Don't call x_set_window_size.
Richard M. Stallman <rms@gnu.org>
parents: 6784
diff changeset
1200 if (frame_update_line_height (f))
471aebc1b151 (frame_update_line_height): Don't call x_set_window_size.
Richard M. Stallman <rms@gnu.org>
parents: 6784
diff changeset
1201 x_set_window_size (f, 0, f->width, f->height);
9184
d50d31da6c8d (Fset_face_attribute_internal): Mark frame garbaged whenever
Richard M. Stallman <rms@gnu.org>
parents: 8965
diff changeset
1202 /* Must clear cache, since it might contain the font
d50d31da6c8d (Fset_face_attribute_internal): Mark frame garbaged whenever
Richard M. Stallman <rms@gnu.org>
parents: 8965
diff changeset
1203 we just got rid of. */
d50d31da6c8d (Fset_face_attribute_internal): Mark frame garbaged whenever
Richard M. Stallman <rms@gnu.org>
parents: 8965
diff changeset
1204 garbaged = 1;
9572
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
1205 #endif
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1206 }
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1207 else if (EQ (attr_name, intern ("foreground")))
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1208 {
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1209 unsigned long new_color = load_color (f, attr_value);
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1210 unload_color (f, face->foreground);
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1211 face->foreground = new_color;
9184
d50d31da6c8d (Fset_face_attribute_internal): Mark frame garbaged whenever
Richard M. Stallman <rms@gnu.org>
parents: 8965
diff changeset
1212 garbaged = 1;
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1213 }
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1214 else if (EQ (attr_name, intern ("background")))
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1215 {
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1216 unsigned long new_color = load_color (f, attr_value);
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1217 unload_color (f, face->background);
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1218 face->background = new_color;
9184
d50d31da6c8d (Fset_face_attribute_internal): Mark frame garbaged whenever
Richard M. Stallman <rms@gnu.org>
parents: 8965
diff changeset
1219 garbaged = 1;
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1220 }
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1221 else if (EQ (attr_name, intern ("background-pixmap")))
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1222 {
9564
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
1223 unsigned int w, h;
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
1224 unsigned long new_pixmap = load_pixmap (f, attr_value, &w, &h);
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
1225 x_destroy_bitmap (f, face->stipple);
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1226 face->stipple = new_pixmap;
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1227 face->pixmap_w = w;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1228 face->pixmap_h = h;
9564
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
1229 garbaged = 1;
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1230 }
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1231 else if (EQ (attr_name, intern ("underline")))
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1232 {
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1233 int new = !NILP (attr_value);
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1234 face->underline = new;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1235 }
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1236 else
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1237 error ("unknown face attribute");
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1238
3882
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
1239 if (id == 0 || id == 1)
a0b9347a3973 Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents: 3843
diff changeset
1240 recompute_basic_faces (f);
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1241
9184
d50d31da6c8d (Fset_face_attribute_internal): Mark frame garbaged whenever
Richard M. Stallman <rms@gnu.org>
parents: 8965
diff changeset
1242 /* We must redraw the frame whenever any face font or color changes,
d50d31da6c8d (Fset_face_attribute_internal): Mark frame garbaged whenever
Richard M. Stallman <rms@gnu.org>
parents: 8965
diff changeset
1243 because it's possible that a merged (display) face
d50d31da6c8d (Fset_face_attribute_internal): Mark frame garbaged whenever
Richard M. Stallman <rms@gnu.org>
parents: 8965
diff changeset
1244 contains the font or color we just replaced.
d50d31da6c8d (Fset_face_attribute_internal): Mark frame garbaged whenever
Richard M. Stallman <rms@gnu.org>
parents: 8965
diff changeset
1245 And we must inhibit any Expose events until the redraw is done,
d50d31da6c8d (Fset_face_attribute_internal): Mark frame garbaged whenever
Richard M. Stallman <rms@gnu.org>
parents: 8965
diff changeset
1246 since they would try to use the invalid display faces. */
d50d31da6c8d (Fset_face_attribute_internal): Mark frame garbaged whenever
Richard M. Stallman <rms@gnu.org>
parents: 8965
diff changeset
1247 if (garbaged)
15992
fb5a22197a8d (Fset_face_attribute_internal): Set mouse_face_defer flag.
Richard M. Stallman <rms@gnu.org>
parents: 15383
diff changeset
1248 {
fb5a22197a8d (Fset_face_attribute_internal): Set mouse_face_defer flag.
Richard M. Stallman <rms@gnu.org>
parents: 15383
diff changeset
1249 SET_FRAME_GARBAGED (f);
18723
e8795ba48121 (Fset_face_attribute_internal): Set mouse_face_defer
Eli Zaretskii <eliz@gnu.org>
parents: 18348
diff changeset
1250 #ifdef HAVE_X_WINDOWS
15992
fb5a22197a8d (Fset_face_attribute_internal): Set mouse_face_defer flag.
Richard M. Stallman <rms@gnu.org>
parents: 15383
diff changeset
1251 FRAME_X_DISPLAY_INFO (f)->mouse_face_defer = 1;
18723
e8795ba48121 (Fset_face_attribute_internal): Set mouse_face_defer
Eli Zaretskii <eliz@gnu.org>
parents: 18348
diff changeset
1252 #endif
15992
fb5a22197a8d (Fset_face_attribute_internal): Set mouse_face_defer flag.
Richard M. Stallman <rms@gnu.org>
parents: 15383
diff changeset
1253 }
2821
95010b414003 * xfaces.c (Fset_face_attribute_internal): Jolt redisplay, so it
Jim Blandy <jimb@redhat.com>
parents: 2818
diff changeset
1254
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1255 return Qnil;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1256 }
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1257 /* Return the face id for name NAME on frame FRAME.
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1258 (It should be the same for all frames,
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1259 but it's as easy to use the "right" frame to look it up
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1260 as to use any other one.) */
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1261
3065
fff06093b756 * xfns.c (Fx_list_fonts): New function.
Jim Blandy <jimb@redhat.com>
parents: 2998
diff changeset
1262 int
fff06093b756 * xfns.c (Fx_list_fonts): New function.
Jim Blandy <jimb@redhat.com>
parents: 2998
diff changeset
1263 face_name_id_number (f, name)
fff06093b756 * xfns.c (Fx_list_fonts): New function.
Jim Blandy <jimb@redhat.com>
parents: 2998
diff changeset
1264 FRAME_PTR f;
fff06093b756 * xfns.c (Fx_list_fonts): New function.
Jim Blandy <jimb@redhat.com>
parents: 2998
diff changeset
1265 Lisp_Object name;
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1266 {
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1267 Lisp_Object tem;
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1268
4258
8f02e992e4dc (face_name_id_number): Use assq_no_quit, not Fassq.
Richard M. Stallman <rms@gnu.org>
parents: 3997
diff changeset
1269 tem = Fcdr (assq_no_quit (name, f->face_alist));
2767
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
1270 if (NILP (tem))
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
1271 return 0;
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1272 CHECK_VECTOR (tem, 0);
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1273 tem = XVECTOR (tem)->contents[2];
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1274 CHECK_NUMBER (tem, 0);
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1275 return XINT (tem);
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1276 }
18083
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
1277
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
1278 #endif /* HAVE_FACES */
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
1279
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
1280
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
1281 DEFUN ("frame-face-alist", Fframe_face_alist, Sframe_face_alist, 1, 1, 0,
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
1282 "")
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
1283 (frame)
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
1284 Lisp_Object frame;
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
1285 {
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
1286 CHECK_FRAME (frame, 0);
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
1287 return XFRAME (frame)->face_alist;
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
1288 }
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
1289
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
1290 DEFUN ("set-frame-face-alist", Fset_frame_face_alist, Sset_frame_face_alist,
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
1291 2, 2, 0, "")
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
1292 (frame, value)
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
1293 Lisp_Object frame, value;
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
1294 {
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
1295 CHECK_FRAME (frame, 0);
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
1296 XFRAME (frame)->face_alist = value;
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
1297 return value;
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
1298 }
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
1299
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
1300 DEFUN ("internal-next-face-id", Finternal_next_face_id, Sinternal_next_face_id,
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
1301 0, 0, 0, "")
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
1302 ()
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
1303 {
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
1304 return make_number (next_face_id++);
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
1305 }
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1306
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
1307 /* Emacs initialization. */
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
1308
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1309 void
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1310 syms_of_xfaces ()
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1311 {
18083
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
1312 #ifdef HAVE_FACES
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1313 Qface = intern ("face");
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1314 staticpro (&Qface);
6615
96ddf85642d1 (compute_char_face): New arg MOUSE.
Richard M. Stallman <rms@gnu.org>
parents: 5858
diff changeset
1315 Qmouse_face = intern ("mouse-face");
96ddf85642d1 (compute_char_face): New arg MOUSE.
Richard M. Stallman <rms@gnu.org>
parents: 5858
diff changeset
1316 staticpro (&Qmouse_face);
9564
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
1317 Qpixmap_spec_p = intern ("pixmap-spec-p");
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
1318 staticpro (&Qpixmap_spec_p);
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1319
2795
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
1320 DEFVAR_INT ("region-face", &region_face,
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
1321 "Face number to use to highlight the region\n\
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
1322 The region is highlighted with this face\n\
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
1323 when Transient Mark mode is enabled and the mark is active.");
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
1324
18083
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
1325 defsubr (&Smake_face_internal);
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
1326 defsubr (&Sset_face_attribute_internal);
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
1327 #endif /* HAVE_FACES */
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
1328
9572
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
1329 #ifdef HAVE_X_WINDOWS
9564
1bfb920ab23e (intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents: 9529
diff changeset
1330 defsubr (&Spixmap_spec_p);
9572
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 9566
diff changeset
1331 #endif
18083
c361afa561c5 Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents: 17047
diff changeset
1332
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1333 defsubr (&Sframe_face_alist);
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1334 defsubr (&Sset_frame_face_alist);
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1335 defsubr (&Sinternal_next_face_id);
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1336 }