annotate src/redisplay-gtk.c @ 4539:061e030e3270

Fix some bugs in load-history construction, built-in symbol file names. lib-src/ChangeLog addition: 2008-12-27 Aidan Kehoe <kehoea@parhasard.net> * make-docfile.c (main): Allow more than one -d argument, followed by a directory to change to. (put_filename): Don't strip directory information; with previous change, allows retrieval of Lisp function and variable origin files from #'built-in-symbol-file relative to lisp-directory. (scan_lisp_file): Don't add an extraneous newline after the file name, put_filename has added the newline already. lisp/ChangeLog addition: 2008-12-27 Aidan Kehoe <kehoea@parhasard.net> * loadup.el (load-history): Add the contents of current-load-list to load-history before clearing it. Move the variable declarations earlier in the file to a format understood by make-docfile.c. * custom.el (custom-declare-variable): Add the variable's symbol to the current file's load history entry correctly, don't use a cons. Eliminate a comment that we don't need to worry about, we don't need to check the `initialized' C variable in Lisp. * bytecomp.el (byte-compile-output-file-form): Merge Andreas Schwab's pre-GPLv3 GNU change of 19970831 here; treat #'custom-declare-variable correctly, generating the docstrings in a format understood by make-docfile.c. * loadhist.el (symbol-file): Correct behaviour for checking autoloaded macros and functions when supplied with a TYPE argument. Accept fully-qualified paths from #'built-in-symbol-file; if a path is not fully-qualified, return it relative to lisp-directory if the filename corresponds to a Lisp file, and relative to (concat source-directory "/src/") otherwise. * make-docfile.el (preloaded-file-list): Rationalise some let bindings a little. Use the "-d" argument to make-docfile.c to supply Lisp paths relative to lisp-directory, not absolutely. Add in loadup.el explicitly to the list of files to be processed by make-docfile.c--it doesn't make sense to add it to preloaded-file-list, since that is used for purposes of byte-compilation too. src/ChangeLog addition: 2008-12-27 Aidan Kehoe <kehoea@parhasard.net> * doc.c (Fbuilt_in_symbol_file): Return a subr's filename immediately if we've found it. Check for compiled function and compiled macro docstrings in DOC too, and return them if they exist. The branch of the if statement focused on functions may have executed, but we may still want to check variable bindings; an else clause isn't appropriate.
author Aidan Kehoe <kehoea@parhasard.net>
date Sat, 27 Dec 2008 14:05:50 +0000
parents 2b84dd8eb906
children a4322ac49e37
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
714
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1 /* GTK output and frame manipulation routines.
462
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.
1318
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 872
diff changeset
5 Copyright (C) 2002, 2003 Ben Wing.
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
6
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
7 This file is part of XEmacs.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
8
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
9 XEmacs is free software; you can redistribute it and/or modify it
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
10 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
11 Free Software Foundation; either version 2, or (at your option) any
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
12 later version.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
13
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
14 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
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
17 for more details.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
18
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
19 You should have received a copy of the GNU General Public License
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
20 along with XEmacs; see the file COPYING. If not, write to
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
21 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
22 Boston, MA 02111-1307, USA. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
23
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
24 /* Synched up with: Not in FSF. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
25
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
26 /* Author: Chuck Thompson */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
27 /* Gtk flavor by William Perry */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
28
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
29 /* Lots of work done by Ben Wing for Mule */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
30
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
31 #include <config.h>
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
32 #include "lisp.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
33
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
34 #include "buffer.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
35 #include "debug.h"
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
36 #include "device-impl.h"
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
37 #include "faces.h"
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
38 #include "file-coding.h"
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
39 #include "frame-impl.h"
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
40 #include "gutter.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
41 #include "redisplay.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
42 #include "sysdep.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
43 #include "window.h"
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
44
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
45 #include "console-gtk-impl.h"
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
46 #include "gccache-gtk.h"
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
47 #include "glyphs-gtk.h"
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
48 #include "objects-gtk-impl.h"
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
49
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
50 #include "sysproc.h" /* for select() */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
51
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
52 #ifdef MULE
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
53 #include "mule-ccl.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
54 #endif
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 CONST const
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 #define EOL_CURSOR_WIDTH 5
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
59
714
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
60 static void gtk_output_pixmap (struct window *w,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
61 Lisp_Object image_instance,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
62 struct display_box *db,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
63 struct display_glyph_area *dga,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
64 face_index findex,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
65 int cursor_start,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
66 int cursor_width,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
67 int cursor_height,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
68 int bgpixmap);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
69 static void gtk_output_vertical_divider (struct window *w, int clear);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
70 static void gtk_output_blank (struct window *w, struct display_line *dl,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
71 struct rune *rb, int start_pixpos,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
72 int cursor_start, int cursor_width);
714
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
73 static void gtk_output_horizontal_line (struct window *w,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
74 struct display_line *dl,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
75 struct rune *rb);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
76 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
77 face_index findex, int x, int y,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
78 int width, int height, Lisp_Object fcolor, Lisp_Object bcolor,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
79 Lisp_Object background_pixmap);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
80 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
81 int xpos, face_index findex);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
82 static void gtk_clear_frame (struct frame *f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
83 static void gtk_clear_frame_windows (Lisp_Object window);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
84 static void gtk_bevel_modeline (struct window *w, struct display_line *dl);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
85
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
86 #if 0
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
87 static void __describe_gc (GdkGC *);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
88 #endif
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 struct textual_run
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
91 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
92 Lisp_Object charset;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
93 unsigned char *ptr;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
94 int len;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
95 int dimension;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
96 };
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
97
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
98 /* 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
99 particular charset. Also convert the characters as necessary into
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
100 the format needed by XDrawImageString(), XDrawImageString16(), et
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
101 al. (This means converting to one or two byte format, possibly
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
102 tweaking the high bits, and possibly running a CCL program.) You
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
103 must pre-allocate the space used and pass it in. (This is done so
851
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
104 you can ALLOCA () the space.) You need to allocate (2 * len) bytes
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
105 of TEXT_STORAGE and (len * sizeof (struct textual_run)) bytes of
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
106 RUN_STORAGE, where LEN is the length of the dynarr.
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 Returns the number of runs actually used. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
109
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
110 static int
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
111 separate_textual_runs (unsigned char *text_storage,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
112 struct textual_run *run_storage,
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 851
diff changeset
113 CONST Ichar *str, Charcount len)
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
114 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
115 Lisp_Object prev_charset = Qunbound; /* not Qnil because that is a
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
116 possible valid charset when
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
117 MULE is not defined */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
118 int runs_so_far = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
119 int i;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
120 #ifdef MULE
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
121 struct ccl_program char_converter;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
122 int need_ccl_conversion = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
123 #endif
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 for (i = 0; i < len; i++)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
126 {
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 851
diff changeset
127 Ichar ch = str[i];
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
128 Lisp_Object charset;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
129 int byte1, byte2;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
130 int dimension;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
131 int graphic;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
132
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 851
diff changeset
133 BREAKUP_ICHAR (ch, charset, byte1, byte2);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
134 dimension = XCHARSET_DIMENSION (charset);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
135 graphic = XCHARSET_GRAPHIC (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 if (!EQ (charset, prev_charset))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
138 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
139 run_storage[runs_so_far].ptr = text_storage;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
140 run_storage[runs_so_far].charset = charset;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
141 run_storage[runs_so_far].dimension = dimension;
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 if (runs_so_far)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
144 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
145 run_storage[runs_so_far - 1].len =
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
146 text_storage - run_storage[runs_so_far - 1].ptr;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
147 if (run_storage[runs_so_far - 1].dimension == 2)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
148 run_storage[runs_so_far - 1].len >>= 1;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
149 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
150 runs_so_far++;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
151 prev_charset = charset;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
152 #ifdef MULE
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
153 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
154 Lisp_Object ccl_prog = XCHARSET_CCL_PROGRAM (charset);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
155 need_ccl_conversion = !NILP (ccl_prog);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
156 if (need_ccl_conversion)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
157 setup_ccl_program (&char_converter, ccl_prog);
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 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
160 }
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 if (graphic == 0)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
163 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
164 byte1 &= 0x7F;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
165 byte2 &= 0x7F;
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 else if (graphic == 1)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
168 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
169 byte1 |= 0x80;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
170 byte2 |= 0x80;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
171 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
172 #ifdef MULE
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
173 if (need_ccl_conversion)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
174 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
175 char_converter.reg[0] = XCHARSET_ID (charset);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
176 char_converter.reg[1] = byte1;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
177 char_converter.reg[2] = byte2;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
178 ccl_driver (&char_converter, 0, 0, 0, 0, CCL_MODE_ENCODING);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
179 byte1 = char_converter.reg[1];
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
180 byte2 = char_converter.reg[2];
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
181 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
182 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
183 *text_storage++ = (unsigned char) byte1;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
184 if (dimension == 2)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
185 *text_storage++ = (unsigned char) byte2;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
186 }
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 if (runs_so_far)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
189 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
190 run_storage[runs_so_far - 1].len =
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
191 text_storage - run_storage[runs_so_far - 1].ptr;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
192 if (run_storage[runs_so_far - 1].dimension == 2)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
193 run_storage[runs_so_far - 1].len >>= 1;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
194 }
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 return runs_so_far;
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 /****************************************************************************/
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 /* Gtk output routines */
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 /****************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
204
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
205 static int
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
206 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
207 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
208 Lisp_Object font_inst = FACE_CACHEL_FONT (cachel, run->charset);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
209 struct Lisp_Font_Instance *fi = XFONT_INSTANCE (font_inst);
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 if (!fi->proportional_p)
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 return fi->width * run->len;
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 else
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 if (run->dimension == 2)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
218 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
219 stderr_out ("Measuring wide characters\n");
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
220 return gdk_text_width_wc (FONT_INSTANCE_GTK_FONT (fi),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
221 (GdkWChar *) run->ptr, run->len);
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 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
224 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
225 return gdk_text_width (FONT_INSTANCE_GTK_FONT (fi),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
226 (char *) run->ptr, run->len);
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
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 gtk_text_width
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
233
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
234 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
235 displayed in the font associated with the face.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
236 */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
237
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
238 static int
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2054
diff changeset
239 gtk_text_width (struct frame *UNUSED (f), struct face_cachel *cachel,
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2054
diff changeset
240 CONST Ichar *str, Charcount len)
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
241 {
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2286
diff changeset
242 /* !!#### */
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
243 int width_so_far = 0;
851
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
244 unsigned char *text_storage = (unsigned char *) ALLOCA (2 * len);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
245 struct textual_run *runs = alloca_array (struct textual_run, len);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
246 int nruns;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
247 int i;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
248
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
249 nruns = separate_textual_runs (text_storage, runs, str, len);
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 for (i = 0; i < nruns; i++)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
252 width_so_far += gtk_text_width_single_run (cachel, runs + i);
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 return width_so_far;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
255 }
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 /*****************************************************************************
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
258 gtk_divider_height
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 Return the height of the horizontal divider. This is a function because
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
261 divider_height is a device method.
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 #### If we add etched horizontal divider lines this will have to get
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
264 smarter.
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 static int
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
267 gtk_divider_height (void)
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 return 2;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
270 }
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 /*****************************************************************************
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
273 gtk_eol_cursor_width
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 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
276 because eol_cursor_width is a device method.
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 static int
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
279 gtk_eol_cursor_width (void)
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 return EOL_CURSOR_WIDTH;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
282 }
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 /*****************************************************************************
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
285 gtk_output_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 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
288 runes between start and end in the specified display block.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
289 ****************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
290 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
291 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
292 int start, int end, int start_pixpos, int cursor_start,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
293 int cursor_width, int cursor_height)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
294 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
295 struct frame *f = XFRAME (w->frame);
3479
2b84dd8eb906 [xemacs-hg @ 2006-06-27 22:59:37 by james]
james
parents: 3087
diff changeset
296 Ichar_dynarr *buf;
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
297 Lisp_Object window;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
298
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
299 struct display_block *db = Dynarr_atp (dl->display_blocks, block);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
300 rune_dynarr *rba = db->runes;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
301 struct rune *rb;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
302
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
303 int elt = start;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
304 face_index findex;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
305 int xpos, width;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
306 Lisp_Object charset = Qunbound; /* Qnil is a valid charset when
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
307 MULE is not defined */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
308
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
309 window = wrap_window (w);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
310 rb = Dynarr_atp (rba, start);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
311
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
312 if (!rb)
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 /* Nothing to do so don't do anything. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
315 return;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
316 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
317 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
318 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
319 findex = rb->findex;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
320 xpos = rb->xpos;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
321 width = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
322 if (rb->type == RUNE_CHAR)
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 851
diff changeset
323 charset = ichar_charset (rb->object.chr.ch);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
324 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
325
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
326 if (end < 0)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
327 end = Dynarr_length (rba);
3479
2b84dd8eb906 [xemacs-hg @ 2006-06-27 22:59:37 by james]
james
parents: 3087
diff changeset
328 buf = Dynarr_new (Ichar);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
329
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
330 while (elt < end)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
331 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
332 rb = Dynarr_atp (rba, elt);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
333
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
334 if (rb->findex == findex && rb->type == RUNE_CHAR
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
335 && rb->object.chr.ch != '\n' && rb->cursor_type != CURSOR_ON
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 851
diff changeset
336 && EQ (charset, ichar_charset (rb->object.chr.ch)))
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
337 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
338 Dynarr_add (buf, rb->object.chr.ch);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
339 width += rb->width;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
340 elt++;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
341 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
342 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
343 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
344 if (Dynarr_length (buf))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
345 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
346 gtk_output_string (w, dl, buf, xpos, 0, start_pixpos, width,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
347 findex, 0, cursor_start, cursor_width,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
348 cursor_height);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
349 xpos = rb->xpos;
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 Dynarr_reset (buf);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
353 width = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
354
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
355 if (rb->type == RUNE_CHAR)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
356 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
357 findex = rb->findex;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
358 xpos = rb->xpos;
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 851
diff changeset
359 charset = ichar_charset (rb->object.chr.ch);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
360
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
361 if (rb->cursor_type == CURSOR_ON)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
362 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
363 if (rb->object.chr.ch == '\n')
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
364 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
365 gtk_output_eol_cursor (w, dl, xpos, findex);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
366 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
367 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
368 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
369 Dynarr_add (buf, rb->object.chr.ch);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
370 gtk_output_string (w, dl, buf, xpos, 0, start_pixpos,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
371 rb->width, findex, 1,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
372 cursor_start, cursor_width,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
373 cursor_height);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
374 Dynarr_reset (buf);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
375 }
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 xpos += rb->width;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
378 elt++;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
379 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
380 else if (rb->object.chr.ch == '\n')
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 /* Clear in case a cursor was formerly here. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
383 int height = dl->ascent + dl->descent - dl->clip;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
384
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
385 redisplay_clear_region (window, findex, xpos, dl->ypos - dl->ascent,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
386 rb->width, height);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
387 elt++;
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 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
390 else if (rb->type == RUNE_BLANK || rb->type == RUNE_HLINE)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
391 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
392 if (rb->type == RUNE_BLANK)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
393 gtk_output_blank (w, dl, rb, start_pixpos, cursor_start,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
394 cursor_width);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
395 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
396 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
397 /* #### Our flagging of when we need to redraw the
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
398 modeline shadows sucks. Since RUNE_HLINE is only used
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
399 by the modeline at the moment it is a good bet
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
400 that if it gets redrawn then we should also
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
401 redraw the shadows. This won't be true forever.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
402 We borrow the shadow_thickness_changed flag for
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
403 now. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
404 w->shadow_thickness_changed = 1;
714
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
405 gtk_output_horizontal_line (w, dl, rb);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
406 }
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 elt++;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
409 if (elt < end)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
410 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
411 rb = Dynarr_atp (rba, elt);
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 findex = rb->findex;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
414 xpos = rb->xpos;
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 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
417 else if (rb->type == RUNE_DGLYPH)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
418 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
419 Lisp_Object instance;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
420 struct display_box dbox;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
421 struct display_glyph_area dga;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
422 redisplay_calculate_display_boxes (dl, rb->xpos, rb->object.dglyph.xoffset,
819
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 809
diff changeset
423 rb->object.dglyph.yoffset ,start_pixpos,
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 809
diff changeset
424 rb->width, &dbox, &dga);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
425
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
426 window = wrap_window (w);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
427 instance = glyph_image_instance (rb->object.dglyph.glyph,
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
428 window, ERROR_ME_DEBUG_WARN, 1);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
429 findex = rb->findex;
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 if (IMAGE_INSTANCEP (instance))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
432 switch (XIMAGE_INSTANCE_TYPE (instance))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
433 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
434 case IMAGE_TEXT:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
435 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
436 /* #### This is way losing. See the comment in
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
437 add_glyph_rune(). */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
438 Lisp_Object string =
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
439 XIMAGE_INSTANCE_TEXT_STRING (instance);
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 851
diff changeset
440 convert_ibyte_string_into_ichar_dynarr
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
441 (XSTRING_DATA (string), XSTRING_LENGTH (string), buf);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
442
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
443 gtk_output_string (w, dl, buf, xpos,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
444 rb->object.dglyph.xoffset,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
445 start_pixpos, -1, findex,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
446 (rb->cursor_type == CURSOR_ON),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
447 cursor_start, cursor_width,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
448 cursor_height);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
449 Dynarr_reset (buf);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
450 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
451 break;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
452
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
453 case IMAGE_MONO_PIXMAP:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
454 case IMAGE_COLOR_PIXMAP:
714
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
455 redisplay_output_pixmap (w, instance, &dbox, &dga,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
456 findex,cursor_start,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
457 cursor_width, cursor_height, 0);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
458 break;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
459
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
460 case IMAGE_POINTER:
2500
3d8143fc88e1 [xemacs-hg @ 2005-01-24 23:33:30 by ben]
ben
parents: 2367
diff changeset
461 ABORT ();
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
463 case IMAGE_WIDGET:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
464 if (EQ (XIMAGE_INSTANCE_WIDGET_TYPE (instance),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
465 Qlayout))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
466 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
467 redisplay_output_layout (window, instance, &dbox,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
468 &dga, findex,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
469 cursor_start, cursor_width,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
470 cursor_height);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
471 break;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
472 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
473
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
474 case IMAGE_SUBWINDOW:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
475 redisplay_output_subwindow (w, instance, &dbox, &dga,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
476 findex, cursor_start,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
477 cursor_width, cursor_height);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
478 break;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
479
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
480 case IMAGE_NOTHING:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
481 /* nothing is as nothing does */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
482 break;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
483
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
484 default:
2500
3d8143fc88e1 [xemacs-hg @ 2005-01-24 23:33:30 by ben]
ben
parents: 2367
diff changeset
485 ABORT ();
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
486 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
487
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
488 xpos += rb->width;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
489 elt++;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
490 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
491 else
2500
3d8143fc88e1 [xemacs-hg @ 2005-01-24 23:33:30 by ben]
ben
parents: 2367
diff changeset
492 ABORT ();
462
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 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
495
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
496 if (Dynarr_length (buf))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
497 gtk_output_string (w, dl, buf, xpos, 0, start_pixpos, width, findex,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
498 0, cursor_start, cursor_width, cursor_height);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
499
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
500 /* #### This is really conditionalized well for optimized
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
501 performance. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
502 if (dl->modeline
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
503 && !EQ (Qzero, w->modeline_shadow_thickness)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
504 && (f->clear
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
505 || f->windows_structure_changed
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
506 || w->shadow_thickness_changed))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
507 gtk_bevel_modeline (w, dl);
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 Dynarr_free (buf);
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
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 gtk_bevel_modeline
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 Draw a 3d border around the modeline on window W.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
516 ****************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
517 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
518 gtk_bevel_modeline (struct window *w, struct display_line *dl)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
519 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
520 struct frame *f = XFRAME (w->frame);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
521 int shadow_thickness = MODELINE_SHADOW_THICKNESS (w);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
522 int x,y, width, height;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
523
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
524 x = WINDOW_MODELINE_LEFT (w);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
525 width = WINDOW_MODELINE_RIGHT (w) - x;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
526 y = dl->ypos - dl->ascent - shadow_thickness;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
527 height = dl->ascent + dl->descent + 2 * 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 gtk_output_shadows (f, x, y, width, height, shadow_thickness);
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
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 gtk_get_gc
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 Given a number of parameters return a GC with those properties.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
536 ****************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
537 GdkGC *
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
538 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
539 Lisp_Object bg_pmap, Lisp_Object lwidth)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
540 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
541 GdkGCValues gcv;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
542 unsigned long mask;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
543
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
544 memset (&gcv, ~0, sizeof (gcv));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
545 gcv.graphics_exposures = FALSE;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
546 /* 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
547 the GC returned by this function. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
548 gcv.clip_mask = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
549 gcv.clip_x_origin = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
550 gcv.clip_y_origin = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
551 gcv.fill = GDK_SOLID;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
552 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
553 mask |= GDK_GC_FILL;
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 if (!NILP (font))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
556 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
557 gcv.font = FONT_INSTANCE_GTK_FONT (XFONT_INSTANCE (font));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
558 mask |= GDK_GC_FONT;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
559 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
560
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
561 /* evil kludge! */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
562 if (!NILP (fg) && !COLOR_INSTANCEP (fg) && !INTP (fg))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
563 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
564 /* #### I fixed once case where this was getting it. It was a
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
565 bad macro expansion (compiler bug). */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
566 fprintf (stderr, "Help! gtk_get_gc got a bogus fg value! fg = ");
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
567 debug_print (fg);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
568 fg = Qnil;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
569 }
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 (!NILP (fg))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
572 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
573 if (COLOR_INSTANCEP (fg))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
574 gcv.foreground = * COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (fg));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
575 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
576 gcv.foreground.pixel = XINT (fg);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
577 mask |= GDK_GC_FOREGROUND;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
578 }
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 (!NILP (bg))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
581 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
582 if (COLOR_INSTANCEP (bg))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
583 gcv.background = * COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (bg));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
584 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
585 gcv.background.pixel = XINT (fg);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
586 mask |= GDK_GC_BACKGROUND;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
587 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
588
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
589 if (IMAGE_INSTANCEP (bg_pmap)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
590 && IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (bg_pmap)))
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 if (XIMAGE_INSTANCE_PIXMAP_DEPTH (bg_pmap) == 0)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
593 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
594 gcv.fill = GDK_OPAQUE_STIPPLED;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
595 gcv.stipple = XIMAGE_INSTANCE_GTK_PIXMAP (bg_pmap);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
596 mask |= (GDK_GC_STIPPLE | GDK_GC_FILL);
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 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
599 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
600 gcv.fill = GDK_TILED;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
601 gcv.tile = XIMAGE_INSTANCE_GTK_PIXMAP (bg_pmap);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
602 mask |= (GDK_GC_TILE | GDK_GC_FILL);
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 }
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 if (!NILP (lwidth))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
607 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
608 gcv.line_width = XINT (lwidth);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
609 mask |= GDK_GC_LINE_WIDTH;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
610 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
611
2054
91d4c8c65a0f [xemacs-hg @ 2004-05-02 04:06:51 by malcolmp]
malcolmp
parents: 1318
diff changeset
612 return gc_cache_lookup (DEVICE_GTK_GC_CACHE (d), &gcv, (GdkGCValuesMask) mask);
462
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
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 gtk_output_string
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
617
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
618 Given a string and a starting position, output that string in the
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
619 given face. If cursor is true, draw a cursor around the string.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
620 Correctly handles multiple charsets in the string.
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 The meaning of the parameters is something like this:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
623
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
624 W Window that the text is to be displayed in.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
625 DL Display line that this text is on. The values in the
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
626 structure are used to determine the vertical position and
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
627 clipping range of the text.
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 851
diff changeset
628 BUF Dynamic array of Ichars specifying what is actually to be
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
629 drawn.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
630 XPOS X position in pixels where the text should start being drawn.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
631 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
632 text. The effect is as if the text were shifted to the
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
633 left this many pixels and clipped at XPOS.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
634 CLIP_START Clip everything left of this X position.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
635 WIDTH Clip everything right of XPOS + WIDTH.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
636 FINDEX Index for the face cache element describing how to display
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
637 the text.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
638 CURSOR #### I don't understand this. There's something
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
639 strange and overcomplexified with this variable.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
640 Chuck, explain please?
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
641 CURSOR_START Starting X position of cursor.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
642 CURSOR_WIDTH Width of cursor in pixels.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
643 CURSOR_HEIGHT Height of cursor in pixels.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
644
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
645 Starting Y position of cursor is the top of the text line.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
646 The cursor is drawn sometimes whether or not CURSOR is set. ???
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
647 ****************************************************************************/
714
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
648 static
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
649 void gdk_draw_text_image (GdkDrawable *drawable,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
650 GdkFont *font,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
651 GdkGC *gc,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
652 gint x,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
653 gint y,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
654 const gchar *text,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
655 gint text_length);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
656
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
657 void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
658 gtk_output_string (struct window *w, struct display_line *dl,
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 851
diff changeset
659 Ichar_dynarr *buf, int xpos, int xoffset, int clip_start,
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
660 int width, face_index findex, int cursor,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
661 int cursor_start, int cursor_width, int cursor_height)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
662 {
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2286
diff changeset
663 /* !!#### Needs review */
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
664 /* General variables */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
665 struct frame *f = XFRAME (w->frame);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
666 struct device *d = XDEVICE (f->device);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
667 Lisp_Object device;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
668 Lisp_Object window;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
669 GdkWindow *x_win = GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (f));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
670
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
671 int clip_end;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
672
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
673 /* Cursor-related variables */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
674 int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
675 int cursor_clip;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
676 Lisp_Object bar_cursor_value = symbol_value_in_buffer (Qbar_cursor,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
677 WINDOW_BUFFER (w));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
678 struct face_cachel *cursor_cachel = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
679
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
680 /* Text-related variables */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
681 Lisp_Object bg_pmap;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
682 GdkGC *bgc, *gc;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
683 int height;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
684 int len = Dynarr_length (buf);
851
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
685 unsigned char *text_storage = (unsigned char *) ALLOCA (2 * len);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
686 struct textual_run *runs = alloca_array (struct textual_run, len);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
687 int nruns;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
688 int i;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
689 struct face_cachel *cachel = WINDOW_FACE_CACHEL (w, findex);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
690
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
691 device = wrap_device (d);
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
692 window = wrap_window (w);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
693
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
694 if (width < 0)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
695 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
696 height = dl->ascent + dl->descent - dl->clip;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
697
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
698 /* Regularize the variables passed in. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
699
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
700 if (clip_start < xpos)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
701 clip_start = xpos;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
702 clip_end = xpos + width;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
703 if (clip_start >= clip_end)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
704 /* It's all clipped out. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
705 return;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
706
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
707 xpos -= xoffset;
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 nruns = separate_textual_runs (text_storage, runs, Dynarr_atp (buf, 0),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
710 Dynarr_length (buf));
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 cursor_clip = (cursor_start >= clip_start &&
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
713 cursor_start < clip_end);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
714
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
715 /* This cursor code is really a mess. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
716 if (!NILP (w->text_cursor_visible_p)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
717 && (cursor
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
718 || cursor_clip
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
719 || (cursor_width
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
720 && (cursor_start + cursor_width >= clip_start)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
721 && !NILP (bar_cursor_value))))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
722 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
723 /* These have to be in separate statements in order to avoid a
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
724 compiler bug. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
725 face_index sucks = get_builtin_face_cache_index (w, Vtext_cursor_face);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
726 cursor_cachel = WINDOW_FACE_CACHEL (w, sucks);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
727
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
728 /* We have to reset this since any call to WINDOW_FACE_CACHEL
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
729 may cause the cache to resize and any pointers to it to
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
730 become invalid. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
731 cachel = WINDOW_FACE_CACHEL (w, findex);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
732 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
733
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
734 bg_pmap = cachel->background_pixmap;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
735 if (!IMAGE_INSTANCEP (bg_pmap)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
736 || !IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (bg_pmap)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
737 bg_pmap = Qnil;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
738
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
739 if ((cursor && focus && NILP (bar_cursor_value)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
740 && !NILP (w->text_cursor_visible_p)) || NILP (bg_pmap))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
741 bgc = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
742 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
743 bgc = gtk_get_gc (d, Qnil, cachel->foreground, cachel->background,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
744 bg_pmap, Qnil);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
745
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
746 if (bgc)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
747 gdk_draw_rectangle (GDK_DRAWABLE (x_win), bgc, TRUE, clip_start,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
748 dl->ypos - dl->ascent, clip_end - clip_start,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
749 height);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
750
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
751 for (i = 0; i < nruns; i++)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
752 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
753 Lisp_Object font = FACE_CACHEL_FONT (cachel, runs[i].charset);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
754 struct Lisp_Font_Instance *fi = XFONT_INSTANCE (font);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
755 GdkFont *gdk_font = FONT_INSTANCE_GTK_FONT (fi);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
756 int this_width;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
757 int need_clipping;
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 if (EQ (font, Vthe_null_font_instance))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
760 continue;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
761
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
762 this_width = gtk_text_width_single_run (cachel, runs + i);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
763 need_clipping = (dl->clip || clip_start > xpos ||
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
764 clip_end < xpos + this_width);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
765
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
766 /* XDrawImageString only clears the area equal to the height of
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
767 the given font. It is possible that a font is being displayed
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
768 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
769 clear some areas. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
770 if ((int) fi->height < (int) (height + dl->clip))
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 int clear_start = max (xpos, clip_start);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
773 int clear_end = min (xpos + this_width, clip_end);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
774
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
775 if (cursor)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
776 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
777 int ypos1_line, ypos1_string, ypos2_line, ypos2_string;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
778
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
779 ypos1_string = dl->ypos - fi->ascent;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
780 ypos2_string = dl->ypos + fi->descent;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
781 ypos1_line = dl->ypos - dl->ascent;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
782 ypos2_line = dl->ypos + dl->descent - dl->clip;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
783
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
784 /* Make sure we don't clear below the real bottom of the
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
785 line. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
786 if (ypos1_string > ypos2_line)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
787 ypos1_string = ypos2_line;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
788 if (ypos2_string > ypos2_line)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
789 ypos2_string = ypos2_line;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
790
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
791 if (ypos1_line < ypos1_string)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
792 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
793 redisplay_clear_region (window, findex, clear_start, ypos1_line,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
794 clear_end - clear_start,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
795 ypos1_string - ypos1_line);
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
798 if (ypos2_line > ypos2_string)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
799 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
800 redisplay_clear_region (window, findex, clear_start, ypos2_string,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
801 clear_end - clear_start,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
802 ypos2_line - ypos2_string);
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 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
805 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
806 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
807 redisplay_clear_region (window, findex, clear_start,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
808 dl->ypos - dl->ascent, clear_end - clear_start,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
809 height);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
810 }
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
813 if (cursor && cursor_cachel && focus && NILP (bar_cursor_value))
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 gc = gtk_get_gc (d, font, cursor_cachel->foreground,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
816 cursor_cachel->background, Qnil, Qnil);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
817 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
818 else
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 gc = gtk_get_gc (d, font, cachel->foreground, cachel->background,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
821 Qnil, Qnil);
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
824 if (need_clipping)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
825 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
826 GdkRectangle clip_box;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
827
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
828 clip_box.x = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
829 clip_box.y = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
830 clip_box.width = clip_end - clip_start;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
831 clip_box.height = height;
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 gdk_gc_set_clip_rectangle (gc, &clip_box);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
834 gdk_gc_set_clip_origin (gc, clip_start, dl->ypos - dl->ascent);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
835 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
836
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
837 /* The X specific called different functions (XDraw*String
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
838 vs. XDraw*String16), but apparently gdk_draw_text takes care
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
839 of that for us.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
840
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
841 BUT, gdk_draw_text also does too much, by dividing the length
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
842 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
843 dimension of the text. This will do the right thing for
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
844 single-dimension runs as well of course.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
845 */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
846 (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
847 dl->ypos, (char *) runs[i].ptr,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
848 runs[i].len * runs[i].dimension);
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 /* We draw underlines in the same color as the text. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
851 if (cachel->underline)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
852 {
2054
91d4c8c65a0f [xemacs-hg @ 2004-05-02 04:06:51 by malcolmp]
malcolmp
parents: 1318
diff changeset
853 int upos, uthick;
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
854
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
855 /* Cannot get at font properties in Gtk, so we resort to
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
856 guessing */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
857 upos = dl->descent / 2;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
858 uthick = 1;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
859
778
2923009caf47 [xemacs-hg @ 2002-03-16 10:38:59 by ben]
ben
parents: 714
diff changeset
860 if ((dl->ypos + upos) < (dl->ypos + dl->descent - dl->clip))
462
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 (dl->ypos + upos + uthick > dl->ypos + dl->descent - dl->clip)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
863 uthick = dl->descent - dl->clip - upos;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
864
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
865 if (uthick == 1)
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 gdk_draw_line (GDK_DRAWABLE (x_win), gc, xpos, dl->ypos + upos,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
868 xpos + this_width, dl->ypos + upos);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
869 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
870 else if (uthick > 1)
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 gdk_draw_rectangle (GDK_DRAWABLE (x_win), gc, TRUE, xpos,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
873 dl->ypos + upos, this_width, uthick);
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 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
876 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
877
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
878 if (cachel->strikethru) {
2054
91d4c8c65a0f [xemacs-hg @ 2004-05-02 04:06:51 by malcolmp]
malcolmp
parents: 1318
diff changeset
879 gint ascent,descent,upos, uthick;
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
880 GdkFont *gfont = FONT_INSTANCE_GTK_FONT (XFONT_INSTANCE (font));
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 /* Cannot get at font properties in Gtk, so we resort to
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
883 guessing */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
884
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
885 ascent = gfont->ascent;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
886 descent = gfont->descent;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
887 uthick = 1;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
888
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
889 upos = ascent - ((ascent + descent) / 2) + 1;
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 /* Generally, upos will be positive (above the baseline),so subtract */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
892 if (dl->ypos - upos < dl->ypos + dl->descent - dl->clip)
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 (dl->ypos - upos + uthick > dl->ypos + dl->descent - dl->clip)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
895 uthick = dl->descent - dl->clip + upos;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
896
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
897 if (uthick == 1)
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 gdk_draw_line (GDK_DRAWABLE (x_win), gc, xpos, dl->ypos - upos,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
900 xpos + this_width, dl->ypos - upos);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
901 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
902 else if (uthick > 1)
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 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
905 this_width, uthick);
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 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
908 }
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 /* Restore the GC */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
911 if (need_clipping)
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 gdk_gc_set_clip_rectangle (gc, NULL);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
914 gdk_gc_set_clip_origin (gc, 0, 0);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
915 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
916
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
917 /* If we are actually superimposing the cursor then redraw with just
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
918 the appropriate section highlighted. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
919 if (cursor_clip && !cursor && focus && cursor_cachel)
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 GdkGC *cgc;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
922 GdkRectangle clip_box;
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 cgc = gtk_get_gc (d, font, cursor_cachel->foreground,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
925 cursor_cachel->background, Qnil, Qnil);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
926
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
927 clip_box.x = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
928 clip_box.y = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
929 clip_box.width = cursor_width;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
930 clip_box.height = height;
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 gdk_gc_set_clip_rectangle (cgc, &clip_box);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
933 gdk_gc_set_clip_origin (cgc, cursor_start, dl->ypos - dl->ascent);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
934
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
935 /* The X specific called different functions (XDraw*String
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
936 vs. XDraw*String16), but apparently gdk_draw_text takes care
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
937 of that for us.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
938
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
939 BUT, gdk_draw_text also does too much, by dividing the
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
940 length by 2. So we fake them out my multiplying the
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
941 length by the dimension of the text. This will do the
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
942 right thing for single-dimension runs as well of course.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
943 */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
944 gdk_draw_text_image (GDK_DRAWABLE (x_win), gdk_font, cgc, xpos,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
945 dl->ypos, (char *) runs[i].ptr,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
946 runs[i].len * runs[i].dimension);
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 gdk_gc_set_clip_rectangle (cgc, NULL);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
949 gdk_gc_set_clip_origin (cgc, 0, 0);
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 xpos += this_width;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
953 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
954
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
955 /* Draw the non-focus box or bar-cursor as needed. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
956 /* Can't this logic be simplified? */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
957 if (cursor_cachel
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
958 && ((cursor && !focus && NILP (bar_cursor_value))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
959 || (cursor_width
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
960 && (cursor_start + cursor_width >= clip_start)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
961 && !NILP (bar_cursor_value))))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
962 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
963 int tmp_height, tmp_y;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
964 int bar_width = EQ (bar_cursor_value, Qt) ? 1 : 2;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
965 int need_clipping = (cursor_start < clip_start
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
966 || clip_end < cursor_start + cursor_width);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
967
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
968 /* #### This value is correct (as far as I know) because
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
969 all of the times we need to draw this cursor, we will
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
970 be called with exactly one character, so we know we
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
971 can always use runs[0].
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
972
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
973 This is bogus as all hell, however. The cursor handling in
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
974 this function is way bogus and desperately needs to be
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
975 cleaned up. (In particular, the drawing of the cursor should
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
976 really really be separated out of this function. This may be
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
977 a bit tricky now because this function itself does way too
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
978 much stuff, a lot of which needs to be moved into
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
979 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
980 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
981 span two characters instead of overlaying just one. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
982 int bogusly_obtained_ascent_value =
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
983 XFONT_INSTANCE (FACE_CACHEL_FONT (cachel, runs[0].charset))->ascent;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
984
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
985 if (!NILP (bar_cursor_value))
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 gc = gtk_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
988 make_int (bar_width));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
989 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
990 else
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 gc = gtk_get_gc (d, Qnil, cursor_cachel->background,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
993 Qnil, Qnil, Qnil);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
994 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
995
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
996 tmp_y = dl->ypos - bogusly_obtained_ascent_value;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
997 tmp_height = cursor_height;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
998 if (tmp_y + tmp_height > (int) (dl->ypos - dl->ascent + height))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
999 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1000 tmp_y = dl->ypos - dl->ascent + height - tmp_height;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1001 if (tmp_y < (int) (dl->ypos - dl->ascent))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1002 tmp_y = dl->ypos - dl->ascent;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1003 tmp_height = dl->ypos - dl->ascent + height - tmp_y;
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1006 if (need_clipping)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1007 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1008 GdkRectangle clip_box;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1009 clip_box.x = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1010 clip_box.y = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1011 clip_box.width = clip_end - clip_start;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1012 clip_box.height = tmp_height;
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 gdk_gc_set_clip_rectangle (gc, &clip_box);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1015 gdk_gc_set_clip_origin (gc, clip_start, tmp_y);
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1018 if (!focus && NILP (bar_cursor_value))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1019 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1020 gdk_draw_rectangle (GDK_DRAWABLE (x_win), gc, FALSE,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1021 cursor_start, tmp_y,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1022 cursor_width - 1, tmp_height - 1);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1023 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1024 else if (focus && !NILP (bar_cursor_value))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1025 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1026 gdk_draw_line (GDK_DRAWABLE (x_win), gc,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1027 cursor_start + bar_width - 1, tmp_y,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1028 cursor_start + bar_width - 1, tmp_y + tmp_height - 1);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1029 }
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 /* Restore the GC */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1032 if (need_clipping)
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 gdk_gc_set_clip_rectangle (gc, NULL);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1035 gdk_gc_set_clip_origin (gc, 0, 0);
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 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1038 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1039
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1040 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1041 our_draw_bitmap (GdkDrawable *drawable,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1042 GdkGC *gc,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1043 GdkPixmap *src,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1044 gint xsrc,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1045 gint ysrc,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1046 gint xdest,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1047 gint ydest,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1048 gint width,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1049 gint height);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1050
714
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1051 static void
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1052 gtk_output_gdk_pixmap (struct frame *f, struct Lisp_Image_Instance *p, int x,
714
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1053 int y, int xoffset, int yoffset,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1054 int width, int height,
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1055 GdkColor *fg, GdkColor *bg, GdkGC *override_gc)
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 struct device *d = XDEVICE (f->device);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1058 GdkWindow *x_win = GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (f));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1059
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1060 GdkGC *gc;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1061 GdkGCValues gcv;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1062 unsigned long pixmap_mask;
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 if (!override_gc)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1065 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1066 memset (&gcv, ~0, sizeof (gcv));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1067 gcv.graphics_exposures = FALSE;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1068 gcv.foreground = *fg;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1069 gcv.background = *bg;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1070 pixmap_mask = GDK_GC_FOREGROUND | GDK_GC_BACKGROUND | GDK_GC_EXPOSURES;
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 if (IMAGE_INSTANCE_GTK_MASK (p))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1073 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1074 gcv.function = GDK_COPY;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1075 gcv.clip_mask = IMAGE_INSTANCE_GTK_MASK (p);
714
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1076 gcv.clip_x_origin = x - xoffset;
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1077 gcv.clip_y_origin = y - yoffset;
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1078 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
1079 GDK_GC_CLIP_Y_ORIGIN);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1080 /* 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
1081 We could conceivably create a new clipmask by zeroing out
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1082 everything outside the clip region. Is it worth it?
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1083 Is it possible to get an equivalent effect by changing the
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1084 args to XCopyArea below rather than messing with a clip box?
714
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1085 - dkindred@cs.cmu.edu
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1086 Yes. We don't clip at all now - andy@xemacs.org
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1087 */
462
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1090 gc = gc_cache_lookup (DEVICE_GTK_GC_CACHE (d), &gcv, pixmap_mask);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1091 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1092 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1093 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1094 gc = override_gc;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1095 /* 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
1096 Maybe we can insist that override_gc have no mask, or use
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1097 one of the suggestions above. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1098 }
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 if (IMAGE_INSTANCE_PIXMAP_DEPTH (p) > 0)
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 gdk_draw_pixmap (GDK_DRAWABLE (x_win), gc,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1103 IMAGE_INSTANCE_GTK_PIXMAP (p),
714
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1104 xoffset, yoffset, x, y, width, height);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1105 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1106 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1107 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1108 our_draw_bitmap (GDK_DRAWABLE (x_win), gc,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1109 IMAGE_INSTANCE_GTK_PIXMAP (p),
714
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1110 xoffset, yoffset, x, y, width, height);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1111 }
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1114 static void
714
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1115 gtk_output_pixmap (struct window *w,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1116 Lisp_Object image_instance,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1117 struct display_box *db,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1118 struct display_glyph_area *dga,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1119 face_index findex,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1120 int cursor_start,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1121 int cursor_width,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1122 int cursor_height,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2054
diff changeset
1123 int UNUSED (bg_pixmap))
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1124 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1125 struct frame *f = XFRAME (w->frame);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1126 struct device *d = XDEVICE (f->device);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1127 struct Lisp_Image_Instance *p = XIMAGE_INSTANCE (image_instance);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1128 Lisp_Object window;
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 GdkWindow *x_win = GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (f));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1131
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
1132 window = wrap_window (w);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1133
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1134 /* Output the pixmap. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1135 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1136 Lisp_Object tmp_pixel;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1137 GdkColor *tmp_bcolor, *tmp_fcolor;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1138
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1139 tmp_pixel = WINDOW_FACE_CACHEL_FOREGROUND (w, findex);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1140 tmp_fcolor = COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (tmp_pixel));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1141 tmp_pixel = WINDOW_FACE_CACHEL_BACKGROUND (w, findex);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1142 tmp_bcolor = COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (tmp_pixel));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1143
714
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1144 gtk_output_gdk_pixmap (f, p, db->xpos, db->ypos,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1145 dga->xoffset, dga->yoffset,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1146 dga->width, dga->height,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1147 tmp_fcolor, tmp_bcolor, NULL);
462
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1150 /* Draw a cursor over top of the pixmap. */
714
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1151 if (cursor_width && cursor_height && (cursor_start >= db->xpos)
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1152 && !NILP (w->text_cursor_visible_p)
714
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1153 && (cursor_start < (db->xpos + dga->width)))
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1154 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1155 GdkGC *gc;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1156 int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1157 struct face_cachel *cursor_cachel =
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1158 WINDOW_FACE_CACHEL (w,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1159 get_builtin_face_cache_index
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1160 (w, Vtext_cursor_face));
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 gc = gtk_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil, Qnil);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1163
714
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1164 if (cursor_width > db->xpos + dga->width - cursor_start)
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1165 cursor_width = db->xpos + dga->width - cursor_start;
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1166
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1167 gdk_draw_rectangle (GDK_DRAWABLE (x_win), gc, focus ? TRUE : FALSE,
714
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1168 cursor_start, db->ypos, cursor_width,
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1169 cursor_height);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1170 }
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 /*****************************************************************************
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1174 gtk_output_vertical_divider
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1175
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1176 Draw a vertical divider down the right side of the given window.
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 static void
3087
dbd2a866e38a [xemacs-hg @ 2005-11-22 11:24:40 by malcolmp]
malcolmp
parents: 2500
diff changeset
1179 gtk_output_vertical_divider (struct window *w, int UNUSED(clear))
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1180 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1181 struct frame *f = XFRAME (w->frame);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1182 struct device *d = XDEVICE (f->device);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1183 GdkWindow *x_win = GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (f));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1184 GdkGC *background_gc;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1185 Lisp_Object tmp_pixel;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1186 GdkGCValues gcv;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1187 unsigned long mask;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1188 int x, y1, y2, width, shadow_thickness, spacing, line_width;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1189 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
1190
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1191 width = window_divider_width (w);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1192 shadow_thickness = XINT (w->vertical_divider_shadow_thickness);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1193 spacing = XINT (w->vertical_divider_spacing);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1194 line_width = XINT (w->vertical_divider_line_width);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1195 x = WINDOW_RIGHT (w) - width;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1196 y1 = WINDOW_TOP (w);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1197 y2 = WINDOW_BOTTOM (w);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1198
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1199 memset (&gcv, ~0, sizeof (gcv));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1200
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1201 tmp_pixel = WINDOW_FACE_CACHEL_BACKGROUND (w, div_face);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1202
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1203 gcv.background = * COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (tmp_pixel));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1204 gcv.foreground = gcv.background;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1205 gcv.graphics_exposures = FALSE;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1206 mask = GDK_GC_FOREGROUND | GDK_GC_BACKGROUND | GDK_GC_EXPOSURES;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1207
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1208 background_gc = gc_cache_lookup (DEVICE_GTK_GC_CACHE (d), &gcv, mask);
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 /* Clear the divider area first. This needs to be done when a
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1211 window split occurs. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1212 /* if (clear) */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1213 gdk_draw_rectangle (GDK_DRAWABLE (x_win), background_gc, TRUE,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1214 x, y1, width, y2 - y1);
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 #if 0
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1217 /* Draw the divider line. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1218 gdk_draw_rectangle (GDK_DRAWABLE (x_win), background_gc, TRUE,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1219 x + spacing + shadow_thickness, y1,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1220 line_width, y2 - y1);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1221 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1222
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1223 /* Draw the shadows around the divider line */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1224 gtk_output_shadows (f, x + spacing, y1,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1225 width - 2 * spacing, y2 - y1,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1226 shadow_thickness);
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1229 /*****************************************************************************
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1230 gtk_output_blank
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1231
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1232 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
1233 of its face.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1234 ****************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1235 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1236 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
1237 int start_pixpos, int cursor_start, int cursor_width)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1238 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1239 struct frame *f = XFRAME (w->frame);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1240 struct device *d = XDEVICE (f->device);
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 GdkWindow *x_win = GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (f));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1243 GdkGC *gc;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1244 struct face_cachel *cursor_cachel =
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1245 WINDOW_FACE_CACHEL (w,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1246 get_builtin_face_cache_index
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1247 (w, Vtext_cursor_face));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1248 Lisp_Object bg_pmap;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1249 Lisp_Object buffer = WINDOW_BUFFER (w);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1250 Lisp_Object bar_cursor_value = symbol_value_in_buffer (Qbar_cursor,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1251 buffer);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1252
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1253 int x = rb->xpos;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1254 int y = dl->ypos - dl->ascent;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1255 int width = rb->width;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1256 int height = dl->ascent + dl->descent - dl->clip;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1257
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1258 if (start_pixpos > x)
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 if (start_pixpos >= (x + width))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1261 return;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1262 else
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 width -= (start_pixpos - x);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1265 x = start_pixpos;
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 }
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 bg_pmap = WINDOW_FACE_CACHEL_BACKGROUND_PIXMAP (w, rb->findex);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1270 if (!IMAGE_INSTANCEP (bg_pmap)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1271 || !IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (bg_pmap)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1272 bg_pmap = Qnil;
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 if (NILP (bg_pmap))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1275 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
1276 Qnil, Qnil, Qnil);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1277 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1278 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
1279 WINDOW_FACE_CACHEL_BACKGROUND (w, rb->findex), bg_pmap,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1280 Qnil);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1281
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1282 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
1283
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1284 /* 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
1285 representing a tab. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1286 if (!NILP (w->text_cursor_visible_p)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1287 && (rb->cursor_type == CURSOR_ON
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1288 || (cursor_width
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1289 && (cursor_start + cursor_width > x)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1290 && cursor_start < (x + width))))
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 int cursor_height, cursor_y;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1293 int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1294 struct Lisp_Font_Instance *fi;
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 fi = XFONT_INSTANCE (FACE_CACHEL_FONT
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1297 (WINDOW_FACE_CACHEL (w, rb->findex),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1298 Vcharset_ascii));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1299
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1300 gc = gtk_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil, Qnil);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1301
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1302 cursor_y = dl->ypos - fi->ascent;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1303 cursor_height = fi->height;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1304 if (cursor_y + cursor_height > y + height)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1305 cursor_height = y + height - cursor_y;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1306
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1307 if (focus)
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 (NILP (bar_cursor_value))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1310 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1311 gdk_draw_rectangle (GDK_DRAWABLE (x_win), gc, TRUE,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1312 cursor_start, cursor_y,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1313 fi->width, cursor_height);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1314 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1315 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1316 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1317 int bar_width = EQ (bar_cursor_value, Qt) ? 1 : 2;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1318
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1319 gc = gtk_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1320 make_int (bar_width));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1321 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
1322 cursor_y, cursor_start + bar_width - 1,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1323 cursor_y + cursor_height - 1);
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 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1326 else if (NILP (bar_cursor_value))
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 gdk_draw_rectangle (GDK_DRAWABLE (x_win), gc, FALSE,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1329 cursor_start, cursor_y,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1330 fi->width - 1, cursor_height - 1);
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 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1333 }
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 /*****************************************************************************
714
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1336 gtk_output_horizontal_line
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1337
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1338 Output a horizontal line in the foreground of its face.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1339 ****************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1340 static void
714
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1341 gtk_output_horizontal_line (struct window *w,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1342 struct display_line *dl,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1343 struct rune *rb)
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1344 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1345 struct frame *f = XFRAME (w->frame);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1346 struct device *d = XDEVICE (f->device);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1347 GtkStyle *style = FRAME_GTK_TEXT_WIDGET (f)->style;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1348
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1349 GdkWindow *x_win = GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (f));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1350 GdkGC *gc;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1351
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1352 int x = rb->xpos;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1353 int width = rb->width;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1354 int height = dl->ascent + dl->descent - dl->clip;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1355
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1356 int ypos1, ypos2, ypos3, ypos4;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1357
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1358 ypos1 = dl->ypos - dl->ascent;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1359 ypos2 = ypos1 + rb->object.hline.yoffset;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1360 ypos3 = ypos2 + rb->object.hline.thickness;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1361 ypos4 = dl->ypos + dl->descent - dl->clip;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1362
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1363 /* First clear the area not covered by the line. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1364 if (height - rb->object.hline.thickness > 0)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1365 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1366 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
1367 Qnil, Qnil, Qnil);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1368
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1369 if (ypos2 - ypos1 > 0)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1370 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
1371 if (ypos4 - ypos3 > 0)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1372 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
1373 }
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 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
1376 "hline", x, x + width, ypos2);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1377 #if 0
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1378 /* Now draw the line. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1379 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
1380 Qnil, Qnil, Qnil);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1381
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1382 if (ypos2 < ypos1)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1383 ypos2 = ypos1;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1384 if (ypos3 > ypos4)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1385 ypos3 = ypos4;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1386
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1387 if (ypos3 - ypos2 > 0)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1388 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
1389 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1390 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1391
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 gtk_output_shadows
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 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
1396 ****************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1397 void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1398 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
1399 int shadow_thickness)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1400 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1401 GdkWindow *x_win = GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (f));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1402 GtkStyle *style = FRAME_GTK_TEXT_WIDGET (f)->style;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1403 GtkShadowType stype = GTK_SHADOW_OUT;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1404
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1405 if (shadow_thickness < 0)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1406 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1407 stype = GTK_SHADOW_IN;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1408 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1409 else if (shadow_thickness == 0)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1410 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1411 stype = GTK_SHADOW_NONE;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1412 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1413
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1414 /* Do we want to have some magic constants to set
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1415 GTK_SHADOW_ETCHED_IN or GTK_SHADOW_ETCHED_OUT? */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1416
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1417 gtk_paint_shadow (style, x_win, GTK_STATE_NORMAL, stype, NULL,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1418 FRAME_GTK_TEXT_WIDGET (f), "modeline",
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1419 x, y, width, height);
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1422 /*****************************************************************************
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1423 gtk_clear_to_window_end
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 Clear the area between ypos1 and ypos2. Each margin area and the
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1426 text area is handled separately since they may each have their own
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1427 background color.
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 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1430 gtk_clear_to_window_end (struct window *w, int ypos1, int ypos2)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1431 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1432 int height = ypos2 - ypos1;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1433
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1434 if (height)
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 Lisp_Object window;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1438 int bflag = (window_needs_vertical_divider (w) ? 0 : 1);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1439 layout_bounds bounds;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1440
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1441 bounds = calculate_display_line_boundaries (w, bflag);
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
1442 window = wrap_window (w);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1443
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1444 if (window_is_leftmost (w))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1445 redisplay_clear_region (window, DEFAULT_INDEX, FRAME_LEFT_BORDER_START (f),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1446 ypos1, FRAME_BORDER_WIDTH (f), height);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1447
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1448 if (bounds.left_in - bounds.left_out > 0)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1449 redisplay_clear_region (window,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1450 get_builtin_face_cache_index (w, Vleft_margin_face),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1451 bounds.left_out, ypos1,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1452 bounds.left_in - bounds.left_out, height);
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 if (bounds.right_in - bounds.left_in > 0)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1455 redisplay_clear_region (window, DEFAULT_INDEX, bounds.left_in, ypos1,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1456 bounds.right_in - bounds.left_in, height);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1457
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1458 if (bounds.right_out - bounds.right_in > 0)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1459 redisplay_clear_region (window,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1460 get_builtin_face_cache_index (w, Vright_margin_face),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1461 bounds.right_in, ypos1,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1462 bounds.right_out - bounds.right_in, height);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1463
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1464 if (window_is_rightmost (w))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1465 redisplay_clear_region (window, DEFAULT_INDEX, FRAME_RIGHT_BORDER_START (f),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1466 ypos1, FRAME_BORDER_WIDTH (f), height);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1467 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1468 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1469
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1470 /****************************************************************************
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1471 gtk_clear_region
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 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
1474 given face.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1475 ****************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1476 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2054
diff changeset
1477 gtk_clear_region (Lisp_Object UNUSED (locale), struct device* d,
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2054
diff changeset
1478 struct frame* f, face_index UNUSED (findex), int x, int y,
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1479 int width, int height, Lisp_Object fcolor, Lisp_Object bcolor,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1480 Lisp_Object background_pixmap)
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 GdkWindow *x_win;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1483 GdkGC *gc = NULL;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1484
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1485 x_win = GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (f));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1486
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1487 if (!UNBOUNDP (background_pixmap))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1488 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1489 gc = gtk_get_gc (d, Qnil, fcolor, bcolor, background_pixmap, Qnil);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1490 }
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 if (gc)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1493 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1494 gdk_draw_rectangle (GDK_DRAWABLE (x_win), gc,TRUE,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1495 x, y, width, height);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1496 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1497 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1498 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1499 gdk_window_clear_area (x_win, x, y, width, height);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1500 }
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
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 gtk_output_eol_cursor
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1505
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1506 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
1507 narrower than the normal cursor.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1508 ****************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1509 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1510 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
1511 face_index findex)
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 struct frame *f = XFRAME (w->frame);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1514 struct device *d = XDEVICE (f->device);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1515 Lisp_Object window;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1516
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1517 GdkWindow *x_win = GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (f));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1518 GdkGC *gc;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1519 face_index elt = get_builtin_face_cache_index (w, Vtext_cursor_face);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1520 struct face_cachel *cursor_cachel = WINDOW_FACE_CACHEL (w, elt);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1521
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1522 int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1523 Lisp_Object bar_cursor_value = symbol_value_in_buffer (Qbar_cursor,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1524 WINDOW_BUFFER (w));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1525
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1526 int x = xpos;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1527 int y = dl->ypos - dl->ascent;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1528 int width = EOL_CURSOR_WIDTH;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1529 int height = dl->ascent + dl->descent - dl->clip;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1530 int cursor_height, cursor_y;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1531 int defheight, defascent;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1532
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
1533 window = wrap_window (w);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1534 redisplay_clear_region (window, findex, x, y, width, height);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1535
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1536 if (NILP (w->text_cursor_visible_p))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1537 return;
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 gc = gtk_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil, Qnil);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1540
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1541 default_face_font_info (window, &defascent, 0, &defheight, 0, 0);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1542
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1543 /* make sure the cursor is entirely contained between y and y+height */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1544 cursor_height = min (defheight, height);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1545 cursor_y = max (y, min (y + height - cursor_height,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1546 dl->ypos - defascent));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1547
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1548 if (focus)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1549 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1550 if (NILP (bar_cursor_value))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1551 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1552 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
1553 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1554 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1555 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1556 int bar_width = EQ (bar_cursor_value, Qt) ? 1 : 2;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1557
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1558 gc = gtk_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1559 make_int (bar_width));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1560 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
1561 x + bar_width - 1, cursor_y + cursor_height - 1);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1562 }
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 else if (NILP (bar_cursor_value))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1565 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1566 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
1567 cursor_height - 1);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1568 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1569 }
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 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1572 gtk_clear_frame_window (Lisp_Object window)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1573 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1574 struct window *w = XWINDOW (window);
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 if (!NILP (w->vchild))
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 gtk_clear_frame_windows (w->vchild);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1579 return;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1580 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1581
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1582 if (!NILP (w->hchild))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1583 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1584 gtk_clear_frame_windows (w->hchild);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1585 return;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1586 }
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 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
1589 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1590
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1591 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1592 gtk_clear_frame_windows (Lisp_Object window)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1593 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1594 for (; !NILP (window); window = XWINDOW (window)->next)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1595 gtk_clear_frame_window (window);
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1598 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1599 gtk_clear_frame (struct frame *f)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1600 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1601 GdkWindow *x_win = GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (f));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1602 int x, y, width, height;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1603 Lisp_Object frame;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1604
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1605 x = FRAME_LEFT_BORDER_START (f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1606 width = (FRAME_PIXWIDTH (f) - FRAME_REAL_LEFT_TOOLBAR_WIDTH (f) -
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1607 FRAME_REAL_RIGHT_TOOLBAR_WIDTH (f) -
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1608 2 * FRAME_REAL_LEFT_TOOLBAR_BORDER_WIDTH (f) -
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1609 2 * FRAME_REAL_RIGHT_TOOLBAR_BORDER_WIDTH (f));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1610 /* #### This adjustment by 1 should be being done in the macros.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1611 There is some small differences between when the menubar is on
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1612 and off that we still need to deal with. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1613 y = FRAME_TOP_BORDER_START (f) - 1;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1614 height = (FRAME_PIXHEIGHT (f) - FRAME_REAL_TOP_TOOLBAR_HEIGHT (f) -
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1615 FRAME_REAL_BOTTOM_TOOLBAR_HEIGHT (f) -
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1616 2 * FRAME_REAL_TOP_TOOLBAR_BORDER_WIDTH (f) -
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1617 2 * FRAME_REAL_BOTTOM_TOOLBAR_BORDER_WIDTH (f)) + 1;
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 gdk_window_clear_area (x_win, x, y, width, height);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1620
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
1621 frame = wrap_frame (f);
462
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 (!UNBOUNDP (FACE_BACKGROUND_PIXMAP (Vdefault_face, frame))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1624 || !UNBOUNDP (FACE_BACKGROUND_PIXMAP (Vleft_margin_face, frame))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1625 || !UNBOUNDP (FACE_BACKGROUND_PIXMAP (Vright_margin_face, frame)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1626 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1627 gtk_clear_frame_windows (f->root_window);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1628 }
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1631 static int
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1632 gtk_flash (struct device *d)
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 GdkGCValues gcv;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1635 GdkGC *gc;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1636 GdkColor tmp_fcolor, tmp_bcolor;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1637 Lisp_Object tmp_pixel, frame;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1638 struct frame *f = device_selected_frame (d);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1639 struct window *w = XWINDOW (FRAME_ROOT_WINDOW (f));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1640
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
1641 frame = wrap_frame (f);
462
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 tmp_pixel = FACE_FOREGROUND (Vdefault_face, frame);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1644 tmp_fcolor = * (COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (tmp_pixel)));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1645 tmp_pixel = FACE_BACKGROUND (Vdefault_face, frame);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1646 tmp_bcolor = * (COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (tmp_pixel)));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1647
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1648 memset (&gcv, ~0, sizeof (gcv)); /* initialize all slots to ~0 */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1649 gcv.foreground.pixel = (tmp_fcolor.pixel ^ tmp_bcolor.pixel);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1650 gcv.function = GDK_XOR;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1651 gcv.graphics_exposures = FALSE;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1652 gc = gc_cache_lookup (DEVICE_GTK_GC_CACHE (XDEVICE (f->device)), &gcv,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1653 GDK_GC_FOREGROUND | GDK_GC_FUNCTION | GDK_GC_EXPOSURES);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1654
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1655 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
1656 gc, TRUE, w->pixel_left, w->pixel_top,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1657 w->pixel_width, w->pixel_height);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1658
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1659 gdk_flush ();
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1660
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1661 #ifdef HAVE_SELECT
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 int usecs = 100000;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1664 struct timeval tv;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1665 tv.tv_sec = usecs / 1000000L;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1666 tv.tv_usec = usecs % 1000000L;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1667 /* I'm sure someone is going to complain about this... */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1668 select (0, 0, 0, 0, &tv);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1669 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1670 #else
778
2923009caf47 [xemacs-hg @ 2002-03-16 10:38:59 by ben]
ben
parents: 714
diff changeset
1671 #ifdef HAVE_POLL
2923009caf47 [xemacs-hg @ 2002-03-16 10:38:59 by ben]
ben
parents: 714
diff changeset
1672 poll (0, 0, 100);
2923009caf47 [xemacs-hg @ 2002-03-16 10:38:59 by ben]
ben
parents: 714
diff changeset
1673 #else
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1674 bite me
778
2923009caf47 [xemacs-hg @ 2002-03-16 10:38:59 by ben]
ben
parents: 714
diff changeset
1675 #endif
2923009caf47 [xemacs-hg @ 2002-03-16 10:38:59 by ben]
ben
parents: 714
diff changeset
1676 #endif
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1677
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1678 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
1679 gc, TRUE, w->pixel_left, w->pixel_top,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1680 w->pixel_width, w->pixel_height);
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 gdk_flush ();
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 return 1;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1685 }
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 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2054
diff changeset
1688 gtk_bevel_area (struct window *w, face_index UNUSED (findex),
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1689 int x, int y, int width, int height,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2054
diff changeset
1690 int shadow_thickness, int UNUSED (edges),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2054
diff changeset
1691 enum edge_style UNUSED (style))
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1692 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1693 struct frame *f = XFRAME (w->frame);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1694
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1695 gtk_output_shadows (f, x, y, width, height, shadow_thickness);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1696 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1697
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1698
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 /* Make audible bell. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1701 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2054
diff changeset
1702 gtk_ring_bell (struct device *UNUSED (d), int volume, int UNUSED (pitch),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2054
diff changeset
1703 int UNUSED (duration))
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1704 {
714
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1705 /* Gdk does not allow us to control the duration / pitch / volume */
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1706 if (volume > 0)
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1707 {
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1708 gdk_beep ();
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1709 }
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1710 }
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1713 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1714 /* initialization */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1715 /************************************************************************/
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 void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1718 console_type_create_redisplay_gtk (void)
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 /* redisplay methods */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1721 CONSOLE_HAS_METHOD (gtk, text_width);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1722 CONSOLE_HAS_METHOD (gtk, output_display_block);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1723 CONSOLE_HAS_METHOD (gtk, divider_height);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1724 CONSOLE_HAS_METHOD (gtk, eol_cursor_width);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1725 CONSOLE_HAS_METHOD (gtk, output_vertical_divider);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1726 CONSOLE_HAS_METHOD (gtk, clear_to_window_end);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1727 CONSOLE_HAS_METHOD (gtk, clear_region);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1728 CONSOLE_HAS_METHOD (gtk, clear_frame);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1729 CONSOLE_HAS_METHOD (gtk, flash);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1730 CONSOLE_HAS_METHOD (gtk, ring_bell);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1731 CONSOLE_HAS_METHOD (gtk, bevel_area);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1732 CONSOLE_HAS_METHOD (gtk, output_string);
714
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1733 CONSOLE_HAS_METHOD (gtk, output_pixmap);
462
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1736 /* 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
1737 get this done right other than calling clear_area before every
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1738 single $#!%@ing piece of text, which I do NOT want to do. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1739 #define USE_X_SPECIFIC_DRAW_ROUTINES 1
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1740
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1741 #include <gdk/gdkx.h>
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1742
714
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1743 static
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1744 void gdk_draw_text_image (GdkDrawable *drawable,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1745 GdkFont *font,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1746 GdkGC *gc,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1747 gint x,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1748 gint y,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1749 const gchar *text,
02339d4ebed4 [xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
wmperry
parents: 665
diff changeset
1750 gint text_length)
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1751 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1752 #if !USE_X_SPECIFIC_DRAW_ROUTINES
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1753 int width = gdk_text_measure (font, text, text_length);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1754 int height = gdk_text_height (font, text, text_length);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1755
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1756 gdk_draw_rectangle (drawable, gc, TRUE, x, y, width, height);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1757 gdk_draw_text (drawable, font, gc, x, y, text, text_length);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1758 #else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1759 GdkWindowPrivate *drawable_private;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1760 GdkFontPrivate *font_private;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1761 GdkGCPrivate *gc_private;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1762
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1763 g_return_if_fail (drawable != NULL);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1764 g_return_if_fail (font != NULL);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1765 g_return_if_fail (gc != NULL);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1766 g_return_if_fail (text != NULL);
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 drawable_private = (GdkWindowPrivate*) drawable;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1769 if (drawable_private->destroyed)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1770 return;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1771 gc_private = (GdkGCPrivate*) gc;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1772 font_private = (GdkFontPrivate*) font;
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 if (font->type == GDK_FONT_FONT)
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 XFontStruct *xfont = (XFontStruct *) font_private->xfont;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1777 XSetFont(drawable_private->xdisplay, gc_private->xgc, xfont->fid);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1778 if ((xfont->min_byte1 == 0) && (xfont->max_byte1 == 0))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1779 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1780 XDrawImageString (drawable_private->xdisplay, drawable_private->xwindow,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1781 gc_private->xgc, x, y, text, text_length);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1782 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1783 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1784 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1785 XDrawImageString16 (drawable_private->xdisplay, drawable_private->xwindow,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1786 gc_private->xgc, x, y, (XChar2b *) text, text_length / 2);
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 else if (font->type == GDK_FONT_FONTSET)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1790 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1791 XFontSet fontset = (XFontSet) font_private->xfont;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1792 XmbDrawImageString (drawable_private->xdisplay, drawable_private->xwindow,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1793 fontset, gc_private->xgc, x, y, text, text_length);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1794 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1795 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1796 g_error("undefined font type\n");
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1797 #endif
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 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1801 our_draw_bitmap (GdkDrawable *drawable,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1802 GdkGC *gc,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1803 GdkPixmap *src,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1804 gint xsrc,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1805 gint ysrc,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1806 gint xdest,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1807 gint ydest,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1808 gint width,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1809 gint height)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1810 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1811 GdkWindowPrivate *drawable_private;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1812 GdkWindowPrivate *src_private;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1813 GdkGCPrivate *gc_private;
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 g_return_if_fail (drawable != NULL);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1816 g_return_if_fail (src != NULL);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1817 g_return_if_fail (gc != NULL);
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 drawable_private = (GdkWindowPrivate*) drawable;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1820 src_private = (GdkWindowPrivate*) src;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1821 if (drawable_private->destroyed || src_private->destroyed)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1822 return;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1823 gc_private = (GdkGCPrivate*) gc;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1824
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1825 if (width == -1)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1826 width = src_private->width;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1827 if (height == -1)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1828 height = src_private->height;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1829
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1830 XCopyPlane (drawable_private->xdisplay,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1831 src_private->xwindow,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1832 drawable_private->xwindow,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1833 gc_private->xgc,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1834 xsrc, ysrc,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1835 width, height,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1836 xdest, ydest, 1L);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1837 }