13434
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1 /* "Face" primitives.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2 Copyright (C) 1993, 1994, 1995 Free Software Foundation.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4 This file is part of GNU Emacs.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
5
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
6 GNU Emacs is free software; you can redistribute it and/or modify
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
7 it under the terms of the GNU General Public License as published by
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
8 the Free Software Foundation; either version 2, or (at your option)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
9 any later version.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
10
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
11 GNU Emacs is distributed in the hope that it will be useful,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
14 GNU General Public License for more details.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
15
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
16 You should have received a copy of the GNU General Public License
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
17 along with GNU Emacs; see the file COPYING. If not, write to
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
19
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
20 /* Ported xfaces.c for win32 - Kevin Gallo */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
21
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
22 #include <sys/types.h>
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
23 #include <sys/stat.h>
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
24
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
25 #include <config.h>
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
26 #include "lisp.h"
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
27
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
28 #include "w32term.h"
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
29 #include "buffer.h"
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
30 #include "dispextern.h"
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
31 #include "frame.h"
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
32 #include "blockinput.h"
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
33 #include "window.h"
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
34 #include "intervals.h"
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
35
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
36
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
37 /* An explanation of the face data structures. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
38
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
39 /* ========================= Face Data Structures =========================
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
40
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
41 Let FACE-NAME be a symbol naming a face.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
42
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
43 Let FACE-VECTOR be (assq FACE-NAME (frame-face-alist FRAME))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
44 FACE-VECTOR is either nil, or a vector of the form
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
45 [face NAME ID FONT FOREGROUND BACKGROUND BACKGROUND-PIXMAP UNDERLINE-P]
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
46 where
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
47 face is the symbol `face',
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
48 NAME is the symbol with which this vector is associated (a backpointer),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
49 ID is the face ID, an integer used internally by the C code to identify
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
50 the face,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
51 FONT, FOREGROUND, and BACKGROUND are strings naming the fonts and colors
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
52 to use with the face,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
53 BACKGROUND-PIXMAP is the name of an x bitmap filename, which we don't
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
54 use right now, and
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
55 UNDERLINE-P is non-nil if the face should be underlined.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
56 If any of these elements are nil, that parameter is considered
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
57 unspecified; parameters from faces specified by lower-priority
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
58 overlays or text properties, or the parameters of the frame itself,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
59 can show through. (lisp/faces.el maintains these lists.)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
60
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
61 (assq FACE-NAME global-face-data) returns a vector describing the
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
62 global parameters for that face.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
63
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
64 Let PARAM-FACE be FRAME->display.x->param_faces[Faref (FACE-VECTOR, 2)].
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
65 PARAM_FACE is a struct face whose members are the Xlib analogues of
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
66 the parameters in FACE-VECTOR. If an element of FACE-VECTOR is
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
67 nil, then the corresponding member of PARAM_FACE is FACE_DEFAULT.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
68 These faces are called "parameter faces", because they're the ones
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
69 lisp manipulates to control what gets displayed. Elements 0 and 1
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
70 of FRAME->display.x->param_faces are special - they describe the
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
71 default and mode line faces. None of the faces in param_faces have
|
14036
|
72 GC's. (See src/dispextern.h for the definition of struct face.
|
13434
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
73 lisp/faces.el maintains the isomorphism between face_alist and
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
74 param_faces.)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
75
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
76 The functions compute_char_face and compute_glyph_face find and
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
77 combine the parameter faces associated with overlays and text
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
78 properties. The resulting faces are called "computed faces"; none
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
79 of their members are FACE_DEFAULT; they are completely specified.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
80 They then call intern_compute_face to search
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
81 FRAME->display.x->computed_faces for a matching face, add one if
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
82 none is found, and return the index into
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
83 FRAME->display.x->computed_faces. FRAME's glyph matrices use these
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
84 indices to record the faces of the matrix characters, and the X
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
85 display hooks consult compute_faces to decide how to display these
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
86 characters. Elements 0 and 1 of computed_faces always describe the
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
87 default and mode-line faces.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
88
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
89 Each computed face belongs to a particular frame.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
90
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
91 Computed faces have graphics contexts some of the time.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
92 intern_face builds a GC for a specified computed face
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
93 if it doesn't have one already.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
94 clear_face_cache clears out the GCs of all computed faces.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
95 This is done from time to time so that we don't hold on to
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
96 lots of GCs that are no longer needed.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
97
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
98 Constraints:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
99
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
100 Symbols naming faces must have associations on all frames; for any
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
101 FRAME, for all FACE-NAME, if (assq FACE-NAME (frame-face-alist
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
102 FRAME)) is non-nil, it must be non-nil for all frames.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
103
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
104 Analogously, indices into param_faces must be valid on all frames;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
105 if param_faces[i] is a non-zero face pointer on one frame, then it
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
106 must be filled in on all frames. Code assumes that face ID's can
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
107 be used on any frame.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
108
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
109 Some subtleties:
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
110
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
111 Why do we keep param_faces and computed_faces separate?
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
112 computed_faces contains an element for every combination of facial
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
113 parameters we have ever displayed. indices into param_faces have
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
114 to be valid on all frames. If they were the same array, then that
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
115 array would grow very large on all frames, because any facial
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
116 combination displayed on any frame would need to be a valid entry
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
117 on all frames. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
118
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
119 /* Definitions and declarations. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
120
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
121 /* The number of face-id's in use (same for all frames). */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
122 static int next_face_id;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
123
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
124 /* The number of the face to use to indicate the region. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
125 static int region_face;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
126
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
127 /* This is what appears in a slot in a face to signify that the face
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
128 does not specify that display aspect. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
129 #define FACE_DEFAULT (~0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
130
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
131 Lisp_Object Qface, Qmouse_face;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
132 Lisp_Object Qpixmap_spec_p;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
133
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
134 int face_name_id_number ( /* FRAME_PTR, Lisp_Object name */ );
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
135
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
136 struct face *intern_face ( /* FRAME_PTR, struct face * */ );
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
137 static int new_computed_face ( /* FRAME_PTR, struct face * */ );
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
138 static int intern_computed_face ( /* FRAME_PTR, struct face * */ );
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
139 static void ensure_face_ready ( /* FRAME_PTR, int id */ );
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
140 void recompute_basic_faces ( /* FRAME_PTR f */ );
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
141
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
142 /* Allocating, copying, and comparing struct faces. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
143
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
144 /* Allocate a new face */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
145 static struct face *
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
146 allocate_face ()
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
147 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
148 struct face *result = (struct face *) xmalloc (sizeof (struct face));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
149 bzero (result, sizeof (struct face));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
150 result->font = (XFontStruct *) FACE_DEFAULT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
151 result->foreground = FACE_DEFAULT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
152 result->background = FACE_DEFAULT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
153 result->stipple = FACE_DEFAULT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
154 return result;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
155 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
156
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
157 /* Make a new face that's a copy of an existing one. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
158 static struct face *
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
159 copy_face (face)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
160 struct face *face;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
161 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
162 struct face *result = allocate_face ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
163
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
164 result->font = face->font;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
165 result->foreground = face->foreground;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
166 result->background = face->background;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
167 result->stipple = face->stipple;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
168 result->underline = face->underline;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
169 result->pixmap_h = face->pixmap_h;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
170 result->pixmap_w = face->pixmap_w;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
171
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
172 return result;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
173 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
174
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
175 static int
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
176 face_eql (face1, face2)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
177 struct face *face1, *face2;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
178 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
179 return ( face1->font == face2->font
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
180 && face1->foreground == face2->foreground
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
181 && face1->background == face2->background
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
182 && face1->stipple == face2->stipple
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
183 && face1->underline == face2->underline);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
184 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
185
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
186 /* Managing graphics contexts of faces. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
187
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
188 /* Given a computed face, construct its graphics context if necessary. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
189
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
190 struct face *
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
191 intern_face (f, face)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
192 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
193 struct face *face;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
194 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
195 face->gc = NULL;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
196
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
197 return face;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
198 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
199
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
200 /* Clear out all graphics contexts for all computed faces
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
201 except for the default and mode line faces.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
202 This should be done from time to time just to avoid
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
203 keeping too many graphics contexts that are no longer needed. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
204
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
205 void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
206 clear_face_cache ()
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
207 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
208 /* Nothing extra */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
209 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
210
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
211 /* Allocating, freeing, and duplicating fonts, colors, and pixmaps.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
212
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
213 These functions operate on param faces only.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
214 Computed faces get their fonts, colors and pixmaps
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
215 by merging param faces. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
216
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
217 static XFontStruct *
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
218 load_font (f, name)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
219 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
220 Lisp_Object name;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
221 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
222 XFontStruct *font;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
223
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
224 if (NILP (name))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
225 return (XFontStruct *) FACE_DEFAULT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
226
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
227 CHECK_STRING (name, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
228 BLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
229 font = win32_load_font (FRAME_WIN32_DISPLAY_INFO (f), (char *) XSTRING (name)->data);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
230 UNBLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
231
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
232 if (! font)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
233 Fsignal (Qerror, Fcons (build_string ("undefined font"),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
234 Fcons (name, Qnil)));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
235 return font;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
236 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
237
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
238 static void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
239 unload_font (f, font)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
240 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
241 XFontStruct *font;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
242 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
243 if (!font || font == ((XFontStruct *) FACE_DEFAULT))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
244 return;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
245
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
246 BLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
247 win32_unload_font (FRAME_WIN32_DISPLAY_INFO (f), font);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
248 UNBLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
249 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
250
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
251 static unsigned long
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
252 load_color (f, name)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
253 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
254 Lisp_Object name;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
255 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
256 COLORREF color;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
257 int result;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
258
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
259 if (NILP (name))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
260 return FACE_DEFAULT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
261
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
262 CHECK_STRING (name, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
263 /* if the colormap is full, defined_color will return a best match
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
264 to the values in an an existing cell. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
265 result = defined_color(f, (char *) XSTRING (name)->data, &color, 1);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
266 if (! result)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
267 Fsignal (Qerror, Fcons (build_string ("undefined color"),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
268 Fcons (name, Qnil)));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
269 return (unsigned long) color;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
270 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
271
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
272 static void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
273 unload_color (f, pixel)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
274 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
275 unsigned long pixel;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
276 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
277 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
278
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
279 DEFUN ("pixmap-spec-p", Fpixmap_spec_p, Spixmap_spec_p, 1, 1, 0,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
280 "Return t if ARG is a valid pixmap specification.")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
281 (arg)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
282 Lisp_Object arg;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
283 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
284 Lisp_Object height, width;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
285
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
286 return ((STRINGP (arg)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
287 || (CONSP (arg)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
288 && CONSP (XCONS (arg)->cdr)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
289 && CONSP (XCONS (XCONS (arg)->cdr)->cdr)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
290 && NILP (XCONS (XCONS (XCONS (arg)->cdr)->cdr)->cdr)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
291 && (width = XCONS (arg)->car, INTEGERP (width))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
292 && (height = XCONS (XCONS (arg)->cdr)->car, INTEGERP (height))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
293 && STRINGP (XCONS (XCONS (XCONS (arg)->cdr)->cdr)->car)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
294 && XINT (width) > 0
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
295 && XINT (height) > 0
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
296 /* The string must have enough bits for width * height. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
297 && ((XSTRING (XCONS (XCONS (XCONS (arg)->cdr)->cdr)->car)->size
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
298 * (BITS_PER_INT / sizeof (int)))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
299 >= XFASTINT (width) * XFASTINT (height))))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
300 ? Qt : Qnil);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
301 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
302
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
303 /* Load a bitmap according to NAME (which is either a file name
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
304 or a pixmap spec). Return the bitmap_id (see xfns.c)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
305 or get an error if NAME is invalid.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
306
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
307 Store the bitmap width in *W_PTR and height in *H_PTR. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
308
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
309 static long
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
310 load_pixmap (f, name, w_ptr, h_ptr)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
311 FRAME_PTR f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
312 Lisp_Object name;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
313 unsigned int *w_ptr, *h_ptr;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
314 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
315 int bitmap_id;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
316 Lisp_Object tem;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
317
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
318 if (NILP (name))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
319 return FACE_DEFAULT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
320
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
321 tem = Fpixmap_spec_p (name);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
322 if (NILP (tem))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
323 wrong_type_argument (Qpixmap_spec_p, name);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
324
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
325 BLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
326
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
327 if (CONSP (name))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
328 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
329 /* Decode a bitmap spec into a bitmap. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
330
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
331 int h, w;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
332 Lisp_Object bits;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
333
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
334 w = XINT (Fcar (name));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
335 h = XINT (Fcar (Fcdr (name)));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
336 bits = Fcar (Fcdr (Fcdr (name)));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
337
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
338 bitmap_id = x_create_bitmap_from_data (f, XSTRING (bits)->data,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
339 w, h);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
340 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
341 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
342 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
343 /* It must be a string -- a file name. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
344 bitmap_id = x_create_bitmap_from_file (f, name);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
345 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
346 UNBLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
347
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
348 if (bitmap_id < 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
349 Fsignal (Qerror, Fcons (build_string ("invalid or undefined bitmap"),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
350 Fcons (name, Qnil)));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
351
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
352 *w_ptr = x_bitmap_width (f, bitmap_id);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
353 *h_ptr = x_bitmap_height (f, bitmap_id);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
354
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
355 return bitmap_id;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
356 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
357
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
358
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
359 /* Managing parameter face arrays for frames. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
360
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
361 void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
362 init_frame_faces (f)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
363 FRAME_PTR f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
364 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
365 ensure_face_ready (f, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
366 ensure_face_ready (f, 1);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
367
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
368 FRAME_N_COMPUTED_FACES (f) = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
369 FRAME_SIZE_COMPUTED_FACES (f) = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
370
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
371 new_computed_face (f, FRAME_PARAM_FACES (f)[0]);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
372 new_computed_face (f, FRAME_PARAM_FACES (f)[1]);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
373 recompute_basic_faces (f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
374
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
375 #ifdef MULTI_FRAME
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
376 /* Find another frame. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
377 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
378 Lisp_Object tail, frame, result;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
379
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
380 result = Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
381 FOR_EACH_FRAME (tail, frame)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
382 if (FRAME_WIN32_P (XFRAME (frame))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
383 && XFRAME (frame) != f)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
384 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
385 result = frame;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
386 break;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
387 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
388
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
389 /* If we didn't find any X frames other than f, then we don't need
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
390 any faces other than 0 and 1, so we're okay. Otherwise, make
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
391 sure that all faces valid on the selected frame are also valid
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
392 on this new frame. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
393 if (FRAMEP (result))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
394 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
395 int i;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
396 int n_faces = FRAME_N_PARAM_FACES (XFRAME (result));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
397 struct face **faces = FRAME_PARAM_FACES (XFRAME (result));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
398
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
399 for (i = 2; i < n_faces; i++)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
400 if (faces[i])
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
401 ensure_face_ready (f, i);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
402 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
403 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
404 #endif /* MULTI_FRAME */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
405 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
406
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
407
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
408 /* Called from Fdelete_frame. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
409
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
410 void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
411 free_frame_faces (f)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
412 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
413 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
414 int i;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
415
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
416 BLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
417
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
418 for (i = 0; i < FRAME_N_PARAM_FACES (f); i++)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
419 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
420 struct face *face = FRAME_PARAM_FACES (f) [i];
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
421 if (face)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
422 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
423 unload_font (f, face->font);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
424 unload_color (f, face->foreground);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
425 unload_color (f, face->background);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
426 x_destroy_bitmap (f, face->stipple);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
427 xfree (face);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
428 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
429 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
430 xfree (FRAME_PARAM_FACES (f));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
431 FRAME_PARAM_FACES (f) = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
432 FRAME_N_PARAM_FACES (f) = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
433
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
434 /* All faces in FRAME_COMPUTED_FACES use resources copied from
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
435 FRAME_PARAM_FACES; we can free them without fuss.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
436 But we do free the GCs and the face objects themselves. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
437 for (i = 0; i < FRAME_N_COMPUTED_FACES (f); i++)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
438 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
439 struct face *face = FRAME_COMPUTED_FACES (f) [i];
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
440 if (face)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
441 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
442 xfree (face);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
443 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
444 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
445 xfree (FRAME_COMPUTED_FACES (f));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
446 FRAME_COMPUTED_FACES (f) = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
447 FRAME_N_COMPUTED_FACES (f) = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
448
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
449 UNBLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
450 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
451
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
452 /* Interning faces in a frame's face array. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
453
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
454 static int
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
455 new_computed_face (f, new_face)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
456 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
457 struct face *new_face;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
458 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
459 int i = FRAME_N_COMPUTED_FACES (f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
460
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
461 if (i >= FRAME_SIZE_COMPUTED_FACES (f))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
462 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
463 int new_size = i + 32;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
464
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
465 FRAME_COMPUTED_FACES (f)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
466 = (struct face **) (FRAME_SIZE_COMPUTED_FACES (f) == 0
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
467 ? xmalloc (new_size * sizeof (struct face *))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
468 : xrealloc (FRAME_COMPUTED_FACES (f),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
469 new_size * sizeof (struct face *)));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
470 FRAME_SIZE_COMPUTED_FACES (f) = new_size;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
471 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
472
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
473 i = FRAME_N_COMPUTED_FACES (f)++;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
474 FRAME_COMPUTED_FACES (f)[i] = copy_face (new_face);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
475 return i;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
476 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
477
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
478
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
479 /* Find a match for NEW_FACE in a FRAME's computed face array, and add
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
480 it if we don't find one. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
481 static int
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
482 intern_computed_face (f, new_face)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
483 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
484 struct face *new_face;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
485 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
486 int len = FRAME_N_COMPUTED_FACES (f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
487 int i;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
488
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
489 /* Search for a computed face already on F equivalent to FACE. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
490 for (i = 0; i < len; i++)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
491 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
492 if (! FRAME_COMPUTED_FACES (f)[i])
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
493 abort ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
494 if (face_eql (new_face, FRAME_COMPUTED_FACES (f)[i]))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
495 return i;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
496 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
497
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
498 /* We didn't find one; add a new one. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
499 return new_computed_face (f, new_face);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
500 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
501
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
502 /* Make parameter face id ID valid on frame F. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
503
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
504 static void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
505 ensure_face_ready (f, id)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
506 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
507 int id;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
508 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
509 if (FRAME_N_PARAM_FACES (f) <= id)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
510 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
511 int n = id + 10;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
512 int i;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
513 if (!FRAME_N_PARAM_FACES (f))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
514 FRAME_PARAM_FACES (f)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
515 = (struct face **) xmalloc (sizeof (struct face *) * n);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
516 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
517 FRAME_PARAM_FACES (f)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
518 = (struct face **) xrealloc (FRAME_PARAM_FACES (f),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
519 sizeof (struct face *) * n);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
520
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
521 bzero (FRAME_PARAM_FACES (f) + FRAME_N_PARAM_FACES (f),
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
522 (n - FRAME_N_PARAM_FACES (f)) * sizeof (struct face *));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
523 FRAME_N_PARAM_FACES (f) = n;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
524 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
525
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
526 if (FRAME_PARAM_FACES (f) [id] == 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
527 FRAME_PARAM_FACES (f) [id] = allocate_face ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
528 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
529
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
530 /* Return non-zero if FONT1 and FONT2 have the same width.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
531 We do not check the height, because we can now deal with
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
532 different heights.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
533 We assume that they're both character-cell fonts. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
534
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
535 int
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
536 same_size_fonts (font1, font2)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
537 XFontStruct *font1, *font2;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
538 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
539 return (FONT_WIDTH(font1) == FONT_WIDTH(font2));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
540 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
541
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
542 /* Update the line_height of frame F according to the biggest font in
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
543 any face. Return nonzero if if line_height changes. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
544
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
545 int
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
546 frame_update_line_height (f)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
547 FRAME_PTR f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
548 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
549 int i;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
550 int biggest = FONT_HEIGHT (f->output_data.win32->font);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
551
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
552 for (i = 0; i < f->output_data.win32->n_param_faces; i++)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
553 if (f->output_data.win32->param_faces[i] != 0
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
554 && f->output_data.win32->param_faces[i]->font != (XFontStruct *) FACE_DEFAULT)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
555 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
556 int height = FONT_HEIGHT (f->output_data.win32->param_faces[i]->font);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
557 if (height > biggest)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
558 biggest = height;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
559 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
560
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
561 if (biggest == f->output_data.win32->line_height)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
562 return 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
563
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
564 f->output_data.win32->line_height = biggest;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
565 return 1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
566 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
567
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
568 /* Modify face TO by copying from FROM all properties which have
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
569 nondefault settings. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
570
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
571 static void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
572 merge_faces (from, to)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
573 struct face *from, *to;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
574 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
575 /* Only merge the font if it's the same width as the base font.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
576 Otherwise ignore it, since we can't handle it properly. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
577 if (from->font != (XFontStruct *) FACE_DEFAULT
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
578 && same_size_fonts (from->font, to->font))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
579 to->font = from->font;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
580 if (from->foreground != FACE_DEFAULT)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
581 to->foreground = from->foreground;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
582 if (from->background != FACE_DEFAULT)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
583 to->background = from->background;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
584 if (from->stipple != FACE_DEFAULT)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
585 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
586 to->stipple = from->stipple;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
587 to->pixmap_h = from->pixmap_h;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
588 to->pixmap_w = from->pixmap_w;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
589 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
590 if (from->underline)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
591 to->underline = from->underline;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
592 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
593
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
594 /* Set up the basic set of facial parameters, based on the frame's
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
595 data; all faces are deltas applied to this. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
596
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
597 static void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
598 compute_base_face (f, face)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
599 FRAME_PTR f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
600 struct face *face;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
601 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
602 face->gc = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
603 face->foreground = FRAME_FOREGROUND_PIXEL (f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
604 face->background = FRAME_BACKGROUND_PIXEL (f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
605 face->font = FRAME_FONT (f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
606 face->stipple = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
607 face->underline = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
608 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
609
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
610 /* Return the face ID to use to display a special glyph which selects
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
611 FACE_CODE as the face ID, assuming that ordinarily the face would
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
612 be CURRENT_FACE. F is the frame. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
613
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
614 int
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
615 compute_glyph_face (f, face_code, current_face)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
616 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
617 int face_code, current_face;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
618 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
619 struct face face;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
620
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
621 face = *FRAME_COMPUTED_FACES (f)[current_face];
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
622
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
623 if (face_code >= 0 && face_code < FRAME_N_PARAM_FACES (f)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
624 && FRAME_PARAM_FACES (f) [face_code] != 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
625 merge_faces (FRAME_PARAM_FACES (f) [face_code], &face);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
626
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
627 return intern_computed_face (f, &face);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
628 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
629
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
630 /* Return the face ID to use to display a special glyph which selects
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
631 FACE_CODE as the face ID, assuming that ordinarily the face would
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
632 be CURRENT_FACE. F is the frame. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
633
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
634 int
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
635 compute_glyph_face_1 (f, face_name, current_face)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
636 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
637 Lisp_Object face_name;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
638 int current_face;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
639 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
640 struct face face;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
641
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
642 face = *FRAME_COMPUTED_FACES (f)[current_face];
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
643
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
644 if (!NILP (face_name))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
645 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
646 int facecode = face_name_id_number (f, face_name);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
647 if (facecode >= 0 && facecode < FRAME_N_PARAM_FACES (f)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
648 && FRAME_PARAM_FACES (f) [facecode] != 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
649 merge_faces (FRAME_PARAM_FACES (f) [facecode], &face);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
650 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
651
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
652 return intern_computed_face (f, &face);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
653 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
654
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
655 /* Return the face ID associated with a buffer position POS.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
656 Store into *ENDPTR the position at which a different face is needed.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
657 This does not take account of glyphs that specify their own face codes.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
658 F is the frame in use for display, and W is a window displaying
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
659 the current buffer.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
660
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
661 REGION_BEG, REGION_END delimit the region, so it can be highlighted.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
662
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
663 LIMIT is a position not to scan beyond. That is to limit
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
664 the time this function can take.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
665
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
666 If MOUSE is nonzero, use the character's mouse-face, not its face. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
667
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
668 int
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
669 compute_char_face (f, w, pos, region_beg, region_end, endptr, limit, mouse)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
670 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
671 struct window *w;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
672 int pos;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
673 int region_beg, region_end;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
674 int *endptr;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
675 int limit;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
676 int mouse;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
677 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
678 struct face face;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
679 Lisp_Object prop, position;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
680 int i, j, noverlays;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
681 int facecode;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
682 Lisp_Object *overlay_vec;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
683 Lisp_Object frame;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
684 int endpos;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
685 Lisp_Object propname;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
686
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
687 /* W must display the current buffer. We could write this function
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
688 to use the frame and buffer of W, but right now it doesn't. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
689 if (XBUFFER (w->buffer) != current_buffer)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
690 abort ();
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
691
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
692 XSETFRAME (frame, f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
693
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
694 endpos = ZV;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
695 if (pos < region_beg && region_beg < endpos)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
696 endpos = region_beg;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
697
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
698 XSETFASTINT (position, pos);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
699
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
700 if (mouse)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
701 propname = Qmouse_face;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
702 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
703 propname = Qface;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
704
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
705 prop = Fget_text_property (position, propname, w->buffer);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
706
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
707 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
708 Lisp_Object limit1, end;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
709
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
710 XSETFASTINT (limit1, (limit < endpos ? limit : endpos));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
711 end = Fnext_single_property_change (position, propname, w->buffer, limit1);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
712 if (INTEGERP (end))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
713 endpos = XINT (end);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
714 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
715
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
716 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
717 int next_overlay;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
718 int len;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
719
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
720 /* First try with room for 40 overlays. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
721 len = 40;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
722 overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
723
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
724 noverlays = overlays_at (pos, 0, &overlay_vec, &len,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
725 &next_overlay, (int *) 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
726
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
727 /* If there are more than 40,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
728 make enough space for all, and try again. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
729 if (noverlays > len)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
730 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
731 len = noverlays;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
732 overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
733 noverlays = overlays_at (pos, 0, &overlay_vec, &len,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
734 &next_overlay, (int *) 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
735 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
736
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
737 if (next_overlay < endpos)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
738 endpos = next_overlay;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
739 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
740
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
741 *endptr = endpos;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
742
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
743 /* Optimize the default case. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
744 if (noverlays == 0 && NILP (prop)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
745 && !(pos >= region_beg && pos < region_end))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
746 return 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
747
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
748 compute_base_face (f, &face);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
749
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
750 if (CONSP (prop))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
751 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
752 /* We have a list of faces, merge them in reverse order */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
753 Lisp_Object length = Flength (prop);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
754 int len = XINT (length);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
755 Lisp_Object *faces;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
756
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
757 /* Put them into an array */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
758 faces = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
759 for (j = 0; j < len; j++)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
760 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
761 faces[j] = Fcar (prop);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
762 prop = Fcdr (prop);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
763 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
764 /* So that we can merge them in the reverse order */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
765 for (j = len - 1; j >= 0; j--)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
766 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
767 facecode = face_name_id_number (f, faces[j]);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
768 if (facecode >= 0 && facecode < FRAME_N_PARAM_FACES (f)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
769 && FRAME_PARAM_FACES (f) [facecode] != 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
770 merge_faces (FRAME_PARAM_FACES (f) [facecode], &face);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
771 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
772 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
773 else if (!NILP (prop))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
774 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
775 facecode = face_name_id_number (f, prop);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
776 if (facecode >= 0 && facecode < FRAME_N_PARAM_FACES (f)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
777 && FRAME_PARAM_FACES (f) [facecode] != 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
778 merge_faces (FRAME_PARAM_FACES (f) [facecode], &face);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
779 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
780
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
781 noverlays = sort_overlays (overlay_vec, noverlays, w);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
782
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
783 /* Now merge the overlay data in that order. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
784 for (i = 0; i < noverlays; i++)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
785 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
786 prop = Foverlay_get (overlay_vec[i], propname);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
787 if (CONSP (prop))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
788 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
789 /* We have a list of faces, merge them in reverse order */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
790 Lisp_Object length = Flength (prop);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
791 int len = XINT (length);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
792 Lisp_Object *faces;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
793 int i;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
794
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
795 /* Put them into an array */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
796 faces = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
797 for (j = 0; j < len; j++)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
798 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
799 faces[j] = Fcar (prop);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
800 prop = Fcdr (prop);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
801 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
802 /* So that we can merge them in the reverse order */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
803 for (j = len - 1; j >= 0; j--)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
804 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
805 facecode = face_name_id_number (f, faces[j]);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
806 if (facecode >= 0 && facecode < FRAME_N_PARAM_FACES (f)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
807 && FRAME_PARAM_FACES (f) [facecode] != 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
808 merge_faces (FRAME_PARAM_FACES (f) [facecode], &face);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
809 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
810 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
811 else if (!NILP (prop))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
812 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
813 Lisp_Object oend;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
814 int oendpos;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
815
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
816 facecode = face_name_id_number (f, prop);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
817 if (facecode >= 0 && facecode < FRAME_N_PARAM_FACES (f)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
818 && FRAME_PARAM_FACES (f) [facecode] != 0)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
819 merge_faces (FRAME_PARAM_FACES (f)[facecode], &face);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
820
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
821 oend = OVERLAY_END (overlay_vec[i]);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
822 oendpos = OVERLAY_POSITION (oend);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
823 if (oendpos < endpos)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
824 endpos = oendpos;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
825 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
826 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
827
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
828 if (pos >= region_beg && pos < region_end)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
829 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
830 if (region_end < endpos)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
831 endpos = region_end;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
832 if (region_face >= 0 && region_face < next_face_id)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
833 merge_faces (FRAME_PARAM_FACES (f)[region_face], &face);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
834 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
835
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
836 *endptr = endpos;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
837
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
838 return intern_computed_face (f, &face);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
839 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
840
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
841 /* Recompute the GC's for the default and modeline faces.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
842 We call this after changing frame parameters on which those GC's
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
843 depend. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
844
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
845 void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
846 recompute_basic_faces (f)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
847 FRAME_PTR f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
848 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
849 /* If the frame's faces haven't been initialized yet, don't worry about
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
850 this stuff. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
851 if (FRAME_N_PARAM_FACES (f) < 2)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
852 return;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
853
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
854 BLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
855
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
856 compute_base_face (f, FRAME_DEFAULT_FACE (f));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
857 compute_base_face (f, FRAME_MODE_LINE_FACE (f));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
858
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
859 merge_faces (FRAME_DEFAULT_PARAM_FACE (f), FRAME_DEFAULT_FACE (f));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
860 merge_faces (FRAME_MODE_LINE_PARAM_FACE (f), FRAME_MODE_LINE_FACE (f));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
861
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
862 intern_face (f, FRAME_DEFAULT_FACE (f));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
863 intern_face (f, FRAME_MODE_LINE_FACE (f));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
864
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
865 UNBLOCK_INPUT;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
866 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
867
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
868
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
869
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
870 /* Lisp interface. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
871
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
872 DEFUN ("frame-face-alist", Fframe_face_alist, Sframe_face_alist, 1, 1, 0,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
873 "")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
874 (frame)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
875 Lisp_Object frame;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
876 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
877 CHECK_FRAME (frame, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
878 return XFRAME (frame)->face_alist;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
879 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
880
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
881 DEFUN ("set-frame-face-alist", Fset_frame_face_alist, Sset_frame_face_alist,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
882 2, 2, 0, "")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
883 (frame, value)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
884 Lisp_Object frame, value;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
885 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
886 CHECK_FRAME (frame, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
887 XFRAME (frame)->face_alist = value;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
888 return value;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
889 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
890
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
891
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
892 DEFUN ("make-face-internal", Fmake_face_internal, Smake_face_internal, 1, 1, 0,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
893 "Create face number FACE-ID on all frames.")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
894 (face_id)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
895 Lisp_Object face_id;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
896 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
897 Lisp_Object rest, frame;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
898 int id = XINT (face_id);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
899
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
900 CHECK_NUMBER (face_id, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
901 if (id < 0 || id >= next_face_id)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
902 error ("Face id out of range");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
903
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
904 FOR_EACH_FRAME (rest, frame)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
905 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
906 if (FRAME_WIN32_P (XFRAME (frame)))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
907 ensure_face_ready (XFRAME (frame), id);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
908 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
909 return Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
910 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
911
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
912
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
913 DEFUN ("set-face-attribute-internal", Fset_face_attribute_internal,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
914 Sset_face_attribute_internal, 4, 4, 0, "")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
915 (face_id, attr_name, attr_value, frame)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
916 Lisp_Object face_id, attr_name, attr_value, frame;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
917 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
918 struct face *face;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
919 struct frame *f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
920 int magic_p;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
921 int id;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
922 int garbaged = 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
923
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
924 CHECK_FRAME (frame, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
925 CHECK_NUMBER (face_id, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
926 CHECK_SYMBOL (attr_name, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
927
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
928 f = XFRAME (frame);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
929 id = XINT (face_id);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
930 if (id < 0 || id >= next_face_id)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
931 error ("Face id out of range");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
932
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
933 if (! FRAME_WIN32_P (f))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
934 return Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
935
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
936 ensure_face_ready (f, id);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
937 face = FRAME_PARAM_FACES (f) [XFASTINT (face_id)];
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
938
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
939 if (EQ (attr_name, intern ("font")))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
940 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
941 XFontStruct *font = load_font (f, attr_value);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
942 if (face->font != f->output_data.win32->font)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
943 unload_font (f, face->font);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
944 face->font = font;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
945 if (frame_update_line_height (f))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
946 x_set_window_size (f, 0, f->width, f->height);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
947 /* Must clear cache, since it might contain the font
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
948 we just got rid of. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
949 garbaged = 1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
950 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
951 else if (EQ (attr_name, intern ("foreground")))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
952 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
953 unsigned long new_color = load_color (f, attr_value);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
954 unload_color (f, face->foreground);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
955 face->foreground = new_color;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
956 garbaged = 1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
957 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
958 else if (EQ (attr_name, intern ("background")))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
959 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
960 unsigned long new_color = load_color (f, attr_value);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
961 unload_color (f, face->background);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
962 face->background = new_color;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
963 garbaged = 1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
964 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
965 else if (EQ (attr_name, intern ("background-pixmap")))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
966 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
967 unsigned int w, h;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
968 unsigned long new_pixmap = load_pixmap (f, attr_value, &w, &h);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
969 x_destroy_bitmap (f, face->stipple);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
970 face->stipple = (Pixmap) new_pixmap;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
971 face->pixmap_w = w;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
972 face->pixmap_h = h;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
973 garbaged = 1;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
974 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
975 else if (EQ (attr_name, intern ("underline")))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
976 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
977 int new = !NILP (attr_value);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
978 face->underline = new;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
979 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
980 else
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
981 error ("unknown face attribute");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
982
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
983 if (id == 0 || id == 1)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
984 recompute_basic_faces (f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
985
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
986 /* We must redraw the frame whenever any face font or color changes,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
987 because it's possible that a merged (display) face
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
988 contains the font or color we just replaced.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
989 And we must inhibit any Expose events until the redraw is done,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
990 since they would try to use the invalid display faces. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
991 if (garbaged)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
992 SET_FRAME_GARBAGED (f);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
993
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
994 return Qnil;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
995 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
996
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
997 DEFUN ("internal-next-face-id", Finternal_next_face_id, Sinternal_next_face_id,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
998 0, 0, 0, "")
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
999 ()
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1000 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1001 return make_number (next_face_id++);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1002 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1003
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1004 /* Return the face id for name NAME on frame FRAME.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1005 (It should be the same for all frames,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1006 but it's as easy to use the "right" frame to look it up
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1007 as to use any other one.) */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1008
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1009 int
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1010 face_name_id_number (f, name)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1011 FRAME_PTR f;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1012 Lisp_Object name;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1013 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1014 Lisp_Object tem;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1015
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1016 tem = Fcdr (assq_no_quit (name, f->face_alist));
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1017 if (NILP (tem))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1018 return 0;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1019 CHECK_VECTOR (tem, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1020 tem = XVECTOR (tem)->contents[2];
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1021 CHECK_NUMBER (tem, 0);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1022 return XINT (tem);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1023 }
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1024
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1025 /* Emacs initialization. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1026
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1027 void
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1028 syms_of_win32faces ()
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1029 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1030 Qface = intern ("face");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1031 staticpro (&Qface);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1032 Qmouse_face = intern ("mouse-face");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1033 staticpro (&Qmouse_face);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1034 Qpixmap_spec_p = intern ("pixmap-spec-p");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1035 staticpro (&Qpixmap_spec_p);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1036
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1037 DEFVAR_INT ("region-face", ®ion_face,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1038 "Face number to use to highlight the region\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1039 The region is highlighted with this face\n\
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1040 when Transient Mark mode is enabled and the mark is active.");
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1041
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1042 defsubr (&Spixmap_spec_p);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1043 defsubr (&Sframe_face_alist);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1044 defsubr (&Sset_frame_face_alist);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1045 defsubr (&Smake_face_internal);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1046 defsubr (&Sset_face_attribute_internal);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1047 defsubr (&Sinternal_next_face_id);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1048 }
|