annotate src/xfaces.c @ 3856:7f0b238b15a1

Initial revision
author Richard M. Stallman <rms@gnu.org>
date Mon, 21 Jun 1993 06:45:33 +0000
parents 18892e151d53
children a0b9347a3973
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.
2961
e94a593c3952 Updated copyright years.
Jim Blandy <jimb@redhat.com>
parents: 2918
diff changeset
2 Copyright (C) 1993 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
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
25 #include "config.h"
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
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
28 #ifdef HAVE_X_WINDOWS
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
29
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
30 #include "xterm.h"
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
31 #include "buffer.h"
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
32 #include "dispextern.h"
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
33 #include "frame.h"
2438
b513de4de386 * xfaces.c: Doc fixes.
Jim Blandy <jimb@redhat.com>
parents: 2391
diff changeset
34 #include "blockinput.h"
2767
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
35 #include "window.h"
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
36
3436
291f28da7ea1 Test XOS_NEEDS_TIME_H, not HPUX, for including time.hj.
Richard M. Stallman <rms@gnu.org>
parents: 3401
diff changeset
37 /* Compensate for bug in Xos.h on some systems. */
291f28da7ea1 Test XOS_NEEDS_TIME_H, not HPUX, for including time.hj.
Richard M. Stallman <rms@gnu.org>
parents: 3401
diff changeset
38 #ifdef XOS_NEEDS_TIME_H
3277
564f748751ea [HPUX]: Include time.h and define __TIMEVAL__.
Richard M. Stallman <rms@gnu.org>
parents: 3074
diff changeset
39 #include <time.h>
564f748751ea [HPUX]: Include time.h and define __TIMEVAL__.
Richard M. Stallman <rms@gnu.org>
parents: 3074
diff changeset
40 #define __TIMEVAL__
564f748751ea [HPUX]: Include time.h and define __TIMEVAL__.
Richard M. Stallman <rms@gnu.org>
parents: 3074
diff changeset
41 #endif
564f748751ea [HPUX]: Include time.h and define __TIMEVAL__.
Richard M. Stallman <rms@gnu.org>
parents: 3074
diff changeset
42
3316
9857db8aa4cd * xfaces.c (unload_color): Don't #include <X11/Intrinsic.h>,
Jim Blandy <jimb@redhat.com>
parents: 3302
diff changeset
43 /* These don't seem to be used. */
9857db8aa4cd * xfaces.c (unload_color): Don't #include <X11/Intrinsic.h>,
Jim Blandy <jimb@redhat.com>
parents: 3302
diff changeset
44 #if 0
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
45 /* Display Context for the icons */
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
46 #include <X11/Intrinsic.h>
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
47 #include <X11/StringDefs.h>
3316
9857db8aa4cd * xfaces.c (unload_color): Don't #include <X11/Intrinsic.h>,
Jim Blandy <jimb@redhat.com>
parents: 3302
diff changeset
48 #include <X11/Xmu/Drawing.h>
9857db8aa4cd * xfaces.c (unload_color): Don't #include <X11/Intrinsic.h>,
Jim Blandy <jimb@redhat.com>
parents: 3302
diff changeset
49 #endif
9857db8aa4cd * xfaces.c (unload_color): Don't #include <X11/Intrinsic.h>,
Jim Blandy <jimb@redhat.com>
parents: 3302
diff changeset
50
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
51 #include <X11/Xos.h>
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
52
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
53
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
54 /* 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
55
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
56 /* ========================= Face Data Structures =========================
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
57
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
58 All lisp code uses symbols as face names.
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
59
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
60 Each frame has a face_alist member (with the frame-face-alist and
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
61 set-frame-face-alist accessors), associating the face names with
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
62 vectors of the form
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
63 [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
64 where
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
65 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
66 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
67 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
68 the face,
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
69 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
70 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
71 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
72 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
73 UNDERLINE-P is non-nil if the face should be underlined.
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
74 If any of these elements are nil, that allows the frame's parameters to
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
75 show through.
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
76 (lisp/faces.el maintains these association lists.)
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
77
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
78 The frames' private alists hold the frame-local definitions for the
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
79 faces. The lisp variable global-face-data contains the global
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
80 defaults for faces. (See lisp/faces.el for this too.)
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
81
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
82 In the C code, we also have a `struct face' with the elements
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
83 `foreground', `background', `font', and `underline',
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
84 which specify its visual appearance, and elements
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
85 `gc' and `cached_index';
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
86 `gc' may be an X GC which has been built for the given display
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
87 parameters. Faces with GC's are called `display faces'. Whether
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
88 or not a face has a GC depends on what data structure the face is
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
89 in; we explain these more below. (See src/dispextern.h.)
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
90
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
91 Each frame also has members called `faces' and `n_faces' (with the
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
92 accessors FRAME_FACES and FRAME_N_FACES), which define an array of
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
93 struct face pointers, indexed by face ID (element 2 of the
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
94 vector). These are called "frame faces".
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
95 Element 0 is the default face --- the one used for normal text.
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
96 Element 1 is the modeline face.
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
97 These faces have their GC's set; the rest do not.
6fab7c7bb1f1 * xfaces.c (init_frame_faces): We have to make sure that face ID's
Jim Blandy <jimb@redhat.com>
parents: 3277
diff changeset
98 If faces[i] is filled in (i.e. non-zero) on one frame, then it must
6fab7c7bb1f1 * xfaces.c (init_frame_faces): We have to make sure that face ID's
Jim Blandy <jimb@redhat.com>
parents: 3277
diff changeset
99 be filled in on all frames. Code assumes that face ID's can be
6fab7c7bb1f1 * xfaces.c (init_frame_faces): We have to make sure that face ID's
Jim Blandy <jimb@redhat.com>
parents: 3277
diff changeset
100 used on any frame. (See src/xterm.h.)
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
101
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
102 The global variables `face_vector' and `nfaces' define another
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
103 array of struct face pointers, with their GC's set. This array
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
104 acts as a cache of GC's to be used by all frames. The function
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
105 `intern_face', passed a struct face *, searches face_vector for a
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
106 struct face with the same parameters, adds a new one with a GC if
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
107 it doesn't find one, and returns it. If you have a `struct face',
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
108 and you want a GC for it, call intern_face on that struct, and it
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
109 will return a `struct face *' with its GC set. The faces in
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
110 face_vector are called `cached faces.' (See src/xfaces.c.)
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
111
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
112 The `GLYPH' data type is an unsigned integer type; the bottom byte
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
113 is a character code, and the byte above that is a face id. The
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
114 `struct frame_glyphs' structure, used to describe frames' current
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
115 or desired contents, is essentially a matrix of GLYPHs; the face
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
116 ID's in a struct frame_glyphs are indices into FRAME_FACES. (See
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
117 src/dispextern.h.)
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
118
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
119 Some subtleties:
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
120
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
121 Since face_vector is just a cache --- there are no pointers into it
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
122 from the rest of the code, and everyone accesses it through
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
123 intern_face --- we could just free its GC's and throw the whole
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
124 thing away without breaking anything. This gives us a simple way
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
125 to garbage-collect old GC's nobody's using any more - we can just
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
126 purge face_vector, and then let subsequent calls to intern_face
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
127 refill it as needed. The function clear_face_vector performs this
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
128 purge.
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
129
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
130 We're often applying intern_face to faces in frames' local arrays -
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
131 for example, we do this while sending GLYPHs from a struct
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
132 frame_glyphs to X during redisplay. It would be nice to avoid
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
133 searching all of face_vector every time we intern a frame's face.
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
134 So, when intern_face finds a match for FACE in face_vector, it
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
135 stores the index of the match in FACE's cached_index member, and
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
136 checks there first next time. */
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
137
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
138
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
139 /* Definitions and declarations. */
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
140
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
141 /* A table of display faces. */
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
142 struct face **face_vector;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
143 /* The length in use of the table. */
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
144 int nfaces;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
145 /* The allocated length of the table. */
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
146 int nfaces_allocated;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
147
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
148 /* The number of face-id's in use (same for all frames). */
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
149 int next_face_id;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
150
2795
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
151 /* The number of the face to use to indicate the region. */
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
152 int region_face;
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
153
2838
5f6a2d52d2ef (compute_char_face): Pass 0 as EXTEND arg to overlays_at.
Richard M. Stallman <rms@gnu.org>
parents: 2821
diff changeset
154 /* 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
155 does not specify that display aspect. */
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
156 #define FACE_DEFAULT (~0)
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
157
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
158 Lisp_Object Qface, Qwindow, Qpriority;
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 static void build_face ( /* FRAME_PTR, struct face * */ );
205d69567177 * xfaces.c: Add forward declaration for recompute_basic_faces.
Jim Blandy <jimb@redhat.com>
parents: 3811
diff changeset
161 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
162
3830
205d69567177 * xfaces.c: Add forward declaration for recompute_basic_faces.
Jim Blandy <jimb@redhat.com>
parents: 3811
diff changeset
163 struct face *intern_face ( /* FRAME_PTR, struct face * */ );
205d69567177 * xfaces.c: Add forward declaration for recompute_basic_faces.
Jim Blandy <jimb@redhat.com>
parents: 3811
diff changeset
164 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
165 void recompute_basic_faces ( /* FRAME_PTR f */ );
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
166
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
167 /* 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
168
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
169 /* 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
170 static struct face *
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
171 allocate_face ()
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
172 {
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
173 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
174 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
175 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
176 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
177 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
178 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
179 return result;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
180 }
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
181
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
182 /* Make a new face that's a copy of an existing one. */
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
183 static struct face *
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
184 copy_face (face)
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
185 struct face *face;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
186 {
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
187 struct face *result = allocate_face ();
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
188
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
189 result->font = face->font;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
190 result->foreground = face->foreground;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
191 result->background = face->background;
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
192 result->stipple = face->stipple;
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
193 result->underline = face->underline;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
194
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
195 return result;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
196 }
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
197
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
198 static int
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
199 face_eql (face1, face2)
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
200 struct face *face1, *face2;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
201 {
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
202 return ( face1->font == face2->font
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
203 && face1->foreground == face2->foreground
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
204 && 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
205 && 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
206 && face1->underline == face2->underline);
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
207 }
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
208
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
209 /* Interning faces in the `face_vector' cache, and clearing that cache. */
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
210
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
211 /* Return the unique display face corresponding to the user-level face FACE.
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
212 If there isn't one, make one, and find a slot in the face_vector to
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
213 put it in. */
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
214 static struct face *
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
215 get_cached_face (f, face)
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
216 struct frame *f;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
217 struct face *face;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
218 {
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
219 int i, empty = -1;
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
220 struct face *result;
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
221
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
222 /* Perhaps FACE->cached_index is valid; this could happen if FACE is
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
223 in a frame's face list. */
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
224 if (face->cached_index >= 0
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
225 && face->cached_index < nfaces
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
226 && face_eql (face_vector[face->cached_index], face))
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
227 return face_vector[face->cached_index];
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
228
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
229 /* Look for an existing display face that does the job.
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
230 Also find an empty slot if any. */
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
231 for (i = 0; i < nfaces; i++)
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
232 {
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
233 if (face_eql (face_vector[i], face))
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
234 return face_vector[i];
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
235 if (face_vector[i] == 0)
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
236 empty = i;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
237 }
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
238
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
239 /* If no empty slots, make one. */
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
240 if (empty < 0 && nfaces == nfaces_allocated)
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
241 {
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
242 int newsize = nfaces + 20;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
243 face_vector
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
244 = (struct face **) xrealloc (face_vector,
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
245 newsize * sizeof (struct face *));
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
246 nfaces_allocated = newsize;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
247 }
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
248
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
249 if (empty < 0)
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
250 empty = nfaces++;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
251
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
252 /* Put a new display face in the empty slot. */
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
253 result = copy_face (face);
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
254 face_vector[empty] = result;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
255
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
256 /* Make a graphics context for it. */
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
257 build_face (f, result);
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
258
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
259 return result;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
260 }
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
261
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
262 /* Given a frame face, return an equivalent display face
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
263 (one which has a graphics context). */
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
264
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
265 struct face *
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
266 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
267 struct frame *f;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
268 struct face *face;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
269 {
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
270 /* If it's equivalent to the default face, use that. */
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
271 if (face_eql (face, FRAME_DEFAULT_FACE (f)))
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
272 {
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
273 if (!FRAME_DEFAULT_FACE (f)->gc)
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
274 build_face (f, FRAME_DEFAULT_FACE (f));
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
275 return FRAME_DEFAULT_FACE (f);
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
276 }
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
277
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
278 /* If it's equivalent to the mode line face, use that. */
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
279 if (face_eql (face, FRAME_MODE_LINE_FACE (f)))
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
280 {
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
281 if (!FRAME_MODE_LINE_FACE (f)->gc)
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
282 build_face (f, FRAME_MODE_LINE_FACE (f));
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
283 return FRAME_MODE_LINE_FACE (f);
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
284 }
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
285
2784
f8c6796b7777 * xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents: 2767
diff changeset
286 /* If it's not one of the frame's default faces, it shouldn't have a GC. */
f8c6796b7777 * xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents: 2767
diff changeset
287 if (face->gc)
f8c6796b7777 * xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents: 2767
diff changeset
288 abort ();
f8c6796b7777 * xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents: 2767
diff changeset
289
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
290 /* Get a specialized display face. */
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
291 return get_cached_face (f, face);
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
292 }
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
293
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
294 /* Clear out face_vector and start anew.
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
295 This should be done from time to time just to avoid
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
296 keeping too many graphics contexts in face_vector
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
297 that are no longer needed. */
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
298
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
299 void
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
300 clear_face_vector ()
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
301 {
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
302 Lisp_Object rest;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
303 Display *dpy = x_current_display;
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
304 int i;
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
305
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
306 BLOCK_INPUT;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
307 /* Free the display faces in the face_vector. */
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
308 for (i = 0; i < nfaces; i++)
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
309 {
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
310 struct face *face = face_vector[i];
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
311 if (face->gc)
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
312 XFreeGC (dpy, face->gc);
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
313 xfree (face);
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
314 }
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
315 nfaces = 0;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
316
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
317 UNBLOCK_INPUT;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
318 }
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
319
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
320 /* Allocating and freeing X resources for display faces. */
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
321
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
322 /* Make a graphics context for face FACE, which is on frame F,
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
323 if that can be done. */
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
324 static void
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
325 build_face (f, face)
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
326 struct frame *f;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
327 struct face *face;
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
328 {
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
329 GC gc;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
330 XGCValues xgcv;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
331 unsigned long mask;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
332
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
333 BLOCK_INPUT;
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
334
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
335 if (face->foreground != FACE_DEFAULT)
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
336 xgcv.foreground = face->foreground;
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
337 else
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
338 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
339
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
340 if (face->background != FACE_DEFAULT)
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
341 xgcv.background = face->background;
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
342 else
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
343 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
344
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
345 if (face->font && (int) face->font != FACE_DEFAULT)
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
346 xgcv.font = face->font->fid;
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
347 else
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
348 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
349
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
350 xgcv.graphics_exposures = 0;
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
351
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
352 mask = GCForeground | GCBackground | GCFont | GCGraphicsExposures;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
353 gc = XCreateGC (x_current_display, FRAME_X_WINDOW (f),
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
354 mask, &xgcv);
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
355
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
356 #if 0
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
357 if (face->stipple && face->stipple != FACE_DEFAULT)
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
358 XSetStipple (x_current_display, gc, face->stipple);
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
359 #endif
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
360
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
361 face->gc = gc;
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
362
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
363 UNBLOCK_INPUT;
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
364 }
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
365
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
366 /* Allocating, freeing, and duplicating fonts, colors, and pixmaps. */
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
367
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
368 static XFontStruct *
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
369 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
370 struct frame *f;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
371 Lisp_Object name;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
372 {
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
373 XFontStruct *font;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
374
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
375 if (NILP (name))
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
376 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
377
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
378 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
379 BLOCK_INPUT;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
380 font = XLoadQueryFont (x_current_display, (char *) XSTRING (name)->data);
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
381 UNBLOCK_INPUT;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
382
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
383 if (! font)
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
384 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
385 Fcons (name, Qnil)));
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
386 return font;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
387 }
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
388
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
389 static void
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
390 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
391 struct frame *f;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
392 XFontStruct *font;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
393 {
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
394 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
395 return;
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
396
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
397 BLOCK_INPUT;
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
398 XFreeFont (x_current_display, font);
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
399 UNBLOCK_INPUT;
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
400 }
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
401
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
402 static unsigned long
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
403 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
404 struct frame *f;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
405 Lisp_Object name;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
406 {
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
407 Display *dpy = x_current_display;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
408 Colormap cmap;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
409 XColor color;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
410 int result;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
411
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
412 if (NILP (name))
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
413 return FACE_DEFAULT;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
414
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
415 cmap = DefaultColormapOfScreen (DefaultScreenOfDisplay (x_current_display));
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
416
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
417 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
418 BLOCK_INPUT;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
419 result = XParseColor (dpy, cmap, (char *) XSTRING (name)->data, &color);
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
420 UNBLOCK_INPUT;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
421 if (! result)
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
422 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
423 Fcons (name, Qnil)));
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
424 BLOCK_INPUT;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
425 result = XAllocColor (dpy, cmap, &color);
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
426 UNBLOCK_INPUT;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
427 if (! result)
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
428 Fsignal (Qerror, Fcons (build_string ("X server cannot allocate color"),
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
429 Fcons (name, Qnil)));
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
430 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
431 }
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
432
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
433 static void
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
434 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
435 struct frame *f;
3316
9857db8aa4cd * xfaces.c (unload_color): Don't #include <X11/Intrinsic.h>,
Jim Blandy <jimb@redhat.com>
parents: 3302
diff changeset
436 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
437 {
3065
fff06093b756 * xfns.c (Fx_list_fonts): New function.
Jim Blandy <jimb@redhat.com>
parents: 2998
diff changeset
438 /* Since faces get built by copying parameters from other faces, the
fff06093b756 * xfns.c (Fx_list_fonts): New function.
Jim Blandy <jimb@redhat.com>
parents: 2998
diff changeset
439 allocation counts for the colors get all screwed up. I don't see
fff06093b756 * xfns.c (Fx_list_fonts): New function.
Jim Blandy <jimb@redhat.com>
parents: 2998
diff changeset
440 any solution that will take less than 10 minutes, and it's better
fff06093b756 * xfns.c (Fx_list_fonts): New function.
Jim Blandy <jimb@redhat.com>
parents: 2998
diff changeset
441 to have a color leak than a crash, so I'm just dyking this out.
fff06093b756 * xfns.c (Fx_list_fonts): New function.
Jim Blandy <jimb@redhat.com>
parents: 2998
diff changeset
442 This isn't really a color leak, anyway - if we ask for it again,
fff06093b756 * xfns.c (Fx_list_fonts): New function.
Jim Blandy <jimb@redhat.com>
parents: 2998
diff changeset
443 we'll get the same pixel. */
fff06093b756 * xfns.c (Fx_list_fonts): New function.
Jim Blandy <jimb@redhat.com>
parents: 2998
diff changeset
444 #if 0
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
445 Colormap cmap;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
446 Display *dpy = x_current_display;
2818
d1cfc6cbdbf7 * xfaces.c (unload_color): Don't try to unload the standard black
Jim Blandy <jimb@redhat.com>
parents: 2795
diff changeset
447 if (pixel == FACE_DEFAULT
d1cfc6cbdbf7 * xfaces.c (unload_color): Don't try to unload the standard black
Jim Blandy <jimb@redhat.com>
parents: 2795
diff changeset
448 || pixel == BLACK_PIX_DEFAULT
d1cfc6cbdbf7 * xfaces.c (unload_color): Don't try to unload the standard black
Jim Blandy <jimb@redhat.com>
parents: 2795
diff changeset
449 || pixel == WHITE_PIX_DEFAULT)
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
450 return;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
451 cmap = DefaultColormapOfScreen (DefaultScreenOfDisplay (x_current_display));
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
452 BLOCK_INPUT;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
453 XFreeColors (dpy, cmap, &pixel, 1, 0);
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
454 UNBLOCK_INPUT;
3065
fff06093b756 * xfns.c (Fx_list_fonts): New function.
Jim Blandy <jimb@redhat.com>
parents: 2998
diff changeset
455 #endif
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
456 }
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
457
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
458 /* Initializing face arrays for frames. */
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
459
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
460 void
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
461 init_frame_faces (f)
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
462 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
463 {
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
464 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
465 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
466
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
467 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
468
3583
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
469 /* Find another X frame. */
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
470 {
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
471 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
472
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
473 result = Qnil;
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
474 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
475 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
476 && XFRAME (frame) != f)
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
477 {
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
478 result = frame;
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
479 break;
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
480 }
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
481
3583
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
482 /* 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
483 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
484 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
485 on this new frame. */
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
486 if (FRAMEP (result))
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
487 {
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
488 int i;
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
489 int n_faces = XFRAME (result)->display.x->n_faces;
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
490 struct face **faces = XFRAME (result)->display.x->faces;
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
491
3583
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
492 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
493 if (faces[i])
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
494 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
495 }
0bc9838eb0bb * xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents: 3528
diff changeset
496 }
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
497 }
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
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
500 /* Called from Fdelete_frame. */
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
501 void
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
502 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
503 struct frame *f;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
504 {
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
505 Display *dpy = x_current_display;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
506 int i;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
507
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
508 BLOCK_INPUT;
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
509
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
510 for (i = 0; i < FRAME_N_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
511 {
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
512 struct face *face = FRAME_FACES (f) [i];
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
513 if (face)
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
514 {
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
515 if (face->gc)
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
516 XFreeGC (dpy, face->gc);
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
517 if (! face->copy)
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
518 {
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
519 unload_font (f, face->font);
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
520 unload_color (f, face->foreground);
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
521 unload_color (f, face->background);
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
522 #if 0
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
523 unload_pixmap (f, face->stipple);
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
524 #endif
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
525 }
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
526 xfree (face);
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
527 }
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
528 }
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
529 xfree (FRAME_FACES (f));
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
530 FRAME_FACES (f) = 0;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
531 FRAME_N_FACES (f) = 0;
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
532
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
533 UNBLOCK_INPUT;
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
534 }
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
535
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
536 /* 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
537
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
538 /* Find a match for NEW_FACE in a FRAME's face array, and add it if we don't
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
539 find one. */
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
540 static int
2767
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
541 intern_frame_face (frame, new_face)
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
542 struct frame *frame;
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
543 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
544 {
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
545 int len = FRAME_N_FACES (frame);
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
546 int i;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
547
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
548 /* Search for a face already on FRAME equivalent to FACE. */
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
549 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
550 {
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
551 struct face *frame_face = FRAME_FACES (frame)[i];
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
552
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
553 if (frame_face && face_eql (new_face, frame_face))
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
554 return i;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
555 }
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
556
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
557 /* We didn't find one; add a new one. */
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
558 i = next_face_id++;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
559
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
560 ensure_face_ready (frame, i);
2784
f8c6796b7777 * xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents: 2767
diff changeset
561 bcopy (new_face, FRAME_FACES (frame)[i], sizeof (*new_face));
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
562 FRAME_FACES (frame)[i]->copy = 1;
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
563
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
564 return i;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
565 }
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
566
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
567 /* Make face id ID valid on frame F. */
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
568
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
569 static void
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
570 ensure_face_ready (f, id)
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
571 struct frame *f;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
572 int id;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
573 {
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
574 if (FRAME_N_FACES (f) <= id)
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
575 {
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
576 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
577 int i;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
578 if (!FRAME_N_FACES (f))
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
579 FRAME_FACES (f)
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
580 = (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
581 else
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
582 FRAME_FACES (f)
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
583 = (struct face **) xrealloc (FRAME_FACES (f),
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
584 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
585
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
586 bzero (FRAME_FACES (f) + FRAME_N_FACES (f),
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
587 (n - FRAME_N_FACES (f)) * sizeof (struct face *));
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
588 FRAME_N_FACES (f) = n;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
589 }
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
590
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
591 if (FRAME_FACES (f) [id] == 0)
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
592 FRAME_FACES (f) [id] = allocate_face ();
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
593 }
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
594
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
595 /* Computing faces appropriate for a given piece of text in a buffer. */
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
596
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
597 /* Return non-zero if FONT1 and FONT2 have the same size bounding box.
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
598 We assume that they're both character-cell fonts. */
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
599 int
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
600 same_size_fonts (font1, font2)
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
601 XFontStruct *font1, *font2;
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
602 {
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
603 XCharStruct *bounds1 = &font1->min_bounds;
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
604 XCharStruct *bounds2 = &font2->min_bounds;
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
605
3528
aad9fd004281 (same_size_fonts): Compare only the width.
Richard M. Stallman <rms@gnu.org>
parents: 3436
diff changeset
606 return (bounds1->width == bounds2->width);
aad9fd004281 (same_size_fonts): Compare only the width.
Richard M. Stallman <rms@gnu.org>
parents: 3436
diff changeset
607 /* Checking the following caused bad results in some cases
aad9fd004281 (same_size_fonts): Compare only the width.
Richard M. Stallman <rms@gnu.org>
parents: 3436
diff changeset
608 when fonts that should be the same size
aad9fd004281 (same_size_fonts): Compare only the width.
Richard M. Stallman <rms@gnu.org>
parents: 3436
diff changeset
609 actually have very slightly different size.
aad9fd004281 (same_size_fonts): Compare only the width.
Richard M. Stallman <rms@gnu.org>
parents: 3436
diff changeset
610 It is possible that this reintroduces the bug whereby line positions
aad9fd004281 (same_size_fonts): Compare only the width.
Richard M. Stallman <rms@gnu.org>
parents: 3436
diff changeset
611 were not right. However, the right way to fix that is to change xterm.c
aad9fd004281 (same_size_fonts): Compare only the width.
Richard M. Stallman <rms@gnu.org>
parents: 3436
diff changeset
612 so that the vertical positions of lines
aad9fd004281 (same_size_fonts): Compare only the width.
Richard M. Stallman <rms@gnu.org>
parents: 3436
diff changeset
613 depend only on the height of the frame's font.
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
614 && bounds1->ascent == bounds2->ascent
3528
aad9fd004281 (same_size_fonts): Compare only the width.
Richard M. Stallman <rms@gnu.org>
parents: 3436
diff changeset
615 && bounds1->descent == bounds2->descent); */
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
616 }
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
617
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
618 /* Modify face TO by copying from FROM all properties which have
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
619 nondefault settings. */
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
620 static void
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
621 merge_faces (from, to)
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
622 struct face *from, *to;
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
623 {
2883
b8a3b11892dc Make sure that all the display faces use fonts of the
Jim Blandy <jimb@redhat.com>
parents: 2875
diff changeset
624 /* Only merge the font if it's the same size as the base font. */
b8a3b11892dc Make sure that all the display faces use fonts of the
Jim Blandy <jimb@redhat.com>
parents: 2875
diff changeset
625 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
626 && 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
627 to->font = from->font;
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
628 if (from->foreground != FACE_DEFAULT)
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
629 to->foreground = from->foreground;
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
630 if (from->background != FACE_DEFAULT)
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
631 to->background = from->background;
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
632 if (from->stipple != FACE_DEFAULT)
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
633 to->stipple = from->stipple;
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
634 if (from->underline)
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
635 to->underline = from->underline;
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
636 }
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
637
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
638 /* 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
639 data; all faces are deltas applied to this. */
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
640 static void
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
641 compute_base_face (f, face)
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
642 FRAME_PTR f;
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
643 struct face *face;
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
644 {
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
645 struct x_display *d = f->display.x;
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
646
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
647 face->gc = 0;
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
648 face->foreground = d->foreground_pixel;
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
649 face->background = d->background_pixel;
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
650 face->font = d->font;
3811
48b1ef149180 * xfaces.c (compute_base_face): Initialize the face's stipple.
Jim Blandy <jimb@redhat.com>
parents: 3583
diff changeset
651 face->stipple = 0;
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
652 face->underline = 0;
3811
48b1ef149180 * xfaces.c (compute_base_face): Initialize the face's stipple.
Jim Blandy <jimb@redhat.com>
parents: 3583
diff changeset
653
48b1ef149180 * xfaces.c (compute_base_face): Initialize the face's stipple.
Jim Blandy <jimb@redhat.com>
parents: 3583
diff changeset
654 /* Avoid a face comparison by making this invalid. */
48b1ef149180 * xfaces.c (compute_base_face): Initialize the face's stipple.
Jim Blandy <jimb@redhat.com>
parents: 3583
diff changeset
655 face->cached_index = -1;
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
656 }
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
657
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
658
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
659 struct sortvec
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
660 {
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
661 Lisp_Object overlay;
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
662 int beg, end;
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
663 int priority;
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
664 };
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
665
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
666 static int
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
667 sort_overlays (s1, s2)
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
668 struct sortvec *s1, *s2;
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 if (s1->priority != s2->priority)
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
671 return s1->priority - s2->priority;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
672 if (s1->beg != s2->beg)
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
673 return s1->beg - s2->beg;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
674 if (s1->end != s2->end)
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
675 return s2->end - s1->end;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
676 return 0;
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
677 }
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
678
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
679 /* Return the face ID associated with a buffer position POS.
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
680 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
681 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
682 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
683 the current buffer.
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
684
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
685 REGION_BEG, REGION_END delimit the region, so it can be highlighted. */
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
686
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
687 int
2795
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
688 compute_char_face (f, w, pos, region_beg, region_end, endptr)
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
689 struct frame *f;
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
690 struct window *w;
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
691 int pos;
2795
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
692 int region_beg, region_end;
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
693 int *endptr;
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
694 {
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
695 struct face face;
2767
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
696 Lisp_Object prop, position;
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
697 int i, j, noverlays;
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
698 int facecode;
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
699 Lisp_Object *overlay_vec;
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
700 struct sortvec *sortvec;
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
701 Lisp_Object frame;
2784
f8c6796b7777 * xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents: 2767
diff changeset
702 int endpos;
f8c6796b7777 * xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents: 2767
diff changeset
703
f8c6796b7777 * xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents: 2767
diff changeset
704 /* 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
705 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
706 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
707 abort ();
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
708
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
709 XSET (frame, Lisp_Frame, f);
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
710
2784
f8c6796b7777 * xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents: 2767
diff changeset
711 endpos = ZV;
2795
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
712 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
713 endpos = region_beg;
2784
f8c6796b7777 * xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents: 2767
diff changeset
714
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
715 XFASTINT (position) = pos;
2767
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
716 prop = Fget_text_property (position, Qface, w->buffer);
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
717 {
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
718 Lisp_Object end;
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
719
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
720 end = Fnext_single_property_change (position, Qface, w->buffer);
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
721 if (INTEGERP (end))
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
722 endpos = XINT (end);
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
723 }
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
724
2767
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
725 {
2784
f8c6796b7777 * xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents: 2767
diff changeset
726 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
727 int len;
2767
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
728
2838
5f6a2d52d2ef (compute_char_face): Pass 0 as EXTEND arg to overlays_at.
Richard M. Stallman <rms@gnu.org>
parents: 2821
diff changeset
729 /* 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
730 len = 40;
5f6a2d52d2ef (compute_char_face): Pass 0 as EXTEND arg to overlays_at.
Richard M. Stallman <rms@gnu.org>
parents: 2821
diff changeset
731 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
732
5f6a2d52d2ef (compute_char_face): Pass 0 as EXTEND arg to overlays_at.
Richard M. Stallman <rms@gnu.org>
parents: 2821
diff changeset
733 noverlays = overlays_at (pos, 0, &overlay_vec, &len, &next_overlay);
5f6a2d52d2ef (compute_char_face): Pass 0 as EXTEND arg to overlays_at.
Richard M. Stallman <rms@gnu.org>
parents: 2821
diff changeset
734
5f6a2d52d2ef (compute_char_face): Pass 0 as EXTEND arg to overlays_at.
Richard M. Stallman <rms@gnu.org>
parents: 2821
diff changeset
735 /* 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
736 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
737 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
738 {
5f6a2d52d2ef (compute_char_face): Pass 0 as EXTEND arg to overlays_at.
Richard M. Stallman <rms@gnu.org>
parents: 2821
diff changeset
739 len = noverlays;
5f6a2d52d2ef (compute_char_face): Pass 0 as EXTEND arg to overlays_at.
Richard M. Stallman <rms@gnu.org>
parents: 2821
diff changeset
740 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
741 noverlays = overlays_at (pos, 0, &overlay_vec, &len, &next_overlay);
5f6a2d52d2ef (compute_char_face): Pass 0 as EXTEND arg to overlays_at.
Richard M. Stallman <rms@gnu.org>
parents: 2821
diff changeset
742 }
5f6a2d52d2ef (compute_char_face): Pass 0 as EXTEND arg to overlays_at.
Richard M. Stallman <rms@gnu.org>
parents: 2821
diff changeset
743
2784
f8c6796b7777 * xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents: 2767
diff changeset
744 if (next_overlay < endpos)
f8c6796b7777 * xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents: 2767
diff changeset
745 endpos = next_overlay;
2767
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
746 }
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
747
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
748 *endptr = endpos;
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
749
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
750 /* 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
751 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
752 && !(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
753 return 0;
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
754
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
755 compute_base_face (f, &face);
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
756
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
757 if (!NILP (prop))
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
758 {
3065
fff06093b756 * xfns.c (Fx_list_fonts): New function.
Jim Blandy <jimb@redhat.com>
parents: 2998
diff changeset
759 facecode = face_name_id_number (f, prop);
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
760 if (facecode >= 0 && facecode < FRAME_N_FACES (f)
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
761 && FRAME_FACES (f) [facecode] != 0)
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
762 merge_faces (FRAME_FACES (f) [facecode], &face);
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
763 }
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
764
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
765 /* Put the valid and relevant overlays into sortvec. */
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
766 sortvec = (struct sortvec *) alloca (noverlays * sizeof (struct sortvec));
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
767
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
768 for (i = 0, j = 0; i < noverlays; i++)
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
769 {
2767
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
770 Lisp_Object overlay = overlay_vec[i];
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
771
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
772 if (OVERLAY_VALID (overlay)
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
773 && OVERLAY_POSITION (OVERLAY_START (overlay)) > 0
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
774 && OVERLAY_POSITION (OVERLAY_END (overlay)) > 0)
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
775 {
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
776 Lisp_Object window;
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
777 window = Foverlay_get (overlay, Qwindow);
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
778
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
779 /* Also ignore overlays limited to one window
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
780 if it's not the window we are using. */
2784
f8c6796b7777 * xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents: 2767
diff changeset
781 if (XTYPE (window) != Lisp_Window
f8c6796b7777 * xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents: 2767
diff changeset
782 || XWINDOW (window) == w)
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
783 {
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
784 Lisp_Object tem;
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
785
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
786 /* This overlay is good and counts:
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
787 put it in sortvec. */
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
788 sortvec[j].overlay = overlay;
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
789 sortvec[j].beg = OVERLAY_POSITION (OVERLAY_START (overlay));
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
790 sortvec[j].end = OVERLAY_POSITION (OVERLAY_END (overlay));
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
791 tem = Foverlay_get (overlay, Qpriority);
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
792 if (INTEGERP (tem))
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
793 sortvec[j].priority = XINT (tem);
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
794 else
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
795 sortvec[j].priority = 0;
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
796 j++;
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
797 }
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
798 }
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
799 }
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
800 noverlays = j;
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
801
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
802 /* Sort the overlays into the proper order: increasing priority. */
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
803
2795
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
804 if (noverlays > 1)
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
805 qsort (sortvec, noverlays, sizeof (struct sortvec), sort_overlays);
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
806
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
807 /* Now merge the overlay data in that order. */
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
808 for (i = 0; i < noverlays; i++)
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
809 {
2784
f8c6796b7777 * xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents: 2767
diff changeset
810 prop = Foverlay_get (sortvec[i].overlay, Qface);
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
811 if (!NILP (prop))
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
812 {
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
813 Lisp_Object oend;
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
814 int oendpos;
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
815
3065
fff06093b756 * xfns.c (Fx_list_fonts): New function.
Jim Blandy <jimb@redhat.com>
parents: 2998
diff changeset
816 facecode = face_name_id_number (f, prop);
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
817 if (facecode >= 0 && facecode < FRAME_N_FACES (f)
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
818 && FRAME_FACES (f) [facecode] != 0)
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
819 merge_faces (FRAME_FACES (f) [facecode], &face);
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
820
2784
f8c6796b7777 * xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents: 2767
diff changeset
821 oend = OVERLAY_END (sortvec[i].overlay);
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
822 oendpos = OVERLAY_POSITION (oend);
2784
f8c6796b7777 * xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents: 2767
diff changeset
823 if (oendpos < endpos)
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
824 endpos = oendpos;
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
825 }
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
826 }
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
827
2795
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
828 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
829 {
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
830 if (region_end < endpos)
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
831 endpos = region_end;
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
832 if (region_face >= 0 && region_face < next_face_id)
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
833 merge_faces (FRAME_FACES (f) [region_face], &face);
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
834 }
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
835
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
836 *endptr = endpos;
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
837
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
838 return intern_frame_face (f, &face);
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
839 }
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
840
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
841 /* Return the face ID to use to display a special glyph which selects
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
842 FACE_CODE as the face ID, assuming that ordinarily the face would
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
843 be BASIC_FACE. F is the frame. */
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
844 int
2743
ddc49d5eee56 * xdisp.c (display_text_line): We can't use the FRAME_DEFAULT_FACE
Jim Blandy <jimb@redhat.com>
parents: 2730
diff changeset
845 compute_glyph_face (f, face_code)
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
846 struct frame *f;
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
847 int face_code;
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
848 {
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
849 struct face face;
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
850
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
851 compute_base_face (f, &face);
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
852
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
853 if (face_code >= 0 && face_code < FRAME_N_FACES (f)
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
854 && FRAME_FACES (f) [face_code] != 0)
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
855 merge_faces (FRAME_FACES (f) [face_code], &face);
2342
f881f2936eec *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2336
diff changeset
856
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
857 return intern_frame_face (f, &face);
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
858 }
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
859
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
860
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
861 /* 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
862 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
863 depend. */
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
864 void
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
865 recompute_basic_faces (f)
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
866 FRAME_PTR f;
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
867 {
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
868 /* 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
869 this stuff. */
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
870 if (FRAME_N_FACES (f) < 2)
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
871 return;
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
872
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
873 BLOCK_INPUT;
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
874
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
875 if (FRAME_DEFAULT_FACE (f)->gc)
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
876 XFreeGC (x_current_display, FRAME_DEFAULT_FACE (f)->gc);
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
877 build_face (f, FRAME_DEFAULT_FACE (f));
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
878
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
879 if (FRAME_MODE_LINE_FACE (f)->gc)
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
880 XFreeGC (x_current_display, FRAME_MODE_LINE_FACE (f)->gc);
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
881 build_face (f, FRAME_MODE_LINE_FACE (f));
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
882
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
883 UNBLOCK_INPUT;
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
884 }
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
885
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
886
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
887
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
888 /* Lisp interface. */
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
889
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
890 DEFUN ("frame-face-alist", Fframe_face_alist, Sframe_face_alist, 1, 1, 0,
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
891 "")
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
892 (frame)
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
893 Lisp_Object frame;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
894 {
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
895 CHECK_FRAME (frame, 0);
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
896 return XFRAME (frame)->face_alist;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
897 }
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
898
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
899 DEFUN ("set-frame-face-alist", Fset_frame_face_alist, Sset_frame_face_alist,
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
900 2, 2, 0, "")
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
901 (frame, value)
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
902 Lisp_Object frame, value;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
903 {
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
904 CHECK_FRAME (frame, 0);
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
905 XFRAME (frame)->face_alist = value;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
906 return value;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
907 }
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
908
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
909
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
910 DEFUN ("make-face-internal", Fmake_face_internal, Smake_face_internal, 1, 1, 0,
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
911 "Create face number FACE-ID on all frames.")
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
912 (face_id)
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
913 Lisp_Object face_id;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
914 {
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
915 Lisp_Object rest;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
916 int id = XINT (face_id);
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
917
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
918 CHECK_NUMBER (face_id, 0);
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
919 if (id < 0 || id >= next_face_id)
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
920 error ("Face id out of range");
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
921
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
922 for (rest = Vframe_list; !NILP (rest); rest = XCONS (rest)->cdr)
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
923 {
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
924 struct frame *f = XFRAME (XCONS (rest)->car);
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
925 if (FRAME_X_P (f))
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
926 ensure_face_ready (f, id);
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
927 }
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
928 return Qnil;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
929 }
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
930
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
931
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
932 DEFUN ("set-face-attribute-internal", Fset_face_attribute_internal,
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
933 Sset_face_attribute_internal, 4, 4, 0, "")
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
934 (face_id, attr_name, attr_value, frame)
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
935 Lisp_Object face_id, attr_name, attr_value, frame;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
936 {
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
937 struct face *face;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
938 struct frame *f;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
939 int magic_p;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
940 int id;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
941
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
942 CHECK_FRAME (frame, 0);
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
943 CHECK_NUMBER (face_id, 0);
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
944 CHECK_SYMBOL (attr_name, 0);
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
945
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
946 f = XFRAME (frame);
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
947 id = XINT (face_id);
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
948 if (id < 0 || id >= next_face_id)
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
949 error ("Face id out of range");
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
950
2767
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
951 if (! FRAME_X_P (f))
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
952 return;
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
953
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
954 ensure_face_ready (f, id);
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
955 face = FRAME_FACES (f) [XFASTINT (face_id)];
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
956
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
957 if (EQ (attr_name, intern ("font")))
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
958 {
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
959 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
960 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
961 unload_font (f, face->font);
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
962 face->font = font;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
963 }
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
964 else if (EQ (attr_name, intern ("foreground")))
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
965 {
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
966 unsigned long new_color = load_color (f, attr_value);
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
967 unload_color (f, face->foreground);
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
968 face->foreground = new_color;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
969 }
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
970 else if (EQ (attr_name, intern ("background")))
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
971 {
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
972 unsigned long new_color = load_color (f, attr_value);
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
973 unload_color (f, face->background);
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
974 face->background = new_color;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
975 }
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
976 #if 0
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
977 else if (EQ (attr_name, intern ("background-pixmap")))
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
978 {
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
979 unsigned int w, h, d;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
980 unsigned long new_pixmap = load_pixmap (f, attr_value, &w, &h, &d, 0);
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
981 unload_pixmap (f, face->stipple);
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
982 if (NILP (attr_value))
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
983 new_pixmap = 0;
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
984 face->stipple = new_pixmap;
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
985 face->pixmap_w = w;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
986 face->pixmap_h = h;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
987 /* face->pixmap_depth = d; */
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
988 }
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
989 #endif /* 0 */
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
990 else if (EQ (attr_name, intern ("underline")))
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
991 {
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
992 int new = !NILP (attr_value);
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
993 face->underline = new;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
994 }
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
995 else
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
996 error ("unknown face attribute");
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
997
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
998 if (id == 0)
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
999 {
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1000 BLOCK_INPUT;
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
1001 if (FRAME_DEFAULT_FACE (f)->gc != 0)
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1002 XFreeGC (x_current_display, FRAME_DEFAULT_FACE (f)->gc);
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1003 build_face (f, FRAME_DEFAULT_FACE (f));
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1004 UNBLOCK_INPUT;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1005 }
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1006
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1007 if (id == 1)
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1008 {
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1009 BLOCK_INPUT;
3074
96b4623fdeb3 * xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents: 3065
diff changeset
1010 if (FRAME_MODE_LINE_FACE (f)->gc != 0)
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1011 XFreeGC (x_current_display, FRAME_MODE_LINE_FACE (f)->gc);
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1012 build_face (f, FRAME_MODE_LINE_FACE (f));
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1013 UNBLOCK_INPUT;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1014 }
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1015
2821
95010b414003 * xfaces.c (Fset_face_attribute_internal): Jolt redisplay, so it
Jim Blandy <jimb@redhat.com>
parents: 2818
diff changeset
1016 /* If we're modifying either of the frame's display faces, that
95010b414003 * xfaces.c (Fset_face_attribute_internal): Jolt redisplay, so it
Jim Blandy <jimb@redhat.com>
parents: 2818
diff changeset
1017 means that we're changing the parameters of a fixed face code;
95010b414003 * xfaces.c (Fset_face_attribute_internal): Jolt redisplay, so it
Jim Blandy <jimb@redhat.com>
parents: 2818
diff changeset
1018 since the color/font/whatever is changed but the face ID hasn't,
95010b414003 * xfaces.c (Fset_face_attribute_internal): Jolt redisplay, so it
Jim Blandy <jimb@redhat.com>
parents: 2818
diff changeset
1019 redisplay won't know to redraw the affected sections. Give it a
95010b414003 * xfaces.c (Fset_face_attribute_internal): Jolt redisplay, so it
Jim Blandy <jimb@redhat.com>
parents: 2818
diff changeset
1020 kick. */
95010b414003 * xfaces.c (Fset_face_attribute_internal): Jolt redisplay, so it
Jim Blandy <jimb@redhat.com>
parents: 2818
diff changeset
1021 if (id == 0 || id == 1)
95010b414003 * xfaces.c (Fset_face_attribute_internal): Jolt redisplay, so it
Jim Blandy <jimb@redhat.com>
parents: 2818
diff changeset
1022 SET_FRAME_GARBAGED (f);
95010b414003 * xfaces.c (Fset_face_attribute_internal): Jolt redisplay, so it
Jim Blandy <jimb@redhat.com>
parents: 2818
diff changeset
1023 else
95010b414003 * xfaces.c (Fset_face_attribute_internal): Jolt redisplay, so it
Jim Blandy <jimb@redhat.com>
parents: 2818
diff changeset
1024 /* Otherwise, it's enough to tell it to redisplay the text. */
95010b414003 * xfaces.c (Fset_face_attribute_internal): Jolt redisplay, so it
Jim Blandy <jimb@redhat.com>
parents: 2818
diff changeset
1025 windows_or_buffers_changed = 1;
95010b414003 * xfaces.c (Fset_face_attribute_internal): Jolt redisplay, so it
Jim Blandy <jimb@redhat.com>
parents: 2818
diff changeset
1026
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1027 return Qnil;
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1028 }
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1029
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1030 DEFUN ("internal-next-face-id", Finternal_next_face_id, Sinternal_next_face_id,
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1031 0, 0, 0, "")
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1032 ()
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1033 {
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1034 return make_number (next_face_id++);
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1035 }
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1036
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1037 /* Return the face id for name NAME on frame FRAME.
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1038 (It should be the same for all frames,
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1039 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
1040 as to use any other one.) */
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1041
3065
fff06093b756 * xfns.c (Fx_list_fonts): New function.
Jim Blandy <jimb@redhat.com>
parents: 2998
diff changeset
1042 int
fff06093b756 * xfns.c (Fx_list_fonts): New function.
Jim Blandy <jimb@redhat.com>
parents: 2998
diff changeset
1043 face_name_id_number (f, name)
fff06093b756 * xfns.c (Fx_list_fonts): New function.
Jim Blandy <jimb@redhat.com>
parents: 2998
diff changeset
1044 FRAME_PTR f;
fff06093b756 * xfns.c (Fx_list_fonts): New function.
Jim Blandy <jimb@redhat.com>
parents: 2998
diff changeset
1045 Lisp_Object name;
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1046 {
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1047 Lisp_Object tem;
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1048
3065
fff06093b756 * xfns.c (Fx_list_fonts): New function.
Jim Blandy <jimb@redhat.com>
parents: 2998
diff changeset
1049 tem = Fcdr (Fassq (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
1050 if (NILP (tem))
482fa0725db6 * xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents: 2743
diff changeset
1051 return 0;
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1052 CHECK_VECTOR (tem, 0);
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1053 tem = XVECTOR (tem)->contents[2];
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1054 CHECK_NUMBER (tem, 0);
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1055 return XINT (tem);
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1056 }
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1057
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
1058 /* Emacs initialization. */
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
1059
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1060 void
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1061 syms_of_xfaces ()
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1062 {
2391
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1063 Qwindow = intern ("window");
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1064 staticpro (&Qwindow);
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1065 Qface = intern ("face");
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1066 staticpro (&Qface);
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1067 Qpriority = intern ("priority");
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1068 staticpro (&Qpriority);
226dcdb8ab67 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2342
diff changeset
1069
2795
e97e96fb0cb8 (compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents: 2784
diff changeset
1070 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
1071 "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
1072 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
1073 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
1074
2336
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1075 defsubr (&Sframe_face_alist);
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1076 defsubr (&Sset_frame_face_alist);
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1077 defsubr (&Smake_face_internal);
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1078 defsubr (&Sset_face_attribute_internal);
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1079 defsubr (&Sinternal_next_face_id);
7aaafd275bec Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1080 }
2730
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
1081
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
1082 #endif /* HAVE_X_WINDOWS */
139740855fa6 * xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents: 2538
diff changeset
1083