annotate src/redisplay-xlike-inc.c @ 4882:eab9498ecc0e

merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c -------------------- ChangeLog entries follow: -------------------- src/ChangeLog addition: 2010-01-18 Ben Wing <ben@xemacs.org> * redisplay-gtk.c: * redisplay-gtk.c (gtk_bevel_area): * redisplay-x.c: * redisplay-x.c (THIS_IS_X): * redisplay-xlike-inc.c: * redisplay-xlike-inc.c (XLIKE_text_width_single_run): * redisplay-xlike-inc.c (XLIKE_text_width): * redisplay-xlike-inc.c (XLIKE_output_display_block): * redisplay-xlike-inc.c (XLIKE_get_gc): * redisplay-xlike-inc.c (XLIKE_output_string): * redisplay-xlike-inc.c (XLIKE_OUTPUT_XLIKE_PIXMAP): * redisplay-xlike-inc.c (XLIKE_output_pixmap): * redisplay-xlike-inc.c (XLIKE_output_vertical_divider): * redisplay-xlike-inc.c (XLIKE_output_blank): * redisplay-xlike-inc.c (XLIKE_output_horizontal_line): * redisplay-xlike-inc.c (XLIKE_clear_region): * redisplay-xlike-inc.c (XLIKE_output_eol_cursor): * redisplay-xlike-inc.c (XLIKE_clear_frame_window): * redisplay-xlike-inc.c (XLIKE_clear_frame): * redisplay-xlike-inc.c (XLIKE_flash): * redisplay-xlike-inc.c (console_type_create_redisplay_XLIKE): Move lots more code into redisplay-xlike-inc.c. Use macros to isolate the code that differs among X vs. GTK, to reduce the need for ifdefs in the middle of the code. Now, redisplay-x.c and redisplay-gtk.c only contain a few functions whose implementation is completely different from one to the other, or which are not present at all in one of them. GTK code not currently tested, but it has bitrotted somewhat any. Doing this will help keep it less bitrotty. * depend: Regenerate.
author Ben Wing <ben@xemacs.org>
date Mon, 18 Jan 2010 08:44:49 -0600
parents a4322ac49e37
children b3ce27ca7647 ea701c23ed84
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4881
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
1 /* Common code between X and GTK.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
3 Copyright (C) 1994 Lucid, Inc.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
4 Copyright (C) 1995 Sun Microsystems, Inc.
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
5 Copyright (C) 2002, 2003, 2005, 2009, 2010 Ben Wing.
4881
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
6
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
7 This file is part of XEmacs.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
8
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
9 XEmacs is free software; you can redistribute it and/or modify it
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
10 under the terms of the GNU General Public License as published by the
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
11 Free Software Foundation; either version 2, or (at your option) any
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
12 later version.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
13
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
14 XEmacs is distributed in the hope that it will be useful, but WITHOUT
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
17 for more details.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
18
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
19 You should have received a copy of the GNU General Public License
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
20 along with XEmacs; see the file COPYING. If not, write to
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
21 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
22 Boston, MA 02111-1307, USA. */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
23
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
24 /* Synched up with: Not in FSF. */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
25
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
26 /* Author: Chuck Thompson */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
27 /* Gtk flavor by William Perry */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
28 /* X and GTK code merged by Ben Wing, 1-10 */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
29
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
30 /* Lots of work done by Ben Wing for Mule */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
31
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
32 #include <config.h>
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
33 #include "lisp.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
34
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
35 #include "buffer.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
36 #include "debug.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
37 #include "device-impl.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
38 #include "faces.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
39 #include "file-coding.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
40 #include "frame-impl.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
41 #include "gutter.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
42 #include "redisplay.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
43 #include "sysdep.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
44 #include "window.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
45
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
46 #ifdef MULE
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
47 #include "mule-ccl.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
48 #endif
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
49 #include "charset.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
50
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
51 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
52 #include "console-x-impl.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
53 #include "glyphs-x.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
54 #include "objects-x-impl.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
55 #include "xgccache.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
56 #else /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
57 #include "console-gtk-impl.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
58 #include "gccache-gtk.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
59 #include "glyphs-gtk.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
60 #include "objects-gtk-impl.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
61 #endif /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
62
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
63 #include "EmacsFrame.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
64 #include "EmacsFrameP.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
65
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
66 #include "sysproc.h" /* for select() */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
67
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
68 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
69 #include <X11/bitmaps/gray>
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
70 #endif /* THIS_IS_X */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
71
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
72 #define EOL_CURSOR_WIDTH 5
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
73
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
74 /* About some of the types below:
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
75
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
76 X has two ways of representing a color: (a) as an unsigned long
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
77 representing a color pixel value, i.e. the actual value stored in memory
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
78 or a file at a particular pixel location to indicate that the pixel
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
79 takes on a specific color; and (b) an XColor structure, which
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
80 encapsulates both the RGB components of a color and the associated color
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
81 pixel value.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
82
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
83 We call the former type XLIKE_PIXCOLOR and the latter XLIKE_COLOR.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
84 GTK uses the same GdkColor structure for both, and normally passes in
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
85 a pointer. We provide routines to handle the two logical color types. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
86
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
87 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
88
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
89 /***************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
90 /* Definitions implementing X flavor of XLIKE */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
91 /***************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
92
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
93 #define XLIKE_NAME x
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
94 #define USED_IF_X(var) var
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
95
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
96 /* types */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
97 #define XLIKE_DISPLAY Display *
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
98 #define XLIKE_WINDOW Window
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
99 #define XLIKE_GC GC
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
100 #define XLIKE_RECTANGLE XRectangle
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
101 #define XLIKE_GCVALUES XGCValues
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
102 #define XLIKE_COLOR XColor
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
103 #define XLIKE_PIXCOLOR unsigned long
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
104
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
105 /* constants */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
106 #define XLIKE_NONE None
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
107 #define XLIKE_FALSE False
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
108
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
109 #define XLIKE_GC_BACKGROUND GCBackground
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
110 #define XLIKE_GC_CLIP_MASK GCClipMask
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
111 #define XLIKE_GC_CLIP_X_ORIGIN GCClipXOrigin
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
112 #define XLIKE_GC_CLIP_Y_ORIGIN GCClipYOrigin
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
113 #define XLIKE_GC_EXPOSURES GCGraphicsExposures
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
114 #define XLIKE_GC_FILL GCFillStyle
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
115 #define XLIKE_GC_FONT GCFont
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
116 #define XLIKE_GC_FOREGROUND GCForeground
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
117 #define XLIKE_GC_FUNCTION GCFunction
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
118 #define XLIKE_GC_LINE_WIDTH GCLineWidth
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
119 #define XLIKE_GC_STIPPLE GCStipple
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
120 #define XLIKE_GC_TILE GCTile
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
121
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
122 #define XLIKE_GX_COPY GXcopy
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
123 #define XLIKE_GX_XOR GXxor
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
124
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
125 #define XLIKE_FILL_MEMBER fill_style
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
126 #define XLIKE_FILL_STIPPLED FillStippled
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
127 #define XLIKE_FILL_OPAQUE_STIPPLED FillOpaqueStippled
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
128 #define XLIKE_FILL_TILED FillTiled
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
129 #define XLIKE_FILL_SOLID FillSolid
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
130
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
131 /* functions */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
132 #define GET_XLIKE_DISPLAY(d) DEVICE_X_DISPLAY (d)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
133 #define GET_XLIKE_WINDOW(w) XtWindow (FRAME_X_TEXT_WIDGET (f))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
134 #define XLIKE_FILL_RECTANGLE(dpy, x_win, gc, x, y, width, height) \
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
135 XFillRectangle (dpy, x_win, gc, x, y, width, height)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
136 #define XLIKE_DRAW_RECTANGLE(dpy, x_win, gc, x, y, width, height) \
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
137 XDrawRectangle (dpy, x_win, gc, x, y, width, height)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
138 #define XLIKE_DRAW_LINE(dpy, x_win, gc, x1, y1, x2, y2) \
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
139 XDrawLine (dpy, x_win, gc, x1, y1, x2, y2)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
140 #define XLIKE_OUTPUT_XLIKE_PIXMAP x_output_x_pixmap
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
141
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
142 #define XLIKE_DISPLAY_LINE_HEIGHT(dl) DISPLAY_LINE_HEIGHT (dl)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
143 #define XLIKE_DISPLAY_LINE_YPOS(dl) DISPLAY_LINE_YPOS (dl)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
144 #define XLIKE_DISPLAY_LINE_TOP_CLIP(dl) ((dl)->top_clip)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
145 #define XLIKE_SET_CLIP_RECTANGLE(dpy, gc, xorig, yorig, prect) \
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
146 /* #### why not Unsorted? */ \
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
147 XSetClipRectangles (dpy, gc, xorig, yorig, prect, 1, YXBanded)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
148 #define XLIKE_CLEAR_CLIP_MASK(dpy, gc) \
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
149 do \
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
150 { \
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
151 XSetClipMask (dpy, gc, None); \
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
152 XSetClipOrigin (dpy, gc, 0, 0); \
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
153 } \
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
154 while (0)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
155 #define XLIKE_FLUSH(dpy) XSync (dpy, False)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
156 #define XLIKE_CLEAR_AREA(dpy, win, x, y, width, height) \
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
157 XClearArea (dpy, win, x, y, width, height, False)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
158
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
159 #define IMAGE_INSTANCE_XLIKE_MASK IMAGE_INSTANCE_X_MASK
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
160 #define XIMAGE_INSTANCE_XLIKE_PIXMAP XIMAGE_INSTANCE_X_PIXMAP
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
161 #define COLOR_INSTANCE_XLIKE_COLOR COLOR_INSTANCE_X_COLOR
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
162 #define FONT_INSTANCE_XLIKE_FONT FONT_INSTANCE_X_FONT
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
163 #define DEVICE_XLIKE_GC_CACHE DEVICE_X_GC_CACHE
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
164 #define DEVICE_XLIKE_GRAY_PIXMAP DEVICE_X_GRAY_PIXMAP
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
165 #define XLIKE_COLOR_TO_PIXCOLOR(ci) ((ci).pixel)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
166 #define XLIKE_SET_PIXCOLOR_COPY(lval, rval) ((lval) = (rval))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
167 #define XLIKE_SET_PIXCOLOR_NUM(lval, rval) ((lval) = (rval))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
168 #define XLIKE_FONT_NUM(val) ((val)->fid)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
169
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
170 #define XLIKE_OUTPUT_XLIKE_PIXMAP x_output_x_pixmap
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
171
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
172 /************ End X flavor of XLIKE **********/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
173
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
174
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
175
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
176
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
177 #else /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
178
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
179 /***************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
180 /* Definitions implementing GTK flavor of XLIKE */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
181 /***************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
182
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
183 #define XLIKE_NAME gtk
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
184 #define USED_IF_X(var) UNUSED (var)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
185
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
186 /*types */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
187 #define XLIKE_DISPLAY void *
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
188 #define XLIKE_WINDOW GdkWindow *
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
189 #define XLIKE_GC GdkGC *
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
190 #define XLIKE_RECTANGLE GdkRectangle
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
191 #define XLIKE_GCVALUES GdkGCValues
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
192 #define XLIKE_COLOR GdkColor *
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
193 #define XLIKE_PIXCOLOR GdkColor *
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
194
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
195 /* constants */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
196 #define XLIKE_NONE 0
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
197 #define XLIKE_FALSE FALSE
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
198
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
199 #define XLIKE_GC_BACKGROUND GDK_GC_BACKGROUND
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
200 #define XLIKE_GC_CLIP_MASK GDK_GC_CLIP_MASK
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
201 #define XLIKE_GC_CLIP_X_ORIGIN GDK_GC_CLIP_X_ORIGIN
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
202 #define XLIKE_GC_CLIP_Y_ORIGIN GDK_GC_CLIP_Y_ORIGIN
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
203 #define XLIKE_GC_EXPOSURES GDK_GC_EXPOSURES
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
204 #define XLIKE_GC_FILL GDK_GC_FILL
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
205 #define XLIKE_GC_FONT GDK_GC_FONT
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
206 #define XLIKE_GC_FOREGROUND GDK_GC_FOREGROUND
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
207 #define XLIKE_GC_FUNCTION GDK_GC_FUNCTION
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
208 #define XLIKE_GC_LINE_WIDTH GDK_GC_LINE_WIDTH
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
209 #define XLIKE_GC_STIPPLE GDK_GC_STIPPLE
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
210 #define XLIKE_GC_TILE GDK_GC_TILE
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
211
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
212 #define XLIKE_GX_COPY GDK_COPY
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
213 #define XLIKE_GX_XOR GDK_XOR
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
214
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
215 #define XLIKE_FILL_MEMBER fill
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
216 #define XLIKE_FILL_STIPPLED GDK_STIPPLED
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
217 #define XLIKE_FILL_OPAQUE_STIPPLED GDK_OPAQUE_STIPPLED
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
218 #define XLIKE_FILL_TILED GDK_TILED
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
219 #define XLIKE_FILL_SOLID GDK_SOLID
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
220
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
221 /* functions */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
222
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
223 #define GET_XLIKE_DISPLAY(d) NULL
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
224 #define GET_XLIKE_WINDOW(w) GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (w))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
225 #define XLIKE_FILL_RECTANGLE(dpy, x_win, gc, x, y, width, height) \
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
226 gdk_draw_rectangle (GDK_DRAWABLE (x_win), gc, TRUE, x, y, width, height)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
227 #define XLIKE_DRAW_RECTANGLE(dpy, x_win, gc, x, y, width, height) \
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
228 gdk_draw_rectangle (GDK_DRAWABLE (x_win), gc, FALSE, x, y, width, height)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
229 #define XLIKE_DRAW_LINE(dpy, x_win, gc, x1, y1, x2, y2) \
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
230 gdk_draw_line (GDK_DRAWABLE (x_win), gc, x1, y1, x2, y2)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
231 #define XLIKE_OUTPUT_XLIKE_PIXMAP gtk_output_gdk_pixmap
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
232
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
233 /* FIXME: This is totally bogus. It removes dl->top_clip from the
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
234 equations. If there is a bug involving this, fix it properly!
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
235 Or just ensure that top_clip is 0. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
236 #define XLIKE_DISPLAY_LINE_HEIGHT(dl) \
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
237 ((dl)->ascent + ((dl)->descent - (dl)->clip)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
238 #define XLIKE_DISPLAY_LINE_YPOS(dl) ((dl)->ypos - (dl)->ascent)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
239 #define XLIKE_DISPLAY_LINE_TOP_CLIP(dl) ((0)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
240 #define XLIKE_SET_CLIP_RECTANGLE(dpy, gc, xorig, yorig, prect) \
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
241 do \
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
242 { \
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
243 gdk_gc_set_clip_rectangle (gc, prect); \
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
244 gdk_gc_set_clip_origin (gc, xorig, yorig); \
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
245 } \
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
246 while (0)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
247 #define XLIKE_CLEAR_CLIP_MASK(dpy, gc) \
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
248 do \
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
249 { \
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
250 gdk_gc_set_clip_rectangle (gc, NULL); \
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
251 gdk_gc_set_clip_origin (gc, 0, 0); \
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
252 } \
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
253 while (0)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
254 #define XLIKE_FLUSH(dpy) gdk_flush ()
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
255 #define XLIKE_CLEAR_AREA(dpy, win, x, y, width, height) \
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
256 gdk_window_clear_area (win, x, y, width, height)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
257
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
258 #define IMAGE_INSTANCE_XLIKE_MASK IMAGE_INSTANCE_GTK_MASK
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
259 #define XIMAGE_INSTANCE_XLIKE_PIXMAP XIMAGE_INSTANCE_GTK_PIXMAP
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
260 #define COLOR_INSTANCE_XLIKE_COLOR COLOR_INSTANCE_GTK_COLOR
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
261 #define FONT_INSTANCE_XLIKE_FONT FONT_INSTANCE_GTK_FONT
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
262 #define DEVICE_XLIKE_GRAY_PIXMAP DEVICE_GTK_GRAY_PIXMAP
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
263 #define DEVICE_XLIKE_GC_CACHE DEVICE_GTK_GC_CACHE
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
264 #define XLIKE_COLOR_TO_PIXCOLOR(ci) (ci)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
265 #define XLIKE_SET_PIXCOLOR_COPY(lval, rval) ((lval) = *(rval))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
266 #define XLIKE_SET_PIXCOLOR_NUM(lval, rval) ((lval).pixel = (rval))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
267 #define XLIKE_FONT_NUM(val) (val)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
268
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
269 #define XLIKE_OUTPUT_XLIKE_PIXMAP gtk_output_gdk_pixmap
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
270
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
271 static void gtk_output_pixmap (struct window *w,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
272 Lisp_Object image_instance,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
273 struct display_box *db,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
274 struct display_glyph_area *dga,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
275 face_index findex,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
276 int cursor_start,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
277 int cursor_width,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
278 int cursor_height,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
279 int bgpixmap);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
280 static void gtk_clear_region (Lisp_Object locale, struct device* d,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
281 struct frame* f, face_index findex, int x, int y,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
282 int width, int height, Lisp_Object fcolor,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
283 Lisp_Object bcolor,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
284 Lisp_Object background_pixmap);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
285 static void gtk_bevel_modeline (struct window *w, struct display_line *dl);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
286
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
287 #if 0
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
288 static void __describe_gc (GdkGC *);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
289 #endif
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
290
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
291 /************ End GTK flavor of XLIKE **********/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
292
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
293 #endif /* (not) THIS_IS_X */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
294
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
295
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
296
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
297 /***************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
298 /* Common definitions */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
299 /***************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
300
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
301 #define XCOLOR_INSTANCE_XLIKE_COLOR(x) \
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
302 COLOR_INSTANCE_XLIKE_COLOR (XCOLOR_INSTANCE (x))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
303
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
304 #define XLIKE_PASTE_1(a,b) a##_##b
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
305 #define XLIKE_PASTE(a,b) XLIKE_PASTE_1(a,b)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
306 #define XLIKE_CONSOLE_HAS_METHOD_1(xlike, name) CONSOLE_HAS_METHOD (xlike, name)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
307 #define XLIKE_CONSOLE_HAS_METHOD(name) \
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
308 XLIKE_CONSOLE_HAS_METHOD_1 (XLIKE_NAME, name)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
309
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
310 /* Device methods */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
311
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
312 #define XLIKE_text_width XLIKE_PASTE (XLIKE_NAME, text_width)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
313 #define XLIKE_output_display_block XLIKE_PASTE (XLIKE_NAME, output_display_block)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
314 #define XLIKE_divider_height XLIKE_PASTE (XLIKE_NAME, divider_height)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
315 #define XLIKE_eol_cursor_width XLIKE_PASTE (XLIKE_NAME, eol_cursor_width)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
316 #define XLIKE_output_vertical_divider XLIKE_PASTE (XLIKE_NAME, output_vertical_divider)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
317 #define XLIKE_clear_region XLIKE_PASTE (XLIKE_NAME, clear_region)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
318 #define XLIKE_clear_frame XLIKE_PASTE (XLIKE_NAME, clear_frame)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
319 #define XLIKE_flash XLIKE_PASTE (XLIKE_NAME, flash)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
320 #define XLIKE_ring_bell XLIKE_PASTE (XLIKE_NAME, ring_bell)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
321 #define XLIKE_bevel_area XLIKE_PASTE (XLIKE_NAME, bevel_area)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
322 #define XLIKE_output_string XLIKE_PASTE (XLIKE_NAME, output_string)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
323 #define XLIKE_output_pixmap XLIKE_PASTE (XLIKE_NAME, output_pixmap)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
324 #define XLIKE_window_output_begin XLIKE_PASTE (XLIKE_NAME, window_output_begin)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
325 #define XLIKE_window_output_end XLIKE_PASTE (XLIKE_NAME, window_output_end)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
326
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
327 /* Miscellaneous split functions */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
328
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
329 #define console_type_create_redisplay_XLIKE XLIKE_PASTE (console_type_create_redisplay, XLIKE_NAME)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
330 #define XLIKE_get_gc XLIKE_PASTE (XLIKE_NAME, get_gc)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
331 #define XLIKE_output_blank XLIKE_PASTE (XLIKE_NAME, output_blank)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
332 #define XLIKE_text_width_single_run XLIKE_PASTE (XLIKE_NAME, text_width_single_run)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
333
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
334 static void XLIKE_output_blank (struct window *w, struct display_line *dl,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
335 struct rune *rb, int start_pixpos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
336 int cursor_start, int cursor_width);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
337 static void XLIKE_output_horizontal_line (struct window *w,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
338 struct display_line *dl,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
339 struct rune *rb);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
340
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
341 static void XLIKE_output_vertical_divider (struct window *w, int clear);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
342
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
343 static void XLIKE_output_eol_cursor (struct window *w,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
344 struct display_line *dl,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
345 int xpos, face_index findex);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
346 static void XLIKE_clear_frame (struct frame *f);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
347 static void XLIKE_clear_frame_windows (Lisp_Object window);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
348 static void XLIKE_window_output_begin (struct window *w);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
349 static void XLIKE_window_output_end (struct window *w);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
350 static void XLIKE_bevel_area (struct window *w, face_index findex,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
351 int x, int y, int width, int height,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
352 int shadow_thickness, int edges,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
353 enum edge_style style);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
354 static void XLIKE_ring_bell (struct device *d, int volume, int pitch,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
355 int duration);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
356
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
357 /****************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
358 /* */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
359 /* Separate textual runs */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
360 /* */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
361 /****************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
362
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
363
4881
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
364 /* Note: We do not use the Xmb*() functions and XFontSets, nor the
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
365 Motif XFontLists and CompoundStrings.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
366 Those functions are generally losing for a number of reasons.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
367 Most important, they only support one locale (e.g. you could
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
368 display Japanese and ASCII text, but not mixed Japanese/Chinese
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
369 text). You could maybe call setlocale() frequently to try to deal
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
370 with this, but that would generally fail because an XFontSet is
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
371 tied to one locale and won't have the other character sets in it.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
372
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
373 fontconfig (the font database for Xft) has some specifier-like
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
374 properties, but it's not sufficient (witness the existence of
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
375 Pango). Pango might do the trick, but it's not a cross-platform
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
376 solution; it would need significant advantages to be worth the
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
377 effort.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
378 */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
379
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
380 struct textual_run
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
381 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
382 Lisp_Object charset;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
383 unsigned char *ptr;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
384 int len;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
385 int dimension;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
386 };
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
387
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
388 /* Separate out the text in STR (an array of Ichars, not a string
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
389 representation) of length LEN into a series of runs, stored in
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
390 RUN_STORAGE. RUN_STORAGE is guaranteed to hold enough space for all
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
391 runs that could be generated from this text. Each run points to the a
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
392 stretch of text given simply by the position codes TEXT_STORAGE into a
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
393 series of textual runs of a particular charset. Also convert the
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
394 characters as necessary into the format needed by XDrawImageString(),
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
395 XDrawImageString16(), et al. This means converting to one or two byte
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
396 format, possibly tweaking the high bits, and possibly running a CCL
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
397 program. You must pre-allocate the space used and pass it in. (This is
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
398 done so you can ALLOCA () the space.) (2 * len) bytes must be allocated
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
399 for TEXT_STORAGE and (len * sizeof (struct textual_run)) bytes of
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
400 RUN_STORAGE, where LEN is the length of the dynarr.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
401
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
402 bufchar might not be fixed width (in the case of UTF-8).
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
403
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
404 Returns the number of runs actually used. */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
405
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
406 /* Notes on Xft implementation
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
407
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
408 - With Unicode, we're no longer going to have repertoires reified as
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
409 charsets. (Not that we ever really did, what with corporate variants,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
410 and so on.) So we really should be querying the face for the desired
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
411 font, rather than the character for the charset, and that's what would
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
412 determine the separation into runs.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
413 - The widechar versions of fontconfig (and therefore Xft) functions
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
414 seem to be just bigendian Unicode. So there's actually no need to use
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
415 the 8-bit versions in computing runs and runes, it would seem.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
416 */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
417
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
418 #if !defined(USE_XFT) && !defined(MULE)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
419 static int
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
420 separate_textual_runs_nomule (unsigned char *text_storage,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
421 struct textual_run *run_storage,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
422 const Ichar *str, Charcount len,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
423 struct face_cachel *UNUSED(cachel))
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
424 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
425 if (!len)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
426 return 0;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
427
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
428 run_storage[0].ptr = text_storage;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
429 run_storage[0].len = len;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
430 run_storage[0].dimension = 1;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
431 run_storage[0].charset = Qnil;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
432
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
433 while (len--)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
434 *text_storage++ = *str++;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
435 return 1;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
436 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
437 #endif
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
438
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
439 #if defined(USE_XFT) && !defined(MULE)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
440 /*
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
441 Note that in this configuration the "Croatian hack" of using an 8-bit,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
442 non-Latin-1 font to get localized display without Mule simply isn't
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
443 available. That's by design -- Unicode does not aid or abet that kind
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
444 of punning.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
445 This means that the cast to XftChar16 gives the correct "conversion" to
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
446 UCS-2.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
447 #### Is there an alignment issue with text_storage?
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
448 */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
449 static int
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
450 separate_textual_runs_xft_nomule (unsigned char *text_storage,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
451 struct textual_run *run_storage,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
452 const Ichar *str, Charcount len,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
453 struct face_cachel *UNUSED(cachel))
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
454 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
455 int i;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
456 if (!len)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
457 return 0;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
458
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
459 run_storage[0].ptr = text_storage;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
460 run_storage[0].len = len;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
461 run_storage[0].dimension = 2;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
462 run_storage[0].charset = Qnil;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
463
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
464 for (i = 0; i < len; i++)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
465 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
466 *(XftChar16 *)text_storage = str[i];
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
467 text_storage += sizeof(XftChar16);
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
468 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
469 return 1;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
470 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
471 #endif
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
472
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
473 #if defined(USE_XFT) && defined(MULE)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
474 static int
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
475 separate_textual_runs_xft_mule (unsigned char *text_storage,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
476 struct textual_run *run_storage,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
477 const Ichar *str, Charcount len,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
478 struct face_cachel *UNUSED(cachel))
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
479 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
480 Lisp_Object prev_charset = Qunbound;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
481 int runs_so_far = 0, i;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
482
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
483 run_storage[0].ptr = text_storage;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
484 run_storage[0].len = len;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
485 run_storage[0].dimension = 2;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
486 run_storage[0].charset = Qnil;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
487
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
488 for (i = 0; i < len; i++)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
489 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
490 Ichar ch = str[i];
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
491 Lisp_Object charset = ichar_charset(ch);
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
492 int ucs = ichar_to_unicode(ch);
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
493
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
494 /* If UCS is less than zero or greater than 0xFFFF, set ucs2 to
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
495 REPLACMENT CHARACTER. */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
496 /* That means we can't handle characters outside of the BMP for now */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
497 ucs = (ucs & ~0xFFFF) ? 0xFFFD : ucs;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
498
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
499 if (!EQ (charset, prev_charset))
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
500 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
501 if (runs_so_far)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
502 run_storage[runs_so_far-1].len = (text_storage - run_storage[runs_so_far-1].ptr) >> 1;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
503 run_storage[runs_so_far].ptr = text_storage;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
504 run_storage[runs_so_far].dimension = 2;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
505 run_storage[runs_so_far].charset = charset;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
506 prev_charset = charset;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
507 runs_so_far++;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
508 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
509
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
510 *(XftChar16 *)text_storage = ucs;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
511 text_storage += sizeof(XftChar16);
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
512 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
513
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
514 if (runs_so_far)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
515 run_storage[runs_so_far-1].len = (text_storage - run_storage[runs_so_far-1].ptr) >> 1;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
516 return runs_so_far;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
517 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
518 #endif
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
519
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
520 #if !defined(USE_XFT) && defined(MULE)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
521 /*
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
522 This is the most complex function of this group, due to the various
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
523 indexing schemes used by different fonts. For our purposes, they
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
524 fall into three classes. Some fonts are indexed compatibly with ISO
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
525 2022; those fonts just use the Mule internal representation directly
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
526 (typically the high bit must be reset; this is determined by the `graphic'
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
527 flag). Some fonts are indexed by Unicode, specifically by UCS-2. These
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
528 are all translated using `ichar_to_unicode'. Finally some fonts have
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
529 irregular indexes, and must be translated ad hoc. In XEmacs ad hoc
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
530 translations are accomplished with CCL programs. */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
531 static int
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
532 separate_textual_runs_mule (unsigned char *text_storage,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
533 struct textual_run *run_storage,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
534 const Ichar *str, Charcount len,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
535 struct face_cachel *cachel)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
536 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
537 Lisp_Object prev_charset = Qunbound;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
538 int runs_so_far = 0, i;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
539 Ibyte charset_leading_byte = LEADING_BYTE_ASCII;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
540 int dimension = 1, graphic = 0, need_ccl_conversion = 0;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
541 Lisp_Object ccl_prog;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
542 struct ccl_program char_converter;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
543
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
544 int translate_to_ucs_2 = 0;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
545
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
546 for (i = 0; i < len; i++)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
547 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
548 Ichar ch = str[i];
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
549 Lisp_Object charset;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
550 int byte1, byte2; /* BREAKUP_ICHAR dereferences the addresses
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
551 of its arguments as pointer to int. */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
552 BREAKUP_ICHAR (ch, charset, byte1, byte2);
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
553
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
554 if (!EQ (charset, prev_charset))
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
555 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
556 /* At this point, dimension' and `prev_charset' refer to just-
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
557 completed run. `runs_so_far' and `text_storage' refer to the
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
558 run about to start. */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
559 if (runs_so_far)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
560 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
561 /* Update metadata for previous run. */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
562 run_storage[runs_so_far - 1].len =
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
563 text_storage - run_storage[runs_so_far - 1].ptr;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
564 if (2 == dimension) run_storage[runs_so_far - 1].len >>= 1;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
565 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
566
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
567 /* Compute metadata for current run.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
568 First, classify font.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
569 If the font is indexed by UCS-2, set `translate_to_ucs_2'.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
570 Else if the charset has a CCL program, set `need_ccl_conversion'.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
571 Else if the font is indexed by an ISO 2022 "graphic register",
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
572 set `graphic'.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
573 These flags are almost mutually exclusive, but we're sloppy
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
574 about resetting "shadowed" flags. So the flags must be checked
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
575 in the proper order in computing byte1 and byte2, below. */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
576 charset_leading_byte = XCHARSET_LEADING_BYTE(charset);
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
577 translate_to_ucs_2 =
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
578 bit_vector_bit (FACE_CACHEL_FONT_FINAL_STAGE (cachel),
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
579 charset_leading_byte - MIN_LEADING_BYTE);
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
580 if (translate_to_ucs_2)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
581 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
582 dimension = 2;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
583 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
584 else
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
585 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
586 dimension = XCHARSET_DIMENSION (charset);
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
587
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
588 /* Check for CCL charset.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
589 If setup_ccl_program fails, we'll get a garbaged display.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
590 This should never happen, and even if it does, it should
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
591 be harmless (unless the X server has buggy handling of
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
592 characters undefined in the font). It may be marginally
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
593 more useful to users and debuggers than substituting a
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
594 fixed replacement character. */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
595 ccl_prog = XCHARSET_CCL_PROGRAM (charset);
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
596 if ((!NILP (ccl_prog))
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
597 && (setup_ccl_program (&char_converter, ccl_prog) >= 0))
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
598 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
599 need_ccl_conversion = 1;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
600 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
601 else
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
602 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
603 /* The charset must have an ISO 2022-compatible font index.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
604 There are 2 "registers" (what such fonts use as index).
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
605 GL (graphic == 0) has the high bit of each octet reset,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
606 GR (graphic == 1) has it set. */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
607 graphic = XCHARSET_GRAPHIC (charset);
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
608 need_ccl_conversion = 0;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
609 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
610 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
611
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
612 /* Initialize metadata for current run. */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
613 run_storage[runs_so_far].ptr = text_storage;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
614 run_storage[runs_so_far].charset = charset;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
615 run_storage[runs_so_far].dimension = dimension;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
616
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
617 /* Update loop variables. */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
618 prev_charset = charset;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
619 runs_so_far++;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
620 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
621
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
622 /* Must check flags in this order. See comment above. */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
623 if (translate_to_ucs_2)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
624 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
625 int ucs = ichar_to_unicode(ch);
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
626 /* If UCS is less than zero or greater than 0xFFFF, set ucs2 to
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
627 REPLACMENT CHARACTER. */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
628 ucs = (ucs & ~0xFFFF) ? 0xFFFD : ucs;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
629
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
630 byte1 = ucs >> 8;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
631 byte2 = ucs;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
632 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
633 else if (need_ccl_conversion)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
634 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
635 char_converter.reg[0] = charset_leading_byte;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
636 char_converter.reg[1] = byte1;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
637 char_converter.reg[2] = byte2;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
638 ccl_driver (&char_converter, 0, 0, 0, 0, CCL_MODE_ENCODING);
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
639 byte1 = char_converter.reg[1];
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
640 byte2 = char_converter.reg[2];
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
641 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
642 else if (graphic == 0)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
643 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
644 byte1 &= 0x7F;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
645 byte2 &= 0x7F;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
646 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
647 else
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
648 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
649 byte1 |= 0x80;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
650 byte2 |= 0x80;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
651 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
652
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
653 *text_storage++ = (unsigned char)byte1;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
654
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
655 if (2 == dimension) *text_storage++ = (unsigned char)byte2;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
656 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
657
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
658 if (runs_so_far)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
659 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
660 run_storage[runs_so_far - 1].len =
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
661 text_storage - run_storage[runs_so_far - 1].ptr;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
662 /* Dimension retains the relevant value for the run before it. */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
663 if (2 == dimension)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
664 run_storage[runs_so_far - 1].len >>= 1;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
665 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
666
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
667 return runs_so_far;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
668 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
669 #endif
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
670
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
671 static int
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
672 separate_textual_runs (unsigned char *text_storage,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
673 struct textual_run *run_storage,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
674 const Ichar *str, Charcount len,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
675 struct face_cachel *cachel)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
676 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
677 #if defined(USE_XFT) && defined(MULE)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
678 return separate_textual_runs_xft_mule (text_storage, run_storage,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
679 str, len, cachel);
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
680 #endif
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
681 #if defined(USE_XFT) && !defined(MULE)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
682 return separate_textual_runs_xft_nomule (text_storage, run_storage,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
683 str, len, cachel);
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
684 #endif
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
685 #if !defined(USE_XFT) && defined(MULE)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
686 return separate_textual_runs_mule (text_storage, run_storage,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
687 str, len, cachel);
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
688 #endif
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
689 #if !defined(USE_XFT) && !defined(MULE)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
690 return separate_textual_runs_nomule (text_storage, run_storage,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
691 str, len, cachel);
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
692 #endif
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
693 }
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
694
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
695 /****************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
696 /* */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
697 /* Xlike output routines */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
698 /* */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
699 /****************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
700
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
701 static int
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
702 XLIKE_text_width_single_run (struct frame * USED_IF_XFT (f),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
703 struct face_cachel *cachel,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
704 struct textual_run *run)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
705 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
706 Lisp_Object font_inst = FACE_CACHEL_FONT (cachel, run->charset);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
707 Lisp_Font_Instance *fi = XFONT_INSTANCE (font_inst);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
708
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
709 if (!fi->proportional_p)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
710 return fi->width * run->len;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
711 #ifdef USE_XFT
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
712 else if (FONT_INSTANCE_X_XFTFONT (fi))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
713 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
714 static XGlyphInfo glyphinfo;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
715 struct device *d = XDEVICE (f->device);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
716 Display *dpy = DEVICE_X_DISPLAY (d);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
717
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
718 if (run->dimension == 2)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
719 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
720 XftTextExtents16 (dpy,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
721 FONT_INSTANCE_X_XFTFONT (fi),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
722 (XftChar16 *) run->ptr, run->len, &glyphinfo);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
723 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
724 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
725 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
726 XftTextExtents8 (dpy,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
727 FONT_INSTANCE_X_XFTFONT (fi),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
728 run->ptr, run->len, &glyphinfo);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
729 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
730
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
731 return glyphinfo.xOff;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
732 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
733 #endif
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
734 else if (FONT_INSTANCE_XLIKE_FONT (fi))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
735 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
736 if (run->dimension == 2)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
737 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
738 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
739 return XTextWidth16 (FONT_INSTANCE_X_FONT (fi),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
740 (XChar2b *) run->ptr, run->len);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
741 #else /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
742 /* stderr_out ("Measuring wide characters\n"); */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
743 return gdk_text_width_wc (FONT_INSTANCE_GTK_FONT (fi),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
744 (GdkWChar *) run->ptr, run->len);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
745 #endif /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
746 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
747 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
748 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
749 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
750 return XTextWidth (FONT_INSTANCE_X_FONT (fi),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
751 (char *) run->ptr, run->len);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
752 #else /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
753 return gdk_text_width (FONT_INSTANCE_GTK_FONT (fi),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
754 (char *) run->ptr, run->len);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
755 #endif /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
756 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
757 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
758 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
759 abort();
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
760 return 0; /* shut up GCC */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
761 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
762
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
763 /*
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
764 XLIKE_text_width
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
765
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
766 Given a string and a merged face, return the string's length in pixels
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
767 when displayed in the fonts associated with the face.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
768 */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
769
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
770 /* #### Break me out into a separate header */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
771 int XLIKE_text_width (struct frame *USED_IF_X (f), struct face_cachel *cachel,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
772 const Ichar *str, Charcount len);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
773 int
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
774 XLIKE_text_width (struct frame *USED_IF_X (f), struct face_cachel *cachel,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
775 const Ichar *str, Charcount len)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
776 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
777 /* !!#### Needs review */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
778 int width_so_far = 0;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
779 unsigned char *text_storage = (unsigned char *) ALLOCA (2 * len);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
780 struct textual_run *runs = alloca_array (struct textual_run, len);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
781 int nruns;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
782 int i;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
783
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
784 nruns = separate_textual_runs (text_storage, runs, str, len,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
785 cachel);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
786
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
787 for (i = 0; i < nruns; i++)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
788 width_so_far += XLIKE_text_width_single_run (f, cachel, runs + i);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
789
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
790 return width_so_far;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
791 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
792
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
793 /*****************************************************************************
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
794 XLIKE_divider_height
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
795
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
796 Return the height of the horizontal divider. This is a function because
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
797 divider_height is a device method.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
798
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
799 #### If we add etched horizontal divider lines this will have to get
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
800 smarter.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
801 ****************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
802 static int
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
803 XLIKE_divider_height (void)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
804 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
805 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
806 return 1;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
807 #else /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
808 return 2;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
809 #endif /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
810 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
811
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
812 /*****************************************************************************
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
813 XLIKE_eol_cursor_width
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
814
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
815 Return the width of the end-of-line cursor. This is a function
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
816 because eol_cursor_width is a device method.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
817 ****************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
818 static int
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
819 XLIKE_eol_cursor_width (void)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
820 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
821 return EOL_CURSOR_WIDTH;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
822 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
823
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
824 /*****************************************************************************
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
825 XLIKE_output_display_block
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
826
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
827 Given a display line, a block number for that start line, output all
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
828 runes between start and end in the specified display block.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
829 ****************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
830 static void
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
831 XLIKE_output_display_block (struct window *w, struct display_line *dl,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
832 int block, int start, int end, int start_pixpos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
833 int cursor_start, int cursor_width,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
834 int cursor_height)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
835 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
836 #ifndef USE_XFT
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
837 struct frame *f = XFRAME (w->frame);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
838 #endif
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
839 Ichar_dynarr *buf;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
840 Lisp_Object window;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
841
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
842 struct display_block *db = Dynarr_atp (dl->display_blocks, block);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
843 rune_dynarr *rba = db->runes;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
844 struct rune *rb;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
845
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
846 int elt = start;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
847 face_index findex;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
848 int xpos, width = 0;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
849 Lisp_Object charset = Qunbound; /* Qnil is a valid charset when
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
850 MULE is not defined */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
851
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
852 window = wrap_window (w);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
853 rb = Dynarr_atp (rba, start);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
854
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
855 if (!rb)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
856 /* Nothing to do so don't do anything. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
857 return;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
858
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
859 findex = rb->findex;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
860 xpos = rb->xpos;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
861 if (rb->type == RUNE_CHAR)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
862 charset = ichar_charset (rb->object.chr.ch);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
863
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
864 if (end < 0)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
865 end = Dynarr_length (rba);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
866 buf = Dynarr_new (Ichar);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
867
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
868 while (elt < end)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
869 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
870 rb = Dynarr_atp (rba, elt);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
871
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
872 if (rb->findex == findex && rb->type == RUNE_CHAR
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
873 && rb->object.chr.ch != '\n' && rb->cursor_type != CURSOR_ON
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
874 && EQ (charset, ichar_charset (rb->object.chr.ch)))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
875 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
876 Dynarr_add (buf, rb->object.chr.ch);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
877 width += rb->width;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
878 elt++;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
879 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
880 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
881 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
882 if (Dynarr_length (buf))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
883 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
884 XLIKE_output_string (w, dl, buf, xpos, 0, start_pixpos, width,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
885 findex, 0, cursor_start, cursor_width,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
886 cursor_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
887 xpos = rb->xpos;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
888 width = 0;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
889 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
890 Dynarr_reset (buf);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
891 width = 0;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
892
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
893 if (rb->type == RUNE_CHAR)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
894 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
895 findex = rb->findex;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
896 xpos = rb->xpos;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
897 charset = ichar_charset (rb->object.chr.ch);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
898
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
899 if (rb->cursor_type == CURSOR_ON)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
900 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
901 if (rb->object.chr.ch == '\n')
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
902 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
903 XLIKE_output_eol_cursor (w, dl, xpos, findex);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
904 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
905 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
906 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
907 Dynarr_add (buf, rb->object.chr.ch);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
908 XLIKE_output_string (w, dl, buf, xpos, 0, start_pixpos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
909 rb->width, findex, 1,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
910 cursor_start, cursor_width,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
911 cursor_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
912 Dynarr_reset (buf);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
913 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
914
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
915 xpos += rb->width;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
916 elt++;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
917 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
918 else if (rb->object.chr.ch == '\n')
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
919 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
920 /* Clear in case a cursor was formerly here. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
921 redisplay_clear_region (window, findex, xpos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
922 XLIKE_DISPLAY_LINE_YPOS (dl),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
923 rb->width,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
924 XLIKE_DISPLAY_LINE_HEIGHT (dl));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
925 elt++;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
926 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
927 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
928 else if (rb->type == RUNE_BLANK || rb->type == RUNE_HLINE)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
929 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
930 if (rb->type == RUNE_BLANK)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
931 XLIKE_output_blank (w, dl, rb, start_pixpos, cursor_start,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
932 cursor_width);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
933 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
934 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
935 /* #### Our flagging of when we need to redraw the
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
936 modeline shadows sucks. Since RUNE_HLINE is only used
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
937 by the modeline at the moment it is a good bet
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
938 that if it gets redrawn then we should also
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
939 redraw the shadows. This won't be true forever.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
940 We borrow the shadow_thickness_changed flag for
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
941 now. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
942 w->shadow_thickness_changed = 1;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
943 XLIKE_output_horizontal_line (w, dl, rb);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
944 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
945
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
946 elt++;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
947 if (elt < end)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
948 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
949 rb = Dynarr_atp (rba, elt);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
950
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
951 findex = rb->findex;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
952 xpos = rb->xpos;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
953 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
954 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
955 else if (rb->type == RUNE_DGLYPH)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
956 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
957 Lisp_Object instance;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
958 struct display_box dbox;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
959 struct display_glyph_area dga;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
960
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
961 redisplay_calculate_display_boxes (dl, rb->xpos, rb->object.dglyph.xoffset,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
962 rb->object.dglyph.yoffset, start_pixpos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
963 rb->width, &dbox, &dga);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
964
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
965 window = wrap_window (w);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
966 instance = glyph_image_instance (rb->object.dglyph.glyph,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
967 window, ERROR_ME_DEBUG_WARN, 1);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
968 findex = rb->findex;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
969
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
970 if (IMAGE_INSTANCEP (instance))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
971 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
972 switch (XIMAGE_INSTANCE_TYPE (instance))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
973 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
974 case IMAGE_TEXT:
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
975 #ifdef THIS_IS_GTK
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
976 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
977 /* !!#### Examine for Mule-izing */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
978 /* #### This is way losing. See the comment in
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
979 add_glyph_rune(). */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
980 Lisp_Object string =
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
981 XIMAGE_INSTANCE_TEXT_STRING (instance);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
982 convert_ibyte_string_into_ichar_dynarr
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
983 (XSTRING_DATA (string), XSTRING_LENGTH (string),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
984 buf);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
985
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
986 gtk_output_string (w, dl, buf, xpos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
987 rb->object.dglyph.xoffset,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
988 start_pixpos, -1, findex,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
989 (rb->cursor_type == CURSOR_ON),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
990 cursor_start, cursor_width,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
991 cursor_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
992 Dynarr_reset (buf);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
993 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
994 break;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
995 #else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
996 ABORT ();
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
997 #endif /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
998 case IMAGE_MONO_PIXMAP:
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
999 case IMAGE_COLOR_PIXMAP:
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1000 redisplay_output_pixmap (w, instance, &dbox, &dga,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1001 findex, cursor_start,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1002 cursor_width,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1003 cursor_height, 0);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1004 break;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1005
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1006 case IMAGE_WIDGET:
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1007 if (EQ (XIMAGE_INSTANCE_WIDGET_TYPE (instance),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1008 Qlayout))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1009 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1010 redisplay_output_layout (window, instance, &dbox,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1011 &dga, findex,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1012 cursor_start, cursor_width,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1013 cursor_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1014 break;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1015 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1016
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1017 case IMAGE_SUBWINDOW:
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1018 redisplay_output_subwindow (w, instance, &dbox, &dga,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1019 findex, cursor_start,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1020 cursor_width, cursor_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1021 break;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1022
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1023 case IMAGE_NOTHING:
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1024 /* nothing is as nothing does */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1025 break;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1026
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1027 case IMAGE_POINTER:
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1028 default:
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1029 ABORT ();
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1030 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1031 IMAGE_INSTANCE_OPTIMIZE_OUTPUT
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1032 (XIMAGE_INSTANCE (instance)) = 0;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1033 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1034
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1035 xpos += rb->width;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1036 elt++;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1037 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1038 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1039 ABORT ();
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1040 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1041 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1042
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1043 if (Dynarr_length (buf))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1044 XLIKE_output_string (w, dl, buf, xpos, 0, start_pixpos, width, findex,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1045 0, cursor_start, cursor_width, cursor_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1046
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1047 if (dl->modeline
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1048 && !EQ (Qzero, w->modeline_shadow_thickness)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1049 #ifndef USE_XFT
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1050 /* This optimization doesn't work right with some Xft fonts, which
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1051 leave antialiasing turds at the boundary. I don't know if this
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1052 is an Xft bug or not, but I think it is. See x_output_string. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1053 && (f->clear
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1054 || f->windows_structure_changed
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1055 || w->shadow_thickness_changed)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1056 #endif
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1057 )
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1058 bevel_modeline (w, dl);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1059
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1060 Dynarr_free (buf);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1061 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1062
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1063 /*****************************************************************************
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1064 XLIKE_get_gc
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1065
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1066 Given a number of parameters return a GC with those properties.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1067 ****************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1068 static XLIKE_GC
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1069 XLIKE_get_gc (struct device *d, Lisp_Object font, Lisp_Object fg,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1070 Lisp_Object bg, Lisp_Object bg_pmap, Lisp_Object lwidth)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1071 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1072 XLIKE_GCVALUES gcv;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1073 unsigned long mask;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1074
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1075 memset (&gcv, ~0, sizeof (gcv));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1076 gcv.graphics_exposures = XLIKE_FALSE;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1077 /* Make absolutely sure that we don't pick up a clipping region in
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1078 the GC returned by this function. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1079 gcv.clip_mask = XLIKE_NONE;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1080 gcv.clip_x_origin = 0;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1081 gcv.clip_y_origin = 0;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1082 gcv.XLIKE_FILL_MEMBER = XLIKE_FILL_SOLID;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1083 mask = XLIKE_GC_EXPOSURES | XLIKE_GC_CLIP_MASK | XLIKE_GC_CLIP_X_ORIGIN | XLIKE_GC_CLIP_Y_ORIGIN;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1084 mask |= XLIKE_GC_FILL;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1085
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1086 if (!NILP (font)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1087 #ifdef USE_XFT
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1088 /* Only set the font if it's a core font */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1089 /* the renderfont will be set elsewhere (not part of gc) */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1090 && !FONT_INSTANCE_X_XFTFONT (XFONT_INSTANCE (font))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1091 #endif
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1092 )
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1093 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1094 gcv.font =
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1095 XLIKE_FONT_NUM (FONT_INSTANCE_XLIKE_FONT (XFONT_INSTANCE (font)));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1096 mask |= XLIKE_GC_FONT;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1097 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1098
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1099 /* evil kludge! */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1100 if (!NILP (fg) && !COLOR_INSTANCEP (fg) && !INTP (fg))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1101 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1102 /* #### I fixed one case where this was getting hit. It was a
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1103 bad macro expansion (compiler bug). */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1104 stderr_out ("Help! x_get_gc got a bogus fg value! fg = ");
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1105 debug_print (fg);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1106 fg = Qnil;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1107 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1108
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1109 if (!NILP (fg))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1110 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1111 if (COLOR_INSTANCEP (fg))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1112 XLIKE_SET_PIXCOLOR_COPY
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1113 (gcv.foreground,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1114 XLIKE_COLOR_TO_PIXCOLOR (XCOLOR_INSTANCE_XLIKE_COLOR (fg)));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1115 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1116 XLIKE_SET_PIXCOLOR_NUM (gcv.foreground, XINT (fg));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1117 mask |= XLIKE_GC_FOREGROUND;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1118 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1119
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1120 if (!NILP (bg))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1121 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1122 if (COLOR_INSTANCEP (bg))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1123 XLIKE_SET_PIXCOLOR_COPY
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1124 (gcv.background,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1125 XLIKE_COLOR_TO_PIXCOLOR (XCOLOR_INSTANCE_XLIKE_COLOR (bg)));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1126 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1127 XLIKE_SET_PIXCOLOR_NUM (gcv.background, XINT (bg));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1128 mask |= XLIKE_GC_BACKGROUND;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1129 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1130
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1131 /* This special case comes from a request to draw text with a face which has
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1132 the dim property. We'll use a stippled foreground GC. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1133 if (EQ (bg_pmap, Qdim))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1134 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1135 assert (DEVICE_XLIKE_GRAY_PIXMAP (d) != XLIKE_NONE);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1136
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1137 gcv.XLIKE_FILL_MEMBER = XLIKE_FILL_STIPPLED;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1138 gcv.stipple = DEVICE_XLIKE_GRAY_PIXMAP (d);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1139 mask |= (XLIKE_GC_FILL | XLIKE_GC_STIPPLE);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1140 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1141 else if (IMAGE_INSTANCEP (bg_pmap)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1142 && IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (bg_pmap)))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1143 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1144 if (XIMAGE_INSTANCE_PIXMAP_DEPTH (bg_pmap) == 0)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1145 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1146 gcv.XLIKE_FILL_MEMBER = XLIKE_FILL_OPAQUE_STIPPLED;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1147 gcv.stipple = XIMAGE_INSTANCE_XLIKE_PIXMAP (bg_pmap);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1148 mask |= (XLIKE_GC_STIPPLE | XLIKE_GC_FILL);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1149 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1150 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1151 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1152 gcv.XLIKE_FILL_MEMBER = XLIKE_FILL_TILED;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1153 gcv.tile = XIMAGE_INSTANCE_XLIKE_PIXMAP (bg_pmap);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1154 mask |= (XLIKE_GC_TILE | XLIKE_GC_FILL);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1155 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1156 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1157
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1158 if (!NILP (lwidth))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1159 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1160 gcv.line_width = XINT (lwidth);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1161 mask |= XLIKE_GC_LINE_WIDTH;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1162 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1163
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1164 #if 0
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1165 debug_out ("\nx_get_gc: calling gc_cache_lookup\n");
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1166 #endif
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1167 return gc_cache_lookup (DEVICE_XLIKE_GC_CACHE (d), &gcv, mask);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1168 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1169
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1170 /*****************************************************************************
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1171 XLIKE_output_string
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1172
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1173 Given a string and a starting position, output that string in the
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1174 given face. If cursor is true, draw a cursor around the string.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1175 Correctly handles multiple charsets in the string.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1176
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1177 The meaning of the parameters is something like this:
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1178
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1179 W Window that the text is to be displayed in.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1180 DL Display line that this text is on. The values in the
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1181 structure are used to determine the vertical position and
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1182 clipping range of the text.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1183 BUF Dynamic array of Ichars specifying what is actually to be
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1184 drawn.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1185 XPOS X position in pixels where the text should start being drawn.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1186 XOFFSET Number of pixels to be chopped off the left side of the
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1187 text. The effect is as if the text were shifted to the
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1188 left this many pixels and clipped at XPOS.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1189 CLIP_START Clip everything left of this X position.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1190 WIDTH Clip everything right of XPOS + WIDTH.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1191 FINDEX Index for the face cache element describing how to display
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1192 the text.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1193 CURSOR #### I don't understand this. There's something
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1194 strange and overcomplexified with this variable.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1195 Chuck, explain please?
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1196 CURSOR_START Starting X position of cursor.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1197 CURSOR_WIDTH Width of cursor in pixels.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1198 CURSOR_HEIGHT Height of cursor in pixels.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1199
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1200 Starting Y position of cursor is the top of the text line.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1201 The cursor is drawn sometimes whether or not CURSOR is set. ???
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1202 ****************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1203 #ifdef THIS_IS_GTK
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1204 static
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1205 void gdk_draw_text_image (GdkDrawable *drawable,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1206 GdkFont *font,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1207 GdkGC *gc,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1208 gint x,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1209 gint y,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1210 const gchar *text,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1211 gint text_length);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1212
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1213 #endif /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1214 void
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1215 XLIKE_output_string (struct window *w, struct display_line *dl,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1216 Ichar_dynarr *buf, int xpos, int xoffset, int clip_start,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1217 int width, face_index findex, int cursor,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1218 int cursor_start, int cursor_width, int cursor_height)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1219 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1220 /* General variables */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1221 struct frame *f = XFRAME (w->frame);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1222 struct device *d = XDEVICE (f->device);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1223 XLIKE_DISPLAY dpy = GET_XLIKE_DISPLAY (d);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1224 XLIKE_WINDOW x_win = GET_XLIKE_WINDOW (f);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1225 Lisp_Object window = wrap_window (w);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1226
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1227 int clip_end;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1228
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1229 /* Cursor-related variables */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1230 int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1231 int cursor_clip;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1232 Lisp_Object bar_cursor_value = symbol_value_in_buffer (Qbar_cursor,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1233 WINDOW_BUFFER (w));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1234 struct face_cachel *cursor_cachel = 0;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1235
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1236 /* Text-related variables */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1237 Lisp_Object bg_pmap;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1238 XLIKE_GC bgc, gc;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1239 int height = XLIKE_DISPLAY_LINE_HEIGHT (dl);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1240 int ypos = XLIKE_DISPLAY_LINE_YPOS (dl);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1241 int len = Dynarr_length (buf);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1242 unsigned char *text_storage = (unsigned char *) ALLOCA (2 * len);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1243 struct textual_run *runs = alloca_array (struct textual_run, len);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1244 int nruns;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1245 int i;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1246 struct face_cachel *cachel = WINDOW_FACE_CACHEL (w, findex);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1247
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1248 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1249 int use_x_font = 1; /* #### bogus!!
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1250 The logic of this function needs review! */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1251 #endif
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1252 #ifdef USE_XFT
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1253 Colormap cmap = DEVICE_X_COLORMAP (d);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1254 Visual *visual = DEVICE_X_VISUAL (d);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1255 static XftColor fg, bg;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1256 XftDraw *xftDraw;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1257
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1258 /* Lazily initialize frame's xftDraw member. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1259 if (!FRAME_X_XFTDRAW (f)) {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1260 FRAME_X_XFTDRAW (f) = XftDrawCreate (dpy, x_win, visual, cmap);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1261 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1262 xftDraw = FRAME_X_XFTDRAW (f);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1263
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1264 /* #### This will probably cause asserts when passed a Lisp integer for a
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1265 color. See ca. line 759 this file.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1266 #### Maybe xft_convert_color should take an XColor, not a pixel. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1267 #define XFT_FROB_LISP_COLOR(color, dim) \
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1268 xft_convert_color (dpy, cmap, visual, \
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1269 COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (color)).pixel, \
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1270 (dim))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1271 #endif /* USE_XFT */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1272
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1273 if (width < 0)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1274 width = XLIKE_text_width (f, cachel, Dynarr_atp (buf, 0),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1275 Dynarr_length (buf));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1276
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1277 /* Regularize the variables passed in. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1278
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1279 if (clip_start < xpos)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1280 clip_start = xpos;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1281 clip_end = xpos + width;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1282 if (clip_start >= clip_end)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1283 /* It's all clipped out. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1284 return;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1285
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1286 xpos -= xoffset;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1287
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1288 /* make sure the area we are about to display is subwindow free. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1289 redisplay_unmap_subwindows_maybe (f, clip_start, ypos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1290 clip_end - clip_start, height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1291
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1292 cursor_clip = (cursor_start >= clip_start &&
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1293 cursor_start < clip_end);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1294
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1295 /* This cursor code is really a mess. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1296 if (!NILP (w->text_cursor_visible_p)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1297 && (cursor
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1298 || cursor_clip
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1299 || (cursor_width
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1300 && (cursor_start + cursor_width >= clip_start)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1301 && !NILP (bar_cursor_value))))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1302 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1303 /* These have to be in separate statements in order to avoid a
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1304 compiler bug. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1305 face_index sucks = get_builtin_face_cache_index (w, Vtext_cursor_face);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1306 cursor_cachel = WINDOW_FACE_CACHEL (w, sucks);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1307
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1308 /* We have to reset this since any call to WINDOW_FACE_CACHEL
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1309 may cause the cache to resize and any pointers to it to
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1310 become invalid. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1311 cachel = WINDOW_FACE_CACHEL (w, findex);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1312 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1313
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1314 #ifdef HAVE_XIM
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1315 if (cursor && focus && (cursor_start == clip_start) && cursor_height)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1316 XIM_SetSpotLocation (f, xpos - 2, dl->ypos + dl->descent - 2);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1317 #endif /* HAVE_XIM */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1318
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1319 bg_pmap = cachel->background_pixmap;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1320 if (!IMAGE_INSTANCEP (bg_pmap)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1321 || !IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (bg_pmap)))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1322 bg_pmap = Qnil;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1323
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1324 if ((cursor && focus && NILP (bar_cursor_value)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1325 && !NILP (w->text_cursor_visible_p)) || NILP (bg_pmap))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1326 bgc = 0;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1327 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1328 bgc = XLIKE_get_gc (d, Qnil, cachel->foreground, cachel->background,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1329 bg_pmap, Qnil);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1330
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1331 if (bgc)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1332 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1333 XLIKE_FILL_RECTANGLE (dpy, x_win, bgc, clip_start,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1334 ypos, clip_end - clip_start,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1335 height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1336 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1337
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1338 nruns = separate_textual_runs (text_storage, runs, Dynarr_atp (buf, 0),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1339 Dynarr_length (buf), cachel);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1340
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1341 for (i = 0; i < nruns; i++)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1342 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1343 Lisp_Object font = FACE_CACHEL_FONT (cachel, runs[i].charset);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1344 Lisp_Font_Instance *fi = XFONT_INSTANCE (font);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1345 int this_width;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1346 int need_clipping;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1347
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1348 if (EQ (font, Vthe_null_font_instance))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1349 continue;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1350
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1351 this_width = XLIKE_text_width_single_run (f, cachel, runs + i);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1352 need_clipping = (dl->clip || clip_start > xpos ||
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1353 clip_end < xpos + this_width);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1354
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1355 /* XDrawImageString only clears the area equal to the height of
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1356 the given font. It is possible that a font is being displayed
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1357 on a line taller than it is, so this would cause us to fail to
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1358 clear some areas. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1359 if ((int) fi->height < (int) (height + dl->clip +
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1360 XLIKE_DISPLAY_LINE_TOP_CLIP (dl)))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1361 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1362 int clear_start = max (xpos, clip_start);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1363 int clear_end = min (xpos + this_width, clip_end);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1364
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1365 if (cursor)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1366 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1367 int ypos1_line, ypos1_string, ypos2_line, ypos2_string;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1368
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1369 ypos1_string = dl->ypos - fi->ascent;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1370 ypos2_string = dl->ypos + fi->descent;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1371 ypos1_line = ypos;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1372 ypos2_line = ypos1_line + height;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1373
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1374 /* Make sure we don't clear below the real bottom of the
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1375 line. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1376 if (ypos1_string > ypos2_line)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1377 ypos1_string = ypos2_line;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1378 if (ypos2_string > ypos2_line)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1379 ypos2_string = ypos2_line;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1380
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1381 if (ypos1_line < ypos1_string)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1382 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1383 redisplay_clear_region (window, findex, clear_start, ypos1_line,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1384 clear_end - clear_start,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1385 ypos1_string - ypos1_line);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1386 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1387
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1388 if (ypos2_line > ypos2_string)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1389 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1390 redisplay_clear_region (window, findex, clear_start, ypos2_string,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1391 clear_end - clear_start,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1392 ypos2_line - ypos2_string);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1393 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1394 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1395 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1396 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1397 redisplay_clear_region (window, findex, clear_start,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1398 ypos, clear_end - clear_start,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1399 height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1400 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1401 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1402
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1403 if (cursor && cursor_cachel && focus && NILP (bar_cursor_value))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1404 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1405 #ifdef USE_XFT
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1406 fg = XFT_FROB_LISP_COLOR (cursor_cachel->foreground, 0);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1407 bg = XFT_FROB_LISP_COLOR (cursor_cachel->background, 0);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1408 #endif
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1409 gc = XLIKE_get_gc (d, font, cursor_cachel->foreground,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1410 cursor_cachel->background, Qnil, Qnil);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1411 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1412 else if (cachel->dim)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1413 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1414 /* Ensure the gray bitmap exists */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1415 if (DEVICE_XLIKE_GRAY_PIXMAP (d) == XLIKE_NONE)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1416 DEVICE_XLIKE_GRAY_PIXMAP (d) =
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1417 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1418 XCreateBitmapFromData (dpy, x_win, (char *)gray_bits,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1419 gray_width, gray_height)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1420 #else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1421 /* #### FIXME! Implement me! */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1422 XLIKE_NONE
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1423 #endif
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1424 ;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1425
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1426 /* Request a GC with the gray stipple pixmap to draw dimmed text */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1427 #ifdef USE_XFT
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1428 fg = XFT_FROB_LISP_COLOR (cachel->foreground, 1);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1429 bg = XFT_FROB_LISP_COLOR (cachel->background, 0);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1430 #endif
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1431 gc = XLIKE_get_gc (d, font, cachel->foreground, cachel->background,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1432 Qdim, Qnil);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1433 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1434 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1435 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1436 #ifdef USE_XFT
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1437 fg = XFT_FROB_LISP_COLOR (cachel->foreground, 0);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1438 bg = XFT_FROB_LISP_COLOR (cachel->background, 0);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1439 #endif
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1440 gc = XLIKE_get_gc (d, font, cachel->foreground, cachel->background,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1441 Qnil, Qnil);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1442 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1443 #ifdef USE_XFT
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1444 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1445 XftFont *rf = FONT_INSTANCE_X_XFTFONT (fi);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1446
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1447 if (rf)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1448 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1449 use_x_font = 0;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1450 if (need_clipping)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1451 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1452 Region clip_reg = XCreateRegion();
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1453 XRectangle clip_box = { clip_start, ypos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1454 clip_end - clip_start, height };
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1455
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1456 XUnionRectWithRegion (&clip_box, clip_reg, clip_reg);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1457 XftDrawSetClip(xftDraw, clip_reg);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1458 XDestroyRegion(clip_reg);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1459 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1460
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1461 if (!bgc)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1462 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1463 /* #### Neither rect_height nor XftTextExtents as computed
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1464 below handles the vertical space taken up by antialiasing,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1465 which for some fonts (eg, Bitstream Vera Sans Mono-16 on
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1466 my Mac PowerBook G4) leaves behind orphaned dots on
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1467 insertion or deletion earlier in the line, especially in
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1468 the case of the underscore character.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1469 Interestingly, insertion or deletion of a single character
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1470 immediately after a refresh does not leave any droppings,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1471 but any further insertions or deletions do.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1472 While adding a pixel to rect_height (mostly) takes care of
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1473 this, it trashes aggressively laid-out elements like the
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1474 modeline (overwriting part of the bevel).
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1475 OK, unconditionally redraw the bevel, and increment
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1476 rect_height by 1. See x_output_display_block. -- sjt */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1477 struct textual_run *run = &runs[i];
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1478 int rect_width = x_text_width_single_run (f, cachel, run);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1479 #ifndef USE_XFTTEXTENTS_TO_AVOID_FONT_DROPPINGS
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1480 int rect_height = FONT_INSTANCE_ASCENT(fi)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1481 + FONT_INSTANCE_DESCENT(fi) + 1;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1482 #else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1483 int rect_height = FONT_INSTANCE_ASCENT(fi)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1484 + FONT_INSTANCE_DESCENT(fi);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1485 XGlyphInfo gi;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1486 if (run->dimension == 2) {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1487 XftTextExtents16 (dpy,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1488 FONT_INSTANCE_X_XFTFONT(fi),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1489 (XftChar16 *) run->ptr, run->len, &gi);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1490 } else {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1491 XftTextExtents8 (dpy,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1492 FONT_INSTANCE_X_XFTFONT(fi),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1493 run->ptr, run->len, &gi);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1494 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1495 rect_height = rect_height > gi.height
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1496 ? rect_height : gi.height;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1497 #endif
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1498
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1499 XftDrawRect (xftDraw, &bg,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1500 xpos, ypos, rect_width, rect_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1501 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1502
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1503 if (runs[i].dimension == 1)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1504 XftDrawString8 (xftDraw, &fg, rf, xpos, dl->ypos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1505 runs[i].ptr, runs[i].len);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1506 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1507 XftDrawString16 (xftDraw, &fg, rf, xpos, dl->ypos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1508 (XftChar16 *) runs[i].ptr, runs[i].len);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1509 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1510 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1511 #endif /* USE_XFT */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1512
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1513 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1514 if (use_x_font)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1515 #endif
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1516 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1517 if (need_clipping)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1518 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1519 XLIKE_RECTANGLE clip_box;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1520
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1521 clip_box.x = 0;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1522 clip_box.y = 0;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1523 clip_box.width = clip_end - clip_start;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1524 clip_box.height = height;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1525
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1526 XLIKE_SET_CLIP_RECTANGLE (dpy, gc, clip_start, ypos, &clip_box);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1527 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1528
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1529 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1530 if (runs[i].dimension == 1)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1531 (bgc ? XDrawString : XDrawImageString)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1532 (dpy, x_win, gc, xpos, dl->ypos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1533 (char *) runs[i].ptr, runs[i].len);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1534 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1535 (bgc ? XDrawString16 : XDrawImageString16)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1536 (dpy, x_win, gc, xpos, dl->ypos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1537 (XChar2b *) runs[i].ptr, runs[i].len);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1538 #else /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1539
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1540 /* The X specific called different functions (XDraw*String
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1541 vs. XDraw*String16), but apparently gdk_draw_text takes care
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1542 of that for us.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1543
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1544 BUT, gdk_draw_text also does too much, by dividing the length
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1545 by 2. So we fake them out my multiplying the length by the
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1546 dimension of the text. This will do the right thing for
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1547 single-dimension runs as well of course.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1548 */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1549 (bgc ? gdk_draw_text : gdk_draw_text_image)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1550 (GDK_DRAWABLE (x_win), FONT_INSTANCE_GTK_FONT (fi), gc, xpos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1551 dl->ypos, (char *) runs[i].ptr, runs[i].len * runs[i].dimension);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1552 #endif /* (not) THIS_IS_X */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1553 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1554
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1555 /* We draw underlines in the same color as the text. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1556 if (cachel->underline)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1557 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1558 int upos, uthick;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1559 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1560 unsigned long upos_ext, uthick_ext;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1561 XFontStruct *fs =
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1562 use_x_font ? FONT_INSTANCE_X_FONT (XFONT_INSTANCE (font)) : 0;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1563 /* #### the logic of the next two may be suboptimal: we may want
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1564 to use the POSITION and/or THICKNESS information with Xft */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1565 if (fs && XGetFontProperty (fs, XA_UNDERLINE_POSITION, &upos_ext))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1566 upos = (int) upos_ext;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1567 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1568 #else /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1569 /* Cannot get at font properties in Gtk, so we resort to
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1570 guessing */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1571 #endif /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1572 upos = dl->descent / 2;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1573 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1574 if (fs && XGetFontProperty (fs, XA_UNDERLINE_THICKNESS, &uthick_ext))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1575 uthick = (int) uthick_ext;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1576 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1577 #endif /* THIS_IS_X */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1578 uthick = 1;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1579 if (dl->ypos + upos < dl->ypos + dl->descent - dl->clip)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1580 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1581 if (dl->ypos + upos + uthick > dl->ypos + dl->descent - dl->clip)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1582 uthick = dl->descent - dl->clip - upos;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1583
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1584 if (uthick == 1)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1585 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1586 XLIKE_DRAW_LINE (dpy, x_win, gc, xpos, dl->ypos + upos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1587 xpos + this_width, dl->ypos + upos);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1588 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1589 else if (uthick > 1)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1590 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1591 XLIKE_FILL_RECTANGLE (dpy, x_win, gc, xpos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1592 dl->ypos + upos, this_width, uthick);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1593 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1594 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1595 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1596
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1597 if (cachel->strikethru)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1598 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1599 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1600 int ascent, descent, upos, uthick;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1601 unsigned long ascent_ext, descent_ext, uthick_ext;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1602 XFontStruct *fs = FONT_INSTANCE_X_FONT (fi);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1603 #else /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1604 gint ascent, descent, upos, uthick;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1605 GdkFont *gfont = FONT_INSTANCE_GTK_FONT (fi);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1606 #endif /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1607
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1608 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1609 if (!use_x_font)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1610 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1611 ascent = dl->ascent;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1612 descent = dl->descent;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1613 uthick = 1;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1614 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1615 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1616 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1617 if (!XGetFontProperty (fs, XA_STRIKEOUT_ASCENT, &ascent_ext))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1618 ascent = fs->ascent;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1619 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1620 ascent = (int) ascent_ext;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1621 if (!XGetFontProperty (fs, XA_STRIKEOUT_DESCENT, &descent_ext))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1622 descent = fs->descent;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1623 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1624 descent = (int) descent_ext;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1625 if (!XGetFontProperty (fs, XA_UNDERLINE_THICKNESS, &uthick_ext))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1626 uthick = 1;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1627 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1628 uthick = (int) uthick_ext;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1629 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1630 #else /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1631 /* Cannot get at font properties in Gtk, so we resort to
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1632 guessing */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1633
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1634 ascent = gfont->ascent;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1635 descent = gfont->descent;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1636 uthick = 1;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1637 #endif /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1638
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1639 upos = ascent - ((ascent + descent) / 2) + 1;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1640
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1641 /* Generally, upos will be positive (above the baseline),so
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1642 subtract */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1643 if (dl->ypos - upos < dl->ypos + dl->descent - dl->clip)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1644 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1645 if (dl->ypos - upos + uthick > dl->ypos + dl->descent - dl->clip)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1646 uthick = dl->descent - dl->clip + upos;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1647
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1648 if (uthick == 1)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1649 XLIKE_DRAW_LINE (dpy, x_win, gc, xpos, dl->ypos - upos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1650 xpos + this_width, dl->ypos - upos);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1651 else if (uthick > 1)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1652 XLIKE_FILL_RECTANGLE (dpy, x_win, gc, xpos, dl->ypos + upos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1653 this_width, uthick);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1654 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1655 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1656
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1657 /* Restore the GC */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1658 if (need_clipping)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1659 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1660 #ifdef USE_XFT
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1661 if (!use_x_font)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1662 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1663 XftDrawSetClip (xftDraw, 0);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1664 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1665 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1666 #endif
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1667 XLIKE_CLEAR_CLIP_MASK (dpy, gc);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1668 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1669
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1670 /* If we are actually superimposing the cursor then redraw with just
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1671 the appropriate section highlighted. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1672 if (cursor_clip && !cursor && focus && cursor_cachel)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1673 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1674 #ifdef USE_XFT
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1675 if (!use_x_font) /* Xft */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1676 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1677 XftFont *rf = FONT_INSTANCE_X_XFTFONT (fi);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1678
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1679 { /* set up clipping */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1680 Region clip_reg = XCreateRegion();
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1681 XRectangle clip_box = { cursor_start, ypos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1682 cursor_width, height };
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1683
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1684 XUnionRectWithRegion (&clip_box, clip_reg, clip_reg);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1685 XftDrawSetClip(xftDraw, clip_reg);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1686 XDestroyRegion(clip_reg);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1687 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1688 { /* draw background rectangle & draw text */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1689 int rect_height = FONT_INSTANCE_ASCENT(fi)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1690 + FONT_INSTANCE_DESCENT(fi);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1691 int rect_width = x_text_width_single_run(f, cachel, &runs[i]);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1692 XftColor xft_color;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1693
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1694 xft_color = XFT_FROB_LISP_COLOR (cursor_cachel->background, 0);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1695 XftDrawRect (xftDraw, &xft_color,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1696 xpos, ypos, rect_width, rect_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1697
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1698 xft_color = XFT_FROB_LISP_COLOR (cursor_cachel->foreground, 0);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1699 if (runs[i].dimension == 1)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1700 XftDrawString8 (xftDraw, &xft_color, rf, xpos, dl->ypos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1701 runs[i].ptr, runs[i].len);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1702 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1703 XftDrawString16 (xftDraw, &xft_color, rf, xpos, dl->ypos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1704 (XftChar16 *) runs[i].ptr, runs[i].len);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1705 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1706
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1707 XftDrawSetClip(xftDraw, 0);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1708 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1709 else /* core font, not Xft */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1710 #endif /* USE_XFT */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1711 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1712 XLIKE_RECTANGLE clip_box;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1713 XLIKE_GC cgc;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1714 cgc = XLIKE_get_gc (d, font, cursor_cachel->foreground,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1715 cursor_cachel->background, Qnil, Qnil);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1716
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1717 clip_box.x = 0;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1718 clip_box.y = 0;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1719 clip_box.width = cursor_width;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1720 clip_box.height = height;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1721
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1722 XLIKE_SET_CLIP_RECTANGLE (dpy, cgc, cursor_start, ypos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1723 &clip_box);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1724 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1725 if (runs[i].dimension == 1)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1726 XDrawImageString (dpy, x_win, cgc, xpos, dl->ypos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1727 (char *) runs[i].ptr, runs[i].len);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1728 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1729 XDrawImageString16 (dpy, x_win, cgc, xpos, dl->ypos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1730 (XChar2b *) runs[i].ptr, runs[i].len);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1731 #else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1732 /* The X specific called different functions (XDraw*String
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1733 vs. XDraw*String16), but apparently gdk_draw_text takes care
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1734 of that for us.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1735
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1736 BUT, gdk_draw_text also does too much, by dividing the
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1737 length by 2. So we fake them out my multiplying the
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1738 length by the dimension of the text. This will do the
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1739 right thing for single-dimension runs as well of course.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1740 */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1741 gdk_draw_text_image (GDK_DRAWABLE (x_win),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1742 FONT_INSTANCE_GTK_FONT (fi), cgc, xpos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1743 dl->ypos, (char *) runs[i].ptr,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1744 runs[i].len * runs[i].dimension);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1745 #endif /* (not) THIS_IS_X */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1746
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1747 XLIKE_CLEAR_CLIP_MASK (dpy, cgc);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1748 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1749 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1750
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1751 xpos += this_width;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1752 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1753
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1754 /* Draw the non-focus box or bar-cursor as needed. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1755 /* Can't this logic be simplified? */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1756 if (cursor_cachel
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1757 && ((cursor && !focus && NILP (bar_cursor_value))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1758 || (cursor_width
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1759 && (cursor_start + cursor_width >= clip_start)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1760 && !NILP (bar_cursor_value))))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1761 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1762 int tmp_height, tmp_y;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1763 int bar_width = EQ (bar_cursor_value, Qt) ? 1 : 2;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1764 int need_clipping = (cursor_start < clip_start
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1765 || clip_end < cursor_start + cursor_width);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1766
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1767 /* #### This value is correct (as far as I know) because
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1768 all of the times we need to draw this cursor, we will
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1769 be called with exactly one character, so we know we
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1770 can always use runs[0].
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1771
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1772 This is bogus as all hell, however. The cursor handling in
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1773 this function is way bogus and desperately needs to be
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1774 cleaned up. (In particular, the drawing of the cursor should
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1775 really really be separated out of this function. This may be
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1776 a bit tricky now because this function itself does way too
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1777 much stuff, a lot of which needs to be moved into
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1778 redisplay.c.) This is the only way to be able to easily add
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1779 new cursor types or (e.g.) make the bar cursor be able to
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1780 span two characters instead of overlaying just one. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1781 int bogusly_obtained_ascent_value =
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1782 XFONT_INSTANCE (FACE_CACHEL_FONT (cachel, runs[0].charset))->ascent;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1783
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1784 if (!NILP (bar_cursor_value))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1785 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1786 gc = XLIKE_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1787 make_int (bar_width));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1788 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1789 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1790 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1791 gc = XLIKE_get_gc (d, Qnil, cursor_cachel->background,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1792 Qnil, Qnil, Qnil);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1793 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1794
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1795 tmp_y = dl->ypos - bogusly_obtained_ascent_value;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1796 tmp_height = cursor_height;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1797 if (tmp_y + tmp_height > (int) (ypos + height))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1798 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1799 tmp_y = ypos + height - tmp_height;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1800 if (tmp_y < (int) ypos)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1801 tmp_y = ypos;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1802 tmp_height = ypos + height - tmp_y;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1803 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1804
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1805 if (need_clipping)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1806 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1807 XLIKE_RECTANGLE clip_box;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1808 clip_box.x = 0;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1809 clip_box.y = 0;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1810 clip_box.width = clip_end - clip_start;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1811 clip_box.height = tmp_height;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1812 XLIKE_SET_CLIP_RECTANGLE (dpy, gc, clip_start, tmp_y, &clip_box);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1813 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1814
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1815 if (!focus && NILP (bar_cursor_value))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1816 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1817 XLIKE_DRAW_RECTANGLE (dpy, x_win, gc, cursor_start, tmp_y,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1818 cursor_width - 1, tmp_height - 1);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1819 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1820 else if (focus && !NILP (bar_cursor_value))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1821 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1822 XLIKE_DRAW_LINE (dpy, x_win, gc, cursor_start + bar_width - 1, tmp_y,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1823 cursor_start + bar_width - 1,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1824 tmp_y + tmp_height - 1);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1825 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1826
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1827 /* Restore the GC */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1828 if (need_clipping)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1829 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1830 XLIKE_CLEAR_CLIP_MASK (dpy, gc);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1831 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1832 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1833
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1834 #ifdef USE_XFT
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1835 #undef XFT_FROB_LISP_COLOR
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1836 #endif
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1837 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1838
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1839 #ifdef THIS_IS_GTK
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1840 static void
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1841 our_draw_bitmap (GdkDrawable *drawable,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1842 GdkGC *gc,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1843 GdkPixmap *src,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1844 gint xsrc,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1845 gint ysrc,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1846 gint xdest,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1847 gint ydest,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1848 gint width,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1849 gint height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1850 #endif /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1851
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1852
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1853 void
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1854 XLIKE_OUTPUT_XLIKE_PIXMAP (struct frame *f, Lisp_Image_Instance *p, int x,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1855 int y, int xoffset, int yoffset,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1856 int width, int height,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1857 XLIKE_PIXCOLOR fg, XLIKE_PIXCOLOR bg,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1858 XLIKE_GC override_gc)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1859 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1860 struct device *d = XDEVICE (f->device);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1861 XLIKE_DISPLAY dpy = GET_XLIKE_DISPLAY (d);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1862 XLIKE_WINDOW x_win = GET_XLIKE_WINDOW (f);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1863 XLIKE_GC gc;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1864 XLIKE_GCVALUES gcv;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1865 unsigned long pixmap_mask;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1866
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1867 if (!override_gc)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1868 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1869 memset (&gcv, ~0, sizeof (gcv));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1870 gcv.graphics_exposures = XLIKE_FALSE;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1871 XLIKE_SET_PIXCOLOR_COPY (gcv.foreground, fg);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1872 XLIKE_SET_PIXCOLOR_COPY (gcv.background, bg);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1873 pixmap_mask = XLIKE_GC_FOREGROUND | XLIKE_GC_BACKGROUND | XLIKE_GC_EXPOSURES;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1874
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1875 if (IMAGE_INSTANCE_XLIKE_MASK (p))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1876 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1877 gcv.function = XLIKE_GX_COPY;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1878 gcv.clip_mask = IMAGE_INSTANCE_XLIKE_MASK (p);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1879 gcv.clip_x_origin = x - xoffset;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1880 gcv.clip_y_origin = y - yoffset;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1881 pixmap_mask |= (XLIKE_GC_FUNCTION | XLIKE_GC_CLIP_MASK |
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1882 XLIKE_GC_CLIP_X_ORIGIN |
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1883 XLIKE_GC_CLIP_Y_ORIGIN);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1884 /* Can't set a clip rectangle below because we already have a mask.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1885 We could conceivably create a new clipmask by zeroing out
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1886 everything outside the clip region. Is it worth it?
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1887 Is it possible to get an equivalent effect by changing the
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1888 args to XCopyArea below rather than messing with a clip box?
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1889 - dkindred@cs.cmu.edu
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1890 Yes. We don't clip at all now - andy@xemacs.org
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1891 */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1892 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1893
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1894 gc = gc_cache_lookup (DEVICE_XLIKE_GC_CACHE (d), &gcv, pixmap_mask);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1895 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1896 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1897 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1898 gc = override_gc;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1899 /* override_gc might have a mask already--we don't want to nuke it.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1900 Maybe we can insist that override_gc have no mask, or use
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1901 one of the suggestions above. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1902 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1903
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1904 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1905 /* depth of 0 means it's a bitmap, not a pixmap, and we should use
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1906 XCopyPlane (1 = current foreground color, 0 = background) instead
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1907 of XCopyArea, which means that the bits in the pixmap are actual
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1908 pixel values, instead of symbolic of fg/bg. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1909 #endif /* THIS_IS_X */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1910 if (IMAGE_INSTANCE_PIXMAP_DEPTH (p) > 0)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1911 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1912 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1913 XCopyArea (dpy,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1914 IMAGE_INSTANCE_X_PIXMAP_SLICE
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1915 (p, IMAGE_INSTANCE_PIXMAP_SLICE (p)), x_win, gc, xoffset,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1916 yoffset, width,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1917 height, x, y);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1918 #else /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1919 gdk_draw_pixmap (GDK_DRAWABLE (x_win), gc,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1920 IMAGE_INSTANCE_GTK_PIXMAP (p),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1921 xoffset, yoffset, x, y, width, height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1922 #endif /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1923 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1924 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1925 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1926 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1927 XCopyPlane (dpy, IMAGE_INSTANCE_X_PIXMAP_SLICE
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1928 (p, IMAGE_INSTANCE_PIXMAP_SLICE (p)), x_win, gc,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1929 xoffset, yoffset, width, height, x, y, 1L);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1930 #else /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1931 our_draw_bitmap (GDK_DRAWABLE (x_win), gc,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1932 IMAGE_INSTANCE_GTK_PIXMAP (p),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1933 xoffset, yoffset, x, y, width, height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1934 #endif /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1935 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1936 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1937
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1938 static void
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1939 XLIKE_output_pixmap (struct window *w, Lisp_Object image_instance,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1940 struct display_box *db, struct display_glyph_area *dga,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1941 face_index findex, int cursor_start, int cursor_width,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1942 int cursor_height, int UNUSED (bg_pixmap))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1943 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1944 struct frame *f = XFRAME (w->frame);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1945 struct device *d = XDEVICE (f->device);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1946 Lisp_Image_Instance *p = XIMAGE_INSTANCE (image_instance);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1947 XLIKE_DISPLAY dpy = GET_XLIKE_DISPLAY (d);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1948 XLIKE_WINDOW x_win = GET_XLIKE_WINDOW (f);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1949
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1950 /* Output the pixmap. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1951 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1952 Lisp_Object tmp_pixel;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1953 XLIKE_COLOR tmp_bcolor, tmp_fcolor;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1954
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1955 tmp_pixel = WINDOW_FACE_CACHEL_FOREGROUND (w, findex);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1956 tmp_fcolor = XCOLOR_INSTANCE_XLIKE_COLOR (tmp_pixel);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1957 tmp_pixel = WINDOW_FACE_CACHEL_BACKGROUND (w, findex);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1958 tmp_bcolor = XCOLOR_INSTANCE_XLIKE_COLOR (tmp_pixel);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1959
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1960 XLIKE_OUTPUT_XLIKE_PIXMAP (f, p, db->xpos, db->ypos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1961 dga->xoffset, dga->yoffset,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1962 dga->width, dga->height,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1963 XLIKE_COLOR_TO_PIXCOLOR (tmp_fcolor),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1964 XLIKE_COLOR_TO_PIXCOLOR (tmp_bcolor), 0);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1965 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1966
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1967 /* Draw a cursor over top of the pixmap. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1968 if (cursor_width && cursor_height && (cursor_start >= db->xpos)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1969 && !NILP (w->text_cursor_visible_p)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1970 && (cursor_start < db->xpos + dga->width))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1971 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1972 XLIKE_GC gc;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1973 int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1974 struct face_cachel *cursor_cachel =
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1975 WINDOW_FACE_CACHEL (w,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1976 get_builtin_face_cache_index
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1977 (w, Vtext_cursor_face));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1978
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1979 gc = XLIKE_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil, Qnil);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1980
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1981 if (cursor_width > db->xpos + dga->width - cursor_start)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1982 cursor_width = db->xpos + dga->width - cursor_start;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1983
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1984 if (focus)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1985 XLIKE_FILL_RECTANGLE (dpy, x_win, gc, cursor_start, db->ypos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1986 cursor_width, cursor_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1987 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1988 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1989 XLIKE_DRAW_RECTANGLE (dpy, x_win, gc, cursor_start, db->ypos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1990 cursor_width, cursor_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1991 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1992 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1993 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1994
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1995 /*****************************************************************************
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1996 XLIKE_output_vertical_divider
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1997
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1998 Draw a vertical divider down the right side of the given window.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1999 ****************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2000 static void
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2001 XLIKE_output_vertical_divider (struct window *w, int USED_IF_X(clear))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2002 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2003 struct frame *f = XFRAME (w->frame);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2004 struct device *d = XDEVICE (f->device);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2005
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2006 XLIKE_DISPLAY dpy = GET_XLIKE_DISPLAY (d);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2007 XLIKE_WINDOW x_win = GET_XLIKE_WINDOW (f);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2008 Lisp_Object tmp_pixel;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2009 XLIKE_GCVALUES gcv;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2010 XLIKE_GC background_gc;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2011 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2012 enum edge_style style;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2013 #endif /* THIS_IS_X */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2014 unsigned long mask;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2015 int x, y1, y2, width, shadow_thickness, spacing, line_width;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2016 face_index div_face =
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2017 get_builtin_face_cache_index (w, Vvertical_divider_face);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2018
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2019 width = window_divider_width (w);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2020 shadow_thickness = XINT (w->vertical_divider_shadow_thickness);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2021 spacing = XINT (w->vertical_divider_spacing);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2022 line_width = XINT (w->vertical_divider_line_width);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2023 x = WINDOW_RIGHT (w) - width;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2024 y1 = WINDOW_TOP (w);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2025 y2 = WINDOW_BOTTOM (w);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2026
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2027 memset (&gcv, ~0, sizeof (gcv));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2028
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2029 tmp_pixel = WINDOW_FACE_CACHEL_BACKGROUND (w, div_face);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2030
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2031 /* First, get the GC's. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2032 XLIKE_SET_PIXCOLOR_COPY
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2033 (gcv.background,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2034 XLIKE_COLOR_TO_PIXCOLOR (XCOLOR_INSTANCE_XLIKE_COLOR (tmp_pixel)));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2035 gcv.foreground = gcv.background;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2036 gcv.graphics_exposures = XLIKE_FALSE;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2037 mask = XLIKE_GC_FOREGROUND | XLIKE_GC_BACKGROUND | XLIKE_GC_EXPOSURES;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2038
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2039 background_gc = gc_cache_lookup (DEVICE_XLIKE_GC_CACHE (d), &gcv, mask);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2040
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2041 /* Clear the divider area first. This needs to be done when a
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2042 window split occurs. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2043 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2044 if (clear)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2045 XClearArea (dpy, x_win, x, y1, width, y2 - y1, False);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2046 #else /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2047 /* if (clear) */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2048 gdk_draw_rectangle (GDK_DRAWABLE (x_win), background_gc, TRUE,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2049 x, y1, width, y2 - y1);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2050 #endif /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2051
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2052 #ifndef THIS_IS_GTK
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2053 /* #### FIXME Why not? Formerly '#if 0' in the GDK code */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2054 /* Draw the divider line. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2055 XLIKE_FILL_RECTANGLE (dpy, x_win, background_gc,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2056 x + spacing + shadow_thickness, y1,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2057 line_width, y2 - y1);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2058
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2059 /* This code not formerly present in GTK version, maybe the omittal
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2060 is intentional? */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2061 if (shadow_thickness < 0)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2062 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2063 shadow_thickness = -shadow_thickness;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2064 style = EDGE_BEVEL_IN;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2065 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2066 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2067 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2068 style = EDGE_BEVEL_OUT;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2069 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2070 #endif /* not THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2071
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2072 /* Draw the shadows around the divider line */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2073 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2074 x_bevel_area (w, div_face, x + spacing, y1,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2075 width - 2 * spacing, y2 - y1,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2076 shadow_thickness, EDGE_ALL, style);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2077 #else /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2078 gtk_output_shadows (f, x + spacing, y1,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2079 width - 2 * spacing, y2 - y1,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2080 shadow_thickness);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2081 #endif /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2082 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2083
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2084 /*****************************************************************************
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2085 XLIKE_output_blank
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2086
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2087 Output a blank by clearing the area it covers in the foreground color
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2088 of its face.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2089 ****************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2090 static void
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2091 XLIKE_output_blank (struct window *w, struct display_line *dl, struct rune *rb,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2092 int start_pixpos, int cursor_start, int cursor_width)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2093 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2094 struct frame *f = XFRAME (w->frame);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2095 struct device *d = XDEVICE (f->device);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2096
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2097 XLIKE_DISPLAY dpy = GET_XLIKE_DISPLAY (d);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2098 XLIKE_WINDOW x_win = GET_XLIKE_WINDOW (f);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2099 XLIKE_GC gc;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2100 struct face_cachel *cursor_cachel =
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2101 WINDOW_FACE_CACHEL (w,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2102 get_builtin_face_cache_index
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2103 (w, Vtext_cursor_face));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2104 Lisp_Object bg_pmap;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2105 Lisp_Object buffer = WINDOW_BUFFER (w);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2106 Lisp_Object bar_cursor_value = symbol_value_in_buffer (Qbar_cursor,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2107 buffer);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2108
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2109 int x = rb->xpos;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2110 int y = XLIKE_DISPLAY_LINE_YPOS (dl);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2111 int height = XLIKE_DISPLAY_LINE_HEIGHT (dl);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2112 int width = rb->width;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2113
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2114 /* Unmap all subwindows in the area we are going to blank. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2115 redisplay_unmap_subwindows_maybe (f, x, y, width, height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2116
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2117 if (start_pixpos > x)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2118 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2119 if (start_pixpos >= (x + width))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2120 return;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2121 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2122 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2123 width -= (start_pixpos - x);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2124 x = start_pixpos;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2125 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2126 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2127
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2128 bg_pmap = WINDOW_FACE_CACHEL_BACKGROUND_PIXMAP (w, rb->findex);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2129 if (!IMAGE_INSTANCEP (bg_pmap)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2130 || !IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (bg_pmap)))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2131 bg_pmap = Qnil;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2132
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2133 if (NILP (bg_pmap))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2134 gc = XLIKE_get_gc (d, Qnil, WINDOW_FACE_CACHEL_BACKGROUND (w, rb->findex),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2135 Qnil, Qnil, Qnil);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2136 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2137 gc = XLIKE_get_gc (d, Qnil, WINDOW_FACE_CACHEL_FOREGROUND (w, rb->findex),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2138 WINDOW_FACE_CACHEL_BACKGROUND (w, rb->findex), bg_pmap,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2139 Qnil);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2140
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2141 XLIKE_FILL_RECTANGLE (dpy, x_win, gc, x, y, width, height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2142
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2143 /* If this rune is marked as having the cursor, then it is actually
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2144 representing a tab. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2145 if (!NILP (w->text_cursor_visible_p)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2146 && (rb->cursor_type == CURSOR_ON
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2147 || (cursor_width
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2148 && (cursor_start + cursor_width > x)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2149 && cursor_start < (x + width))))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2150 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2151 int cursor_height, cursor_y;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2152 int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2153 Lisp_Font_Instance *fi;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2154
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2155 fi = XFONT_INSTANCE (FACE_CACHEL_FONT
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2156 (WINDOW_FACE_CACHEL (w, rb->findex),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2157 Vcharset_ascii));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2158
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2159 gc = XLIKE_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil, Qnil);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2160
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2161 cursor_y = dl->ypos - fi->ascent;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2162 cursor_height = fi->height;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2163 if (cursor_y + cursor_height > y + height)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2164 cursor_height = y + height - cursor_y;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2165
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2166 if (focus)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2167 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2168 if (NILP (bar_cursor_value))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2169 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2170 XLIKE_FILL_RECTANGLE (dpy, x_win, gc, cursor_start, cursor_y,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2171 fi->width, cursor_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2172 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2173 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2174 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2175 int bar_width = EQ (bar_cursor_value, Qt) ? 1 : 2;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2176
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2177 gc = XLIKE_get_gc (d, Qnil, cursor_cachel->background,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2178 Qnil, Qnil, make_int (bar_width));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2179 XLIKE_DRAW_LINE (dpy, x_win, gc, cursor_start + bar_width - 1,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2180 cursor_y, cursor_start + bar_width - 1,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2181 cursor_y + cursor_height - 1);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2182 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2183 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2184 else if (NILP (bar_cursor_value))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2185 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2186 XLIKE_DRAW_RECTANGLE (dpy, x_win, gc, cursor_start, cursor_y,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2187 fi->width - 1, cursor_height - 1);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2188 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2189 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2190 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2191
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2192 /*****************************************************************************
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2193 XLIKE_output_horizontal_line
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2194
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2195 Output a horizontal line in the foreground of its face.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2196 ****************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2197 static void
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2198 XLIKE_output_horizontal_line (struct window *w, struct display_line *dl,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2199 struct rune *rb)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2200 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2201 struct frame *f = XFRAME (w->frame);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2202 struct device *d = XDEVICE (f->device);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2203
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2204 XLIKE_DISPLAY dpy = GET_XLIKE_DISPLAY (d);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2205 XLIKE_WINDOW x_win = GET_XLIKE_WINDOW (f);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2206 XLIKE_GC gc;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2207
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2208 int x = rb->xpos;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2209 int width = rb->width;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2210 int height = XLIKE_DISPLAY_LINE_HEIGHT (dl);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2211 int ypos1, ypos2, ypos3, ypos4;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2212
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2213 ypos1 = XLIKE_DISPLAY_LINE_YPOS (dl);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2214 ypos2 = ypos1 + rb->object.hline.yoffset;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2215 ypos3 = ypos2 + rb->object.hline.thickness;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2216 ypos4 = dl->ypos + dl->descent - dl->clip;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2217
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2218 /* First clear the area not covered by the line. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2219 if (height - rb->object.hline.thickness > 0)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2220 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2221 gc = XLIKE_get_gc (d, Qnil,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2222 WINDOW_FACE_CACHEL_FOREGROUND (w, rb->findex),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2223 Qnil, Qnil, Qnil);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2224
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2225 if (ypos2 - ypos1 > 0)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2226 XLIKE_FILL_RECTANGLE (dpy, x_win, gc, x, ypos1, width, ypos2 - ypos1);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2227 if (ypos4 - ypos3 > 0)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2228 XLIKE_FILL_RECTANGLE (dpy, x_win, gc, x, ypos1, width, ypos2 - ypos1);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2229 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2230
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2231 #ifdef THIS_IS_GTK
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2232 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2233 GtkStyle *style = FRAME_GTK_TEXT_WIDGET (f)->style;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2234 gtk_paint_hline (style, x_win, GTK_STATE_NORMAL, NULL,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2235 FRAME_GTK_TEXT_WIDGET (f), "hline", x, x + width, ypos2);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2236 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2237 #else /* THIS_IS_X */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2238 /* Now draw the line. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2239 gc = XLIKE_get_gc (d, Qnil, WINDOW_FACE_CACHEL_BACKGROUND (w, rb->findex),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2240 Qnil, Qnil, Qnil);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2241
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2242 if (ypos2 < ypos1)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2243 ypos2 = ypos1;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2244 if (ypos3 > ypos4)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2245 ypos3 = ypos4;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2246
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2247 if (ypos3 - ypos2 > 0)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2248 XLIKE_FILL_RECTANGLE (dpy, x_win, gc, x, ypos2, width, ypos3 - ypos2);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2249 #endif /* THIS_IS_X */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2250 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2251
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2252 /****************************************************************************
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2253 XLIKE_clear_region
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2254
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2255 Clear the area in the box defined by the given parameters using the
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2256 given face.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2257 ****************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2258 static void
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2259 XLIKE_clear_region (Lisp_Object UNUSED (locale), struct device* d,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2260 struct frame* f, face_index UNUSED (findex), int x, int y,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2261 int width, int height, Lisp_Object fcolor,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2262 Lisp_Object bcolor, Lisp_Object background_pixmap)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2263 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2264 XLIKE_DISPLAY dpy = GET_XLIKE_DISPLAY (d);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2265 XLIKE_WINDOW x_win = GET_XLIKE_WINDOW (f);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2266 XLIKE_GC gc = NULL;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2267
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2268 if (!UNBOUNDP (background_pixmap))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2269 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2270 gc = XLIKE_get_gc (d, Qnil, fcolor, bcolor, background_pixmap, Qnil);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2271 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2272
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2273 if (gc)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2274 XLIKE_FILL_RECTANGLE (dpy, x_win, gc, x, y, width, height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2275 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2276 XLIKE_CLEAR_AREA (dpy, x_win, x, y, width, height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2277 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2278
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2279 /*****************************************************************************
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2280 xlike_output_eol_cursor
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2281
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2282 Draw a cursor at the end of a line. The end-of-line cursor is
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2283 narrower than the normal cursor.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2284 ****************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2285 static void
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2286 XLIKE_output_eol_cursor (struct window *w, struct display_line *dl, int xpos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2287 face_index findex)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2288 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2289 struct frame *f = XFRAME (w->frame);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2290 struct device *d = XDEVICE (f->device);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2291 Lisp_Object window;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2292
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2293 XLIKE_DISPLAY dpy = GET_XLIKE_DISPLAY (d);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2294 XLIKE_WINDOW x_win = GET_XLIKE_WINDOW (f);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2295 XLIKE_GC gc = NULL;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2296 face_index elt = get_builtin_face_cache_index (w, Vtext_cursor_face);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2297 struct face_cachel *cursor_cachel = WINDOW_FACE_CACHEL (w, elt);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2298
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2299 int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2300 Lisp_Object bar_cursor_value = symbol_value_in_buffer (Qbar_cursor,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2301 WINDOW_BUFFER (w));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2302
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2303 int x = xpos;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2304 int y = XLIKE_DISPLAY_LINE_YPOS (dl);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2305 int width = EOL_CURSOR_WIDTH;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2306 int height = XLIKE_DISPLAY_LINE_HEIGHT (dl);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2307 int cursor_height, cursor_y;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2308 int defheight, defascent;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2309
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2310 window = wrap_window (w);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2311 redisplay_clear_region (window, findex, x, y, width, height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2312
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2313 if (NILP (w->text_cursor_visible_p))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2314 return;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2315
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2316 gc = XLIKE_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil, Qnil);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2317
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2318 default_face_font_info (window, &defascent, 0, &defheight, 0, 0);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2319
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2320 /* make sure the cursor is entirely contained between y and y+height */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2321 cursor_height = min (defheight, height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2322 cursor_y = max (y, min (y + height - cursor_height,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2323 dl->ypos - defascent));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2324
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2325 if (focus)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2326 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2327 #ifdef HAVE_XIM
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2328 XIM_SetSpotLocation (f, x - 2 , cursor_y + cursor_height - 2);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2329 #endif /* HAVE_XIM */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2330
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2331 if (NILP (bar_cursor_value))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2332 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2333 XLIKE_FILL_RECTANGLE (dpy, x_win, gc, x, cursor_y, width,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2334 cursor_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2335 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2336 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2337 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2338 int bar_width = EQ (bar_cursor_value, Qt) ? 1 : 2;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2339
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2340 gc = XLIKE_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2341 make_int (bar_width));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2342 XLIKE_DRAW_LINE (dpy, x_win, gc, x + bar_width - 1, cursor_y,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2343 x + bar_width - 1, cursor_y + cursor_height - 1);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2344 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2345 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2346 else if (NILP (bar_cursor_value))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2347 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2348 XLIKE_DRAW_RECTANGLE (dpy, x_win, gc, x, cursor_y, width - 1,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2349 cursor_height - 1);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2350 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2351 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2352
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2353 static void
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2354 XLIKE_clear_frame_window (Lisp_Object window)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2355 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2356 struct window *w = XWINDOW (window);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2357
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2358 if (!NILP (w->vchild))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2359 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2360 XLIKE_clear_frame_windows (w->vchild);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2361 return;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2362 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2363
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2364 if (!NILP (w->hchild))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2365 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2366 XLIKE_clear_frame_windows (w->hchild);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2367 return;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2368 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2369
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2370 redisplay_clear_to_window_end (w, WINDOW_TEXT_TOP (w),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2371 WINDOW_TEXT_BOTTOM (w));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2372 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2373
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2374 static void
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2375 XLIKE_clear_frame_windows (Lisp_Object window)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2376 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2377 for (; !NILP (window); window = XWINDOW (window)->next)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2378 XLIKE_clear_frame_window (window);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2379 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2380
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2381 static void
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2382 XLIKE_clear_frame (struct frame *f)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2383 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2384 XLIKE_DISPLAY dpy = GET_XLIKE_DISPLAY (XDEVICE (f->device));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2385 XLIKE_WINDOW x_win = GET_XLIKE_WINDOW (f);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2386 int x, y, width, height;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2387 Lisp_Object frame;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2388
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2389 x = FRAME_LEFT_BORDER_START (f);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2390 width = (FRAME_PIXWIDTH (f) - FRAME_REAL_LEFT_TOOLBAR_WIDTH (f) -
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2391 FRAME_REAL_RIGHT_TOOLBAR_WIDTH (f) -
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2392 2 * FRAME_REAL_LEFT_TOOLBAR_BORDER_WIDTH (f) -
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2393 2 * FRAME_REAL_RIGHT_TOOLBAR_BORDER_WIDTH (f));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2394 /* #### This adjustment by 1 should be being done in the macros.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2395 There is some small differences between when the menubar is on
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2396 and off that we still need to deal with. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2397 y = FRAME_TOP_BORDER_START (f) - 1;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2398 height = (FRAME_PIXHEIGHT (f) - FRAME_REAL_TOP_TOOLBAR_HEIGHT (f) -
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2399 FRAME_REAL_BOTTOM_TOOLBAR_HEIGHT (f) -
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2400 2 * FRAME_REAL_TOP_TOOLBAR_BORDER_WIDTH (f) -
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2401 2 * FRAME_REAL_BOTTOM_TOOLBAR_BORDER_WIDTH (f)) + 1;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2402
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2403 XLIKE_CLEAR_AREA (dpy, x_win, x, y, width, height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2404
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2405 frame = wrap_frame (f);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2406
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2407 if (!UNBOUNDP (FACE_BACKGROUND_PIXMAP (Vdefault_face, frame))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2408 || !UNBOUNDP (FACE_BACKGROUND_PIXMAP (Vleft_margin_face, frame))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2409 || !UNBOUNDP (FACE_BACKGROUND_PIXMAP (Vright_margin_face, frame)))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2410 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2411 XLIKE_clear_frame_windows (f->root_window);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2412 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2413 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2414 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2415 struct device *d = XDEVICE (f->device);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2416 if (!(check_if_pending_expose_event (d)))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2417 XFlush (DEVICE_X_DISPLAY (d));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2418 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2419 #endif /* THIS_IS_X */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2420 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2421
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2422 /* briefly swap the foreground and background colors.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2423 */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2424
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2425 static int
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2426 XLIKE_flash (struct device *d)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2427 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2428 struct frame *f = device_selected_frame (d);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2429 XLIKE_DISPLAY dpy = GET_XLIKE_DISPLAY (d);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2430 XLIKE_WINDOW win = GET_XLIKE_WINDOW (f);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2431 XLIKE_GC gc = NULL;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2432 XLIKE_GCVALUES gcv;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2433 XLIKE_COLOR tmp_fcolor, tmp_bcolor;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2434 Lisp_Object tmp_pixel, frame;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2435 struct window *w = XWINDOW (FRAME_ROOT_WINDOW (f));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2436 int flash_height;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2437
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2438 frame = wrap_frame (f);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2439
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2440 tmp_pixel = FACE_FOREGROUND (Vdefault_face, frame);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2441 XLIKE_SET_PIXCOLOR_COPY (tmp_fcolor,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2442 XCOLOR_INSTANCE_XLIKE_COLOR (tmp_pixel));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2443 tmp_pixel = FACE_BACKGROUND (Vdefault_face, frame);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2444 XLIKE_SET_PIXCOLOR_COPY (tmp_bcolor,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2445 XCOLOR_INSTANCE_XLIKE_COLOR (tmp_pixel));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2446 memset (&gcv, ~0, sizeof (gcv)); /* initialize all slots to ~0 */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2447 XLIKE_SET_PIXCOLOR_NUM (gcv.foreground,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2448 (tmp_fcolor.pixel ^ tmp_bcolor.pixel));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2449 gcv.function = XLIKE_GX_XOR;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2450 gcv.graphics_exposures = XLIKE_FALSE;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2451 gc = gc_cache_lookup (DEVICE_XLIKE_GC_CACHE (XDEVICE (f->device)), &gcv,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2452 XLIKE_GC_FOREGROUND | XLIKE_GC_FUNCTION | XLIKE_GC_EXPOSURES);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2453 default_face_height_and_width (frame, &flash_height, 0);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2454
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2455 /* If window is tall, flash top and bottom line. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2456 if (EQ (Vvisible_bell, Qtop_bottom) && w->pixel_height > 3 * flash_height)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2457 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2458 XLIKE_FILL_RECTANGLE (dpy, win, gc, w->pixel_left, w->pixel_top,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2459 w->pixel_width, flash_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2460 XLIKE_FILL_RECTANGLE (dpy, win, gc, w->pixel_left,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2461 w->pixel_top + w->pixel_height - flash_height,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2462 w->pixel_width, flash_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2463 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2464 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2465 /* If it is short, flash it all. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2466 XLIKE_FILL_RECTANGLE (dpy, win, gc, w->pixel_left, w->pixel_top,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2467 w->pixel_width, w->pixel_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2468
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2469 XLIKE_FLUSH (dpy);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2470
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2471 #ifdef HAVE_SELECT
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2472 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2473 int usecs = 100000;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2474 struct timeval tv;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2475 tv.tv_sec = usecs / 1000000L;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2476 tv.tv_usec = usecs % 1000000L;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2477 /* I'm sure someone is going to complain about this... */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2478 select (0, 0, 0, 0, &tv);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2479 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2480 #else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2481 #ifdef HAVE_POLL
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2482 poll (0, 0, 100);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2483 #else /* !HAVE_POLL */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2484 #error bite me
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2485 #endif /* HAVE_POLL */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2486 #endif /* HAVE_SELECT */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2487
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2488 /* If window is tall, flash top and bottom line. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2489 if (EQ (Vvisible_bell, Qtop_bottom) && w->pixel_height > 3 * flash_height)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2490 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2491 XLIKE_FILL_RECTANGLE (dpy, win, gc, w->pixel_left, w->pixel_top,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2492 w->pixel_width, flash_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2493 XLIKE_FILL_RECTANGLE (dpy, win, gc, w->pixel_left,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2494 w->pixel_top + w->pixel_height - flash_height,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2495 w->pixel_width, flash_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2496 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2497 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2498 /* If it is short, flash it all. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2499 XLIKE_FILL_RECTANGLE (dpy, win, gc, w->pixel_left, w->pixel_top,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2500 w->pixel_width, w->pixel_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2501
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2502 XLIKE_FLUSH (dpy);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2503
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2504 return 1;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2505 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2506
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2507
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2508 /************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2509 /* initialization */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2510 /************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2511
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2512 void
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2513 console_type_create_redisplay_XLIKE (void)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2514 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2515 /* redisplay methods */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2516 XLIKE_CONSOLE_HAS_METHOD (text_width);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2517 XLIKE_CONSOLE_HAS_METHOD (output_display_block);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2518 XLIKE_CONSOLE_HAS_METHOD (divider_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2519 XLIKE_CONSOLE_HAS_METHOD (eol_cursor_width);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2520 XLIKE_CONSOLE_HAS_METHOD (output_vertical_divider);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2521 XLIKE_CONSOLE_HAS_METHOD (clear_region);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2522 XLIKE_CONSOLE_HAS_METHOD (clear_frame);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2523 XLIKE_CONSOLE_HAS_METHOD (flash);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2524 XLIKE_CONSOLE_HAS_METHOD (ring_bell);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2525 XLIKE_CONSOLE_HAS_METHOD (bevel_area);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2526 XLIKE_CONSOLE_HAS_METHOD (output_string);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2527 XLIKE_CONSOLE_HAS_METHOD (output_pixmap);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2528
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2529 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2530 XLIKE_CONSOLE_HAS_METHOD (window_output_begin);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2531 XLIKE_CONSOLE_HAS_METHOD (window_output_end);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2532 #endif
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2533 }