annotate src/xfaces.c @ 11938:cc1b306581c5

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