annotate src/redisplay-x.c @ 14:9ee227acff29 r19-15b90

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