annotate src/redisplay-gtk.c @ 569:9cdcb214753f

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