Mercurial > emacs
annotate src/xfaces.c @ 5897:5a68abc8f1f9
(free_frame_menubar) [USE_X_TOOLKIT]. New function to destroy the X Widget
instance of the menubar.
author | Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr> |
---|---|
date | Fri, 11 Feb 1994 13:19:19 +0000 |
parents | 021e58905963 |
children | 96ddf85642d1 |
rev | line source |
---|---|
2730
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
1 /* "Face" primitives. |
2961 | 2 Copyright (C) 1993 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 | |
5858
021e58905963
(compute_char_face): Extract overlay-sorting code as a separate function,
Karl Heuer <kwzh@gnu.org>
parents:
5801
diff
changeset
|
173 Lisp_Object Qface; |
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)) | |
251 return face_vector[i]; | |
252 if (face_vector[i] == 0) | |
253 empty = i; | |
254 } | |
255 | |
256 /* If no empty slots, make one. */ | |
257 if (empty < 0 && nfaces == nfaces_allocated) | |
258 { | |
259 int newsize = nfaces + 20; | |
260 face_vector | |
261 = (struct face **) xrealloc (face_vector, | |
262 newsize * sizeof (struct face *)); | |
263 nfaces_allocated = newsize; | |
264 } | |
265 | |
266 if (empty < 0) | |
267 empty = nfaces++; | |
268 | |
269 /* Put a new display face in the empty slot. */ | |
270 result = copy_face (face); | |
271 face_vector[empty] = result; | |
272 | |
273 /* Make a graphics context for it. */ | |
274 build_face (f, result); | |
275 | |
276 return result; | |
277 } | |
278 | |
3882
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
279 /* 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
|
280 (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
|
281 |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
282 struct face * |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
283 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
|
284 struct frame *f; |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
285 struct face *face; |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
286 { |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
287 /* 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
|
288 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
|
289 { |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
290 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
|
291 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
|
292 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
|
293 } |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
294 |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
295 /* 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
|
296 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
|
297 { |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
298 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
|
299 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
|
300 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
|
301 } |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
302 |
2784
f8c6796b7777
* xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents:
2767
diff
changeset
|
303 /* 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
|
304 if (face->gc) |
f8c6796b7777
* xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents:
2767
diff
changeset
|
305 abort (); |
f8c6796b7777
* xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents:
2767
diff
changeset
|
306 |
2730
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
307 /* 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
|
308 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
|
309 } |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
310 |
2336 | 311 /* Clear out face_vector and start anew. |
312 This should be done from time to time just to avoid | |
313 keeping too many graphics contexts in face_vector | |
314 that are no longer needed. */ | |
315 | |
316 void | |
317 clear_face_vector () | |
318 { | |
319 Lisp_Object rest; | |
320 Display *dpy = x_current_display; | |
2391 | 321 int i; |
2336 | 322 |
323 BLOCK_INPUT; | |
324 /* Free the display faces in the face_vector. */ | |
325 for (i = 0; i < nfaces; i++) | |
326 { | |
327 struct face *face = face_vector[i]; | |
2391 | 328 if (face->gc) |
329 XFreeGC (dpy, face->gc); | |
2336 | 330 xfree (face); |
331 } | |
332 nfaces = 0; | |
333 | |
334 UNBLOCK_INPUT; | |
335 } | |
336 | |
2730
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
337 /* 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
|
338 |
2391 | 339 /* Make a graphics context for face FACE, which is on frame F, |
340 if that can be done. */ | |
2336 | 341 static void |
342 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
|
343 struct frame *f; |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
344 struct face *face; |
2336 | 345 { |
346 GC gc; | |
347 XGCValues xgcv; | |
348 unsigned long mask; | |
349 | |
3074
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
350 BLOCK_INPUT; |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
351 |
2391 | 352 if (face->foreground != FACE_DEFAULT) |
353 xgcv.foreground = face->foreground; | |
354 else | |
3074
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
355 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
|
356 |
2391 | 357 if (face->background != FACE_DEFAULT) |
358 xgcv.background = face->background; | |
359 else | |
3074
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
360 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
|
361 |
2391 | 362 if (face->font && (int) face->font != FACE_DEFAULT) |
363 xgcv.font = face->font->fid; | |
364 else | |
365 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
|
366 |
2336 | 367 xgcv.graphics_exposures = 0; |
3074
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
368 |
2336 | 369 mask = GCForeground | GCBackground | GCFont | GCGraphicsExposures; |
370 gc = XCreateGC (x_current_display, FRAME_X_WINDOW (f), | |
371 mask, &xgcv); | |
3074
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
372 |
2336 | 373 #if 0 |
2391 | 374 if (face->stipple && face->stipple != FACE_DEFAULT) |
375 XSetStipple (x_current_display, gc, face->stipple); | |
2336 | 376 #endif |
3074
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
377 |
2391 | 378 face->gc = gc; |
3074
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
379 |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
380 UNBLOCK_INPUT; |
2336 | 381 } |
2730
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
382 |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
383 /* 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
|
384 |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
385 static XFontStruct * |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
386 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
|
387 struct frame *f; |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
388 Lisp_Object name; |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
389 { |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
390 XFontStruct *font; |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
391 |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
392 if (NILP (name)) |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
393 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
|
394 |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
395 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
|
396 BLOCK_INPUT; |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
397 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
|
398 UNBLOCK_INPUT; |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
399 |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
400 if (! font) |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
401 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
|
402 Fcons (name, Qnil))); |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
403 return font; |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
404 } |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
405 |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
406 static void |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
407 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
|
408 struct frame *f; |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
409 XFontStruct *font; |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
410 { |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
411 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
|
412 return; |
3074
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
413 |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
414 BLOCK_INPUT; |
2730
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
415 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
|
416 UNBLOCK_INPUT; |
2730
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
417 } |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
418 |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
419 static unsigned long |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
420 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
|
421 struct frame *f; |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
422 Lisp_Object name; |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
423 { |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
424 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
|
425 Colormap cmap; |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
426 XColor color; |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
427 int result; |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
428 |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
429 if (NILP (name)) |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
430 return FACE_DEFAULT; |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
431 |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
432 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
|
433 |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
434 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
|
435 BLOCK_INPUT; |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
436 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
|
437 UNBLOCK_INPUT; |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
438 if (! result) |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
439 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
|
440 Fcons (name, Qnil))); |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
441 BLOCK_INPUT; |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
442 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
|
443 UNBLOCK_INPUT; |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
444 if (! result) |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
445 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
|
446 Fcons (name, Qnil))); |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
447 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
|
448 } |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
449 |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
450 static void |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
451 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
|
452 struct frame *f; |
3316
9857db8aa4cd
* xfaces.c (unload_color): Don't #include <X11/Intrinsic.h>,
Jim Blandy <jimb@redhat.com>
parents:
3302
diff
changeset
|
453 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
|
454 { |
3065
fff06093b756
* xfns.c (Fx_list_fonts): New function.
Jim Blandy <jimb@redhat.com>
parents:
2998
diff
changeset
|
455 /* 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
|
456 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
|
457 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
|
458 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
|
459 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
|
460 we'll get the same pixel. */ |
fff06093b756
* xfns.c (Fx_list_fonts): New function.
Jim Blandy <jimb@redhat.com>
parents:
2998
diff
changeset
|
461 #if 0 |
2730
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
462 Colormap cmap; |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
463 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
|
464 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
|
465 || 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
|
466 || 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
|
467 return; |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
468 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
|
469 BLOCK_INPUT; |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
470 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
|
471 UNBLOCK_INPUT; |
3065
fff06093b756
* xfns.c (Fx_list_fonts): New function.
Jim Blandy <jimb@redhat.com>
parents:
2998
diff
changeset
|
472 #endif |
2730
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
473 } |
2336 | 474 |
3882
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
475 /* 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
|
476 |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
477 void |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
478 init_frame_faces (f) |
3074
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
479 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
|
480 { |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
481 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
|
482 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
|
483 |
5801
af397aaa8e6b
(init_frame_faces): Clear FRAME_N_COMPUTED_FACES
Richard M. Stallman <rms@gnu.org>
parents:
5084
diff
changeset
|
484 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
|
485 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
|
486 |
3882
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
487 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
|
488 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
|
489 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
|
490 |
3583
0bc9838eb0bb
* xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents:
3528
diff
changeset
|
491 /* Find another X frame. */ |
0bc9838eb0bb
* xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents:
3528
diff
changeset
|
492 { |
0bc9838eb0bb
* xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents:
3528
diff
changeset
|
493 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
|
494 |
0bc9838eb0bb
* xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents:
3528
diff
changeset
|
495 result = Qnil; |
0bc9838eb0bb
* xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents:
3528
diff
changeset
|
496 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
|
497 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
|
498 && XFRAME (frame) != f) |
0bc9838eb0bb
* xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents:
3528
diff
changeset
|
499 { |
0bc9838eb0bb
* xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents:
3528
diff
changeset
|
500 result = frame; |
0bc9838eb0bb
* xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents:
3528
diff
changeset
|
501 break; |
0bc9838eb0bb
* xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents:
3528
diff
changeset
|
502 } |
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
|
503 |
3583
0bc9838eb0bb
* xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents:
3528
diff
changeset
|
504 /* 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
|
505 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
|
506 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
|
507 on this new frame. */ |
0bc9838eb0bb
* xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents:
3528
diff
changeset
|
508 if (FRAMEP (result)) |
0bc9838eb0bb
* xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents:
3528
diff
changeset
|
509 { |
0bc9838eb0bb
* xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents:
3528
diff
changeset
|
510 int i; |
3882
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
511 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
|
512 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
|
513 |
3583
0bc9838eb0bb
* xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents:
3528
diff
changeset
|
514 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
|
515 if (faces[i]) |
0bc9838eb0bb
* xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents:
3528
diff
changeset
|
516 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
|
517 } |
0bc9838eb0bb
* xfaces.c (init_frame_faces): Remove assumption that the selected
Jim Blandy <jimb@redhat.com>
parents:
3528
diff
changeset
|
518 } |
3074
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
519 } |
2730
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
520 |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
521 |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
522 /* 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
|
523 void |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
524 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
|
525 struct frame *f; |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
526 { |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
527 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
|
528 int i; |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
529 |
3074
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
530 BLOCK_INPUT; |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
531 |
3882
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
532 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
|
533 { |
3882
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
534 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
|
535 if (face) |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
536 { |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
537 if (face->gc) |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
538 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
|
539 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
|
540 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
|
541 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
|
542 #if 0 |
3882
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
543 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
|
544 #endif |
3074
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
545 xfree (face); |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
546 } |
2730
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
547 } |
3882
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
548 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
|
549 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
|
550 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
|
551 |
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
552 /* 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
|
553 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
|
554 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
|
555 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
|
556 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
|
557 |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
558 UNBLOCK_INPUT; |
2730
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
559 } |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
560 |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
561 /* 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
|
562 |
3074
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
563 static int |
3882
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
564 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
|
565 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
|
566 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
|
567 { |
3882
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
568 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
|
569 |
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
570 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
|
571 { |
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
572 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
|
573 |
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
574 FRAME_COMPUTED_FACES (f) |
5801
af397aaa8e6b
(init_frame_faces): Clear FRAME_N_COMPUTED_FACES
Richard M. Stallman <rms@gnu.org>
parents:
5084
diff
changeset
|
575 = (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
|
576 ? 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
|
577 : xrealloc (FRAME_COMPUTED_FACES (f), |
af397aaa8e6b
(init_frame_faces): Clear FRAME_N_COMPUTED_FACES
Richard M. Stallman <rms@gnu.org>
parents:
5084
diff
changeset
|
578 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
|
579 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
|
580 } |
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
581 |
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
582 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
|
583 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
|
584 return i; |
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 |
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
587 |
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
588 /* 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
|
589 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
|
590 static int |
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
591 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
|
592 struct frame *f; |
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
593 struct face *new_face; |
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
594 { |
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
595 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
|
596 int i; |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
597 |
3882
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
598 /* 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
|
599 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
|
600 { |
3882
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
601 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
|
602 abort (); |
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
603 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
|
604 return i; |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
605 } |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
606 |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
607 /* 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
|
608 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
|
609 } |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
610 |
3882
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
611 /* 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
|
612 |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
613 static void |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
614 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
|
615 struct frame *f; |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
616 int id; |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
617 { |
3882
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
618 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
|
619 { |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
620 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
|
621 int i; |
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)) |
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
623 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
|
624 = (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
|
625 else |
3882
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
626 FRAME_PARAM_FACES (f) |
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
627 = (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
|
628 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 |
3882
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
630 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
|
631 (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
|
632 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
|
633 } |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
634 |
3882
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
635 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
|
636 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
|
637 } |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
638 |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
639 /* Computing faces appropriate for a given piece of text in a buffer. */ |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
640 |
3074
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
641 /* Return non-zero if FONT1 and FONT2 have the same size bounding box. |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
642 We assume that they're both character-cell fonts. */ |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
643 int |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
644 same_size_fonts (font1, font2) |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
645 XFontStruct *font1, *font2; |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
646 { |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
647 XCharStruct *bounds1 = &font1->min_bounds; |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
648 XCharStruct *bounds2 = &font2->min_bounds; |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
649 |
3528
aad9fd004281
(same_size_fonts): Compare only the width.
Richard M. Stallman <rms@gnu.org>
parents:
3436
diff
changeset
|
650 return (bounds1->width == bounds2->width); |
aad9fd004281
(same_size_fonts): Compare only the width.
Richard M. Stallman <rms@gnu.org>
parents:
3436
diff
changeset
|
651 /* Checking the following caused bad results in some cases |
aad9fd004281
(same_size_fonts): Compare only the width.
Richard M. Stallman <rms@gnu.org>
parents:
3436
diff
changeset
|
652 when fonts that should be the same size |
aad9fd004281
(same_size_fonts): Compare only the width.
Richard M. Stallman <rms@gnu.org>
parents:
3436
diff
changeset
|
653 actually have very slightly different size. |
aad9fd004281
(same_size_fonts): Compare only the width.
Richard M. Stallman <rms@gnu.org>
parents:
3436
diff
changeset
|
654 It is possible that this reintroduces the bug whereby line positions |
aad9fd004281
(same_size_fonts): Compare only the width.
Richard M. Stallman <rms@gnu.org>
parents:
3436
diff
changeset
|
655 were not right. However, the right way to fix that is to change xterm.c |
aad9fd004281
(same_size_fonts): Compare only the width.
Richard M. Stallman <rms@gnu.org>
parents:
3436
diff
changeset
|
656 so that the vertical positions of lines |
aad9fd004281
(same_size_fonts): Compare only the width.
Richard M. Stallman <rms@gnu.org>
parents:
3436
diff
changeset
|
657 depend only on the height of the frame's font. |
3074
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
658 && bounds1->ascent == bounds2->ascent |
3528
aad9fd004281
(same_size_fonts): Compare only the width.
Richard M. Stallman <rms@gnu.org>
parents:
3436
diff
changeset
|
659 && bounds1->descent == bounds2->descent); */ |
3074
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
660 } |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
661 |
2342 | 662 /* Modify face TO by copying from FROM all properties which have |
663 nondefault settings. */ | |
664 static void | |
665 merge_faces (from, to) | |
666 struct face *from, *to; | |
667 { | |
2883
b8a3b11892dc
Make sure that all the display faces use fonts of the
Jim Blandy <jimb@redhat.com>
parents:
2875
diff
changeset
|
668 /* Only merge the font if it's the same size as the base font. */ |
b8a3b11892dc
Make sure that all the display faces use fonts of the
Jim Blandy <jimb@redhat.com>
parents:
2875
diff
changeset
|
669 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
|
670 && 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
|
671 to->font = from->font; |
2342 | 672 if (from->foreground != FACE_DEFAULT) |
673 to->foreground = from->foreground; | |
674 if (from->background != FACE_DEFAULT) | |
675 to->background = from->background; | |
2391 | 676 if (from->stipple != FACE_DEFAULT) |
677 to->stipple = from->stipple; | |
2342 | 678 if (from->underline) |
679 to->underline = from->underline; | |
680 } | |
681 | |
3074
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
682 /* 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
|
683 data; all faces are deltas applied to this. */ |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
684 static void |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
685 compute_base_face (f, face) |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
686 FRAME_PTR f; |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
687 struct face *face; |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
688 { |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
689 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
|
690 |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
691 face->gc = 0; |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
692 face->foreground = d->foreground_pixel; |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
693 face->background = d->background_pixel; |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
694 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
|
695 face->stipple = 0; |
3074
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
696 face->underline = 0; |
3811
48b1ef149180
* xfaces.c (compute_base_face): Initialize the face's stipple.
Jim Blandy <jimb@redhat.com>
parents:
3583
diff
changeset
|
697 |
48b1ef149180
* xfaces.c (compute_base_face): Initialize the face's stipple.
Jim Blandy <jimb@redhat.com>
parents:
3583
diff
changeset
|
698 /* 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
|
699 face->cached_index = -1; |
3074
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
700 } |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
701 |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
702 |
2730
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
703 /* Return the face ID associated with a buffer position POS. |
2342 | 704 Store into *ENDPTR the position at which a different face is needed. |
705 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
|
706 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
|
707 the current buffer. |
e97e96fb0cb8
(compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents:
2784
diff
changeset
|
708 |
5084
863e092a5891
(compute_char_face): Accept new arg LIMIT.
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
709 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
|
710 |
863e092a5891
(compute_char_face): Accept new arg LIMIT.
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
711 LIMIT is a position not to scan beyond. That is to limit |
863e092a5891
(compute_char_face): Accept new arg LIMIT.
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
712 the time this function can take. */ |
2795
e97e96fb0cb8
(compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents:
2784
diff
changeset
|
713 |
2730
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
714 int |
5084
863e092a5891
(compute_char_face): Accept new arg LIMIT.
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
715 compute_char_face (f, w, pos, region_beg, region_end, endptr, limit) |
2342 | 716 struct frame *f; |
2391 | 717 struct window *w; |
2342 | 718 int pos; |
2795
e97e96fb0cb8
(compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents:
2784
diff
changeset
|
719 int region_beg, region_end; |
2342 | 720 int *endptr; |
5084
863e092a5891
(compute_char_face): Accept new arg LIMIT.
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
721 int limit; |
2342 | 722 { |
723 struct face face; | |
2767
482fa0725db6
* xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents:
2743
diff
changeset
|
724 Lisp_Object prop, position; |
2342 | 725 int i, j, noverlays; |
726 int facecode; | |
727 Lisp_Object *overlay_vec; | |
2391 | 728 Lisp_Object frame; |
2784
f8c6796b7777
* xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents:
2767
diff
changeset
|
729 int endpos; |
f8c6796b7777
* xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents:
2767
diff
changeset
|
730 |
f8c6796b7777
* xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents:
2767
diff
changeset
|
731 /* 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
|
732 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
|
733 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
|
734 abort (); |
2391 | 735 |
736 XSET (frame, Lisp_Frame, f); | |
2342 | 737 |
2784
f8c6796b7777
* xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents:
2767
diff
changeset
|
738 endpos = ZV; |
2795
e97e96fb0cb8
(compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents:
2784
diff
changeset
|
739 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
|
740 endpos = region_beg; |
2784
f8c6796b7777
* xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents:
2767
diff
changeset
|
741 |
2342 | 742 XFASTINT (position) = pos; |
2767
482fa0725db6
* xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents:
2743
diff
changeset
|
743 prop = Fget_text_property (position, Qface, w->buffer); |
482fa0725db6
* xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents:
2743
diff
changeset
|
744 { |
5084
863e092a5891
(compute_char_face): Accept new arg LIMIT.
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
745 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
|
746 |
5084
863e092a5891
(compute_char_face): Accept new arg LIMIT.
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
747 XFASTINT (limit1) = (limit < endpos ? limit : endpos); |
863e092a5891
(compute_char_face): Accept new arg LIMIT.
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
748 end = Fnext_single_property_change (position, Qface, w->buffer, limit1); |
2767
482fa0725db6
* xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents:
2743
diff
changeset
|
749 if (INTEGERP (end)) |
482fa0725db6
* xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents:
2743
diff
changeset
|
750 endpos = XINT (end); |
482fa0725db6
* xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents:
2743
diff
changeset
|
751 } |
2342 | 752 |
2767
482fa0725db6
* xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents:
2743
diff
changeset
|
753 { |
2784
f8c6796b7777
* xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents:
2767
diff
changeset
|
754 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
|
755 int len; |
2767
482fa0725db6
* xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents:
2743
diff
changeset
|
756 |
2838
5f6a2d52d2ef
(compute_char_face): Pass 0 as EXTEND arg to overlays_at.
Richard M. Stallman <rms@gnu.org>
parents:
2821
diff
changeset
|
757 /* 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
|
758 len = 40; |
5f6a2d52d2ef
(compute_char_face): Pass 0 as EXTEND arg to overlays_at.
Richard M. Stallman <rms@gnu.org>
parents:
2821
diff
changeset
|
759 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
|
760 |
5f6a2d52d2ef
(compute_char_face): Pass 0 as EXTEND arg to overlays_at.
Richard M. Stallman <rms@gnu.org>
parents:
2821
diff
changeset
|
761 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
|
762 |
5f6a2d52d2ef
(compute_char_face): Pass 0 as EXTEND arg to overlays_at.
Richard M. Stallman <rms@gnu.org>
parents:
2821
diff
changeset
|
763 /* 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
|
764 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
|
765 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
|
766 { |
5f6a2d52d2ef
(compute_char_face): Pass 0 as EXTEND arg to overlays_at.
Richard M. Stallman <rms@gnu.org>
parents:
2821
diff
changeset
|
767 len = noverlays; |
5f6a2d52d2ef
(compute_char_face): Pass 0 as EXTEND arg to overlays_at.
Richard M. Stallman <rms@gnu.org>
parents:
2821
diff
changeset
|
768 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
|
769 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
|
770 } |
5f6a2d52d2ef
(compute_char_face): Pass 0 as EXTEND arg to overlays_at.
Richard M. Stallman <rms@gnu.org>
parents:
2821
diff
changeset
|
771 |
2784
f8c6796b7777
* xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents:
2767
diff
changeset
|
772 if (next_overlay < endpos) |
f8c6796b7777
* xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents:
2767
diff
changeset
|
773 endpos = next_overlay; |
2767
482fa0725db6
* xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents:
2743
diff
changeset
|
774 } |
482fa0725db6
* xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents:
2743
diff
changeset
|
775 |
482fa0725db6
* xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents:
2743
diff
changeset
|
776 *endptr = endpos; |
2342 | 777 |
778 /* 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
|
779 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
|
780 && !(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
|
781 return 0; |
2342 | 782 |
3074
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
783 compute_base_face (f, &face); |
2342 | 784 |
785 if (!NILP (prop)) | |
786 { | |
3065
fff06093b756
* xfns.c (Fx_list_fonts): New function.
Jim Blandy <jimb@redhat.com>
parents:
2998
diff
changeset
|
787 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
|
788 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
|
789 && 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
|
790 merge_faces (FRAME_PARAM_FACES (f) [facecode], &face); |
2342 | 791 } |
792 | |
5858
021e58905963
(compute_char_face): Extract overlay-sorting code as a separate function,
Karl Heuer <kwzh@gnu.org>
parents:
5801
diff
changeset
|
793 noverlays = sort_overlays (overlay_vec, noverlays, w); |
2342 | 794 |
795 /* Now merge the overlay data in that order. */ | |
796 for (i = 0; i < noverlays; i++) | |
797 { | |
5858
021e58905963
(compute_char_face): Extract overlay-sorting code as a separate function,
Karl Heuer <kwzh@gnu.org>
parents:
5801
diff
changeset
|
798 prop = Foverlay_get (overlay_vec[i], Qface); |
2342 | 799 if (!NILP (prop)) |
800 { | |
801 Lisp_Object oend; | |
802 int oendpos; | |
803 | |
3065
fff06093b756
* xfns.c (Fx_list_fonts): New function.
Jim Blandy <jimb@redhat.com>
parents:
2998
diff
changeset
|
804 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
|
805 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
|
806 && 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
|
807 merge_faces (FRAME_PARAM_FACES (f) [facecode], &face); |
2342 | 808 |
5858
021e58905963
(compute_char_face): Extract overlay-sorting code as a separate function,
Karl Heuer <kwzh@gnu.org>
parents:
5801
diff
changeset
|
809 oend = OVERLAY_END (overlay_vec[i]); |
2342 | 810 oendpos = OVERLAY_POSITION (oend); |
2784
f8c6796b7777
* xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents:
2767
diff
changeset
|
811 if (oendpos < endpos) |
2342 | 812 endpos = oendpos; |
813 } | |
814 } | |
815 | |
2795
e97e96fb0cb8
(compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents:
2784
diff
changeset
|
816 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
|
817 { |
e97e96fb0cb8
(compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents:
2784
diff
changeset
|
818 if (region_end < endpos) |
e97e96fb0cb8
(compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents:
2784
diff
changeset
|
819 endpos = region_end; |
e97e96fb0cb8
(compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents:
2784
diff
changeset
|
820 if (region_face >= 0 && region_face < next_face_id) |
3882
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
821 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
|
822 } |
e97e96fb0cb8
(compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents:
2784
diff
changeset
|
823 |
2342 | 824 *endptr = endpos; |
825 | |
3882
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
826 return intern_computed_face (f, &face); |
2342 | 827 } |
828 | |
2730
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
829 /* Return the face ID to use to display a special glyph which selects |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
830 FACE_CODE as the face ID, assuming that ordinarily the face would |
5801
af397aaa8e6b
(init_frame_faces): Clear FRAME_N_COMPUTED_FACES
Richard M. Stallman <rms@gnu.org>
parents:
5084
diff
changeset
|
831 be CURRENT_FACE. F is the frame. */ |
af397aaa8e6b
(init_frame_faces): Clear FRAME_N_COMPUTED_FACES
Richard M. Stallman <rms@gnu.org>
parents:
5084
diff
changeset
|
832 |
2730
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
833 int |
5801
af397aaa8e6b
(init_frame_faces): Clear FRAME_N_COMPUTED_FACES
Richard M. Stallman <rms@gnu.org>
parents:
5084
diff
changeset
|
834 compute_glyph_face (f, face_code, current_face) |
2342 | 835 struct frame *f; |
5801
af397aaa8e6b
(init_frame_faces): Clear FRAME_N_COMPUTED_FACES
Richard M. Stallman <rms@gnu.org>
parents:
5084
diff
changeset
|
836 int face_code, current_face; |
2342 | 837 { |
838 struct face face; | |
839 | |
5801
af397aaa8e6b
(init_frame_faces): Clear FRAME_N_COMPUTED_FACES
Richard M. Stallman <rms@gnu.org>
parents:
5084
diff
changeset
|
840 face = *FRAME_COMPUTED_FACES (f)[current_face]; |
2342 | 841 |
3882
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
842 if (face_code >= 0 && face_code < 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
|
843 && FRAME_PARAM_FACES (f) [face_code] != 0) |
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
844 merge_faces (FRAME_PARAM_FACES (f) [face_code], &face); |
2342 | 845 |
3882
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
846 return intern_computed_face (f, &face); |
2336 | 847 } |
3074
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
848 |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
849 |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
850 /* 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
|
851 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
|
852 depend. */ |
5801
af397aaa8e6b
(init_frame_faces): Clear FRAME_N_COMPUTED_FACES
Richard M. Stallman <rms@gnu.org>
parents:
5084
diff
changeset
|
853 |
3074
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
854 void |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
855 recompute_basic_faces (f) |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
856 FRAME_PTR f; |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
857 { |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
858 /* 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
|
859 this stuff. */ |
3882
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
860 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
|
861 return; |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
862 |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
863 BLOCK_INPUT; |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
864 |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
865 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
|
866 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
|
867 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
|
868 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
|
869 |
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
870 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
|
871 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
|
872 |
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
873 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
|
874 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
|
875 |
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
876 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
|
877 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
|
878 |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
879 UNBLOCK_INPUT; |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
880 } |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
881 |
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
882 |
2336 | 883 |
2730
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
884 /* Lisp interface. */ |
2336 | 885 |
886 DEFUN ("frame-face-alist", Fframe_face_alist, Sframe_face_alist, 1, 1, 0, | |
887 "") | |
888 (frame) | |
889 Lisp_Object frame; | |
890 { | |
891 CHECK_FRAME (frame, 0); | |
892 return XFRAME (frame)->face_alist; | |
893 } | |
894 | |
895 DEFUN ("set-frame-face-alist", Fset_frame_face_alist, Sset_frame_face_alist, | |
896 2, 2, 0, "") | |
897 (frame, value) | |
898 Lisp_Object frame, value; | |
899 { | |
900 CHECK_FRAME (frame, 0); | |
901 XFRAME (frame)->face_alist = value; | |
902 return value; | |
903 } | |
904 | |
905 | |
906 DEFUN ("make-face-internal", Fmake_face_internal, Smake_face_internal, 1, 1, 0, | |
907 "Create face number FACE-ID on all frames.") | |
908 (face_id) | |
909 Lisp_Object face_id; | |
910 { | |
911 Lisp_Object rest; | |
912 int id = XINT (face_id); | |
913 | |
2391 | 914 CHECK_NUMBER (face_id, 0); |
915 if (id < 0 || id >= next_face_id) | |
916 error ("Face id out of range"); | |
2336 | 917 |
918 for (rest = Vframe_list; !NILP (rest); rest = XCONS (rest)->cdr) | |
919 { | |
920 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
|
921 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
|
922 ensure_face_ready (f, id); |
2336 | 923 } |
924 return Qnil; | |
925 } | |
926 | |
927 | |
928 DEFUN ("set-face-attribute-internal", Fset_face_attribute_internal, | |
929 Sset_face_attribute_internal, 4, 4, 0, "") | |
930 (face_id, attr_name, attr_value, frame) | |
931 Lisp_Object face_id, attr_name, attr_value, frame; | |
932 { | |
933 struct face *face; | |
934 struct frame *f; | |
935 int magic_p; | |
936 int id; | |
937 | |
938 CHECK_FRAME (frame, 0); | |
2391 | 939 CHECK_NUMBER (face_id, 0); |
2336 | 940 CHECK_SYMBOL (attr_name, 0); |
941 | |
942 f = XFRAME (frame); | |
943 id = XINT (face_id); | |
2391 | 944 if (id < 0 || id >= next_face_id) |
945 error ("Face id out of range"); | |
2336 | 946 |
2767
482fa0725db6
* xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents:
2743
diff
changeset
|
947 if (! FRAME_X_P (f)) |
482fa0725db6
* xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents:
2743
diff
changeset
|
948 return; |
482fa0725db6
* xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents:
2743
diff
changeset
|
949 |
2336 | 950 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
|
951 face = FRAME_PARAM_FACES (f) [XFASTINT (face_id)]; |
2336 | 952 |
953 if (EQ (attr_name, intern ("font"))) | |
954 { | |
2391 | 955 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
|
956 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
|
957 unload_font (f, face->font); |
2336 | 958 face->font = font; |
959 } | |
960 else if (EQ (attr_name, intern ("foreground"))) | |
961 { | |
2391 | 962 unsigned long new_color = load_color (f, attr_value); |
2336 | 963 unload_color (f, face->foreground); |
964 face->foreground = new_color; | |
965 } | |
966 else if (EQ (attr_name, intern ("background"))) | |
967 { | |
2391 | 968 unsigned long new_color = load_color (f, attr_value); |
2336 | 969 unload_color (f, face->background); |
970 face->background = new_color; | |
971 } | |
972 #if 0 | |
973 else if (EQ (attr_name, intern ("background-pixmap"))) | |
974 { | |
975 unsigned int w, h, d; | |
976 unsigned long new_pixmap = load_pixmap (f, attr_value, &w, &h, &d, 0); | |
2391 | 977 unload_pixmap (f, face->stipple); |
978 if (NILP (attr_value)) | |
979 new_pixmap = 0; | |
980 face->stipple = new_pixmap; | |
2336 | 981 face->pixmap_w = w; |
982 face->pixmap_h = h; | |
983 /* face->pixmap_depth = d; */ | |
984 } | |
985 #endif /* 0 */ | |
986 else if (EQ (attr_name, intern ("underline"))) | |
987 { | |
988 int new = !NILP (attr_value); | |
989 face->underline = new; | |
990 } | |
991 else | |
992 error ("unknown face attribute"); | |
993 | |
3882
a0b9347a3973
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3843
diff
changeset
|
994 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
|
995 recompute_basic_faces (f); |
2336 | 996 |
2821
95010b414003
* xfaces.c (Fset_face_attribute_internal): Jolt redisplay, so it
Jim Blandy <jimb@redhat.com>
parents:
2818
diff
changeset
|
997 /* 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
|
998 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
|
999 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
|
1000 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
|
1001 kick. */ |
95010b414003
* xfaces.c (Fset_face_attribute_internal): Jolt redisplay, so it
Jim Blandy <jimb@redhat.com>
parents:
2818
diff
changeset
|
1002 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
|
1003 SET_FRAME_GARBAGED (f); |
95010b414003
* xfaces.c (Fset_face_attribute_internal): Jolt redisplay, so it
Jim Blandy <jimb@redhat.com>
parents:
2818
diff
changeset
|
1004 else |
95010b414003
* xfaces.c (Fset_face_attribute_internal): Jolt redisplay, so it
Jim Blandy <jimb@redhat.com>
parents:
2818
diff
changeset
|
1005 /* 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
|
1006 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
|
1007 |
2336 | 1008 return Qnil; |
1009 } | |
1010 | |
1011 DEFUN ("internal-next-face-id", Finternal_next_face_id, Sinternal_next_face_id, | |
1012 0, 0, 0, "") | |
1013 () | |
1014 { | |
1015 return make_number (next_face_id++); | |
1016 } | |
2391 | 1017 |
1018 /* Return the face id for name NAME on frame FRAME. | |
1019 (It should be the same for all frames, | |
1020 but it's as easy to use the "right" frame to look it up | |
1021 as to use any other one.) */ | |
1022 | |
3065
fff06093b756
* xfns.c (Fx_list_fonts): New function.
Jim Blandy <jimb@redhat.com>
parents:
2998
diff
changeset
|
1023 int |
fff06093b756
* xfns.c (Fx_list_fonts): New function.
Jim Blandy <jimb@redhat.com>
parents:
2998
diff
changeset
|
1024 face_name_id_number (f, name) |
fff06093b756
* xfns.c (Fx_list_fonts): New function.
Jim Blandy <jimb@redhat.com>
parents:
2998
diff
changeset
|
1025 FRAME_PTR f; |
fff06093b756
* xfns.c (Fx_list_fonts): New function.
Jim Blandy <jimb@redhat.com>
parents:
2998
diff
changeset
|
1026 Lisp_Object name; |
2391 | 1027 { |
1028 Lisp_Object tem; | |
1029 | |
4258
8f02e992e4dc
(face_name_id_number): Use assq_no_quit, not Fassq.
Richard M. Stallman <rms@gnu.org>
parents:
3997
diff
changeset
|
1030 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
|
1031 if (NILP (tem)) |
482fa0725db6
* xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents:
2743
diff
changeset
|
1032 return 0; |
2391 | 1033 CHECK_VECTOR (tem, 0); |
1034 tem = XVECTOR (tem)->contents[2]; | |
1035 CHECK_NUMBER (tem, 0); | |
1036 return XINT (tem); | |
1037 } | |
2336 | 1038 |
2730
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
1039 /* Emacs initialization. */ |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
1040 |
2336 | 1041 void |
2391 | 1042 syms_of_xfaces () |
2336 | 1043 { |
2391 | 1044 Qface = intern ("face"); |
1045 staticpro (&Qface); | |
1046 | |
2795
e97e96fb0cb8
(compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents:
2784
diff
changeset
|
1047 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
|
1048 "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
|
1049 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
|
1050 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
|
1051 |
2336 | 1052 defsubr (&Sframe_face_alist); |
1053 defsubr (&Sset_frame_face_alist); | |
1054 defsubr (&Smake_face_internal); | |
1055 defsubr (&Sset_face_attribute_internal); | |
1056 defsubr (&Sinternal_next_face_id); | |
1057 } | |
2730
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
1058 |
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
1059 #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
|
1060 |