annotate src/redisplay-x.c @ 406:b8cc9ab3f761 r21-2-33

Import from CVS: tag r21-2-33
author cvs
date Mon, 13 Aug 2007 11:17:09 +0200
parents 2f8bb876ab1d
children 501cfd01ee6d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 /* X output and frame manipulation routines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 Copyright (C) 1994 Lucid, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 Copyright (C) 1995 Sun Microsystems, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 under the terms of the GNU General Public License as published by the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 Free Software Foundation; either version 2, or (at your option) any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 along with XEmacs; see the file COPYING. If not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 Boston, MA 02111-1307, USA. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 /* Synched up with: Not in FSF. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 /* Author: Chuck Thompson */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 /* Lots of work done by Ben Wing for Mule */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 #include <config.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 #include "lisp.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 #include "console-x.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 #include "EmacsFrame.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 #include "EmacsFrameP.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 #include "xgccache.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 #include "glyphs-x.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 #include "objects-x.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 #include "buffer.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 #include "debug.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 #include "faces.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 #include "frame.h"
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
43 #include "gutter.h"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 #include "redisplay.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 #include "sysdep.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 #include "window.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 #include <X11/bitmaps/gray>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 #include "sysproc.h" /* for select() */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 42
diff changeset
51 #ifdef MULE
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 209
diff changeset
52 #include "mule-ccl.h"
259
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents: 251
diff changeset
53 #include "file-coding.h" /* for CCL conversion */
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 42
diff changeset
54 #endif
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
55
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 /* Number of pixels below each line. */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
57 int x_interline_space; /* #### implement me */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 #define EOL_CURSOR_WIDTH 5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 static void x_output_vertical_divider (struct window *w, int clear);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 static void x_output_blank (struct window *w, struct display_line *dl,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 struct rune *rb, int start_pixpos,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 int cursor_start, int cursor_width);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 static void x_output_hline (struct window *w, struct display_line *dl,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 struct rune *rb);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 static void x_redraw_exposed_window (struct window *w, int x, int y,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 int width, int height);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 static void x_redraw_exposed_windows (Lisp_Object window, int x, int y,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 int width, int height);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 static void x_output_eol_cursor (struct window *w, struct display_line *dl,
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 259
diff changeset
72 int xpos, face_index findex);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 static void x_clear_frame (struct frame *f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 static void x_clear_frame_windows (Lisp_Object window);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 /* Note: We do not use the Xmb*() functions and XFontSets.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 Those functions are generally losing for a number of reasons:
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
79
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 1) They only support one locale (e.g. you could display
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 Japanese and ASCII text, but not mixed Japanese/Chinese
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 text). You could maybe call setlocale() frequently
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 to try to deal with this, but that would generally
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 fail because an XFontSet is tied to one locale and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 won't have the other character sets in it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 2) Not all (or even very many) OS's support the useful
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 locales. For example, as far as I know SunOS and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 Solaris only support the Japanese locale if you get the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 special Asian-language version of the OS. Yuck yuck
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 yuck. Linux doesn't support the Japanese locale at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 all.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 3) The locale support in X only exists in R5, not in R4.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 (Not sure how big of a problem this is: how many
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 people are using R4?)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 4) Who knows if the multi-byte text format (which is locale-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 specific) is even the same for the same locale on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 different OS's? It's not even documented anywhere that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 I can find what the multi-byte text format for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 Japanese locale under SunOS and Solaris is, but I assume
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 it's EUC.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 struct textual_run
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 Lisp_Object charset;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 unsigned char *ptr;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 int len;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 int dimension;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 /* Separate out the text in DYN into a series of textual runs of a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 particular charset. Also convert the characters as necessary into
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 the format needed by XDrawImageString(), XDrawImageString16(), et
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 al. (This means converting to one or two byte format, possibly
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 tweaking the high bits, and possibly running a CCL program.) You
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 must pre-allocate the space used and pass it in. (This is done so
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 you can alloca() the space.) You need to allocate (2 * len) bytes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 of TEXT_STORAGE and (len * sizeof (struct textual_run)) bytes of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 RUN_STORAGE, where LEN is the length of the dynarr.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 Returns the number of runs actually used. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 separate_textual_runs (unsigned char *text_storage,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 struct textual_run *run_storage,
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
126 const Emchar *str, Charcount len)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 Lisp_Object prev_charset = Qunbound; /* not Qnil because that is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 possible valid charset when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 MULE is not defined */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 int runs_so_far = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 int i;
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 42
diff changeset
133 #ifdef MULE
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 42
diff changeset
134 struct ccl_program char_converter;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 42
diff changeset
135 int need_ccl_conversion = 0;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 42
diff changeset
136 #endif
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 for (i = 0; i < len; i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 Emchar ch = str[i];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 Lisp_Object charset;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 int byte1, byte2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 int dimension;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 int graphic;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 BREAKUP_CHAR (ch, charset, byte1, byte2);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 dimension = XCHARSET_DIMENSION (charset);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 graphic = XCHARSET_GRAPHIC (charset);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 if (!EQ (charset, prev_charset))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 run_storage[runs_so_far].ptr = text_storage;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 run_storage[runs_so_far].charset = charset;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 run_storage[runs_so_far].dimension = dimension;
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
155
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 if (runs_so_far)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 run_storage[runs_so_far - 1].len =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 text_storage - run_storage[runs_so_far - 1].ptr;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 if (run_storage[runs_so_far - 1].dimension == 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 run_storage[runs_so_far - 1].len >>= 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 runs_so_far++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 prev_charset = charset;
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 42
diff changeset
165 #ifdef MULE
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 42
diff changeset
166 {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 42
diff changeset
167 Lisp_Object ccl_prog = XCHARSET_CCL_PROGRAM (charset);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 42
diff changeset
168 need_ccl_conversion = !NILP (ccl_prog);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 42
diff changeset
169 if (need_ccl_conversion)
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 209
diff changeset
170 setup_ccl_program (&char_converter, ccl_prog);
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 42
diff changeset
171 }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 42
diff changeset
172 #endif
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 if (graphic == 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 byte1 &= 0x7F;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 byte2 &= 0x7F;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 else if (graphic == 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 byte1 |= 0x80;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 byte2 |= 0x80;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 }
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 42
diff changeset
185 #ifdef MULE
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 42
diff changeset
186 if (need_ccl_conversion)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 42
diff changeset
187 {
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 209
diff changeset
188 char_converter.reg[0] = XCHARSET_ID (charset);
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 209
diff changeset
189 char_converter.reg[1] = byte1;
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 209
diff changeset
190 char_converter.reg[2] = byte2;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
191 ccl_driver (&char_converter, 0, 0, 0, 0, CCL_MODE_ENCODING);
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 209
diff changeset
192 byte1 = char_converter.reg[1];
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 209
diff changeset
193 byte2 = char_converter.reg[2];
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 42
diff changeset
194 }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 42
diff changeset
195 #endif
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 *text_storage++ = (unsigned char) byte1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 if (dimension == 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 *text_storage++ = (unsigned char) byte2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 if (runs_so_far)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 run_storage[runs_so_far - 1].len =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 text_storage - run_storage[runs_so_far - 1].ptr;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 if (run_storage[runs_so_far - 1].dimension == 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 run_storage[runs_so_far - 1].len >>= 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 return runs_so_far;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 /****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 /* */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 /* X output routines */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 /* */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 /****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 x_text_width_single_run (struct face_cachel *cachel, struct textual_run *run)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 Lisp_Object font_inst = FACE_CACHEL_FONT (cachel, run->charset);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
222 Lisp_Font_Instance *fi = XFONT_INSTANCE (font_inst);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 if (!fi->proportional_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 return fi->width * run->len;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 if (run->dimension == 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 return XTextWidth16 (FONT_INSTANCE_X_FONT (fi),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 (XChar2b *) run->ptr, run->len);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 return XTextWidth (FONT_INSTANCE_X_FONT (fi),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 (char *) run->ptr, run->len);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 x_text_width
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 Given a string and a face, return the string's length in pixels when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 displayed in the font associated with the face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 static int
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
244 x_text_width (struct frame *f, struct face_cachel *cachel, const Emchar *str,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 Charcount len)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 int width_so_far = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 unsigned char *text_storage = (unsigned char *) alloca (2 * len);
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
249 struct textual_run *runs = alloca_array (struct textual_run, len);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 int nruns;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 int i;
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
252
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 nruns = separate_textual_runs (text_storage, runs, str, len);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 for (i = 0; i < nruns; i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 width_so_far += x_text_width_single_run (cachel, runs + i);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 return width_so_far;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 x_divider_height
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 Return the height of the horizontal divider. This is a function because
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 divider_height is a device method.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 #### If we add etched horizontal divider lines this will have to get
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 smarter.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 x_divider_height (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 return 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 x_eol_cursor_width
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 Return the width of the end-of-line cursor. This is a function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 because eol_cursor_width is a device method.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 x_eol_cursor_width (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 return EOL_CURSOR_WIDTH;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 x_output_begin
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 Perform any necessary initialization prior to an update.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 x_output_begin (struct device *d)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 x_output_end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 Perform any necessary flushing of queues when an update has completed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 x_output_end (struct device *d)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 XFlush (DEVICE_X_DISPLAY (d));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 x_output_display_block
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 Given a display line, a block number for that start line, output all
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 runes between start and end in the specified display block.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 x_output_display_block (struct window *w, struct display_line *dl, int block,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 int start, int end, int start_pixpos, int cursor_start,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 int cursor_width, int cursor_height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 struct frame *f = XFRAME (w->frame);
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
321 Emchar_dynarr *buf = Dynarr_new (Emchar);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 Lisp_Object window;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 struct display_block *db = Dynarr_atp (dl->display_blocks, block);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 rune_dynarr *rba = db->runes;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 struct rune *rb;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 int elt = start;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 face_index findex;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
330 int xpos, width = 0;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 Lisp_Object charset = Qunbound; /* Qnil is a valid charset when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 MULE is not defined */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 XSETWINDOW (window, w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 rb = Dynarr_atp (rba, start);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 if (!rb)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
338 /* Nothing to do so don't do anything. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
339 return;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
340
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
341 findex = rb->findex;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
342 xpos = rb->xpos;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
343 if (rb->type == RUNE_CHAR)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
344 charset = CHAR_CHARSET (rb->object.chr.ch);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 if (end < 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 end = Dynarr_length (rba);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 Dynarr_reset (buf);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 while (elt < end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 rb = Dynarr_atp (rba, elt);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 if (rb->findex == findex && rb->type == RUNE_CHAR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 && rb->object.chr.ch != '\n' && rb->cursor_type != CURSOR_ON
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 && EQ (charset, CHAR_CHARSET (rb->object.chr.ch)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 Dynarr_add (buf, rb->object.chr.ch);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 width += rb->width;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 elt++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 if (Dynarr_length (buf))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 x_output_string (w, dl, buf, xpos, 0, start_pixpos, width,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 findex, 0, cursor_start, cursor_width,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 cursor_height);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 xpos = rb->xpos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 width = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 Dynarr_reset (buf);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 width = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 if (rb->type == RUNE_CHAR)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 findex = rb->findex;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 xpos = rb->xpos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 charset = CHAR_CHARSET (rb->object.chr.ch);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 if (rb->cursor_type == CURSOR_ON)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 if (rb->object.chr.ch == '\n')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 {
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 259
diff changeset
385 x_output_eol_cursor (w, dl, xpos, findex);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 Dynarr_add (buf, rb->object.chr.ch);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 x_output_string (w, dl, buf, xpos, 0, start_pixpos,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 rb->width, findex, 1,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 cursor_start, cursor_width,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 cursor_height);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 Dynarr_reset (buf);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 xpos += rb->width;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 elt++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 else if (rb->object.chr.ch == '\n')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 /* Clear in case a cursor was formerly here. */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
403 redisplay_clear_region (window, findex, xpos,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
404 DISPLAY_LINE_YPOS (dl),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
405 rb->width,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
406 DISPLAY_LINE_HEIGHT (dl));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 elt++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 else if (rb->type == RUNE_BLANK || rb->type == RUNE_HLINE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 if (rb->type == RUNE_BLANK)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 x_output_blank (w, dl, rb, start_pixpos, cursor_start,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 cursor_width);
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
415 else
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 /* #### Our flagging of when we need to redraw the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 modeline shadows sucks. Since RUNE_HLINE is only used
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 by the modeline at the moment it is a good bet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 that if it gets redrawn then we should also
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 redraw the shadows. This won't be true forever.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 We borrow the shadow_thickness_changed flag for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 now. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 w->shadow_thickness_changed = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 x_output_hline (w, dl, rb);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 elt++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 if (elt < end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 rb = Dynarr_atp (rba, elt);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 findex = rb->findex;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 xpos = rb->xpos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 else if (rb->type == RUNE_DGLYPH)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 Lisp_Object instance;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
440 struct display_box dbox;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
441 struct display_glyph_area dga;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
442 redisplay_calculate_display_boxes (dl, rb->xpos, rb->object.dglyph.xoffset,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
443 start_pixpos, rb->width,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
444 &dbox, &dga);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 XSETWINDOW (window, w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 instance = glyph_image_instance (rb->object.dglyph.glyph,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 window, ERROR_ME_NOT, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 findex = rb->findex;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 if (IMAGE_INSTANCEP (instance))
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
452 {
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
453 switch (XIMAGE_INSTANCE_TYPE (instance))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 {
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
455 case IMAGE_MONO_PIXMAP:
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
456 case IMAGE_COLOR_PIXMAP:
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
457 redisplay_output_pixmap (w, instance, &dbox, &dga, findex,
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
458 cursor_start, cursor_width,
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
459 cursor_height, 0);
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
460 break;
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
461
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
462 case IMAGE_WIDGET:
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
463 case IMAGE_SUBWINDOW:
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
464 redisplay_output_subwindow (w, instance, &dbox, &dga, findex,
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
465 cursor_start, cursor_width,
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
466 cursor_height);
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
467 break;
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
468
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
469 case IMAGE_LAYOUT:
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
470 redisplay_output_layout (w, instance, &dbox, &dga, findex,
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
471 cursor_start, cursor_width,
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
472 cursor_height);
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
473 break;
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
474
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
475 case IMAGE_NOTHING:
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
476 /* nothing is as nothing does */
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
477 break;
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
478
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
479 case IMAGE_TEXT:
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
480 case IMAGE_POINTER:
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
481 default:
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
482 abort ();
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 }
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
484 IMAGE_INSTANCE_OPTIMIZE_OUTPUT
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
485 (XIMAGE_INSTANCE (instance)) = 0;
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
486 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 xpos += rb->width;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 elt++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 if (Dynarr_length (buf))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 x_output_string (w, dl, buf, xpos, 0, start_pixpos, width, findex,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 0, cursor_start, cursor_width, cursor_height);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 /* #### This is really conditionalized well for optimized
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 performance. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 if (dl->modeline
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 && !EQ (Qzero, w->modeline_shadow_thickness)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 && (f->clear
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 || f->windows_structure_changed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 || w->shadow_thickness_changed))
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
507 bevel_modeline (w, dl);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 Dynarr_free (buf);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 /*****************************************************************************
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
513 x_bevel_area
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
515 Draw a shadows for the given area in the given face.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 static void
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
518 x_bevel_area (struct window *w, face_index findex,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
519 int x, int y, int width, int height,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
520 int shadow_thickness, int edges, enum edge_style style)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 struct frame *f = XFRAME (w->frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 struct device *d = XDEVICE (f->device);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
524
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
525 EmacsFrame ef = (EmacsFrame) FRAME_X_TEXT_WIDGET (f);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 Display *dpy = DEVICE_X_DISPLAY (d);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 Window x_win = XtWindow (FRAME_X_TEXT_WIDGET (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 Pixel top_shadow_pixel, bottom_shadow_pixel, background_pixel;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
529 Lisp_Object tmp_pixel;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 XColor tmp_color;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 XGCValues gcv;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
532 GC top_shadow_gc, bottom_shadow_gc, background_gc;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
533
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 int use_pixmap = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 int flip_gcs = 0;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
536 unsigned long mask;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
538 assert (shadow_thickness >=0);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 memset (&gcv, ~0, sizeof (XGCValues));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
541 tmp_pixel = WINDOW_FACE_CACHEL_BACKGROUND (w, findex);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 tmp_color = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (tmp_pixel));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 /* First, get the GC's. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 top_shadow_pixel = tmp_color.pixel;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 bottom_shadow_pixel = tmp_color.pixel;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 background_pixel = tmp_color.pixel;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 x_generate_shadow_pixels (f, &top_shadow_pixel, &bottom_shadow_pixel,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 background_pixel, ef->core.background_pixel);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
552 tmp_pixel = WINDOW_FACE_CACHEL_FOREGROUND (w, findex);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 tmp_color = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (tmp_pixel));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 gcv.background = tmp_color.pixel;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 gcv.graphics_exposures = False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 mask = GCForeground | GCBackground | GCGraphicsExposures;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
558 /* If we can't distinguish one of the shadows (the color is the same as the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
559 background), it's better to use a pixmap to generate a dithered gray. */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 if (top_shadow_pixel == background_pixel ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 bottom_shadow_pixel == background_pixel)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 use_pixmap = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 if (use_pixmap)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 if (DEVICE_X_GRAY_PIXMAP (d) == None)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 DEVICE_X_GRAY_PIXMAP (d) =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 XCreatePixmapFromBitmapData (dpy, x_win, (char *) gray_bits,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 gray_width, gray_height, 1, 0, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
573 tmp_pixel = WINDOW_FACE_CACHEL_BACKGROUND (w, findex);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 tmp_color = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (tmp_pixel));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 gcv.foreground = tmp_color.pixel;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
576 /* this is needed because the GC draws with a pixmap here */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 gcv.fill_style = FillOpaqueStippled;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 gcv.stipple = DEVICE_X_GRAY_PIXMAP (d);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 top_shadow_gc = gc_cache_lookup (DEVICE_X_GC_CACHE (d), &gcv,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 (mask | GCStipple | GCFillStyle));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
582 tmp_pixel = WINDOW_FACE_CACHEL_FOREGROUND (w, findex);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 tmp_color = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (tmp_pixel));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 bottom_shadow_pixel = tmp_color.pixel;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 flip_gcs = (bottom_shadow_pixel ==
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 WhitePixelOfScreen (DefaultScreenOfDisplay (dpy)));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 gcv.foreground = top_shadow_pixel;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 top_shadow_gc = gc_cache_lookup (DEVICE_X_GC_CACHE (d), &gcv, mask);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 gcv.foreground = bottom_shadow_pixel;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 bottom_shadow_gc = gc_cache_lookup (DEVICE_X_GC_CACHE (d), &gcv, mask);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 if (use_pixmap && flip_gcs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 GC tmp_gc = bottom_shadow_gc;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 bottom_shadow_gc = top_shadow_gc;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 top_shadow_gc = tmp_gc;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 gcv.foreground = background_pixel;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 background_gc = gc_cache_lookup (DEVICE_X_GC_CACHE (d), &gcv, mask);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
608 /* possibly revert the GC's This will give a depressed look to the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
609 divider */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
610 if (style == EDGE_ETCHED_IN || style == EDGE_BEVEL_IN)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 GC temp;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 temp = top_shadow_gc;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 top_shadow_gc = bottom_shadow_gc;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 bottom_shadow_gc = temp;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
619 if (style == EDGE_ETCHED_IN || style == EDGE_ETCHED_OUT)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
620 shadow_thickness /= 2;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
621
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
622 /* Draw the shadows around the divider line */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
623 x_output_shadows (f, x, y, width, height,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
624 top_shadow_gc, bottom_shadow_gc,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
625 background_gc, shadow_thickness, edges);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
627 if (style == EDGE_ETCHED_IN || style == EDGE_ETCHED_OUT)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
628 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
629 /* Draw the shadows around the divider line */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
630 x_output_shadows (f, x + shadow_thickness, y + shadow_thickness,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
631 width - 2*shadow_thickness, height - 2*shadow_thickness,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
632 bottom_shadow_gc, top_shadow_gc,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
633 background_gc, shadow_thickness, edges);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
634 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 x_get_gc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 Given a number of parameters return a GC with those properties.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 static GC
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 x_get_gc (struct device *d, Lisp_Object font, Lisp_Object fg, Lisp_Object bg,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 Lisp_Object bg_pmap, Lisp_Object lwidth)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 XGCValues gcv;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 unsigned long mask;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 memset (&gcv, ~0, sizeof (XGCValues));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 gcv.graphics_exposures = False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 /* Make absolutely sure that we don't pick up a clipping region in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 the GC returned by this function. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 gcv.clip_mask = None;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 gcv.clip_x_origin = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 gcv.clip_y_origin = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 gcv.fill_style = FillSolid;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 mask = GCGraphicsExposures | GCClipMask | GCClipXOrigin | GCClipYOrigin;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 mask |= GCFillStyle;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 if (!NILP (font))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 gcv.font = FONT_INSTANCE_X_FONT (XFONT_INSTANCE (font))->fid;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 mask |= GCFont;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 /* evil kludge! */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 if (!NILP (fg) && !COLOR_INSTANCEP (fg) && !INTP (fg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 /* #### I fixed once case where this was getting it. It was a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 bad macro expansion (compiler bug). */
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
671 stderr_out ("Help! x_get_gc got a bogus fg value! fg = ");
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 debug_print (fg);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 fg = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 if (!NILP (fg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 if (COLOR_INSTANCEP (fg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 gcv.foreground = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (fg)).pixel;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 gcv.foreground = XINT (fg);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 mask |= GCForeground;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 if (!NILP (bg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 if (COLOR_INSTANCEP (bg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 gcv.background = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (bg)).pixel;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690 gcv.background = XINT (bg);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 mask |= GCBackground;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
694 /* This special case comes from a request to draw text with a face which has
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
695 the dim property. We'll use a stippled foreground GC. */
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
696 if (EQ (bg_pmap, Qdim))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
697 {
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
698 assert (DEVICE_X_GRAY_PIXMAP (d) != None);
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
699
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
700 gcv.fill_style = FillStippled;
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
701 gcv.stipple = DEVICE_X_GRAY_PIXMAP (d);
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
702 mask |= (GCFillStyle | GCStipple);
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
703 }
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
704 else if (IMAGE_INSTANCEP (bg_pmap)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
705 && IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (bg_pmap)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 if (XIMAGE_INSTANCE_PIXMAP_DEPTH (bg_pmap) == 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 gcv.fill_style = FillOpaqueStippled;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 gcv.stipple = XIMAGE_INSTANCE_X_PIXMAP (bg_pmap);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 mask |= (GCStipple | GCFillStyle);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 gcv.fill_style = FillTiled;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 gcv.tile = XIMAGE_INSTANCE_X_PIXMAP (bg_pmap);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 mask |= (GCTile | GCFillStyle);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 if (!NILP (lwidth))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 gcv.line_width = XINT (lwidth);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 mask |= GCLineWidth;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 return gc_cache_lookup (DEVICE_X_GC_CACHE (d), &gcv, mask);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 x_output_string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 Given a string and a starting position, output that string in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 given face. If cursor is true, draw a cursor around the string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 Correctly handles multiple charsets in the string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 The meaning of the parameters is something like this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 W Window that the text is to be displayed in.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 DL Display line that this text is on. The values in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 structure are used to determine the vertical position and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 clipping range of the text.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 BUF Dynamic array of Emchars specifying what is actually to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 drawn.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 XPOS X position in pixels where the text should start being drawn.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 XOFFSET Number of pixels to be chopped off the left side of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 text. The effect is as if the text were shifted to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 left this many pixels and clipped at XPOS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 CLIP_START Clip everything left of this X position.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 WIDTH Clip everything right of XPOS + WIDTH.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 FINDEX Index for the face cache element describing how to display
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 the text.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 CURSOR #### I don't understand this. There's something
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 strange and overcomplexified with this variable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 Chuck, explain please?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 CURSOR_START Starting X position of cursor.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 CURSOR_WIDTH Width of cursor in pixels.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 CURSOR_HEIGHT Height of cursor in pixels.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 Starting Y position of cursor is the top of the text line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761 The cursor is drawn sometimes whether or not CURSOR is set. ???
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 x_output_string (struct window *w, struct display_line *dl,
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
765 Emchar_dynarr *buf, int xpos, int xoffset, int clip_start,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 int width, face_index findex, int cursor,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767 int cursor_start, int cursor_width, int cursor_height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769 /* General variables */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 struct frame *f = XFRAME (w->frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 struct device *d = XDEVICE (f->device);
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
772 Lisp_Object device;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
773 Lisp_Object window;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774 Display *dpy = DEVICE_X_DISPLAY (d);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 Window x_win = XtWindow (FRAME_X_TEXT_WIDGET (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777 int clip_end;
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
778
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 /* Cursor-related variables */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 int cursor_clip;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 Lisp_Object bar_cursor_value = symbol_value_in_buffer (Qbar_cursor,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783 WINDOW_BUFFER (w));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784 struct face_cachel *cursor_cachel = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 /* Text-related variables */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787 Lisp_Object bg_pmap;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 GC bgc, gc;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789 int height;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 int len = Dynarr_length (buf);
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
791 unsigned char *text_storage = (unsigned char *) alloca (2 * len);
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
792 struct textual_run *runs = alloca_array (struct textual_run, len);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793 int nruns;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 int i;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 struct face_cachel *cachel = WINDOW_FACE_CACHEL (w, findex);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797 XSETDEVICE (device, d);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798 XSETWINDOW (window, w);
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
799
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800 if (width < 0)
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 247
diff changeset
801 width = x_text_width (f, cachel, Dynarr_atp (buf, 0), Dynarr_length (buf));
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
802 height = DISPLAY_LINE_HEIGHT (dl);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 /* Regularize the variables passed in. */
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
805
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806 if (clip_start < xpos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 clip_start = xpos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 clip_end = xpos + width;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809 if (clip_start >= clip_end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 /* It's all clipped out. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 xpos -= xoffset;
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
814
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
815 /* make sure the area we are about to display is subwindow free. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
816 redisplay_unmap_subwindows_maybe (f, clip_start, DISPLAY_LINE_YPOS (dl),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
817 clip_end - clip_start, DISPLAY_LINE_HEIGHT (dl));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
818
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 nruns = separate_textual_runs (text_storage, runs, Dynarr_atp (buf, 0),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820 Dynarr_length (buf));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 cursor_clip = (cursor_start >= clip_start &&
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 cursor_start < clip_end);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 /* This cursor code is really a mess. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 if (!NILP (w->text_cursor_visible_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 && (cursor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 || cursor_clip
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 || (cursor_width
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830 && (cursor_start + cursor_width >= clip_start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 && !NILP (bar_cursor_value))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 /* These have to be in separate statements in order to avoid a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 compiler bug. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 face_index sucks = get_builtin_face_cache_index (w, Vtext_cursor_face);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 cursor_cachel = WINDOW_FACE_CACHEL (w, sucks);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 /* We have to reset this since any call to WINDOW_FACE_CACHEL
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 may cause the cache to resize and any pointers to it to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 become invalid. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 cachel = WINDOW_FACE_CACHEL (w, findex);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 }
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
843
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 42
diff changeset
844 #ifdef HAVE_XIM
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 42
diff changeset
845 if (cursor && focus && (cursor_start == clip_start) && cursor_height)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 42
diff changeset
846 XIM_SetSpotLocation (f, xpos - 2, dl->ypos + dl->descent - 2);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 42
diff changeset
847 #endif /* HAVE_XIM */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 bg_pmap = cachel->background_pixmap;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 if (!IMAGE_INSTANCEP (bg_pmap)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 || !IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (bg_pmap)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 bg_pmap = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 if ((cursor && focus && NILP (bar_cursor_value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 && !NILP (w->text_cursor_visible_p)) || NILP (bg_pmap))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856 bgc = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 bgc = x_get_gc (d, Qnil, cachel->foreground, cachel->background,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 bg_pmap, Qnil);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 if (bgc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 XFillRectangle (dpy, x_win, bgc, clip_start,
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
863 DISPLAY_LINE_YPOS (dl), clip_end - clip_start,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 height);
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
865
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 for (i = 0; i < nruns; i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 Lisp_Object font = FACE_CACHEL_FONT (cachel, runs[i].charset);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
869 Lisp_Font_Instance *fi = XFONT_INSTANCE (font);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 int this_width;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 int need_clipping;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 if (EQ (font, Vthe_null_font_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 continue;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 this_width = x_text_width_single_run (cachel, runs + i);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 need_clipping = (dl->clip || clip_start > xpos ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 clip_end < xpos + this_width);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 /* XDrawImageString only clears the area equal to the height of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 the given font. It is possible that a font is being displayed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 on a line taller than it is, so this would cause us to fail to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 clear some areas. */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
884 if ((int) fi->height < (int) (height + dl->clip + dl->top_clip))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 int clear_start = max (xpos, clip_start);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 int clear_end = min (xpos + this_width, clip_end);
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
888
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 if (cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891 int ypos1_line, ypos1_string, ypos2_line, ypos2_string;
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
892
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 ypos1_string = dl->ypos - fi->ascent;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 ypos2_string = dl->ypos + fi->descent;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
895 ypos1_line = DISPLAY_LINE_YPOS (dl);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
896 ypos2_line = ypos1_line + DISPLAY_LINE_HEIGHT (dl);
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
897
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 /* Make sure we don't clear below the real bottom of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 line. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 if (ypos1_string > ypos2_line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 ypos1_string = ypos2_line;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902 if (ypos2_string > ypos2_line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 ypos2_string = ypos2_line;
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
904
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 if (ypos1_line < ypos1_string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906 {
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
907 redisplay_clear_region (window, findex, clear_start, ypos1_line,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908 clear_end - clear_start,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 ypos1_string - ypos1_line);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910 }
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
911
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912 if (ypos2_line > ypos2_string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 {
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
914 redisplay_clear_region (window, findex, clear_start, ypos2_string,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 clear_end - clear_start,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 ypos2_line - ypos2_string);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 {
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
921 redisplay_clear_region (window, findex, clear_start,
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
922 DISPLAY_LINE_YPOS (dl), clear_end - clear_start,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923 height);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 if (cursor && cursor_cachel && focus && NILP (bar_cursor_value))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 gc = x_get_gc (d, font, cursor_cachel->foreground,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 cursor_cachel->background, Qnil, Qnil);
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
930 else if (cachel->dim)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
931 {
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
932 /* Ensure the gray bitmap exists */
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
933 if (DEVICE_X_GRAY_PIXMAP (d) == None)
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
934 DEVICE_X_GRAY_PIXMAP (d) =
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
935 XCreateBitmapFromData (dpy, x_win, (char *)gray_bits,
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
936 gray_width, gray_height);
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
937
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
938 /* Request a GC with the gray stipple pixmap to draw dimmed text */
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
939 gc = x_get_gc (d, font, cachel->foreground, cachel->background,
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
940 Qdim, Qnil);
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
941 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 gc = x_get_gc (d, font, cachel->foreground, cachel->background,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 Qnil, Qnil);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 if (need_clipping)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 XRectangle clip_box[1];
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
949
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 clip_box[0].x = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 clip_box[0].y = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 clip_box[0].width = clip_end - clip_start;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 clip_box[0].height = height;
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
954
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
955 XSetClipRectangles (dpy, gc, clip_start, DISPLAY_LINE_YPOS (dl),
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 clip_box, 1, Unsorted);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 if (runs[i].dimension == 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960 (bgc ? XDrawString : XDrawImageString) (dpy, x_win, gc, xpos,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961 dl->ypos, (char *) runs[i].ptr,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962 runs[i].len);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964 (bgc ? XDrawString16 : XDrawImageString16) (dpy, x_win, gc, xpos,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965 dl->ypos,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966 (XChar2b *) runs[i].ptr,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967 runs[i].len);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 /* We draw underlines in the same color as the text. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 if (cachel->underline)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 unsigned long upos, uthick;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973 XFontStruct *xfont;
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
974
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975 xfont = FONT_INSTANCE_X_FONT (XFONT_INSTANCE (font));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 if (!XGetFontProperty (xfont, XA_UNDERLINE_POSITION, &upos))
247
e70b3a057e12 Import from CVS: tag r20-5b22
cvs
parents: 219
diff changeset
977 upos = dl->descent / 2;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 if (!XGetFontProperty (xfont, XA_UNDERLINE_THICKNESS, &uthick))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979 uthick = 1;
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
980
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981 if (dl->ypos + upos < dl->ypos + dl->descent - dl->clip)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 if (dl->ypos + upos + uthick > dl->ypos + dl->descent - dl->clip)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984 uthick = dl->descent - dl->clip - upos;
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
985
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 if (uthick == 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 XDrawLine (dpy, x_win, gc, xpos, dl->ypos + upos,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 xpos + this_width, dl->ypos + upos);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991 else if (uthick > 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993 XFillRectangle (dpy, x_win, gc, xpos,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 dl->ypos + upos, this_width, uthick);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 }
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
998
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 if (cachel->strikethru) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 unsigned long ascent,descent,upos, uthick;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001 XFontStruct *xfont;
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
1002
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003 xfont = FONT_INSTANCE_X_FONT (XFONT_INSTANCE (font));
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
1004
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005 if (!XGetFontProperty (xfont, XA_STRIKEOUT_ASCENT, &ascent))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006 ascent = xfont->ascent;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 if (!XGetFontProperty (xfont, XA_STRIKEOUT_DESCENT, &descent))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008 descent = xfont->descent;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009 if (!XGetFontProperty (xfont, XA_UNDERLINE_THICKNESS, &uthick))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010 uthick = 1;
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
1011
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012 upos = ascent - ((ascent + descent) / 2) + 1;
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
1013
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014 /* Generally, upos will be positive (above the baseline),so subtract */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 if (dl->ypos - upos < dl->ypos + dl->descent - dl->clip)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 if (dl->ypos - upos + uthick > dl->ypos + dl->descent - dl->clip)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 uthick = dl->descent - dl->clip + upos;
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
1019
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 if (uthick == 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 XDrawLine (dpy, x_win, gc, xpos, dl->ypos - upos,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 xpos + this_width, dl->ypos - upos);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 else if (uthick > 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 XFillRectangle (dpy, x_win, gc, xpos, dl->ypos + upos,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028 this_width, uthick);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 }
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
1032
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033 /* Restore the GC */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 if (need_clipping)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036 XSetClipMask (dpy, gc, None);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 XSetClipOrigin (dpy, gc, 0, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038 }
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
1039
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040 /* If we are actually superimposing the cursor then redraw with just
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041 the appropriate section highlighted. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 if (cursor_clip && !cursor && focus && cursor_cachel)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044 GC cgc;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045 XRectangle clip_box[1];
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
1046
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047 cgc = x_get_gc (d, font, cursor_cachel->foreground,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048 cursor_cachel->background, Qnil, Qnil);
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
1049
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050 clip_box[0].x = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051 clip_box[0].y = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052 clip_box[0].width = cursor_width;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053 clip_box[0].height = height;
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
1054
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1055 XSetClipRectangles (dpy, cgc, cursor_start, DISPLAY_LINE_YPOS (dl),
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056 clip_box, 1, Unsorted);
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
1057
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1058 if (runs[i].dimension == 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059 XDrawImageString (dpy, x_win, cgc, xpos, dl->ypos,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060 (char *) runs[i].ptr, runs[i].len);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062 XDrawImageString16 (dpy, x_win, cgc, xpos, dl->ypos,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063 (XChar2b *) runs[i].ptr, runs[i].len);
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
1064
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065 XSetClipMask (dpy, cgc, None);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066 XSetClipOrigin (dpy, cgc, 0, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1068
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069 xpos += this_width;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1071
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1072 /* Draw the non-focus box or bar-cursor as needed. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1073 /* Can't this logic be simplified? */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1074 if (cursor_cachel
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075 && ((cursor && !focus && NILP (bar_cursor_value))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1076 || (cursor_width
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077 && (cursor_start + cursor_width >= clip_start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078 && !NILP (bar_cursor_value))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080 int tmp_height, tmp_y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081 int bar_width = EQ (bar_cursor_value, Qt) ? 1 : 2;
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 112
diff changeset
1082 int need_clipping = (cursor_start < clip_start
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 112
diff changeset
1083 || clip_end < cursor_start + cursor_width);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085 /* #### This value is correct (as far as I know) because
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086 all of the times we need to draw this cursor, we will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087 be called with exactly one character, so we know we
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088 can always use runs[0].
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090 This is bogus as all hell, however. The cursor handling in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091 this function is way bogus and desperately needs to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092 cleaned up. (In particular, the drawing of the cursor should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1093 really really be separated out of this function. This may be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094 a bit tricky now because this function itself does way too
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095 much stuff, a lot of which needs to be moved into
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096 redisplay.c) This is the only way to be able to easily add
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097 new cursor types or (e.g.) make the bar cursor be able to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098 span two characters instead of overlaying just one. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099 int bogusly_obtained_ascent_value =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1100 XFONT_INSTANCE (FACE_CACHEL_FONT (cachel, runs[0].charset))->ascent;
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
1101
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102 if (!NILP (bar_cursor_value))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1103 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1104 gc = x_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1105 make_int (bar_width));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1106 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1107 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1108 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109 gc = x_get_gc (d, Qnil, cursor_cachel->background,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1110 Qnil, Qnil, Qnil);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1111 }
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
1112
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1113 tmp_y = dl->ypos - bogusly_obtained_ascent_value;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1114 tmp_height = cursor_height;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1115 if (tmp_y + tmp_height > (int) (DISPLAY_LINE_YPOS(dl) + height))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1116 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1117 tmp_y = DISPLAY_LINE_YPOS (dl) + height - tmp_height;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1118 if (tmp_y < (int) DISPLAY_LINE_YPOS (dl))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1119 tmp_y = DISPLAY_LINE_YPOS (dl);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1120 tmp_height = DISPLAY_LINE_YPOS (dl) + height - tmp_y;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1121 }
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
1122
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 112
diff changeset
1123 if (need_clipping)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 112
diff changeset
1124 {
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 112
diff changeset
1125 XRectangle clip_box[1];
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 112
diff changeset
1126 clip_box[0].x = 0;
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 112
diff changeset
1127 clip_box[0].y = 0;
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 112
diff changeset
1128 clip_box[0].width = clip_end - clip_start;
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 112
diff changeset
1129 clip_box[0].height = tmp_height;
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 112
diff changeset
1130 XSetClipRectangles (dpy, gc, clip_start, tmp_y,
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 112
diff changeset
1131 clip_box, 1, Unsorted);
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 112
diff changeset
1132 }
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 112
diff changeset
1133
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134 if (!focus && NILP (bar_cursor_value))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135 {
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 112
diff changeset
1136 XDrawRectangle (dpy, x_win, gc, cursor_start, tmp_y,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137 cursor_width - 1, tmp_height - 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139 else if (focus && !NILP (bar_cursor_value))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140 {
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 112
diff changeset
1141 XDrawLine (dpy, x_win, gc, cursor_start + bar_width - 1, tmp_y,
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 112
diff changeset
1142 cursor_start + bar_width - 1, tmp_y + tmp_height - 1);
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 112
diff changeset
1143 }
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 112
diff changeset
1144
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 112
diff changeset
1145 /* Restore the GC */
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 112
diff changeset
1146 if (need_clipping)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 112
diff changeset
1147 {
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 112
diff changeset
1148 XSetClipMask (dpy, gc, None);
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 112
diff changeset
1149 XSetClipOrigin (dpy, gc, 0, 0);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1150 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1151 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1152 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1153
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1154 void
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1155 x_output_x_pixmap (struct frame *f, Lisp_Image_Instance *p, int x,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1156 int y, int xoffset, int yoffset,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1157 int width, int height, unsigned long fg, unsigned long bg,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1158 GC override_gc)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1159 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1160 struct device *d = XDEVICE (f->device);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1161 Display *dpy = DEVICE_X_DISPLAY (d);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1162 Window x_win = XtWindow (FRAME_X_TEXT_WIDGET (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1163
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1164 GC gc;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1165 XGCValues gcv;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1166 unsigned long pixmap_mask;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1167
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1168 if (!override_gc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1169 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1170 memset (&gcv, ~0, sizeof (XGCValues));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1171 gcv.graphics_exposures = False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1172 gcv.foreground = fg;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1173 gcv.background = bg;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1174 pixmap_mask = GCForeground | GCBackground | GCGraphicsExposures;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1175
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1176 if (IMAGE_INSTANCE_X_MASK (p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1177 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1178 gcv.function = GXcopy;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1179 gcv.clip_mask = IMAGE_INSTANCE_X_MASK (p);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1180 gcv.clip_x_origin = x - xoffset;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1181 gcv.clip_y_origin = y - yoffset;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1182 pixmap_mask |= (GCFunction | GCClipMask | GCClipXOrigin |
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1183 GCClipYOrigin);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1184 /* Can't set a clip rectangle because we already have a mask.
112
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents: 70
diff changeset
1185 Is it possible to get an equivalent effect by changing the
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents: 70
diff changeset
1186 args to XCopyArea below rather than messing with a clip box?
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1187 - dkindred@cs.cmu.edu
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1188 Yes. We don't clip at all now - andy@xemacs.org
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1189 */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1190 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1191
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1192 gc = gc_cache_lookup (DEVICE_X_GC_CACHE (d), &gcv, pixmap_mask);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1193 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1194 else
112
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents: 70
diff changeset
1195 {
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents: 70
diff changeset
1196 gc = override_gc;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents: 70
diff changeset
1197 /* override_gc might have a mask already--we don't want to nuke it.
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents: 70
diff changeset
1198 Maybe we can insist that override_gc have no mask, or use
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents: 70
diff changeset
1199 one of the suggestions above. */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1200 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1201
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1202 /* depth of 0 means it's a bitmap, not a pixmap, and we should use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1203 XCopyPlane (1 = current foreground color, 0 = background) instead
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1204 of XCopyArea, which means that the bits in the pixmap are actual
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1205 pixel values, instead of symbolic of fg/bg. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1206 if (IMAGE_INSTANCE_PIXMAP_DEPTH (p) > 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1207 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1208 XCopyArea (dpy,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1209 IMAGE_INSTANCE_X_PIXMAP_SLICE
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1210 (p, IMAGE_INSTANCE_PIXMAP_SLICE (p)), x_win, gc, xoffset,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1211 yoffset, width,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1212 height, x, y);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1213 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1214 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1215 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1216 XCopyPlane (dpy, IMAGE_INSTANCE_X_PIXMAP_SLICE
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1217 (p, IMAGE_INSTANCE_PIXMAP_SLICE (p)), x_win, gc,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1218 xoffset, yoffset, width, height, x, y, 1L);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1219 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1220 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1221
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1222 static void
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1223 x_output_pixmap (struct window *w, Lisp_Object image_instance,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1224 struct display_box *db, struct display_glyph_area *dga,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1225 face_index findex, int cursor_start, int cursor_width,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1226 int cursor_height, int bg_pixmap)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1227 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1228 struct frame *f = XFRAME (w->frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1229 struct device *d = XDEVICE (f->device);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1230 Lisp_Image_Instance *p = XIMAGE_INSTANCE (image_instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1231
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1232 Display *dpy = DEVICE_X_DISPLAY (d);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1233 Window x_win = XtWindow (FRAME_X_TEXT_WIDGET (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1234
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1235 /* Output the pixmap. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1236 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1237 Lisp_Object tmp_pixel;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1238 XColor tmp_bcolor, tmp_fcolor;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1239
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1240 tmp_pixel = WINDOW_FACE_CACHEL_FOREGROUND (w, findex);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1241 tmp_fcolor = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (tmp_pixel));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1242 tmp_pixel = WINDOW_FACE_CACHEL_BACKGROUND (w, findex);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1243 tmp_bcolor = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (tmp_pixel));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1244
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1245 x_output_x_pixmap (f, p, db->xpos, db->ypos,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1246 dga->xoffset, dga->yoffset,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1247 dga->width, dga->height,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1248 tmp_fcolor.pixel, tmp_bcolor.pixel, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1249 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1250
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1251 /* Draw a cursor over top of the pixmap. */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1252 if (cursor_width && cursor_height && (cursor_start >= db->xpos)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1253 && !NILP (w->text_cursor_visible_p)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1254 && (cursor_start < db->xpos + dga->width))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1255 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1256 GC gc;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1257 int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1258 struct face_cachel *cursor_cachel =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1259 WINDOW_FACE_CACHEL (w,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1260 get_builtin_face_cache_index
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1261 (w, Vtext_cursor_face));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1262
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1263 gc = x_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil, Qnil);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1264
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1265 if (cursor_width > db->xpos + dga->width - cursor_start)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1266 cursor_width = db->xpos + dga->width - cursor_start;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1267
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1268 if (focus)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1269 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1270 XFillRectangle (dpy, x_win, gc, cursor_start, db->ypos, cursor_width,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1271 cursor_height);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1272 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1273 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1274 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1275 XDrawRectangle (dpy, x_win, gc, cursor_start, db->ypos, cursor_width,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1276 cursor_height);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1277 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1278 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1279 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1280
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1281 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1282 x_output_vertical_divider
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1283
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
1284 Draw a vertical divider down the right side of the given window.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1285 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1286 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1287 x_output_vertical_divider (struct window *w, int clear)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1288 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1289 struct frame *f = XFRAME (w->frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1290 struct device *d = XDEVICE (f->device);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1291
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1292 Display *dpy = DEVICE_X_DISPLAY (d);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1293 Window x_win = XtWindow (FRAME_X_TEXT_WIDGET (f));
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
1294 Lisp_Object tmp_pixel;
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
1295 XColor tmp_color;
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
1296 XGCValues gcv;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1297 GC background_gc;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1298 enum edge_style style;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1299
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
1300 unsigned long mask;
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
1301 int x, y1, y2, width, shadow_thickness, spacing, line_width;
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
1302 face_index div_face = get_builtin_face_cache_index (w, Vvertical_divider_face);
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
1303
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
1304 width = window_divider_width (w);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
1305 shadow_thickness = XINT (w->vertical_divider_shadow_thickness);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
1306 spacing = XINT (w->vertical_divider_spacing);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
1307 line_width = XINT (w->vertical_divider_line_width);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
1308 x = WINDOW_RIGHT (w) - width;
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
1309 y1 = WINDOW_TOP (w);
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
1310 y2 = WINDOW_BOTTOM (w);
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
1311
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
1312 memset (&gcv, ~0, sizeof (XGCValues));
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
1313
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
1314 tmp_pixel = WINDOW_FACE_CACHEL_BACKGROUND (w, div_face);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
1315 tmp_color = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (tmp_pixel));
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
1316
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
1317 /* First, get the GC's. */
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
1318 gcv.background = tmp_color.pixel;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1319 gcv.foreground = tmp_color.pixel;
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
1320 gcv.graphics_exposures = False;
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
1321 mask = GCForeground | GCBackground | GCGraphicsExposures;
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
1322 background_gc = gc_cache_lookup (DEVICE_X_GC_CACHE (d), &gcv, mask);
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
1323
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
1324 /* Clear the divider area first. This needs to be done when a
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
1325 window split occurs. */
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
1326 if (clear)
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
1327 XClearArea (dpy, x_win, x, y1, width, y2 - y1, False);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1328
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
1329 /* Draw the divider line. */
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
1330 XFillRectangle (dpy, x_win, background_gc,
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
1331 x + spacing + shadow_thickness, y1,
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
1332 line_width, y2 - y1);
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
1333
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1334 if (shadow_thickness < 0)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1335 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1336 shadow_thickness = -shadow_thickness;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1337 style = EDGE_BEVEL_IN;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1338 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1339 else
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1340 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1341 style = EDGE_BEVEL_OUT;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1342 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1343
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
1344 /* Draw the shadows around the divider line */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1345 x_bevel_area (w, div_face, x + spacing, y1,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1346 width - 2 * spacing, y2 - y1,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1347 shadow_thickness, EDGE_ALL, style);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1348 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1349
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1350 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1351 x_output_blank
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1352
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1353 Output a blank by clearing the area it covers in the foreground color
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1354 of its face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1355 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1356 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1357 x_output_blank (struct window *w, struct display_line *dl, struct rune *rb,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1358 int start_pixpos, int cursor_start, int cursor_width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1359 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1360 struct frame *f = XFRAME (w->frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1361 struct device *d = XDEVICE (f->device);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1362
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1363 Display *dpy = DEVICE_X_DISPLAY (d);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1364 Window x_win = XtWindow (FRAME_X_TEXT_WIDGET (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1365 GC gc;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1366 struct face_cachel *cursor_cachel =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1367 WINDOW_FACE_CACHEL (w,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1368 get_builtin_face_cache_index
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1369 (w, Vtext_cursor_face));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1370 Lisp_Object bg_pmap;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1371 Lisp_Object buffer = WINDOW_BUFFER (w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1372 Lisp_Object bar_cursor_value = symbol_value_in_buffer (Qbar_cursor,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1373 buffer);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1374
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1375 int x = rb->xpos;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1376 int y = DISPLAY_LINE_YPOS (dl);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1377 int width = rb->width;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1378 int height = DISPLAY_LINE_HEIGHT (dl);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1379
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1380 /* Unmap all subwindows in the area we are going to blank. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1381 redisplay_unmap_subwindows_maybe (f, x, y, width, height);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1382
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1383 if (start_pixpos > x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1384 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1385 if (start_pixpos >= (x + width))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1386 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1387 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1388 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1389 width -= (start_pixpos - x);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1390 x = start_pixpos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1391 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1392 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1393
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1394 bg_pmap = WINDOW_FACE_CACHEL_BACKGROUND_PIXMAP (w, rb->findex);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1395 if (!IMAGE_INSTANCEP (bg_pmap)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1396 || !IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (bg_pmap)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1397 bg_pmap = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1398
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1399 if (NILP (bg_pmap))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1400 gc = x_get_gc (d, Qnil, WINDOW_FACE_CACHEL_BACKGROUND (w, rb->findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1401 Qnil, Qnil, Qnil);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1402 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1403 gc = x_get_gc (d, Qnil, WINDOW_FACE_CACHEL_FOREGROUND (w, rb->findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1404 WINDOW_FACE_CACHEL_BACKGROUND (w, rb->findex), bg_pmap,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1405 Qnil);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1406
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1407 XFillRectangle (dpy, x_win, gc, x, y, width, height);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1408
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1409 /* If this rune is marked as having the cursor, then it is actually
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1410 representing a tab. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1411 if (!NILP (w->text_cursor_visible_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1412 && (rb->cursor_type == CURSOR_ON
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1413 || (cursor_width
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1414 && (cursor_start + cursor_width > x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1415 && cursor_start < (x + width))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1416 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1417 int cursor_height, cursor_y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1418 int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d));
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1419 Lisp_Font_Instance *fi;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1420
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1421 fi = XFONT_INSTANCE (FACE_CACHEL_FONT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1422 (WINDOW_FACE_CACHEL (w, rb->findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1423 Vcharset_ascii));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1424
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1425 gc = x_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil, Qnil);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1426
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1427 cursor_y = dl->ypos - fi->ascent;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1428 cursor_height = fi->height;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1429 if (cursor_y + cursor_height > y + height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1430 cursor_height = y + height - cursor_y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1431
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1432 if (focus)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1433 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1434 if (NILP (bar_cursor_value))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1435 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1436 XFillRectangle (dpy, x_win, gc, cursor_start, cursor_y,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1437 fi->width, cursor_height);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1438 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1439 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1440 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1441 int bar_width = EQ (bar_cursor_value, Qt) ? 1 : 2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1442
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1443 gc = x_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1444 make_int (bar_width));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1445 XDrawLine (dpy, x_win, gc, cursor_start + bar_width - 1,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1446 cursor_y, cursor_start + bar_width - 1,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1447 cursor_y + cursor_height - 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1448 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1449 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1450 else if (NILP (bar_cursor_value))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1451 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1452 XDrawRectangle (dpy, x_win, gc, cursor_start, cursor_y,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1453 fi->width - 1, cursor_height - 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1454 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1455 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1456 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1457
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1458 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1459 x_output_hline
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1460
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1461 Output a horizontal line in the foreground of its face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1462 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1463 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1464 x_output_hline (struct window *w, struct display_line *dl, struct rune *rb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1465 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1466 struct frame *f = XFRAME (w->frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1467 struct device *d = XDEVICE (f->device);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1468
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1469 Display *dpy = DEVICE_X_DISPLAY (d);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1470 Window x_win = XtWindow (FRAME_X_TEXT_WIDGET (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1471 GC gc;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1472
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1473 int x = rb->xpos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1474 int width = rb->width;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1475 int height = DISPLAY_LINE_HEIGHT (dl);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1476 int ypos1, ypos2, ypos3, ypos4;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1477
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1478 ypos1 = DISPLAY_LINE_YPOS (dl);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1479 ypos2 = ypos1 + rb->object.hline.yoffset;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1480 ypos3 = ypos2 + rb->object.hline.thickness;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1481 ypos4 = dl->ypos + dl->descent - dl->clip;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1482
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1483 /* First clear the area not covered by the line. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1484 if (height - rb->object.hline.thickness > 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1485 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1486 gc = x_get_gc (d, Qnil, WINDOW_FACE_CACHEL_FOREGROUND (w, rb->findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1487 Qnil, Qnil, Qnil);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1488
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1489 if (ypos2 - ypos1 > 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1490 XFillRectangle (dpy, x_win, gc, x, ypos1, width, ypos2 - ypos1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1491 if (ypos4 - ypos3 > 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1492 XFillRectangle (dpy, x_win, gc, x, ypos1, width, ypos2 - ypos1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1493 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1494
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1495 /* Now draw the line. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1496 gc = x_get_gc (d, Qnil, WINDOW_FACE_CACHEL_BACKGROUND (w, rb->findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1497 Qnil, Qnil, Qnil);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1498
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1499 if (ypos2 < ypos1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1500 ypos2 = ypos1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1501 if (ypos3 > ypos4)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1502 ypos3 = ypos4;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1503
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1504 if (ypos3 - ypos2 > 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1505 XFillRectangle (dpy, x_win, gc, x, ypos2, width, ypos3 - ypos2);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1506 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1507
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1508 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1509 x_output_shadows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1510
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1511 Draw a shadow around the given area using the given GC's. It is the
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
1512 callers responsibility to set the GC's appropriately.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1513 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1514 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1515 x_output_shadows (struct frame *f, int x, int y, int width, int height,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1516 GC top_shadow_gc, GC bottom_shadow_gc, GC background_gc,
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1517 int shadow_thickness, int edges)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1518 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1519 struct device *d = XDEVICE (f->device);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1520
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1521 Display *dpy = DEVICE_X_DISPLAY (d);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1522 Window x_win = XtWindow (FRAME_X_TEXT_WIDGET (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1523
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1524 XSegment top_shadow[20], bottom_shadow[20];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1525 int elt;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1526
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1527 if (shadow_thickness > 10)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1528 shadow_thickness = 10;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1529 else if (shadow_thickness < 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1530 shadow_thickness = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1531 if (shadow_thickness > (width / 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1532 shadow_thickness = width / 2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1533 if (shadow_thickness > (height / 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1534 shadow_thickness = height / 2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1535
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1536 for (elt = 0; elt < shadow_thickness; elt++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1537 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1538 int seg1 = elt;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1539 int seg2 = (edges & EDGE_TOP) ? elt + shadow_thickness : elt;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1540 int bot_seg2 = (edges & EDGE_BOTTOM) ? elt + shadow_thickness : elt;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1541
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1542 if (edges & EDGE_TOP)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1543 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1544 top_shadow[seg1].x1 = x + elt;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1545 top_shadow[seg1].x2 = x + width - elt - 1;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1546 top_shadow[seg1].y1 = top_shadow[seg1].y2 = y + elt;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1547 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1548 if (edges & EDGE_LEFT)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1549 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1550 top_shadow[seg2].x1 = top_shadow[seg2].x2 = x + elt;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1551 top_shadow[seg2].y1 = y + elt;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1552 top_shadow[seg2].y2 = y + height - elt - 1;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1553 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1554 if (edges & EDGE_BOTTOM)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1555 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1556 bottom_shadow[seg1].x1 = x + elt;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1557 bottom_shadow[seg1].x2 = x + width - elt - 1;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1558 bottom_shadow[seg1].y1 = bottom_shadow[seg1].y2 = y + height - elt - 1;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1559 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1560 if (edges & EDGE_RIGHT)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1561 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1562 bottom_shadow[bot_seg2].x1 = bottom_shadow[bot_seg2].x2 = x + width - elt - 1;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1563 bottom_shadow[bot_seg2].y1 = y + elt;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1564 bottom_shadow[bot_seg2].y2 = y + height - elt - 1;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1565 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1566 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1567
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1568 XDrawSegments (dpy, x_win, top_shadow_gc, top_shadow,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1569 ((edges & EDGE_TOP) ? shadow_thickness : 0)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1570 + ((edges & EDGE_LEFT) ? shadow_thickness : 0));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1571 XDrawSegments (dpy, x_win, bottom_shadow_gc, bottom_shadow,
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1572 ((edges & EDGE_BOTTOM) ? shadow_thickness : 0)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1573 + ((edges & EDGE_RIGHT) ? shadow_thickness : 0));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1574 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1575
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1576 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1577 x_generate_shadow_pixels
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1578
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1579 Given three pixels (top shadow, bottom shadow, background) massage
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1580 the top and bottom shadow colors to guarantee that they differ. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1581 background pixels are not allowed to be modified.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1582
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1583 This function modifies its parameters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1584
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1585 This code is modified from code blatantly stolen from lwlib/xlwmenu.c
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1586 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1587 #define MINL(x,y) ((((unsigned long) (x)) < ((unsigned long) (y))) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1588 ? ((unsigned long) (x)) : ((unsigned long) (y)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1589
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1590 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1591 x_generate_shadow_pixels (struct frame *f, unsigned long *top_shadow,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1592 unsigned long *bottom_shadow,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1593 unsigned long background,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1594 unsigned long core_background)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1595 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1596 struct device *d = XDEVICE (f->device);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1597 Display *dpy = DEVICE_X_DISPLAY (d);
219
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 217
diff changeset
1598 Colormap cmap = DEVICE_X_COLORMAP (d);
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 217
diff changeset
1599 Visual *visual = DEVICE_X_VISUAL (d);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1600
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1601 XColor topc, botc;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1602 int top_frobbed = 0, bottom_frobbed = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1603
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
1604 /* If the top shadow is the same color as the background, try to
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1605 adjust it. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1606 if (*top_shadow == background)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1607 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1608 topc.pixel = background;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1609 XQueryColor (dpy, cmap, &topc);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1610 /* don't overflow/wrap! */
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
1611 topc.red = MINL (65535, (unsigned long) topc.red * 6 / 5);
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
1612 topc.green = MINL (65535, (unsigned long) topc.green * 6 / 5);
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
1613 topc.blue = MINL (65535, (unsigned long) topc.blue * 6 / 5);
219
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 217
diff changeset
1614 if (allocate_nearest_color (dpy, cmap, visual, &topc))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1615 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1616 *top_shadow = topc.pixel;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1617 top_frobbed = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1618 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1619 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1620
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
1621 /* If the bottom shadow is the same color as the background, try to
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1622 adjust it. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1623 if (*bottom_shadow == background)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1624 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1625 botc.pixel = background;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1626 XQueryColor (dpy, cmap, &botc);
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
1627 botc.red = (unsigned short) ((unsigned long) botc.red * 3 / 5);
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
1628 botc.green = (unsigned short) ((unsigned long) botc.green * 3 / 5);
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 183
diff changeset
1629 botc.blue = (unsigned short) ((unsigned long) botc.blue * 3 / 5);
219
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 217
diff changeset
1630 if (allocate_nearest_color (dpy, cmap, visual, &botc))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1631 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1632 *bottom_shadow = botc.pixel;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1633 bottom_frobbed = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1634 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1635 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1636
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1637 /* If we had to adjust both shadows, then we have to do some
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1638 additional work. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1639 if (top_frobbed && bottom_frobbed)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1640 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1641 int top_avg = ((topc.red / 3) + (topc.green / 3) + (topc.blue / 3));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1642 int bot_avg = ((botc.red / 3) + (botc.green / 3) + (botc.blue / 3));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1643 if (bot_avg > top_avg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1644 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1645 Pixel tmp = *top_shadow;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1646
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1647 *top_shadow = *bottom_shadow;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1648 *bottom_shadow = tmp;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1649 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1650 else if (topc.pixel == botc.pixel)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1651 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1652 if (botc.pixel == background)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1653 *top_shadow = core_background;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1654 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1655 *bottom_shadow = background;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1656 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1657 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1658 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1659
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1660 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1661 x_redraw_exposed_window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1662
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1663 Given a bounding box for an area that needs to be redrawn, determine
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1664 what parts of what lines are contained within and re-output their
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1665 contents.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1666 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1667 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1668 x_redraw_exposed_window (struct window *w, int x, int y, int width, int height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1669 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1670 struct frame *f = XFRAME (w->frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1671 int line;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1672 int start_x, start_y, end_x, end_y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1673 int orig_windows_structure_changed;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1674
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1675 display_line_dynarr *cdla = window_display_lines (w, CURRENT_DISP);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1676
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1677 if (!NILP (w->vchild))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1678 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1679 x_redraw_exposed_windows (w->vchild, x, y, width, height);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1680 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1681 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1682 else if (!NILP (w->hchild))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1683 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1684 x_redraw_exposed_windows (w->hchild, x, y, width, height);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1685 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1686 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1687
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1688 /* If the window doesn't intersect the exposed region, we're done here. */
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 112
diff changeset
1689 if (x >= WINDOW_RIGHT (w) || (x + width) <= WINDOW_LEFT (w)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 112
diff changeset
1690 || y >= WINDOW_BOTTOM (w) || (y + height) <= WINDOW_TOP (w))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1691 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1692 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1693 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1694 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1695 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1696 start_x = max (WINDOW_LEFT (w), x);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1697 end_x = min (WINDOW_RIGHT (w), (x + width));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1698 start_y = max (WINDOW_TOP (w), y);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1699 end_y = min (WINDOW_BOTTOM (w), y + height);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1700
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1701 /* We do this to make sure that the 3D modelines get redrawn if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1702 they are in the exposed region. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1703 orig_windows_structure_changed = f->windows_structure_changed;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1704 f->windows_structure_changed = 1;
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
1705 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1706
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1707 if (window_needs_vertical_divider (w))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1708 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1709 x_output_vertical_divider (w, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1710 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1711
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1712 for (line = 0; line < Dynarr_length (cdla); line++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1713 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1714 struct display_line *cdl = Dynarr_atp (cdla, line);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1715 int top_y = cdl->ypos - cdl->ascent;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1716 int bottom_y = cdl->ypos + cdl->descent;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1717
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1718 if (bottom_y >= start_y)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1719 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1720 if (top_y > end_y)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1721 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1722 if (line == 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1723 continue;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1724 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1725 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1726 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1727 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1728 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1729 output_display_line (w, 0, cdla, line, start_x, end_x);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1730 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1731 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1732 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1733
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1734 f->windows_structure_changed = orig_windows_structure_changed;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1735
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1736 /* If there have never been any face cache_elements created, then this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1737 expose event doesn't actually have anything to do. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1738 if (Dynarr_largest (w->face_cachels))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1739 redisplay_clear_bottom_of_window (w, cdla, start_y, end_y);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1740 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1741
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1742 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1743 x_redraw_exposed_windows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1744
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1745 For each window beneath the given window in the window hierarchy,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1746 ensure that it is redrawn if necessary after an Expose event.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1747 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1748 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1749 x_redraw_exposed_windows (Lisp_Object window, int x, int y, int width,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1750 int height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1751 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1752 for (; !NILP (window); window = XWINDOW (window)->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1753 x_redraw_exposed_window (XWINDOW (window), x, y, width, height);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1754 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1755
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1756 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1757 x_redraw_exposed_area
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1758
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1759 For each window on the given frame, ensure that any area in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1760 Exposed area is redrawn.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1761 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1762 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1763 x_redraw_exposed_area (struct frame *f, int x, int y, int width, int height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1764 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1765 /* If any window on the frame has had its face cache reset then the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1766 redisplay structures are effectively invalid. If we attempt to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1767 use them we'll blow up. We mark the frame as changed to ensure
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1768 that redisplay will do a full update. This probably isn't
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1769 necessary but it can't hurt. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1770
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1771 #ifdef HAVE_TOOLBARS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1772 /* #### We would rather put these off as well but there is currently
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1773 no combination of flags which will force an unchanged toolbar to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1774 redraw anyhow. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1775 MAYBE_FRAMEMETH (f, redraw_exposed_toolbars, (f, x, y, width, height));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1776 #endif
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1777 redraw_exposed_gutters (f, x, y, width, height);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1778
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1779 if (!f->window_face_cache_reset)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1780 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1781 x_redraw_exposed_windows (f->root_window, x, y, width, height);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1782
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1783 XFlush (DEVICE_X_DISPLAY (XDEVICE (f->device)));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1784 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1785 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1786 MARK_FRAME_CHANGED (f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1787 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1788
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1789 /****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1790 x_clear_region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1791
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1792 Clear the area in the box defined by the given parameters using the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1793 given face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1794 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1795 static void
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1796 x_clear_region (Lisp_Object locale, struct device* d, struct frame* f, face_index findex,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1797 int x, int y,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1798 int width, int height, Lisp_Object fcolor, Lisp_Object bcolor,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1799 Lisp_Object background_pixmap)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1800 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1801 Display *dpy;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1802 Window x_win;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1803 GC gc = NULL;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1804
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1805 dpy = DEVICE_X_DISPLAY (d);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1806 x_win = XtWindow (FRAME_X_TEXT_WIDGET (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1807
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1808 if (!UNBOUNDP (background_pixmap))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1809 {
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1810 gc = x_get_gc (d, Qnil, fcolor, bcolor, background_pixmap, Qnil);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1811 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1812
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1813 if (gc)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1814 XFillRectangle (dpy, x_win, gc, x, y, width, height);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1815 else
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1816 XClearArea (dpy, x_win, x, y, width, height, False);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1817 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1818
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1819 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1820 x_output_eol_cursor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1821
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1822 Draw a cursor at the end of a line. The end-of-line cursor is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1823 narrower than the normal cursor.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1824 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1825 static void
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 259
diff changeset
1826 x_output_eol_cursor (struct window *w, struct display_line *dl, int xpos,
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 259
diff changeset
1827 face_index findex)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1828 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1829 struct frame *f = XFRAME (w->frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1830 struct device *d = XDEVICE (f->device);
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 259
diff changeset
1831 Lisp_Object window;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1832
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1833 Display *dpy = DEVICE_X_DISPLAY (d);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1834 Window x_win = XtWindow (FRAME_X_TEXT_WIDGET (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1835 GC gc;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1836 face_index elt = get_builtin_face_cache_index (w, Vtext_cursor_face);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1837 struct face_cachel *cursor_cachel = WINDOW_FACE_CACHEL (w, elt);
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
1838
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1839 int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1840 Lisp_Object bar_cursor_value = symbol_value_in_buffer (Qbar_cursor,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1841 WINDOW_BUFFER (w));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1842
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1843 int x = xpos;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1844 int y = DISPLAY_LINE_YPOS (dl);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1845 int width = EOL_CURSOR_WIDTH;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1846 int height = DISPLAY_LINE_HEIGHT (dl);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1847 int cursor_height, cursor_y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1848 int defheight, defascent;
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
1849
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 259
diff changeset
1850 XSETWINDOW (window, w);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1851 redisplay_clear_region (window, findex, x, y, width, height);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1852
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1853 if (NILP (w->text_cursor_visible_p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1854 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1855
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1856 gc = x_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil, Qnil);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1857
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1858 default_face_font_info (window, &defascent, 0, &defheight, 0, 0);
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
1859
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 112
diff changeset
1860 /* make sure the cursor is entirely contained between y and y+height */
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 112
diff changeset
1861 cursor_height = min (defheight, height);
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
1862 cursor_y = max (y, min (y + height - cursor_height,
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 112
diff changeset
1863 dl->ypos - defascent));
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
1864
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1865 if (focus)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1866 {
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 42
diff changeset
1867 #ifdef HAVE_XIM
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 42
diff changeset
1868 XIM_SetSpotLocation (f, x - 2 , cursor_y + cursor_height - 2);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 42
diff changeset
1869 #endif /* HAVE_XIM */
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
1870
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1871 if (NILP (bar_cursor_value))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1872 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1873 XFillRectangle (dpy, x_win, gc, x, cursor_y, width, cursor_height);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1874 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1875 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1876 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1877 int bar_width = EQ (bar_cursor_value, Qt) ? 1 : 2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1878
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1879 gc = x_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1880 make_int (bar_width));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1881 XDrawLine (dpy, x_win, gc, x + bar_width - 1, cursor_y,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1882 x + bar_width - 1, cursor_y + cursor_height - 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1883 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1884 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1885 else if (NILP (bar_cursor_value))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1886 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1887 XDrawRectangle (dpy, x_win, gc, x, cursor_y, width - 1,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1888 cursor_height - 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1889 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1890 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1891
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1892 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1893 x_clear_frame_window (Lisp_Object window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1894 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1895 struct window *w = XWINDOW (window);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1896
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1897 if (!NILP (w->vchild))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1898 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1899 x_clear_frame_windows (w->vchild);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1900 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1901 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1902
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1903 if (!NILP (w->hchild))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1904 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1905 x_clear_frame_windows (w->hchild);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1906 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1907 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1908
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1909 redisplay_clear_to_window_end (w, WINDOW_TEXT_TOP (w),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1910 WINDOW_TEXT_BOTTOM (w));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1911 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1912
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1913 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1914 x_clear_frame_windows (Lisp_Object window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1915 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1916 for (; !NILP (window); window = XWINDOW (window)->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1917 x_clear_frame_window (window);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1918 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1919
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1920 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1921 x_clear_frame (struct frame *f)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1922 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1923 struct device *d = XDEVICE (f->device);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1924 Display *dpy = DEVICE_X_DISPLAY (d);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1925 Window x_win = XtWindow (FRAME_X_TEXT_WIDGET (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1926 int x, y, width, height;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1927 Lisp_Object frame;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1928
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1929 x = FRAME_LEFT_BORDER_START (f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1930 width = (FRAME_PIXWIDTH (f) - FRAME_REAL_LEFT_TOOLBAR_WIDTH (f) -
215
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
1931 FRAME_REAL_RIGHT_TOOLBAR_WIDTH (f) -
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
1932 2 * FRAME_REAL_LEFT_TOOLBAR_BORDER_WIDTH (f) -
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
1933 2 * FRAME_REAL_RIGHT_TOOLBAR_BORDER_WIDTH (f));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1934 /* #### This adjustment by 1 should be being done in the macros.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1935 There is some small differences between when the menubar is on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1936 and off that we still need to deal with. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1937 y = FRAME_TOP_BORDER_START (f) - 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1938 height = (FRAME_PIXHEIGHT (f) - FRAME_REAL_TOP_TOOLBAR_HEIGHT (f) -
215
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
1939 FRAME_REAL_BOTTOM_TOOLBAR_HEIGHT (f) -
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
1940 2 * FRAME_REAL_TOP_TOOLBAR_BORDER_WIDTH (f) -
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
1941 2 * FRAME_REAL_BOTTOM_TOOLBAR_BORDER_WIDTH (f)) + 1;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1942
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1943 XClearArea (dpy, x_win, x, y, width, height, False);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1944
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1945 XSETFRAME (frame, f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1946
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1947 if (!UNBOUNDP (FACE_BACKGROUND_PIXMAP (Vdefault_face, frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1948 || !UNBOUNDP (FACE_BACKGROUND_PIXMAP (Vleft_margin_face, frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1949 || !UNBOUNDP (FACE_BACKGROUND_PIXMAP (Vright_margin_face, frame)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1950 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1951 x_clear_frame_windows (f->root_window);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1952 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1953
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1954 XFlush (DEVICE_X_DISPLAY (d));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1955 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1956
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1957 /* briefly swap the foreground and background colors.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1958 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1959
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1960 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1961 x_flash (struct device *d)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1962 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1963 Display *dpy;
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents: 215
diff changeset
1964 Window win;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1965 XGCValues gcv;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1966 GC gc;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1967 XColor tmp_fcolor, tmp_bcolor;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1968 Lisp_Object tmp_pixel, frame;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1969 struct frame *f = device_selected_frame (d);
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents: 215
diff changeset
1970 struct window *w = XWINDOW (FRAME_ROOT_WINDOW (f));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1971 Widget shell = FRAME_X_SHELL_WIDGET (f);
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
1972 int flash_height;
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
1973
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1974 XSETFRAME (frame, f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1975
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1976 tmp_pixel = FACE_FOREGROUND (Vdefault_face, frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1977 tmp_fcolor = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (tmp_pixel));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1978 tmp_pixel = FACE_BACKGROUND (Vdefault_face, frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1979 tmp_bcolor = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (tmp_pixel));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1980
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1981 dpy = XtDisplay (shell);
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents: 215
diff changeset
1982 win = XtWindow (FRAME_X_TEXT_WIDGET (f));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1983 memset (&gcv, ~0, sizeof (XGCValues)); /* initialize all slots to ~0 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1984 gcv.foreground = (tmp_fcolor.pixel ^ tmp_bcolor.pixel);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1985 gcv.function = GXxor;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1986 gcv.graphics_exposures = False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1987 gc = gc_cache_lookup (DEVICE_X_GC_CACHE (XDEVICE (f->device)), &gcv,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1988 (GCForeground | GCFunction | GCGraphicsExposures));
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
1989 default_face_height_and_width (frame, &flash_height, 0);
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
1990
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
1991 /* If window is tall, flash top and bottom line. */
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
1992 if (EQ (Vvisible_bell, Qtop_bottom) && w->pixel_height > 3 * flash_height)
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
1993 {
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
1994 XFillRectangle (dpy, win, gc, w->pixel_left, w->pixel_top,
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
1995 w->pixel_width, flash_height);
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
1996 XFillRectangle (dpy, win, gc, w->pixel_left,
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
1997 w->pixel_top + w->pixel_height - flash_height,
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
1998 w->pixel_width, flash_height);
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
1999 }
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
2000 else
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
2001 /* If it is short, flash it all. */
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
2002 XFillRectangle (dpy, win, gc, w->pixel_left, w->pixel_top,
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
2003 w->pixel_width, w->pixel_height);
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
2004
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2005 XSync (dpy, False);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2006
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
2007 #ifdef HAVE_SELECT
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2008 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2009 int usecs = 100000;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2010 struct timeval tv;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2011 tv.tv_sec = usecs / 1000000L;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2012 tv.tv_usec = usecs % 1000000L;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2013 /* I'm sure someone is going to complain about this... */
183
e121b013d1f0 Import from CVS: tag r20-3b18
cvs
parents: 173
diff changeset
2014 select (0, 0, 0, 0, &tv);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2015 }
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
2016 #else
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 314
diff changeset
2017 #ifdef HAVE_POLL
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 314
diff changeset
2018 poll (0, 0, 100);
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 314
diff changeset
2019 #else /* !HAVE_POLL */
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
2020 bite me
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
2021 #endif /* HAVE_POLL */
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
2022 #endif /* HAVE_SELECT */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2023
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
2024 /* If window is tall, flash top and bottom line. */
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
2025 if (EQ (Vvisible_bell, Qtop_bottom) && w->pixel_height > 3 * flash_height)
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
2026 {
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
2027 XFillRectangle (dpy, win, gc, w->pixel_left, w->pixel_top,
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
2028 w->pixel_width, flash_height);
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
2029 XFillRectangle (dpy, win, gc, w->pixel_left,
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
2030 w->pixel_top + w->pixel_height - flash_height,
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
2031 w->pixel_width, flash_height);
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
2032 }
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
2033 else
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
2034 /* If it is short, flash it all. */
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
2035 XFillRectangle (dpy, win, gc, w->pixel_left, w->pixel_top,
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
2036 w->pixel_width, w->pixel_height);
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
2037
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2038 XSync (dpy, False);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2039
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2040 return 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2041 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2042
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2043 /* Make audible bell. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2044
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2045 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2046 x_ring_bell (struct device *d, int volume, int pitch, int duration)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2047 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2048 Display *display = DEVICE_X_DISPLAY (d);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2049
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2050 if (volume < 0) volume = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2051 else if (volume > 100) volume = 100;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2052 if (pitch < 0 && duration < 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2053 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2054 XBell (display, (volume * 2) - 100);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2055 XFlush (display);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2056 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2057 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2058 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2059 XKeyboardState state;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2060 XKeyboardControl ctl;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2061 XSync (display, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2062 /* #### grab server? */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2063 XGetKeyboardControl (display, &state);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2064
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2065 ctl.bell_pitch = (pitch >= 0 ? pitch : state.bell_pitch);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2066 ctl.bell_duration = (duration >= 0 ? duration : state.bell_duration);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2067 XChangeKeyboardControl (display, KBBellPitch|KBBellDuration, &ctl);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2068
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2069 XBell (display, (volume * 2) - 100);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2070
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2071 ctl.bell_pitch = state.bell_pitch;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2072 ctl.bell_duration = state.bell_duration;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2073 XChangeKeyboardControl (display, KBBellPitch|KBBellDuration, &ctl);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2074
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2075 /* #### ungrab server? */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2076 XSync (display, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2077 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2078 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2079
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2080
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2081 /************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2082 /* initialization */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2083 /************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2084
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2085 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2086 console_type_create_redisplay_x (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2087 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2088 /* redisplay methods */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2089 CONSOLE_HAS_METHOD (x, text_width);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2090 CONSOLE_HAS_METHOD (x, output_display_block);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2091 CONSOLE_HAS_METHOD (x, divider_height);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2092 CONSOLE_HAS_METHOD (x, eol_cursor_width);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2093 CONSOLE_HAS_METHOD (x, output_vertical_divider);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2094 CONSOLE_HAS_METHOD (x, clear_region);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2095 CONSOLE_HAS_METHOD (x, clear_frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2096 CONSOLE_HAS_METHOD (x, output_begin);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2097 CONSOLE_HAS_METHOD (x, output_end);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2098 CONSOLE_HAS_METHOD (x, flash);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2099 CONSOLE_HAS_METHOD (x, ring_bell);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
2100 CONSOLE_HAS_METHOD (x, bevel_area);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
2101 CONSOLE_HAS_METHOD (x, output_string);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
2102 CONSOLE_HAS_METHOD (x, output_pixmap);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2103 }