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