annotate src/redisplay-output.c @ 5581:56144c8593a8

Mechanically change INT to FIXNUM in our sources. src/ChangeLog addition: 2011-10-09 Aidan Kehoe <kehoea@parhasard.net> [...] Mechanically change INT (where it refers to non-bignum Lisp integers) to FIXNUM in our sources. Done for the following functions, enums, and macros: Lisp_Type_Int_Even, Lisp_Type_Int_Odd, INT_GCBITS, INT_VALBITS, make_int(), INTP(), XINT(), CHECK_INT(), XREALINT(), INT_PLUS(), INT_MINUS(), EMACS_INT_MAX (to MOST_POSITIVE_FIXNUM), EMACS_INT_MIN (to MOST_NEGATIVE_FIXNUM), NUMBER_FITS_IN_AN_EMACS_INT() to NUMBER_FITS_IN_A_FIXNUM(), XFLOATINT, XCHAR_OR_INT, INT_OR_FLOAT. The EMACS_INT typedef was not changed, it does not describe non-bignum Lisp integers. Script that did the change available in http://mid.gmane.org/20067.17650.181273.12014@parhasard.net . modules/ChangeLog addition: 2011-10-09 Aidan Kehoe <kehoea@parhasard.net> [...] Mechanically change INT to FIXNUM, where the usage describes non-bignum Lisp integers. See the src/ChangeLog entry for more details. man/ChangeLog addition: 2011-10-09 Aidan Kehoe <kehoea@parhasard.net> * internals/internals.texi (How Lisp Objects Are Represented in C): * internals/internals.texi (Integers and Characters): Mechanically change INT to FIXNUM, where the usage describes non-bignum Lisp integers.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 09 Oct 2011 09:51:57 +0100
parents f87be7ddd60d
children b0d712bbc2a6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* Synchronize redisplay structures and output changes.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
1318
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
3 Copyright (C) 1995, 1996, 2002, 2003 Ben Wing.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 Copyright (C) 1996 Chuck Thompson.
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 851
diff changeset
5 Copyright (C) 1999, 2002 Andy Piper.
5080
5502045ec510 The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents: 5074
diff changeset
6 Copyright (C) 2010 Didier Verna
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5090
diff changeset
10 XEmacs is free software: you can redistribute it and/or modify it
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 under the terms of the GNU General Public License as published by the
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5090
diff changeset
12 Free Software Foundation, either version 3 of the License, or (at your
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5090
diff changeset
13 option) any later version.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 You should have received a copy of the GNU General Public License
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5090
diff changeset
21 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 /* Synched up with: Not in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 /* This file has been Mule-ized. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 /* Author: Chuck Thompson */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 /* Heavily hacked for modularity, gutter and subwindow support by Andy
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 Piper. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 #include "lisp.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 #include "buffer.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 #include "window.h"
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
37 #include "frame-impl.h"
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
38 #include "device-impl.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 #include "glyphs.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 #include "redisplay.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 #include "faces.h"
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
42 #include "gutter.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 static int compare_runes (struct window *w, struct rune *crb,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 struct rune *drb);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 static void redraw_cursor_in_window (struct window *w,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 int run_end_begin_glyphs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 static void redisplay_output_display_block (struct window *w, struct display_line *dl,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 int block, int start, int end, int start_pixpos,
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
50 int cursor_start, int cursor_width,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 int cursor_height);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
52 static void redisplay_normalize_display_box (struct display_box* dest,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 struct display_glyph_area* src);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 static int redisplay_display_boxes_in_window_p (struct window* w,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 struct display_box* db,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 struct display_glyph_area* dga);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
57 static void redisplay_clear_clipped_region (Lisp_Object locale, face_index findex,
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
58 struct display_box* dest,
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
59 struct display_glyph_area* glyphsrc,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 int fullheight_p, Lisp_Object);
1318
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
61 static void redisplay_redraw_exposed_windows (Lisp_Object window, int x,
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
62 int y, int width, int height);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 sync_rune_structs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 Synchronize the given rune blocks.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1318
diff changeset
70 sync_rune_structs (struct window *UNUSED (w), rune_dynarr *cra,
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1318
diff changeset
71 rune_dynarr *dra)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 int rune_elt;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 int max_move = ((Dynarr_length (dra) > Dynarr_largest (cra))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 ? Dynarr_largest (cra)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 : Dynarr_length (dra));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 if (max_move)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 /* #### Doing this directly breaks the encapsulation. But, the
4187
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
81 running time of this function has a measurable impact on
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
82 redisplay performance so avoiding all excess overhead is a
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
83 good thing. Is all of this true? */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 memcpy (cra->base, dra->base, sizeof (struct rune) * max_move);
5038
9410323e4b0d major dynarr fixes
Ben Wing <ben@xemacs.org>
parents: 4967
diff changeset
85 Dynarr_set_lengthr (cra, max_move);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 Dynarr_reset (cra);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 for (rune_elt = max_move; rune_elt < Dynarr_length (dra); rune_elt++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 struct rune rb, *crb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 struct rune *drb = Dynarr_atp (dra, rune_elt);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 crb = &rb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 memcpy (crb, drb, sizeof (struct rune));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 Dynarr_add (cra, *crb);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 sync_display_line_structs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 For the given LINE in window W, make the current display line equal
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 the desired display line.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 ****************************************************************************/
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
107 void
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 sync_display_line_structs (struct window *w, int line, int do_blocks,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 display_line_dynarr *cdla,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 display_line_dynarr *ddla)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 struct display_line dl, *clp, *dlp;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 int db_elt;
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
114 int local = 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115
4207
62d532188a28 [xemacs-hg @ 2007-10-03 10:06:39 by didierv]
didierv
parents: 4187
diff changeset
116 /* #### NOTE: practically, this is not needed because of the memcpy below.
62d532188a28 [xemacs-hg @ 2007-10-03 10:06:39 by didierv]
didierv
parents: 4187
diff changeset
117 #### However, it's cleaner and bugs-in-the-future proof. -- dvl */
62d532188a28 [xemacs-hg @ 2007-10-03 10:06:39 by didierv]
didierv
parents: 4187
diff changeset
118 DISPLAY_LINE_INIT (dl);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 dlp = Dynarr_atp (ddla, line);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 if (line >= Dynarr_largest (cdla))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 clp = &dl;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 clp->display_blocks = Dynarr_new (display_block);
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
124 local = 1;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 clp = Dynarr_atp (cdla, line);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 if (clp->display_blocks)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 Dynarr_reset (clp->display_blocks);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 if (clp->left_glyphs)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 Dynarr_free (clp->left_glyphs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 clp->left_glyphs = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 if (clp->right_glyphs)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 Dynarr_free (clp->right_glyphs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 clp->right_glyphs = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 display_block_dynarr *tdb = clp->display_blocks;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 memcpy (clp, dlp, sizeof (struct display_line));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 clp->display_blocks = tdb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 clp->left_glyphs = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 clp->right_glyphs = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
151 if (do_blocks || line < Dynarr_length (cdla))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 {
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
153 for (db_elt = 0; db_elt < Dynarr_length (dlp->display_blocks); db_elt++)
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
154 {
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
155 struct display_block db, *cdb;
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
156 struct display_block *ddb = Dynarr_atp (dlp->display_blocks, db_elt);
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
157
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
158 if (db_elt >= Dynarr_largest (clp->display_blocks))
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
159 {
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
160 cdb = &db;
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
161 memcpy (cdb, ddb, sizeof (struct display_block));
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
162 cdb->runes = Dynarr_new (rune);
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
163 Dynarr_add (clp->display_blocks, *cdb);
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
164 }
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
165 else
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
166 {
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
167 rune_dynarr *tr;
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
168
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
169 cdb = Dynarr_atp (clp->display_blocks, db_elt);
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
170 tr = cdb->runes;
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
171 memcpy (cdb, ddb, sizeof (struct display_block));
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
172 cdb->runes = tr;
5038
9410323e4b0d major dynarr fixes
Ben Wing <ben@xemacs.org>
parents: 4967
diff changeset
173 Dynarr_incrementr (clp->display_blocks);
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
174 }
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
175
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
176 sync_rune_structs (w, cdb->runes, ddb->runes);
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
177 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
180 if (local)
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
181 Dynarr_add (cdla, *clp);
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
182 else if (line >= Dynarr_length (cdla))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183 {
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
184 assert (line == Dynarr_length (cdla));
5038
9410323e4b0d major dynarr fixes
Ben Wing <ben@xemacs.org>
parents: 4967
diff changeset
185 Dynarr_incrementr (cdla);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 compare_runes
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
192 Compare two runes to see if each of their fields is equal. If so,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 return true otherwise return false.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 compare_runes (struct window *w, struct rune *crb, struct rune *drb)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 {
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 638
diff changeset
198 /* Do not compare the values of charbpos and endpos. They do not
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 affect the display characteristics. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 /* Note: (hanoi 6) spends 95% of its time in redisplay, and about
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 30% here. Not using bitfields for rune.type alone gives a redisplay
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203 speed up of 10%.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 #### In profile arcs run of a normal Gnus session this function
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 is run 6.76 million times, only to return 1 in 6.73 million of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 those.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 In addition a quick look GCC sparc assembly shows that GCC is not
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 doing a good job here.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 1. The function is not inlined (too complicated?)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 2. It seems to be reloading the crb and drb variables all the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 time.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 3. It doesn't seem to notice that the second half of these if's
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 are really a switch statement.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 So I (JV) conjecture
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 #### It would really be worth it to arrange for this function to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 be (almost) a single call to memcmp. */
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
221
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
222 if (crb->xpos != drb->xpos)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 else if (crb->width != drb->width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 else if (crb->cursor_type != drb->cursor_type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 else if (crb->type != drb->type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 else if (crb->type == RUNE_CHAR &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 (crb->object.chr.ch != drb->object.chr.ch))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 else if (crb->type == RUNE_HLINE &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 (crb->object.hline.thickness != drb->object.hline.thickness ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 crb->object.hline.yoffset != drb->object.hline.yoffset))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 return 0;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
237 else if (crb->type == RUNE_DGLYPH &&
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 (!EQ (crb->object.dglyph.glyph, drb->object.dglyph.glyph) ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 !EQ (crb->object.dglyph.extent, drb->object.dglyph.extent) ||
819
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
240 crb->object.dglyph.xoffset != drb->object.dglyph.xoffset ||
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
241 crb->object.dglyph.yoffset != drb->object.dglyph.yoffset ||
4187
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
242 crb->object.dglyph.ascent != drb->object.dglyph.ascent ||
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
243 crb->object.dglyph.descent != drb->object.dglyph.descent))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 /* Only check dirtiness if we know something has changed. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 else if (crb->type == RUNE_DGLYPH &&
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
247 (XGLYPH_DIRTYP (crb->object.dglyph.glyph) ||
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
248 crb->findex != drb->findex))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
250 /* We need some way of telling redisplay_output_layout () that the
4187
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
251 only reason we are outputting it is because something has
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
252 changed internally. That way we can optimize whether we need
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
253 to clear the layout first and also only output the components
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
254 that have changed. The image_instance dirty flag and
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
255 display_hash are no good to us because these will invariably
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
256 have been set anyway if the layout has changed. So it looks
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
257 like we need yet another change flag that we can set here and
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
258 then clear in redisplay_output_layout (). */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
259 Lisp_Object window, image;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
260 Lisp_Image_Instance* ii;
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 665
diff changeset
261 window = wrap_window (w);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
262 image = glyph_image_instance (crb->object.dglyph.glyph,
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 665
diff changeset
263 window, ERROR_ME_DEBUG_WARN, 1);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
264
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
265 if (!IMAGE_INSTANCEP (image))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
266 return 0;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
267 ii = XIMAGE_INSTANCE (image);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
268
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
269 if (TEXT_IMAGE_INSTANCEP (image) &&
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
270 (crb->findex != drb->findex ||
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
271 WINDOW_FACE_CACHEL_DIRTY (w, drb->findex)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272 return 0;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
273
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
274 /* It is quite common for the two glyphs to be EQ since in many
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
275 cases they will actually be the same object. This does not
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
276 mean, however, that nothing has changed. We therefore need to
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
277 check the current hash of the glyph against the last recorded
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
278 display hash and the pending display items. See
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
279 update_subwindow (). */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
280 if (image_instance_changed (image) ||
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
281 crb->findex != drb->findex ||
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
282 WINDOW_FACE_CACHEL_DIRTY (w, drb->findex))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
283 {
638
373ced43e288 [xemacs-hg @ 2001-07-26 21:10:44 by adrian]
adrian
parents: 462
diff changeset
284 /* Now we are going to re-output the glyph, but since
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
285 this is for some internal reason not related to geometry
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
286 changes, send a hint to the output routines that they can
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
287 take some short cuts. This is most useful for
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
288 layouts. This flag should get reset by the output
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
289 routines.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
290
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
291 #### It is possible for us to get here when the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
292 face_cachel is dirty. I do not know what the implications
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
293 of this are.*/
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
294 IMAGE_INSTANCE_OPTIMIZE_OUTPUT (ii) = 1;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
295 return 0;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
296 }
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
297 else
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 }
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
300 /* We now do this last so that glyph checks can do their own thing
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
301 for face changes. Face changes quite often happen when we are
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
302 trying to output something in the gutter, this would normally
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
303 lead to a lot of flashing. The indices can quite often be
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
304 different and yet the faces are the same, we do not want to
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
305 re-output in this instance. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
306 else if (crb->findex != drb->findex ||
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
307 WINDOW_FACE_CACHEL_DIRTY (w, drb->findex))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
308 return 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312
851
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
313 #if 0
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
314 void
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
315 compare_runes_2 (struct window *w, struct rune *crb, struct rune *drb)
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
316 {
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
317 if (crb->type == DGLYPH)
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
318 {
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
319 if (!EQ (crb->object.dglyph.glyph, drb->object.dglyph.glyph) ||
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
320 !EQ (crb->object.dglyph.extent, drb->object.dglyph.extent) ||
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
321 crb->object.dglyph.xoffset != drb->object.dglyph.xoffset ||
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
322 crb->object.dglyph.yoffset != drb->object.dglyph.yoffset ||
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
323 crb->object.dglyph.ascent != drb->object.dglyph.ascent ||
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
324 crb->object.dglyph.descent != drb->object.dglyph.descent)
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
325 return 0;
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
326 /* Only check dirtiness if we know something has changed. */
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
327 else if (XGLYPH_DIRTYP (crb->object.dglyph.glyph) ||
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
328 crb->findex != drb->findex)
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
329 {
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
330 /* We need some way of telling redisplay_output_layout () that the
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
331 only reason we are outputting it is because something has
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
332 changed internally. That way we can optimize whether we need
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
333 to clear the layout first and also only output the components
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
334 that have changed. The image_instance dirty flag and
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
335 display_hash are no good to us because these will invariably
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
336 have been set anyway if the layout has changed. So it looks
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
337 like we need yet another change flag that we can set here and
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
338 then clear in redisplay_output_layout (). */
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
339 Lisp_Object window, image;
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
340 Lisp_Image_Instance* ii;
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
341 window = wrap_window (w);
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
342 image = glyph_image_instance (crb->object.dglyph.glyph,
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
343 window, crb->object.dglyph.matchspec,
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
344 ERROR_ME_DEBUG_WARN, 1);
4187
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
345
851
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
346 if (!IMAGE_INSTANCEP (image))
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
347 return 0;
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
348 ii = XIMAGE_INSTANCE (image);
4187
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
349
851
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
350 if (TEXT_IMAGE_INSTANCEP (image) &&
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
351 (crb->findex != drb->findex ||
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
352 WINDOW_FACE_CACHEL_DIRTY (w, drb->findex)))
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
353 return 0;
4187
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
354
851
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
355 /* It is quite common for the two glyphs to be EQ since in many
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
356 cases they will actually be the same object. This does not
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
357 mean, however, that nothing has changed. We therefore need to
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
358 check the current hash of the glyph against the last recorded
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
359 display hash and the pending display items. See
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
360 update_widget () ^^#### which function?. */
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
361 if (image_instance_changed (image) ||
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
362 crb->findex != drb->findex ||
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
363 WINDOW_FACE_CACHEL_DIRTY (w, drb->findex))
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
364 {
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
365 /* Now we are going to re-output the glyph, but since
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
366 this is for some internal reason not related to geometry
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
367 changes, send a hint to the output routines that they can
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
368 take some short cuts. This is most useful for
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
369 layouts. This flag should get reset by the output
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
370 routines.
4187
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
371
851
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
372 #### It is possible for us to get here when the
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
373 face_cachel is dirty. I do not know what the implications
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
374 of this are.*/
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
375 IMAGE_INSTANCE_OPTIMIZE_OUTPUT (ii) = 1;
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
376 return 0;
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
377 }
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
378 else
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
379 return 1;
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
380 }
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
381 else if (crb->findex != drb->findex ||
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
382 WINDOW_FACE_CACHEL_DIRTY (w, drb->findex))
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
383 return 0;
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
384 else
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
385 return 1;
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
386 }
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
387 else return !(memcmp (crb, drb, sizeof (*crb)) ||
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
388 WINDOW_FACE_CACHEL_DIRTY (w, drb->findex));
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
389 }
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
390 #endif
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
391
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 826
diff changeset
392
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394 get_next_display_block
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396 Return the next display starting at or overlapping START_POS. Return
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 the start of the next region in NEXT_START.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399 int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400 get_next_display_block (layout_bounds bounds, display_block_dynarr *dba,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401 int start_pos, int *next_start)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
403 int next_display_block = NO_BLOCK;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
404 int priority = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
405 int block;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407 /* If we don't find a display block covering or starting at
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408 start_pos, then we return the starting point of the next display
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 block or the next division boundary, whichever is closer to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410 start_pos. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411 if (next_start)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
413 if (start_pos >= bounds.left_out && start_pos < bounds.left_in)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414 *next_start = bounds.left_in;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415 else if (start_pos < bounds.left_white)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416 *next_start = bounds.left_white;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417 else if (start_pos < bounds.right_white)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418 *next_start = bounds.right_white;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
419 else if (start_pos < bounds.right_in)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420 *next_start = bounds.right_in;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421 else if (start_pos <= bounds.right_out)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
422 *next_start = bounds.right_out;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
423 else
4932
8b63e21b0436 fix compile issues with gcc 4
Ben Wing <ben@xemacs.org>
parents: 4844
diff changeset
424 {
8b63e21b0436 fix compile issues with gcc 4
Ben Wing <ben@xemacs.org>
parents: 4844
diff changeset
425 ABORT ();
8b63e21b0436 fix compile issues with gcc 4
Ben Wing <ben@xemacs.org>
parents: 4844
diff changeset
426 *next_start = 0;
8b63e21b0436 fix compile issues with gcc 4
Ben Wing <ben@xemacs.org>
parents: 4844
diff changeset
427 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
428 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
429
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
430 for (block = 0; block < Dynarr_length (dba); block++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
431 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432 struct display_block *db = Dynarr_atp (dba, block);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
433
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
434 if (db->start_pos <= start_pos && db->end_pos > start_pos)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
435 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
436 if ((int) db->type > priority)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
437 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
438 priority = db->type;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
439 next_display_block = block;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
440 if (next_start)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
441 *next_start = db->end_pos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
442 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
443 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
444 else if (next_start && db->start_pos > start_pos)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
445 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
446 if (db->start_pos < *next_start)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
447 *next_start = db->start_pos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
448 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
449 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
451 return next_display_block;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
452 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
453
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
454 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455 get_cursor_size_and_location
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
456
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
457 Return the information defining the pixel location of the cursor.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
458 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
459 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
460 get_cursor_size_and_location (struct window *w, struct display_block *db,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
461 int cursor_location,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
462 int *cursor_start, int *cursor_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
463 int *cursor_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
464 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
465 struct rune *rb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
466 Lisp_Object window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
467 int defheight, defwidth;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
468
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
469 if (Dynarr_length (db->runes) <= cursor_location)
2500
3d8143fc88e1 [xemacs-hg @ 2005-01-24 23:33:30 by ben]
ben
parents: 2286
diff changeset
470 ABORT ();
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
471
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 665
diff changeset
472 window = wrap_window (w);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
473
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
474 rb = Dynarr_atp (db->runes, cursor_location);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
475 *cursor_start = rb->xpos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
476
5047
07dcc7000bbf put width before height consistently, fix a real bug found in the process
Ben Wing <ben@xemacs.org>
parents: 5045
diff changeset
477 default_face_width_and_height (window, &defwidth, &defheight);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
478 *cursor_height = defheight;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
480 if (rb->type == RUNE_BLANK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481 *cursor_width = defwidth;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
482 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483 *cursor_width = rb->width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
485
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
486 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487 compare_display_blocks
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
488
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
489 Given two display blocks, output only those areas where they differ.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
490 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
491 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
492 compare_display_blocks (struct window *w, struct display_line *cdl,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
493 struct display_line *ddl, int c_block, int d_block,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
494 int start_pixpos, int cursor_start, int cursor_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
495 int cursor_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
496 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
497 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498 struct display_block *cdb, *ddb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
499 int start_pos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
500 int stop_pos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
501 int force = 0;
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1318
diff changeset
502 #if 0
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
503 int block_end;
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1318
diff changeset
504 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
505
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
506 cdb = Dynarr_atp (cdl->display_blocks, c_block);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
507 ddb = Dynarr_atp (ddl->display_blocks, d_block);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
508
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
509 assert (cdb->type == ddb->type);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
510
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
511 start_pos = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
512 stop_pos = min (Dynarr_length (cdb->runes), Dynarr_length (ddb->runes));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
513
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1318
diff changeset
514 #if 0
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
515 block_end =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
516 (!Dynarr_length (ddb->runes)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
517 ? 0
4844
91b3d00e717f Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents: 4207
diff changeset
518 : (Dynarr_lastp (ddb->runes)->xpos +
91b3d00e717f Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents: 4207
diff changeset
519 Dynarr_lastp (ddb->runes)->width));
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1318
diff changeset
520 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
521
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
522 /* If the new block type is not text and the cursor status is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
523 changing and it overlaps the position of this block then force a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
524 full redraw of the block in order to make sure that the cursor is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
525 updated properly. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
526 if (ddb->type != TEXT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
527 #if 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
528 /* I'm not sure exactly what this code wants to do, but it's
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
529 * not right--it doesn't update when cursor_elt changes from, e.g.,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
530 * 0 to 8, and the new or old cursor loc overlaps this block.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
531 * I've replaced it with the more conservative test below.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
532 * -dkindred@cs.cmu.edu 23-Mar-1997 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
533 && ((cdl->cursor_elt == -1 && ddl->cursor_elt != -1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
534 || (cdl->cursor_elt != -1 && ddl->cursor_elt == -1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
535 && (ddl->cursor_elt == -1 ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
536 (cursor_start
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
537 && cursor_width
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
538 && (cursor_start + cursor_width) >= start_pixpos
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
539 && cursor_start <= block_end))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
540 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
541 && (cdl->cursor_elt != ddl->cursor_elt)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
542 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
543 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
544 force = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
545
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
546 if (f->windows_structure_changed ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
547 /* #### Why is this so? We have face cachels so that we don't
4187
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
548 have to recalculate all the display blocks when faces
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
549 change. I have fixed this for glyphs and am inclined to think
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
550 that faces should "Just Work", but I'm not feeling brave
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
551 today. Maybe its because the face cachels represent merged
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
552 faces rather than simply instantiations in a particular
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
553 domain. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
554 f->faces_changed ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
555 cdl->ypos != ddl->ypos ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
556 cdl->ascent != ddl->ascent ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
557 cdl->descent != ddl->descent ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
558 cdl->clip != ddl->clip ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
559 force)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
560 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
561 start_pos = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
562 force = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
563 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
564 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
565 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
566 int elt = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
567
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
568 while (start_pos < 0 && elt < stop_pos)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
569 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
570 if (!compare_runes (w, Dynarr_atp (cdb->runes, elt),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
571 Dynarr_atp (ddb->runes, elt)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
572 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
573 start_pos = elt;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
574 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
575 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
576 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
577 elt++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
578 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
579 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
580
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
581 /* If nothing has changed in the area where the blocks overlap, but
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
582 there are new blocks in the desired block, then adjust the start
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
583 point accordingly. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
584 if (elt == stop_pos && stop_pos < Dynarr_length (ddb->runes))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
585 start_pos = stop_pos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
586 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
587
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
588 if (start_pos >= 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
589 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
590 if ((Dynarr_length (ddb->runes) != Dynarr_length (cdb->runes))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
591 || force)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
592 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
593 stop_pos = Dynarr_length (ddb->runes);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
594 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
595 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
596 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
597 /* If the lines have the same number of runes and we are not
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
598 forcing a full redraw because the display line has
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
599 changed position then we try and optimize how much of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
600 line we actually redraw by scanning backwards from the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
601 end for the first changed rune. This optimization is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
602 almost always triggered by face changes. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
603
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
604 int elt = Dynarr_length (ddb->runes) - 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
605
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
606 while (elt > start_pos)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
607 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
608 if (!compare_runes (w, Dynarr_atp (cdb->runes, elt),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
609 Dynarr_atp (ddb->runes, elt)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
610 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
611 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
612 elt--;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
613 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
614 stop_pos = elt + 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
615 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
616
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
617 redisplay_output_display_block (w, ddl, d_block, start_pos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
618 stop_pos, start_pixpos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
619 cursor_start, cursor_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
620 cursor_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
621 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
622 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
623
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
624 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
625 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
626
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
627 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
628 clear_left_border
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
629
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
630 Clear the lefthand outside border.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
631 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
632 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
633 clear_left_border (struct window *w, int y, int height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
634 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
635 struct frame *f = XFRAME (w->frame);
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 665
diff changeset
636 Lisp_Object window = wrap_window (w);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
637
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
638 redisplay_clear_region (window, DEFAULT_INDEX,
5090
0ca81354c4c7 Further frame-geometry cleanups
Ben Wing <ben@xemacs.org>
parents: 5080
diff changeset
639 FRAME_LEFT_INTERNAL_BORDER_START (f), y,
0ca81354c4c7 Further frame-geometry cleanups
Ben Wing <ben@xemacs.org>
parents: 5080
diff changeset
640 FRAME_INTERNAL_BORDER_WIDTH (f), height);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
641 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
642
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
643 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
644 clear_right_border
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
645
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
646 Clear the righthand outside border.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
647 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
648 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
649 clear_right_border (struct window *w, int y, int height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
650 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
651 struct frame *f = XFRAME (w->frame);
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 665
diff changeset
652 Lisp_Object window = wrap_window (w);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
653
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
654 redisplay_clear_region (window, DEFAULT_INDEX,
5090
0ca81354c4c7 Further frame-geometry cleanups
Ben Wing <ben@xemacs.org>
parents: 5080
diff changeset
655 FRAME_RIGHT_INTERNAL_BORDER_START (f),
0ca81354c4c7 Further frame-geometry cleanups
Ben Wing <ben@xemacs.org>
parents: 5080
diff changeset
656 y, FRAME_INTERNAL_BORDER_WIDTH (f), height);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
657 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
658
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
659 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
660 output_display_line
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
661
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
662 Ensure that the contents of the given display line is correct
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
663 on-screen. The force_ parameters are used by redisplay_move_cursor
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
664 to correctly update cursor locations and only cursor locations.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
665 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
666 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
667 output_display_line (struct window *w, display_line_dynarr *cdla,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
668 display_line_dynarr *ddla, int line, int force_start,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
669 int force_end)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
670
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
671 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
672 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
673 struct buffer *b = XBUFFER (w->buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
674 struct buffer *old_b = window_display_buffer (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
675 struct display_line *cdl, *ddl;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
676 display_block_dynarr *cdba, *ddba;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
677 int start_pixpos, end_pixpos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
678 int cursor_start, cursor_width, cursor_height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
679
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
680 int force = (force_start >= 0 || force_end >= 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
681 int clear_border = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
682 int must_sync = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
683
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
684 if (cdla && line < Dynarr_length (cdla))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
685 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
686 cdl = Dynarr_atp (cdla, line);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
687 cdba = cdl->display_blocks;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
688 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
689 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
690 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
691 cdl = NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
692 cdba = NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
693 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
694
4844
91b3d00e717f Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents: 4207
diff changeset
695 /* The following will assert line < Dynarr_length (ddla) */
91b3d00e717f Various cleanups for Dynarr code, from Unicode-internal ws
Ben Wing <ben@xemacs.org>
parents: 4207
diff changeset
696 ddl = Dynarr_atp (ddla, line);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
697 ddba = ddl->display_blocks;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
698
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
699 if (force_start >= 0 && force_start >= ddl->bounds.left_out)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
700 start_pixpos = force_start;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
701 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
702 start_pixpos = ddl->bounds.left_out;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
703
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
704 if (force_end >= 0 && force_end < ddl->bounds.right_out)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
705 end_pixpos = force_end;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
706 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
707 end_pixpos = ddl->bounds.right_out;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
708
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
709 /* Get the cursor parameters. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
710 if (ddl->cursor_elt != -1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
711 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
712 struct display_block *db;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
713
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
714 /* If the lines cursor parameter is not -1 then it indicates
4187
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
715 which rune in the TEXT block contains the cursor. This means
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
716 that there must be at least one display block. The TEXT
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
717 block, if present, must always be the first display block. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
718 assert (Dynarr_length (ddba) != 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
719
4967
0d4c9d0f6a8d rewrite dynarr code
Ben Wing <ben@xemacs.org>
parents: 4932
diff changeset
720 db = Dynarr_begin (ddba);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
721 assert (db->type == TEXT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
722
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
723 get_cursor_size_and_location (w, db, ddl->cursor_elt, &cursor_start,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
724 &cursor_width, &cursor_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
725 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
726 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
727 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
728 cursor_start = cursor_width = cursor_height = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
729 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
730
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
731 /* The modeline should only have a single block and it had better be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
732 a TEXT block. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
733 if (ddl->modeline)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
734 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
735 /* The shadow thickness check is necessary if only the sign of
4187
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
736 the size changed. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
737 if (cdba && !w->shadow_thickness_changed)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
738 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
739 must_sync |= compare_display_blocks (w, cdl, ddl, 0, 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
740 start_pixpos, 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
741 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
742 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
743 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
744 redisplay_output_display_block (w, ddl, 0, 0, -1, start_pixpos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
745 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
746 must_sync = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
747 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
748
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
749 if (must_sync)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
750 clear_border = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
751 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
752
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
753 while (!ddl->modeline && start_pixpos < end_pixpos)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
754 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
755 int block;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
756 int next_start_pixpos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
757
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
758 block = get_next_display_block (ddl->bounds, ddba, start_pixpos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
759 &next_start_pixpos);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
760
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
761 /* If we didn't find a block then we should blank the area
4187
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
762 between start_pos and next_start if necessary. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
763 if (block == NO_BLOCK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
764 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
765 /* We only erase those areas which were actually previously
4187
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
766 covered by a display block unless the window structure
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
767 changed. In that case we clear all areas since the current
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
768 structures may actually represent a different buffer. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
769 while (start_pixpos < next_start_pixpos)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
770 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
771 int block_end;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
772 int old_block;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
773
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
774 if (cdba)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
775 old_block = get_next_display_block (ddl->bounds, cdba,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
776 start_pixpos, &block_end);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
777 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
778 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
779 old_block = NO_BLOCK;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
780 block_end = next_start_pixpos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
781 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
782
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
783 if (!cdba || old_block != NO_BLOCK || b != old_b ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
784 f->windows_structure_changed ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
785 f->faces_changed ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
786 force ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
787 (cdl && (cdl->ypos != ddl->ypos ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
788 cdl->ascent != ddl->ascent ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
789 cdl->descent != ddl->descent ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
790 cdl->top_clip != ddl->top_clip ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
791 cdl->clip != ddl->clip)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
792 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
793 int x, y, width, height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
794 face_index findex;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
795
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
796 must_sync = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
797 x = start_pixpos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
798 y = DISPLAY_LINE_YPOS (ddl);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
799 width = min (next_start_pixpos, block_end) - x;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
800 height = DISPLAY_LINE_HEIGHT (ddl);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
801
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
802 if (x < ddl->bounds.left_in)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
803 {
4187
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
804 findex = (ddl->left_margin_findex > DEFAULT_INDEX) ?
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
805 ddl->left_margin_findex
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
806 : get_builtin_face_cache_index (w, Vleft_margin_face);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
807 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
808 else if (x < ddl->bounds.right_in)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
809 {
4187
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
810 findex = (ddl->default_findex >= DEFAULT_INDEX) ?
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
811 ddl->default_findex
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
812 : DEFAULT_INDEX;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
813 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
814 else if (x < ddl->bounds.right_out)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
815 {
4187
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
816 findex = (ddl->right_margin_findex > DEFAULT_INDEX) ?
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
817 ddl->right_margin_findex
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
818 : get_builtin_face_cache_index (w, Vright_margin_face);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
819 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
820 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
821 findex = (face_index) -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
822
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
823 if (findex != (face_index) -1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
824 {
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 665
diff changeset
825 Lisp_Object window = wrap_window (w);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
826
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
827
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
828 /* Clear the empty area. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
829 redisplay_clear_region (window, findex, x, y, width, height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
830
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
831 /* Mark that we should clear the border. This is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
832 necessary because italic fonts may leave
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
833 droppings in the border. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
834 clear_border = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
835 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
836 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
837
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
838 start_pixpos = min (next_start_pixpos, block_end);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
839 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
840 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
841 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
842 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
843 struct display_block *cdb, *ddb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
844 int block_end;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
845 int old_block;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
846
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
847 if (cdba)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
848 old_block = get_next_display_block (ddl->bounds, cdba,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
849 start_pixpos, &block_end);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
850 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
851 old_block = NO_BLOCK;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
852
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
853 ddb = Dynarr_atp (ddba, block);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
854 cdb = (old_block != NO_BLOCK ? Dynarr_atp (cdba, old_block) : 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
855
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
856 /* If there was formerly no block over the current
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
857 region or if it was a block of a different type, then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
858 output the entire ddb. Otherwise, compare cdb and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
859 ddb and output only the changed region. */
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
860 if (!force && cdb && ddb->type == cdb->type
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
861 /* If there was no buffer being display before the
4187
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
862 compare anyway as we might be outputting a gutter. */
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
863 &&
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
864 (b == old_b || !old_b))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
865 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
866 must_sync |= compare_display_blocks (w, cdl, ddl, old_block,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
867 block, start_pixpos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
868 cursor_start, cursor_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
869 cursor_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
870 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
871 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
872 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
873 int elt;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
874 int first_elt = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
875 int last_elt = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
876
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
877 for (elt = 0; elt < Dynarr_length (ddb->runes); elt++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
878 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
879 struct rune *rb = Dynarr_atp (ddb->runes, elt);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
880
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
881 if (start_pixpos >= rb->xpos
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
882 && start_pixpos < rb->xpos + rb->width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
883 first_elt = elt;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
884
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
885 if (end_pixpos > rb->xpos
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
886 && end_pixpos <= rb->xpos + rb->width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
887 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
888 last_elt = elt + 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
889 if (last_elt > Dynarr_length (ddb->runes))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
890 last_elt = Dynarr_length (ddb->runes);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
891 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
892 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
893 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
894
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
895 must_sync = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
896 redisplay_output_display_block (w, ddl, block, first_elt,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
897 last_elt,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
898 start_pixpos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
899 cursor_start, cursor_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
900 cursor_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
901 }
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
902
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
903 start_pixpos = next_start_pixpos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
904 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
905 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
906
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
907 /* Clear the internal border if we are next to it and the window
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
908 structure or frame size has changed or if something caused
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
909 clear_border to be tripped. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
910 /* #### Doing this on f->clear sucks but is necessary because of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
911 window-local background values. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
912 if (f->windows_structure_changed || f->faces_changed || clear_border
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
913 || f->clear)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
914 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
915 int y = DISPLAY_LINE_YPOS (ddl);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
916 int height = DISPLAY_LINE_HEIGHT (ddl);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
917
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
918 /* If we are in the gutter then we musn't clear the borders. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
919 if (y >= WINDOW_TEXT_TOP (w) && (y + height) <= WINDOW_TEXT_BOTTOM (w))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
920 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
921 if (ddl->modeline)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
922 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
923 y -= MODELINE_SHADOW_THICKNESS (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
924 height += (2 * MODELINE_SHADOW_THICKNESS (w));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
925 }
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
926
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
927 if (window_is_leftmost (w))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
928 clear_left_border (w, y, height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
929 if (window_is_rightmost (w))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
930 clear_right_border (w, y, height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
931 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
932 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
933
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
934 if (cdla)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
935 sync_display_line_structs (w, line, must_sync, cdla, ddla);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
936 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
937
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
938 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
939 redisplay_move_cursor
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
940
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
941 For the given window W, move the cursor to NEW_POINT. Returns a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
942 boolean indicating success or failure.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
943 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
944
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 819
diff changeset
945 #define ADJ_CHARPOS (rb->charpos + dl->offset)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
946 #define ADJ_ENDPOS (rb->endpos + dl->offset)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
947
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
948 int
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 638
diff changeset
949 redisplay_move_cursor (struct window *w, Charbpos new_point, int no_output_end)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
950 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
951 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
952 struct device *d = XDEVICE (f->device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
953
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
954 display_line_dynarr *cla = window_display_lines (w, CURRENT_DISP);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
955 struct display_line *dl;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
956 struct display_block *db;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
957 struct rune *rb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
958 int x = w->last_point_x[CURRENT_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
959 int y = w->last_point_y[CURRENT_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
960
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
961 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
962 * Bail if cursor_in_echo_area is non-zero and we're fiddling with
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
963 * the cursor in a non-active minibuffer window, since that is a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
964 * special case that is handled elsewhere and this function need
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
965 * not handle it. Return 1 so the caller will assume we
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
966 * succeeded.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
967 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
968 if (cursor_in_echo_area && MINI_WINDOW_P (w) &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
969 w != XWINDOW (FRAME_SELECTED_WINDOW (f)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
970 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
971
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
972 if (y < 0 || y >= Dynarr_length (cla))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
973 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
974
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
975 dl = Dynarr_atp (cla, y);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
976 db = get_display_block_from_line (dl, TEXT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
977
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
978 if (x < 0 || x >= Dynarr_length (db->runes))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
979 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
980
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
981 rb = Dynarr_atp (db->runes, x);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
982
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
983 if (rb->cursor_type == CURSOR_OFF)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
984 return 0;
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 819
diff changeset
985 else if (ADJ_CHARPOS == new_point
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 819
diff changeset
986 || (ADJ_ENDPOS && (new_point >= ADJ_CHARPOS)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
987 && (new_point <= ADJ_ENDPOS)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
988 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
989 w->last_point_x[CURRENT_DISP] = x;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
990 w->last_point_y[CURRENT_DISP] = y;
5581
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5515
diff changeset
991 Fset_marker (w->last_point[CURRENT_DISP], make_fixnum (ADJ_CHARPOS),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
992 w->buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
993 dl->cursor_elt = x;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
994 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
995 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
996 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
997 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
998 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
999 MAYBE_DEVMETH (d, frame_output_begin, (f));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1000 MAYBE_DEVMETH (d, window_output_begin, (w));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1001 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1002 rb->cursor_type = CURSOR_OFF;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1003 dl->cursor_elt = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1004 output_display_line (w, 0, cla, y, rb->xpos, rb->xpos + rb->width);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1005 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1006
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1007 w->last_point_x[CURRENT_DISP] = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1008 w->last_point_y[CURRENT_DISP] = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1009 Fset_marker (w->last_point[CURRENT_DISP], Qnil, w->buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1010
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1011 /* If this isn't the selected frame, then erasing the old cursor is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1012 all we actually had to do. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1013 if (w != XWINDOW (FRAME_SELECTED_WINDOW (device_selected_frame (d))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1014 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1015 if (!no_output_end)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1016 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1017 MAYBE_DEVMETH (d, window_output_end, (w));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1018 MAYBE_DEVMETH (d, frame_output_end, (f));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1019 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1020
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1021 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1022 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1023
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1024 /* This should only occur in the minibuffer. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1025 if (new_point == 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1026 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1027 w->last_point_x[CURRENT_DISP] = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1028 w->last_point_y[CURRENT_DISP] = y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1029 Fset_marker (w->last_point[CURRENT_DISP], Qzero, w->buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1030
4967
0d4c9d0f6a8d rewrite dynarr code
Ben Wing <ben@xemacs.org>
parents: 4932
diff changeset
1031 rb = Dynarr_begin (db->runes);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1032 rb->cursor_type = CURSOR_ON;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1033 dl->cursor_elt = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1034
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1035 output_display_line (w, 0, cla, y, rb->xpos, rb->xpos + rb->width);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1036
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1037 if (!no_output_end)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1038 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1039 MAYBE_DEVMETH (d, window_output_end, (w));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1040 MAYBE_DEVMETH (d, frame_output_end, (f));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1041 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1042 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1043 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1044 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1045 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1046 int cur_rb = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1047 int first = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1048 int cur_dl, up;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1049
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 819
diff changeset
1050 if (ADJ_CHARPOS < new_point)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1051 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1052 up = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1053 cur_rb = x + 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1054 cur_dl = y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1055 }
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 638
diff changeset
1056 else /* (rb->charbpos + dl->offset) > new_point */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1057 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1058 up = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1059
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1060 if (!x)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1061 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1062 cur_dl = y - 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1063 first = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1064 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1065 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1066 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1067 cur_rb = x - 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1068 cur_dl = y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1069 first = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1070 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1071 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1072
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1073 while (up ? (cur_dl < Dynarr_length (cla)) : (cur_dl >= 0))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1074 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1075 dl = Dynarr_atp (cla, cur_dl);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1076 db = get_display_block_from_line (dl, TEXT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1077
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1078 if (!up && !first)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1079 cur_rb = Dynarr_length (db->runes) - 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1080
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1081 while ((!scroll_on_clipped_lines || !dl->clip) &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1082 (up ? (cur_rb < Dynarr_length (db->runes)) : (cur_rb >= 0)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1083 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1084 rb = Dynarr_atp (db->runes, cur_rb);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1085
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1086 if (rb->cursor_type != IGNORE_CURSOR
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1087 && rb->cursor_type != NO_CURSOR &&
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 819
diff changeset
1088 (ADJ_CHARPOS == new_point
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 819
diff changeset
1089 || (ADJ_ENDPOS && (new_point >= ADJ_CHARPOS)
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 819
diff changeset
1090 && (new_point <= ADJ_CHARPOS))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1091 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1092 rb->cursor_type = CURSOR_ON;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1093 dl->cursor_elt = cur_rb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1094
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1095
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1096 output_display_line (w, 0, cla, cur_dl, rb->xpos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1097 rb->xpos + rb->width);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1098
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1099 w->last_point_x[CURRENT_DISP] = cur_rb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1100 w->last_point_y[CURRENT_DISP] = cur_dl;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1101 Fset_marker (w->last_point[CURRENT_DISP],
5581
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5515
diff changeset
1102 make_fixnum (ADJ_CHARPOS), w->buffer);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1103
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1104 if (!no_output_end)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1105 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1106 MAYBE_DEVMETH (d, window_output_end, (w));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1107 MAYBE_DEVMETH (d, frame_output_end, (f));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1108 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1109 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1110 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1111
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1112 (up ? cur_rb++ : cur_rb--);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1113 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1114
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1115 (up ? (cur_rb = 0) : (first = 0));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1116 (up ? cur_dl++ : cur_dl--);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1117 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1118 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1119
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1120 if (!no_output_end)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1121 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1122 MAYBE_DEVMETH (d, window_output_end, (w));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1123 MAYBE_DEVMETH (d, frame_output_end, (f));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1124 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1125 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1126 }
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 819
diff changeset
1127 #undef ADJ_CHARPOS
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1128 #undef ADJ_ENDPOS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1129
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1130 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1131 redraw_cursor_in_window
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1132
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1133 For the given window W, redraw the cursor if it is contained within
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1134 the window.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1135 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1136 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1137 redraw_cursor_in_window (struct window *w, int run_end_begin_meths)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1138 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1139 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1140 struct device *d = XDEVICE (f->device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1141
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1142 display_line_dynarr *dla = window_display_lines (w, CURRENT_DISP);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1143 struct display_line *dl;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1144 struct display_block *db;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1145 struct rune *rb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1146
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1147 int x = w->last_point_x[CURRENT_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1148 int y = w->last_point_y[CURRENT_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1149
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1150 if (cursor_in_echo_area && MINI_WINDOW_P (w) &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1151 !echo_area_active (f) && minibuf_level == 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1152 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1153 MAYBE_DEVMETH (d, set_final_cursor_coords, (f, w->pixel_top, 0));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1154 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1155
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1156 if (y < 0 || y >= Dynarr_length (dla))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1157 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1158
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1159 if (MINI_WINDOW_P (w) && f != device_selected_frame (d) &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1160 !is_surrogate_for_selected_frame (f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1161 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1162
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1163 dl = Dynarr_atp (dla, y);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1164 db = get_display_block_from_line (dl, TEXT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1165
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1166 if (x < 0 || x >= Dynarr_length (db->runes))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1167 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1168
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1169 rb = Dynarr_atp (db->runes, x);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1170
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1171 /* Don't call the output routine if the block isn't actually the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1172 cursor. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1173 if (rb->cursor_type == CURSOR_ON)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1174 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1175 MAYBE_DEVMETH (d, set_final_cursor_coords,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1176 (f, dl->ypos - 1, rb->xpos));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1177
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1178 if (run_end_begin_meths)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1179 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1180 MAYBE_DEVMETH (d, frame_output_begin, (f));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1181 MAYBE_DEVMETH (d, window_output_begin, (w));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1182 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1183
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1184 output_display_line (w, 0, dla, y, rb->xpos, rb->xpos + rb->width);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1185
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1186 if (run_end_begin_meths)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1187 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1188 MAYBE_DEVMETH (d, window_output_end, (w));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1189 MAYBE_DEVMETH (d, frame_output_end, (f));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1190 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1191 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1192 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1193
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1194 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1195 redisplay_redraw_cursor
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1196
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1197 For the given frame F, redraw the cursor on the selected window.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1198 This is used to update the cursor after focus changes.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1199 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1200 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1201 redisplay_redraw_cursor (struct frame *f, int run_end_begin_meths)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1202 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1203 Lisp_Object window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1204
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1205 if (!cursor_in_echo_area)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1206 window = FRAME_SELECTED_WINDOW (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1207 else if (FRAME_HAS_MINIBUF_P (f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1208 window = FRAME_MINIBUF_WINDOW (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1209 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1210 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1211
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1212 redraw_cursor_in_window (XWINDOW (window), run_end_begin_meths);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1213 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1214
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1215 /****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1216 redisplay_output_display_block
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1217
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1218 Given a display line, a block number for that start line, output all
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1219 runes between start and end in the specified display block.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1220 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1221 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1222 redisplay_output_display_block (struct window *w, struct display_line *dl, int block,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1223 int start, int end, int start_pixpos, int cursor_start,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1224 int cursor_width, int cursor_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1225 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1226 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1227 struct device *d = XDEVICE (f->device);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1228 /* Temporarily disabled until generalization is done. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1229 #if 0
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1230 struct display_block *db = Dynarr_atp (dl->display_blocks, block);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1231 rune_dynarr *rba = db->runes;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1232 struct rune *rb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1233 int xpos, width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1234 rb = Dynarr_atp (rba, start);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1235
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1236 if (!rb)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1237 /* Nothing to do so don't do anything. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1238 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1239
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1240 xpos = max (start_pixpos, rb->xpos);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1241
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1242 if (end < 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1243 end = Dynarr_length (rba);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1244
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1245 rb = Dynarr_atp (rba, end - 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1246 width = rb->xpos + rb->width - xpos;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1247 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1248 /* now actually output the block. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1249 DEVMETH (d, output_display_block, (w, dl, block, start,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1250 end, start_pixpos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1251 cursor_start, cursor_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1252 cursor_height));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1253 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1254
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1255 /****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1256 redisplay_unmap_subwindows
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1257
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1258 Remove subwindows from the area in the box defined by the given
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1259 parameters.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1260 ****************************************************************************/
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1261 static void
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1262 redisplay_unmap_subwindows (struct frame* f, int x, int y, int width, int height,
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1263 Lisp_Object ignored_window)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1264 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1265 Lisp_Object rest;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1266
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1267 LIST_LOOP (rest, XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1268 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1269 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (XCAR (rest));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1270 if (IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (ii)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1271 &&
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1272 IMAGE_INSTANCE_DISPLAY_X (ii)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1273 + IMAGE_INSTANCE_DISPLAY_WIDTH (ii) > x
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1274 &&
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1275 IMAGE_INSTANCE_DISPLAY_X (ii) < x + width
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1276 &&
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1277 IMAGE_INSTANCE_DISPLAY_Y (ii)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1278 + IMAGE_INSTANCE_DISPLAY_HEIGHT (ii) > y
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1279 &&
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1280 IMAGE_INSTANCE_DISPLAY_Y (ii) < y + height
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1281 &&
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1282 !EQ (XCAR (rest), ignored_window))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1283 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1284 unmap_subwindow (XCAR (rest));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1285 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1286 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1287 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1288
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1289 /****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1290 redisplay_unmap_subwindows_maybe
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1291
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1292 Potentially subwindows from the area in the box defined by the given
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1293 parameters.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1294 ****************************************************************************/
1279
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 872
diff changeset
1295 void
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 872
diff changeset
1296 redisplay_unmap_subwindows_maybe (struct frame *f, int x, int y, int width,
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 872
diff changeset
1297 int height)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1298 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1299 if (!NILP (XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1300 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1301 redisplay_unmap_subwindows (f, x, y, width, height, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1302 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1303 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1304
1279
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 872
diff changeset
1305 static void
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 872
diff changeset
1306 redisplay_unmap_subwindows_except_us (struct frame *f, int x, int y, int width,
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 872
diff changeset
1307 int height, Lisp_Object subwindow)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1308 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1309 if (!NILP (XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1310 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1311 redisplay_unmap_subwindows (f, x, y, width, height, subwindow);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1312 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1313 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1314
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1315 /****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1316 redisplay_output_subwindow
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1317
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1318 output a subwindow. This code borrows heavily from the pixmap stuff,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1319 although is much simpler not needing to account for partial
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1320 pixmaps, backgrounds etc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1321 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1322 void
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1323 redisplay_output_subwindow (struct window *w,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1324 Lisp_Object image_instance,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1325 struct display_box* db, struct display_glyph_area* dga,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1318
diff changeset
1326 face_index findex, int UNUSED (cursor_start),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1318
diff changeset
1327 int UNUSED (cursor_width),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1318
diff changeset
1328 int UNUSED (cursor_height))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1329 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1330 Lisp_Image_Instance *p = XIMAGE_INSTANCE (image_instance);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1331 Lisp_Object window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1332 struct display_glyph_area sdga;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1333
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1334 dga->height = IMAGE_INSTANCE_HEIGHT (p);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1335 dga->width = IMAGE_INSTANCE_WIDTH (p);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1336
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1337 /* The first thing we are going to do is update the display
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1338 characteristics of the subwindow. This also clears the dirty
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1339 flags as a side effect. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1340 redisplay_subwindow (image_instance);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1341
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1342 /* This makes the glyph area fit into the display area. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1343 if (!redisplay_normalize_glyph_area (db, dga))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1344 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1345
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 665
diff changeset
1346 window = wrap_window (w);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1347
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1348 /* Clear the area the subwindow is going into. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1349 redisplay_clear_clipped_region (window, findex,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1350 db, dga, 0, image_instance);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1351
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1352 /* This shrinks the display box to exactly enclose the glyph
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1353 area. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1354 redisplay_normalize_display_box (db, dga);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1355
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1356 /* if we can't view the whole window we can't view any of it. We
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1357 have to be careful here since we may be being asked to display
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1358 part of a subwindow, the rest of which is on-screen as well. We
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1359 need to allow this case and map the entire subwindow. We also
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1360 need to be careful since the subwindow could be outside the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1361 window in the gutter or modeline - we also need to allow these
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1362 cases.*/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1363 sdga.xoffset = -dga->xoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1364 sdga.yoffset = -dga->yoffset;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1365 sdga.height = IMAGE_INSTANCE_HEIGHT (p);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1366 sdga.width = IMAGE_INSTANCE_WIDTH (p);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1367
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
1368 if (redisplay_display_boxes_in_window_p (w, db, &sdga) == 0
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
1369 ||
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
1370 /* We only want to do full subwindow display for windows that
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
1371 are completely in the gutter, otherwise we must clip to be
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
1372 safe. */
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
1373 display_boxes_in_gutter_p (XFRAME (w->frame), db, &sdga) <= 0)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1374 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1375 map_subwindow (image_instance, db->xpos, db->ypos, dga);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1376 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1377 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1378 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1379 sdga.xoffset = sdga.yoffset = 0;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1380 map_subwindow (image_instance, db->xpos - dga->xoffset,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1381 db->ypos - dga->yoffset, &sdga);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1382 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1383 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1384
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1385 /****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1386 redisplay_output_layout
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1387
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1388 Output a widget hierarchy. This can safely call itself recursively.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1389
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1390 The complexity of outputting layouts is deciding whether to do it or
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1391 not. Consider a layout enclosing some text, the text changes and is
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1392 marked as dirty, but the enclosing layout has not been marked as
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1393 dirty so no updates occur and the text will potentially be truncated.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1394 Alternatively we hold a back pointer in the image instance to the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1395 parent and mark the parent as dirty. But the layout code assumes that
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1396 if the layout is dirty then the whole layout should be redisplayed,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1397 so we then get lots of flashing even though only the text has changed
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1398 size. Of course if the text shrinks in size then we do actually need
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1399 to redisplay the layout to repaint the exposed area. So what happens
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1400 if we make a non-structural change like changing color? Either we
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1401 redisplay everything, or we redisplay nothing. These are exactly the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1402 issues lwlib has to grapple with. We really need to know what has
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1403 actually changed and make a layout decision based on that. We also
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1404 really need to know what has changed so that we can only make the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1405 necessary changes in update_subwindow. This has all now been
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1406 implemented, Viva la revolution!
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1407 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1408 void
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1409 redisplay_output_layout (Lisp_Object domain,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1410 Lisp_Object image_instance,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1411 struct display_box* db, struct display_glyph_area* dga,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1318
diff changeset
1412 face_index findex, int UNUSED (cursor_start),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1318
diff changeset
1413 int UNUSED (cursor_width), int UNUSED (cursor_height))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1414 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1415 Lisp_Image_Instance *p = XIMAGE_INSTANCE (image_instance);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1416 Lisp_Object rest, window = DOMAIN_WINDOW (domain);
3479
2b84dd8eb906 [xemacs-hg @ 2006-06-27 22:59:37 by james]
james
parents: 2500
diff changeset
1417 Ichar_dynarr *buf;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1418 struct window *w = XWINDOW (window);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1419 struct device *d = DOMAIN_XDEVICE (domain);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1420 int layout_height, layout_width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1421
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1422 layout_height = glyph_height (image_instance, domain);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1423 layout_width = glyph_width (image_instance, domain);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1424
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1425 dga->height = layout_height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1426 dga->width = layout_width;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1427 #ifdef DEBUG_WIDGET_OUTPUT
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1428 printf ("outputing layout glyph %p\n", p);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1429 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1430 /* This makes the glyph area fit into the display area. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1431 if (!redisplay_normalize_glyph_area (db, dga))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1432 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1433
3479
2b84dd8eb906 [xemacs-hg @ 2006-06-27 22:59:37 by james]
james
parents: 2500
diff changeset
1434 buf = Dynarr_new (Ichar);
2b84dd8eb906 [xemacs-hg @ 2006-06-27 22:59:37 by james]
james
parents: 2500
diff changeset
1435
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1436 /* Highly dodgy optimization. We want to only output the whole
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1437 layout if we really have to. */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1438 if (!IMAGE_INSTANCE_OPTIMIZE_OUTPUT (p)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1439 || IMAGE_INSTANCE_LAYOUT_CHANGED (p)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1440 || IMAGE_INSTANCE_WIDGET_FACE_CHANGED (p)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1441 || IMAGE_INSTANCE_SIZE_CHANGED (p)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1442 || IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (p))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1443 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1444 /* First clear the area we are drawing into. This is the easiest
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1445 thing to do since we have many gaps that we have to make sure are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1446 filled in. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1447 redisplay_clear_clipped_region (window, findex, db, dga, 1, Qnil);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1448
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1449 /* Output a border if required */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1450 if (!NILP (IMAGE_INSTANCE_LAYOUT_BORDER (p)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1451 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1452 int edges = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1453 enum edge_style style;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1454 int ypos = db->ypos;
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 851
diff changeset
1455 int xpos = db->xpos;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1456 int height = dga->height;
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 851
diff changeset
1457 int width = dga->width;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1458
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 851
diff changeset
1459 /* The bevel_area routines always draw in from the specified
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 851
diff changeset
1460 area so there is no need to adjust the displayed area to
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 851
diff changeset
1461 make sure that the lines are visible. */
4187
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
1462 if (dga->xoffset >= 0)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1463 edges |= EDGE_LEFT;
4187
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
1464 if (dga->width - dga->xoffset == layout_width)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1465 edges |= EDGE_RIGHT;
4187
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
1466 if (dga->yoffset >= 0)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1467 edges |= EDGE_TOP;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1468 if (dga->height - dga->yoffset == layout_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1469 edges |= EDGE_BOTTOM;
4187
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
1470
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1471 if (EQ (IMAGE_INSTANCE_LAYOUT_BORDER (p), Qetched_in))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1472 style = EDGE_ETCHED_IN;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1473 else if (EQ (IMAGE_INSTANCE_LAYOUT_BORDER (p), Qetched_out))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1474 style = EDGE_ETCHED_OUT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1475 else if (EQ (IMAGE_INSTANCE_LAYOUT_BORDER (p), Qbevel_in))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1476 style = EDGE_BEVEL_IN;
5581
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5515
diff changeset
1477 else if (FIXNUMP (IMAGE_INSTANCE_LAYOUT_BORDER (p)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1478 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1479 style = EDGE_ETCHED_IN;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1480 if (edges & EDGE_TOP)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1481 {
5581
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5515
diff changeset
1482 ypos += XFIXNUM (IMAGE_INSTANCE_LAYOUT_BORDER (p));
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5515
diff changeset
1483 height -= XFIXNUM (IMAGE_INSTANCE_LAYOUT_BORDER (p));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1484 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1485 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1486 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1487 style = EDGE_BEVEL_OUT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1488
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1489 MAYBE_DEVMETH (d, bevel_area,
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 851
diff changeset
1490 (w, findex, xpos, ypos, width, height,
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 851
diff changeset
1491 DEFAULT_WIDGET_SHADOW_WIDTH, edges, style));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1492 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1493 }
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1494
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1495 /* This shrinks the display box to exactly enclose the glyph
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1496 area. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1497 redisplay_normalize_display_box (db, dga);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1498
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1499 /* Flip through the widgets in the layout displaying as necessary */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1500 LIST_LOOP (rest, IMAGE_INSTANCE_LAYOUT_CHILDREN (p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1501 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1502 Lisp_Object child = glyph_image_instance (XCAR (rest), image_instance,
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 665
diff changeset
1503 ERROR_ME_DEBUG_WARN, 1);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1504
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1505 struct display_box cdb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1506 /* For losing HP-UX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1507 cdb.xpos = db->xpos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1508 cdb.ypos = db->ypos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1509 cdb.width = db->width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1510 cdb.height = db->height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1511
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1512 /* First determine if the image is visible at all */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1513 if (IMAGE_INSTANCEP (child))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1514 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1515 Lisp_Image_Instance* childii = XIMAGE_INSTANCE (child);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1516
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1517 /* The enclosing layout offsets are +ve at this point */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1518 struct display_glyph_area cdga;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1519 cdga.xoffset = IMAGE_INSTANCE_XOFFSET (childii) - dga->xoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1520 cdga.yoffset = IMAGE_INSTANCE_YOFFSET (childii) - dga->yoffset;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1521 cdga.width = glyph_width (child, image_instance);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1522 cdga.height = glyph_height (child, image_instance);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1523
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1524 IMAGE_INSTANCE_OPTIMIZE_OUTPUT (childii) =
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1525 IMAGE_INSTANCE_OPTIMIZE_OUTPUT (p);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1526
4207
62d532188a28 [xemacs-hg @ 2007-10-03 10:06:39 by didierv]
didierv
parents: 4187
diff changeset
1527 /* Although normalization is done by the output routines we have to
62d532188a28 [xemacs-hg @ 2007-10-03 10:06:39 by didierv]
didierv
parents: 4187
diff changeset
1528 do it here so that they don't try and clear all of db. This is
62d532188a28 [xemacs-hg @ 2007-10-03 10:06:39 by didierv]
didierv
parents: 4187
diff changeset
1529 true below also. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1530 if (redisplay_normalize_glyph_area (&cdb, &cdga))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1531 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1532 redisplay_normalize_display_box (&cdb, &cdga);
4207
62d532188a28 [xemacs-hg @ 2007-10-03 10:06:39 by didierv]
didierv
parents: 4187
diff changeset
1533 /* Since the display boxes will now be totally in the window if
62d532188a28 [xemacs-hg @ 2007-10-03 10:06:39 by didierv]
didierv
parents: 4187
diff changeset
1534 they are visible at all we can now check this easily. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1535 if (cdb.xpos < db->xpos || cdb.ypos < db->ypos
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1536 || cdb.xpos + cdb.width > db->xpos + db->width
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1537 || cdb.ypos + cdb.height > db->ypos + db->height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1538 continue;
4207
62d532188a28 [xemacs-hg @ 2007-10-03 10:06:39 by didierv]
didierv
parents: 4187
diff changeset
1539 /* We have to invert the offset here as normalization will have
62d532188a28 [xemacs-hg @ 2007-10-03 10:06:39 by didierv]
didierv
parents: 4187
diff changeset
1540 made them positive which the output routines will treat as a
62d532188a28 [xemacs-hg @ 2007-10-03 10:06:39 by didierv]
didierv
parents: 4187
diff changeset
1541 truly +ve offset. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1542 cdga.xoffset = -cdga.xoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1543 cdga.yoffset = -cdga.yoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1544
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1545 switch (IMAGE_INSTANCE_TYPE (childii))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1546 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1547 case IMAGE_TEXT:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1548 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1549 /* #### This is well hacked and could use some
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1550 generalisation.*/
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1551 if (redisplay_normalize_glyph_area (&cdb, &cdga)
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1552 &&
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1553 (!IMAGE_INSTANCE_OPTIMIZE_OUTPUT (childii) ||
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1554 IMAGE_INSTANCE_DIRTYP (childii)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1555 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1556 struct display_line dl; /* this is fake */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1557 Lisp_Object string =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1558 IMAGE_INSTANCE_TEXT_STRING (childii);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1559 unsigned char charsets[NUM_LEADING_BYTES];
4207
62d532188a28 [xemacs-hg @ 2007-10-03 10:06:39 by didierv]
didierv
parents: 4187
diff changeset
1560 struct face_cachel *cachel
62d532188a28 [xemacs-hg @ 2007-10-03 10:06:39 by didierv]
didierv
parents: 4187
diff changeset
1561 = WINDOW_FACE_CACHEL (w, findex);
62d532188a28 [xemacs-hg @ 2007-10-03 10:06:39 by didierv]
didierv
parents: 4187
diff changeset
1562
62d532188a28 [xemacs-hg @ 2007-10-03 10:06:39 by didierv]
didierv
parents: 4187
diff changeset
1563 DISPLAY_LINE_INIT (dl);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1564
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 863
diff changeset
1565 find_charsets_in_ibyte_string (charsets,
4207
62d532188a28 [xemacs-hg @ 2007-10-03 10:06:39 by didierv]
didierv
parents: 4187
diff changeset
1566 XSTRING_DATA (string),
62d532188a28 [xemacs-hg @ 2007-10-03 10:06:39 by didierv]
didierv
parents: 4187
diff changeset
1567 XSTRING_LENGTH (string));
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1568 ensure_face_cachel_complete (cachel, window, charsets);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1569
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 863
diff changeset
1570 convert_ibyte_string_into_ichar_dynarr
4207
62d532188a28 [xemacs-hg @ 2007-10-03 10:06:39 by didierv]
didierv
parents: 4187
diff changeset
1571 (XSTRING_DATA (string), XSTRING_LENGTH (string),
62d532188a28 [xemacs-hg @ 2007-10-03 10:06:39 by didierv]
didierv
parents: 4187
diff changeset
1572 buf);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1573
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1574 redisplay_normalize_display_box (&cdb, &cdga);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1575 /* Offsets are now +ve again so be careful
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1576 when fixing up the display line. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1577 /* Munge boxes into display lines. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1578 dl.ypos = (cdb.ypos - cdga.yoffset)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1579 + glyph_ascent (child, image_instance);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1580 dl.ascent = glyph_ascent (child, image_instance);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1581 dl.descent = glyph_descent (child, image_instance);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1582 dl.top_clip = cdga.yoffset;
4207
62d532188a28 [xemacs-hg @ 2007-10-03 10:06:39 by didierv]
didierv
parents: 4187
diff changeset
1583 dl.clip = (dl.ypos + dl.descent)
62d532188a28 [xemacs-hg @ 2007-10-03 10:06:39 by didierv]
didierv
parents: 4187
diff changeset
1584 - (cdb.ypos + cdb.height);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1585 /* output_string doesn't understand offsets in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1586 the same way as other routines - we have to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1587 add the offset to the width so that we
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1588 output the full string. */
4207
62d532188a28 [xemacs-hg @ 2007-10-03 10:06:39 by didierv]
didierv
parents: 4187
diff changeset
1589 MAYBE_DEVMETH (d, output_string,
62d532188a28 [xemacs-hg @ 2007-10-03 10:06:39 by didierv]
didierv
parents: 4187
diff changeset
1590 (w, &dl, buf, cdb.xpos,
62d532188a28 [xemacs-hg @ 2007-10-03 10:06:39 by didierv]
didierv
parents: 4187
diff changeset
1591 cdga.xoffset, cdb.xpos,
62d532188a28 [xemacs-hg @ 2007-10-03 10:06:39 by didierv]
didierv
parents: 4187
diff changeset
1592 cdga.width + cdga.xoffset,
62d532188a28 [xemacs-hg @ 2007-10-03 10:06:39 by didierv]
didierv
parents: 4187
diff changeset
1593 findex, 0, 0, 0, 0));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1594 Dynarr_reset (buf);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1595 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1596 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1597 break;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1598
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1599 case IMAGE_MONO_PIXMAP:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1600 case IMAGE_COLOR_PIXMAP:
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1601 if (!IMAGE_INSTANCE_OPTIMIZE_OUTPUT (childii)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1602 || IMAGE_INSTANCE_DIRTYP (childii))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1603 redisplay_output_pixmap (w, child, &cdb, &cdga, findex,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1604 0, 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1605 break;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1606
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1607 case IMAGE_WIDGET:
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1608 if (EQ (IMAGE_INSTANCE_WIDGET_TYPE (childii), Qlayout))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1609 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1610 redisplay_output_layout (image_instance, child, &cdb, &cdga, findex,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1611 0, 0, 0);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1612 break;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1613 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1614 case IMAGE_SUBWINDOW:
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1615 if (!IMAGE_INSTANCE_OPTIMIZE_OUTPUT (childii) ||
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1616 IMAGE_INSTANCE_DIRTYP (childii))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1617 redisplay_output_subwindow (w, child, &cdb, &cdga, findex,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1618 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1619 break;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1620
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1621 case IMAGE_NOTHING:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1622 /* nothing is as nothing does */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1623 break;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1624
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1625 case IMAGE_POINTER:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1626 default:
2500
3d8143fc88e1 [xemacs-hg @ 2005-01-24 23:33:30 by ben]
ben
parents: 2286
diff changeset
1627 ABORT ();
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1628 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1629 }
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1630 IMAGE_INSTANCE_OPTIMIZE_OUTPUT (childii) = 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1631 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1632 }
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1633
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1634 /* Update any display properties. I'm not sure whether this actually
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1635 does anything for layouts except clear the changed flags. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1636 redisplay_subwindow (image_instance);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1637
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1638 Dynarr_free (buf);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1639 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1640
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1641 /****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1642 redisplay_output_pixmap
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1643
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1644
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1645 output a pixmap.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1646 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1647 void
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1648 redisplay_output_pixmap (struct window *w,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1649 Lisp_Object image_instance,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1650 struct display_box* db, struct display_glyph_area* dga,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1651 face_index findex, int cursor_start, int cursor_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1652 int cursor_height, int offset_bitmap)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1653 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1654 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1655 struct device *d = XDEVICE (f->device);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1656 Lisp_Image_Instance *p = XIMAGE_INSTANCE (image_instance);
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 665
diff changeset
1657 Lisp_Object window = wrap_window (w);
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 665
diff changeset
1658
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1659
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1660 dga->height = IMAGE_INSTANCE_PIXMAP_HEIGHT (p);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1661 dga->width = IMAGE_INSTANCE_PIXMAP_WIDTH (p);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1662
819
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1663 #ifdef DEBUG_REDISPLAY
5090
0ca81354c4c7 Further frame-geometry cleanups
Ben Wing <ben@xemacs.org>
parents: 5080
diff changeset
1664 printf ("redisplay_output_pixmap(request) [%dx%d@%d+%d] in [%dx%d@%d+%d]\n",
819
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1665 db->width, db->height, db->xpos, db->ypos,
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1666 dga->width, dga->height, dga->xoffset, dga->yoffset);
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1667 #endif
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1668
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1669 /* This makes the glyph area fit into the display area. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1670 if (!redisplay_normalize_glyph_area (db, dga))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1671 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1672
819
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1673 #ifdef DEBUG_REDISPLAY
5090
0ca81354c4c7 Further frame-geometry cleanups
Ben Wing <ben@xemacs.org>
parents: 5080
diff changeset
1674 printf ("redisplay_output_pixmap(normalized) [%dx%d@%d+%d] in [%dx%d@%d+%d]\n",
819
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1675 db->width, db->height, db->xpos, db->ypos,
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1676 dga->width, dga->height, dga->xoffset, dga->yoffset);
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1677 #endif
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1678
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1679 /* Clear the area the pixmap is going into. The pixmap itself will
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1680 always take care of the full width. We don't want to clear where
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1681 it is going to go in order to avoid flicker. So, all we have to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1682 take care of is any area above or below the pixmap. If the pixmap
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1683 has a mask in which case we have to clear the whole damn thing
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1684 since we can't yet clear just the area not included in the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1685 mask. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1686 if (!offset_bitmap)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1687 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1688 redisplay_clear_clipped_region (window, findex,
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1689 db, dga,
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1690 (IMAGE_INSTANCE_PIXMAP_MASK (p) != 0),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1691 Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1692
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1693 /* This shrinks the display box to exactly enclose the glyph
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1694 area. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1695 redisplay_normalize_display_box (db, dga);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1696 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1697 assert (db->xpos >= 0 && db->ypos >= 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1698
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1699 MAYBE_DEVMETH (d, output_pixmap, (w, image_instance,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1700 db, dga,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1701 findex, cursor_start,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1702 cursor_width, cursor_height,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1703 offset_bitmap));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1704 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1705
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1706 /****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1707 redisplay_clear_region
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1708
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1709 Clear the area in the box defined by the given parameters using the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1710 given face. This has been generalised so that subwindows can be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1711 coped with effectively.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1712 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1713 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1714 redisplay_clear_region (Lisp_Object locale, face_index findex, int x, int y,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1715 int width, int height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1716 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1717 struct window *w = NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1718 struct frame *f = NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1719 struct device *d;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1720 Lisp_Object background_pixmap = Qunbound;
5080
5502045ec510 The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents: 5074
diff changeset
1721 Lisp_Object background_placement = Qunbound;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1722 Lisp_Object fcolor = Qnil, bcolor = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1723
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1724 if (!width || !height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1725 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1726
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1727 if (WINDOWP (locale))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1728 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1729 w = XWINDOW (locale);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1730 f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1731 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1732 else if (FRAMEP (locale))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1733 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1734 w = NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1735 f = XFRAME (locale);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1736 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1737 else
2500
3d8143fc88e1 [xemacs-hg @ 2005-01-24 23:33:30 by ben]
ben
parents: 2286
diff changeset
1738 ABORT ();
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1739
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1740 d = XDEVICE (f->device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1741
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1742 /* if we have subwindows in the region we have to unmap them */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1743 redisplay_unmap_subwindows_maybe (f, x, y, width, height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1744
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1745 /* #### This isn't quite right for when this function is called
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1746 from the toolbar code. */
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1747
5090
0ca81354c4c7 Further frame-geometry cleanups
Ben Wing <ben@xemacs.org>
parents: 5080
diff changeset
1748 /* #### GEOM! This uses a backing pixmap in the gutter. Correct? */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1749 /* Don't use a backing pixmap in the border area */
5090
0ca81354c4c7 Further frame-geometry cleanups
Ben Wing <ben@xemacs.org>
parents: 5080
diff changeset
1750 if (x >= FRAME_LEFT_INTERNAL_BORDER_END (f)
0ca81354c4c7 Further frame-geometry cleanups
Ben Wing <ben@xemacs.org>
parents: 5080
diff changeset
1751 && x < FRAME_RIGHT_INTERNAL_BORDER_START (f)
0ca81354c4c7 Further frame-geometry cleanups
Ben Wing <ben@xemacs.org>
parents: 5080
diff changeset
1752 && y >= FRAME_TOP_INTERNAL_BORDER_END (f)
0ca81354c4c7 Further frame-geometry cleanups
Ben Wing <ben@xemacs.org>
parents: 5080
diff changeset
1753 && y < FRAME_BOTTOM_INTERNAL_BORDER_START (f))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1754 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1755 Lisp_Object temp;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1756
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1757 if (w)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1758 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1759 temp = WINDOW_FACE_CACHEL_BACKGROUND_PIXMAP (w, findex);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1760
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1761 if (IMAGE_INSTANCEP (temp)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1762 && IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (temp)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1763 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1764 /* #### maybe we could implement such that a string
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1765 can be a background pixmap? */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1766 background_pixmap = temp;
5080
5502045ec510 The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents: 5074
diff changeset
1767 background_placement
5502045ec510 The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents: 5074
diff changeset
1768 = WINDOW_FACE_CACHEL_BACKGROUND_PLACEMENT (w, findex);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1769 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1770 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1771 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1772 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1773 temp = FACE_BACKGROUND_PIXMAP (Vdefault_face, locale);
5080
5502045ec510 The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents: 5074
diff changeset
1774
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1775 if (IMAGE_INSTANCEP (temp)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1776 && IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (temp)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1777 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1778 background_pixmap = temp;
5080
5502045ec510 The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents: 5074
diff changeset
1779 background_placement
5502045ec510 The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents: 5074
diff changeset
1780 = FACE_BACKGROUND_PLACEMENT (Vdefault_face, locale);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1781 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1782 }
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1783 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1784
5080
5502045ec510 The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents: 5074
diff changeset
1785 if (!UNBOUNDP (background_pixmap)
5502045ec510 The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents: 5074
diff changeset
1786 && XIMAGE_INSTANCE_PIXMAP_DEPTH (background_pixmap) == 0)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1787 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1788 if (w)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1789 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1790 fcolor = WINDOW_FACE_CACHEL_FOREGROUND (w, findex);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1791 bcolor = WINDOW_FACE_CACHEL_BACKGROUND (w, findex);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1792 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1793 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1794 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1795 fcolor = FACE_FOREGROUND (Vdefault_face, locale);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1796 bcolor = FACE_BACKGROUND (Vdefault_face, locale);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1797 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1798 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1799 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1800 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1801 fcolor = (w ?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1802 WINDOW_FACE_CACHEL_BACKGROUND (w, findex) :
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1803 FACE_BACKGROUND (Vdefault_face, locale));
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1804
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1805 }
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1806
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1807 if (UNBOUNDP (background_pixmap))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1808 background_pixmap = Qnil;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1809
5515
f87be7ddd60d Simplify clear_region interface.
Didier Verna <didier@lrde.epita.fr>
parents: 5402
diff changeset
1810 DEVMETH (d, clear_region, (locale, f, findex, x, y, width, height,
5080
5502045ec510 The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents: 5074
diff changeset
1811 fcolor, bcolor,
5502045ec510 The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents: 5074
diff changeset
1812 background_pixmap, background_placement));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1813 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1814
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1815 /****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1816 redisplay_clear_clipped_region
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1817
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1818 Clear the area in the dest display_box not covered by the src
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1819 display_glyph_area using the given face. This is a common occurrence
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1820 for images shorter than the display line. Clipping can be played
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1821 around with by altering these. glyphsrc should be normalized.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1822 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1823 static void
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1824 redisplay_clear_clipped_region (Lisp_Object window, face_index findex,
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1825 struct display_box* dest, struct display_glyph_area* glyphsrc,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1826 int fullheight_p, Lisp_Object ignored_subwindow)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1827 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1828 /* assume dest->xpos >= 0 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1829 int clear_x;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1830 struct frame* f = XFRAME (XWINDOW (window)->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1831
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1832 if (glyphsrc->xoffset > 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1833 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1834 clear_x = dest->xpos + glyphsrc->xoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1835 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1836 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1837 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1838 clear_x = dest->xpos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1839 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1840
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1841 /* If we need the whole height cleared then just do it. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1842 if (fullheight_p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1843 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1844 redisplay_clear_region (window, findex, clear_x, dest->ypos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1845 glyphsrc->width, dest->height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1846 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1847 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1848 {
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1849 int yoffset = (glyphsrc->yoffset > 0 ? glyphsrc->yoffset : 0);
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1850
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1851 /* We need to make sure that subwindows are unmapped from the
4187
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
1852 whole area. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1853 redisplay_unmap_subwindows_except_us (f, clear_x, dest->ypos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1854 glyphsrc->width, dest->height,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1855 ignored_subwindow);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1856 /* first the top box */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1857 if (yoffset > 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1858 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1859 redisplay_clear_region (window, findex, clear_x, dest->ypos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1860 glyphsrc->width, yoffset);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1861
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1862 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1863 /* Then the bottom box */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1864 if (yoffset + glyphsrc->height < dest->height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1865 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1866 redisplay_clear_region (window, findex, clear_x,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1867 dest->ypos + yoffset + glyphsrc->height,
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1868 glyphsrc->width,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1869 dest->height - (yoffset + glyphsrc->height));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1870
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1871 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1872 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1873 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1874
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1875 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1876 redisplay_normalize_glyph_area
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1877 redisplay_normalize_display_box
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1878
819
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1879 Calculate the visible box for displaying glyphsrc in dest.
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1880
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1881 display_box and display_glyph_area are used to represent an area to
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1882 displayed and where to display it. Using these two structures all
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1883 combinations of clipping and position can be accommodated.
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1884
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1885 dest - display_box
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1886
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1887 xpos - absolute horizontal position of area.
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1888
4187
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
1889 ypos - absolute vertical position of area.
819
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1890
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1891 glyphsrc - display_glyph_area
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1892
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1893 xoffset - horizontal offset of the glyph, +ve means display
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1894 the glyph with the x position offset by xoffset, -ve means
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1895 display starting xoffset into the glyph.
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1896
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1897 yoffset - vertical offset of the glyph, +ve means display the
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1898 glyph with y position offset by yoffset, -ve means display
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1899 starting xoffset into the glyph.
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1900
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1901 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1902 int
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1903 redisplay_normalize_glyph_area (struct display_box* dest,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1904 struct display_glyph_area* glyphsrc)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1905 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1906 if (dest->xpos + glyphsrc->xoffset > dest->xpos + dest->width
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1907 ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1908 dest->ypos + glyphsrc->yoffset > dest->ypos + dest->height
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1909 ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1910 -glyphsrc->xoffset >= glyphsrc->width
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1911 ||
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1912 -glyphsrc->yoffset >= glyphsrc->height
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1913 ||
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1914 /* #### Not sure why this wasn't coped with before but normalizing
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1915 to zero width or height is definitely wrong. */
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1916 (dest->xpos + glyphsrc->xoffset + glyphsrc->width > dest->xpos + dest->width
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1917 &&
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1918 dest->width - glyphsrc->xoffset <= 0)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1919 ||
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1920 (dest->ypos + glyphsrc->yoffset + glyphsrc->height > dest->ypos + dest->height
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1921 &&
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1922 dest->height - glyphsrc->yoffset <= 0))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1923 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1924 /* It's all clipped out */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1925 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1926 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1927
819
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1928 /* Horizontal offsets. This works because xoffset can be -ve as well
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1929 as +ve. When we enter this function the glyphsrc width and
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1930 height are set to the actual glyph width and height irrespective
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1931 of how much can be displayed. We are trying to clip both the
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1932 offset into the image and the rightmost bounding box. Its
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1933 possible for the glyph width to be much larger than the area we
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1934 are displaying into (e.g. a large glyph in a small frame). */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1935 if (dest->xpos + glyphsrc->xoffset + glyphsrc->width > dest->xpos + dest->width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1936 {
819
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1937 /* glyphsrc offset is +ve we are trying to display offset from the
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1938 origin (the bounding box contains some space and then the
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1939 glyph). At most the width we want to display is dest->width -
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1940 glyphsrc->xoffset. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1941 if (glyphsrc->xoffset > 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1942 glyphsrc->width = dest->width - glyphsrc->xoffset;
819
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1943 /* glyphsrc offset is -ve we are trying to display hard up
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1944 against the dest corner inset into the glyphsrc by
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1945 xoffset.*/
4187
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
1946 else if (glyphsrc->xoffset < 0)
819
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1947 {
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1948 glyphsrc->width += glyphsrc->xoffset;
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1949 glyphsrc->width = min (glyphsrc->width, dest->width);
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1950 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1951 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1952 glyphsrc->width = dest->width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1953 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1954
4187
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
1955 else if (glyphsrc->xoffset < 0)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1956 glyphsrc->width += glyphsrc->xoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1957
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1958 /* Vertical offsets. This works because yoffset can be -ve as well as +ve */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1959 if (dest->ypos + glyphsrc->yoffset + glyphsrc->height > dest->ypos + dest->height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1960 {
819
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1961 if ((glyphsrc->yoffset > 0) && (dest->height > glyphsrc->yoffset))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1962 glyphsrc->height = dest->height - glyphsrc->yoffset;
4187
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
1963 else if (glyphsrc->yoffset < 0)
819
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1964 {
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1965 glyphsrc->height += glyphsrc->yoffset;
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1966 glyphsrc->height = min (glyphsrc->height, dest->height);
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1967 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1968 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1969 glyphsrc->height = dest->height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1970 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1971
819
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1972 else if (glyphsrc->yoffset < 0)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1973 glyphsrc->height += glyphsrc->yoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1974
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1975 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1976 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1977
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1978 static void
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1979 redisplay_normalize_display_box (struct display_box* dest,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1980 struct display_glyph_area* glyphsrc)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1981 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1982 /* Adjust the destination area. At the end of this the destination
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1983 area will exactly enclose the glyph area. The only remaining
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1984 adjustment will be offsets into the glyph area. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1985
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1986 /* Horizontal adjustment. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1987 if (glyphsrc->xoffset > 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1988 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1989 dest->xpos += glyphsrc->xoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1990 dest->width -= glyphsrc->xoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1991 glyphsrc->xoffset = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1992 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1993 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1994 glyphsrc->xoffset = -glyphsrc->xoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1995
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1996 if (glyphsrc->width < dest->width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1997 dest->width = glyphsrc->width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1998
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1999 /* Vertical adjustment. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2000 if (glyphsrc->yoffset > 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2001 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2002 dest->ypos += glyphsrc->yoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2003 dest->height -= glyphsrc->yoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2004 glyphsrc->yoffset = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2005 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2006 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2007 glyphsrc->yoffset = -glyphsrc->yoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2008
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2009 if (glyphsrc->height < dest->height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2010 dest->height = glyphsrc->height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2011 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2012
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2013 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2014 redisplay_display_boxes_in_window_p
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2015
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
2016 Determine whether the required display_glyph_area is completely inside
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
2017 the window. -1 means the display_box is not in the window. 1 means the
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
2018 display_box and the display_glyph_area are in the window. 0 means
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2019 the display_box is in the window but the display_glyph_area is not.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2020 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2021 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2022 redisplay_display_boxes_in_window_p (struct window* w,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2023 struct display_box* db,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2024 struct display_glyph_area* dga)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2025 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2026 int left = WINDOW_TEXT_LEFT (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2027 int right = WINDOW_TEXT_RIGHT (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2028 int top = WINDOW_TEXT_TOP (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2029 int bottom = WINDOW_TEXT_BOTTOM (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2030
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2031 if (db->xpos < left || db->ypos < top
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2032 || db->xpos + db->width > right
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2033 || db->ypos + db->height > bottom)
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
2034 /* We are not displaying in a window at all */
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
2035 return -1;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
2036
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2037 if (db->xpos + dga->xoffset >= left
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2038 &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2039 db->ypos + dga->yoffset >= top
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2040 &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2041 db->xpos + dga->xoffset + dga->width <= right
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2042 &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2043 db->ypos + dga->yoffset + dga->height <= bottom)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2044 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2045
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
2046 return 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2047 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2048
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2049 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2050 redisplay_calculate_display_boxes
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2051
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2052 Convert from rune/display_line co-ordinates to display_box
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2053 co-ordinates.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2054 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2055 int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2056 redisplay_calculate_display_boxes (struct display_line *dl, int xpos,
819
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
2057 int xoffset, int yoffset, int start_pixpos,
4187
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
2058 int width, struct display_box* dest,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2059 struct display_glyph_area* src)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2060 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2061 dest->xpos = xpos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2062 dest->ypos = DISPLAY_LINE_YPOS (dl);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2063 dest->width = width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2064 dest->height = DISPLAY_LINE_HEIGHT (dl);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2065
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2066 src->xoffset = -xoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2067 src->width = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2068 src->height = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2069
819
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
2070 src->yoffset = -dl->top_clip + yoffset;
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
2071
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2072 if (start_pixpos >=0 && start_pixpos > xpos)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2073 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2074 /* Oops, we're asking for a start outside of the displayable
4187
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
2075 area. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2076 if (start_pixpos > xpos + width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2077 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2078 dest->xpos = start_pixpos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2079 dest->width -= (start_pixpos - xpos);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2080 /* Offsets are -ve when we want to clip pixels off the displayed
4187
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
2081 glyph. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2082 src->xoffset -= (start_pixpos - xpos);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2083 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2084
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2085 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2086 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2087
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2088 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2089 redisplay_clear_top_of_window
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2090
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2091 If window is topmost, clear the internal border above it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2092 ****************************************************************************/
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
2093 void
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2094 redisplay_clear_top_of_window (struct window *w)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2095 {
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 665
diff changeset
2096 Lisp_Object window = wrap_window (w);
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 665
diff changeset
2097
5090
0ca81354c4c7 Further frame-geometry cleanups
Ben Wing <ben@xemacs.org>
parents: 5080
diff changeset
2098 /* #### GEOM! FIXME #### This is definitely wrong. It was clearly not
0ca81354c4c7 Further frame-geometry cleanups
Ben Wing <ben@xemacs.org>
parents: 5080
diff changeset
2099 fixed up to accommodate the gutter. The internal border width is now
0ca81354c4c7 Further frame-geometry cleanups
Ben Wing <ben@xemacs.org>
parents: 5080
diff changeset
2100 no longer adjacent to the leftmost window, since the gutter
0ca81354c4c7 Further frame-geometry cleanups
Ben Wing <ben@xemacs.org>
parents: 5080
diff changeset
2101 intervenes. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2102 if (!NILP (Fwindow_highest_p (window)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2103 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2104 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2105 int x, y, width, height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2106
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2107 x = w->pixel_left;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2108 width = w->pixel_width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2109
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2110 if (window_is_leftmost (w))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2111 {
5045
c3cc3fa503a2 more frame-sizing cleanups
Ben Wing <ben@xemacs.org>
parents: 4967
diff changeset
2112 x -= FRAME_INTERNAL_BORDER_WIDTH (f);
c3cc3fa503a2 more frame-sizing cleanups
Ben Wing <ben@xemacs.org>
parents: 4967
diff changeset
2113 width += FRAME_INTERNAL_BORDER_WIDTH (f);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2114 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2115 if (window_is_rightmost (w))
5045
c3cc3fa503a2 more frame-sizing cleanups
Ben Wing <ben@xemacs.org>
parents: 4967
diff changeset
2116 width += FRAME_INTERNAL_BORDER_WIDTH (f);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2117
5090
0ca81354c4c7 Further frame-geometry cleanups
Ben Wing <ben@xemacs.org>
parents: 5080
diff changeset
2118 /* #### This off-by-one stuff also occurs in XLIKE_clear_frame(). */
0ca81354c4c7 Further frame-geometry cleanups
Ben Wing <ben@xemacs.org>
parents: 5080
diff changeset
2119 y = FRAME_TOP_INTERNAL_BORDER_START (f) - 1;
5045
c3cc3fa503a2 more frame-sizing cleanups
Ben Wing <ben@xemacs.org>
parents: 4967
diff changeset
2120 height = FRAME_INTERNAL_BORDER_HEIGHT (f) + 1;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2121
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2122 redisplay_clear_region (window, DEFAULT_INDEX, x, y, width, height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2123 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2124 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2125
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2126 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2127 redisplay_clear_to_window_end
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2128
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2129 Clear the area between ypos1 and ypos2. Each margin area and the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2130 text area is handled separately since they may each have their own
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2131 background color.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2132 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2133 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2134 redisplay_clear_to_window_end (struct window *w, int ypos1, int ypos2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2135 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2136 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2137 struct device *d = XDEVICE (f->device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2138
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2139 if (HAS_DEVMETH_P (d, clear_to_window_end))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2140 DEVMETH (d, clear_to_window_end, (w, ypos1, ypos2));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2141 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2142 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2143 int height = ypos2 - ypos1;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
2144
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2145 if (height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2146 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2147 Lisp_Object window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2148 int bflag = 0 ; /* (window_needs_vertical_divider (w) ? 0 : 1);*/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2149 layout_bounds bounds;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
2150
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2151 bounds = calculate_display_line_boundaries (w, bflag);
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 665
diff changeset
2152 window = wrap_window (w);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2153
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2154 if (window_is_leftmost (w))
5090
0ca81354c4c7 Further frame-geometry cleanups
Ben Wing <ben@xemacs.org>
parents: 5080
diff changeset
2155 redisplay_clear_region (window, DEFAULT_INDEX,
0ca81354c4c7 Further frame-geometry cleanups
Ben Wing <ben@xemacs.org>
parents: 5080
diff changeset
2156 FRAME_LEFT_INTERNAL_BORDER_START (f),
0ca81354c4c7 Further frame-geometry cleanups
Ben Wing <ben@xemacs.org>
parents: 5080
diff changeset
2157 ypos1, FRAME_INTERNAL_BORDER_WIDTH (f),
0ca81354c4c7 Further frame-geometry cleanups
Ben Wing <ben@xemacs.org>
parents: 5080
diff changeset
2158 height);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
2159
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2160 if (bounds.left_in - bounds.left_out > 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2161 redisplay_clear_region (window,
5090
0ca81354c4c7 Further frame-geometry cleanups
Ben Wing <ben@xemacs.org>
parents: 5080
diff changeset
2162 get_builtin_face_cache_index
0ca81354c4c7 Further frame-geometry cleanups
Ben Wing <ben@xemacs.org>
parents: 5080
diff changeset
2163 (w, Vleft_margin_face),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2164 bounds.left_out, ypos1,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2165 bounds.left_in - bounds.left_out, height);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
2166
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2167 if (bounds.right_in - bounds.left_in > 0)
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
2168 redisplay_clear_region (window,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2169 DEFAULT_INDEX,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2170 bounds.left_in, ypos1,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2171 bounds.right_in - bounds.left_in, height);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
2172
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2173 if (bounds.right_out - bounds.right_in > 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2174 redisplay_clear_region (window,
5090
0ca81354c4c7 Further frame-geometry cleanups
Ben Wing <ben@xemacs.org>
parents: 5080
diff changeset
2175 get_builtin_face_cache_index
0ca81354c4c7 Further frame-geometry cleanups
Ben Wing <ben@xemacs.org>
parents: 5080
diff changeset
2176 (w, Vright_margin_face),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2177 bounds.right_in, ypos1,
5090
0ca81354c4c7 Further frame-geometry cleanups
Ben Wing <ben@xemacs.org>
parents: 5080
diff changeset
2178 bounds.right_out - bounds.right_in,
0ca81354c4c7 Further frame-geometry cleanups
Ben Wing <ben@xemacs.org>
parents: 5080
diff changeset
2179 height);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
2180
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2181 if (window_is_rightmost (w))
5090
0ca81354c4c7 Further frame-geometry cleanups
Ben Wing <ben@xemacs.org>
parents: 5080
diff changeset
2182 redisplay_clear_region (window, DEFAULT_INDEX,
0ca81354c4c7 Further frame-geometry cleanups
Ben Wing <ben@xemacs.org>
parents: 5080
diff changeset
2183 FRAME_RIGHT_INTERNAL_BORDER_START (f),
0ca81354c4c7 Further frame-geometry cleanups
Ben Wing <ben@xemacs.org>
parents: 5080
diff changeset
2184 ypos1, FRAME_INTERNAL_BORDER_WIDTH (f),
0ca81354c4c7 Further frame-geometry cleanups
Ben Wing <ben@xemacs.org>
parents: 5080
diff changeset
2185 height);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2186 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2187 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2188 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2189
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2190 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2191 redisplay_clear_bottom_of_window
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2192
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2193 Clear window from right below the last display line to right above
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2194 the modeline. The calling function can limit the area actually
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2195 erased by setting min_start and/or max_end to positive values.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2196 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2197 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2198 redisplay_clear_bottom_of_window (struct window *w, display_line_dynarr *ddla,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2199 int min_start, int max_end)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2200 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2201 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2202 int ypos1, ypos2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2203 int ddla_len = Dynarr_length (ddla);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2204
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2205 ypos2 = WINDOW_TEXT_BOTTOM (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2206 #ifdef HAVE_SCROLLBARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2207 /* This adjustment is to catch the intersection of any scrollbars. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2208 if (f->windows_structure_changed && NILP (w->scrollbar_on_top_p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2209 ypos2 += window_scrollbar_height (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2210 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2211
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2212 if (ddla_len)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2213 {
4967
0d4c9d0f6a8d rewrite dynarr code
Ben Wing <ben@xemacs.org>
parents: 4932
diff changeset
2214 if (ddla_len == 1 && Dynarr_begin (ddla)->modeline)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2215 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2216 ypos1 = WINDOW_TEXT_TOP (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2217 #ifdef HAVE_SCROLLBARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2218 /* This adjustment is to catch the intersection of any scrollbars. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2219 if (f->windows_structure_changed && !NILP (w->scrollbar_on_top_p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2220 ypos1 -= window_scrollbar_height (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2221 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2222 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2223 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2224 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2225 struct display_line *dl = Dynarr_atp (ddla, ddla_len - 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2226 ypos1 = dl->ypos + dl->descent - dl->clip;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2227 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2228 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2229 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2230 ypos1 = WINDOW_TEXT_TOP (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2231
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2232 /* #### See if this can be made conditional on the frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2233 changing size. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2234 if (MINI_WINDOW_P (w))
5045
c3cc3fa503a2 more frame-sizing cleanups
Ben Wing <ben@xemacs.org>
parents: 4967
diff changeset
2235 ypos2 += FRAME_INTERNAL_BORDER_HEIGHT (f);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2236
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2237 if (min_start >= 0 && ypos1 < min_start)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2238 ypos1 = min_start;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2239 if (max_end >= 0 && ypos2 > max_end)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2240 ypos2 = max_end;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2241
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2242 if (ypos2 <= ypos1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2243 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2244
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2245 redisplay_clear_to_window_end (w, ypos1, ypos2);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2246 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2247
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2248 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2249 redisplay_update_line
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2250
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2251 This is used during incremental updates to update a single line and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2252 correct the offsets on all lines below it. At the moment
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2253 update_values is false if we are only updating the modeline.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2254 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2255 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2256 redisplay_update_line (struct window *w, int first_line, int last_line,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2257 int update_values)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2258 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2259 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2260 struct device *d = XDEVICE (f->device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2261
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2262 display_line_dynarr *cdla = window_display_lines (w, CURRENT_DISP);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2263 display_line_dynarr *ddla = window_display_lines (w, DESIRED_DISP);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2264
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2265 MAYBE_DEVMETH (d, window_output_begin, (w));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2266
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2267 while (first_line <= last_line)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2268 {
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 819
diff changeset
2269 Charcount old_len = (Dynarr_atp (cdla, first_line)->end_charpos -
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 819
diff changeset
2270 Dynarr_atp (cdla, first_line)->charpos);
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 819
diff changeset
2271 Charcount new_len = (Dynarr_atp (ddla, first_line)->end_charpos -
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 819
diff changeset
2272 Dynarr_atp (ddla, first_line)->charpos);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2273
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2274 assert (Dynarr_length (cdla) == Dynarr_length (ddla));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2275
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2276 /* Output the changes. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2277 output_display_line (w, cdla, ddla, first_line, -1, -1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2278
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2279 /* Update the offsets. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2280 if (update_values)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2281 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2282 int cur_line = first_line + 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2283 while (cur_line < Dynarr_length (cdla))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2284 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2285 Dynarr_atp (cdla, cur_line)->offset += (new_len - old_len);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2286 Dynarr_atp (ddla, cur_line)->offset += (new_len - old_len);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2287 cur_line++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2288 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2289 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2290
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2291 /* Update the window_end_pos and other settings. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2292 if (update_values)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2293 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2294 w->window_end_pos[CURRENT_DISP] -= (new_len - old_len);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2295
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2296 if (Dynarr_atp (ddla, first_line)->cursor_elt != -1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2297 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2298 w->last_point_x[CURRENT_DISP] = w->last_point_x[DESIRED_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2299 w->last_point_y[CURRENT_DISP] = w->last_point_y[DESIRED_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2300 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2301 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2302
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2303 first_line++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2304 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2305
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2306 /* Update the window max line length. We have to scan the entire
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2307 set of display lines otherwise we might not detect if the max is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2308 supposed to shrink. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2309 if (update_values)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2310 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2311 int line = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2312
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2313 w->max_line_len = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2314 while (line < Dynarr_length (ddla))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2315 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2316 struct display_line *dl = Dynarr_atp (ddla, line);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2317
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2318 if (!dl->modeline)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2319 w->max_line_len = max (dl->num_chars, w->max_line_len);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2320
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2321 line++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2322 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2323 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2324
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2325 w->last_modified[CURRENT_DISP] = w->last_modified[DESIRED_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2326 w->last_facechange[CURRENT_DISP] = w->last_facechange[DESIRED_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2327 Fset_marker (w->last_point[CURRENT_DISP],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2328 Fmarker_position (w->last_point[DESIRED_DISP]), w->buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2329 Fset_marker (w->last_start[CURRENT_DISP],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2330 Fmarker_position (w->last_start[DESIRED_DISP]), w->buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2331
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2332 /* We don't bother updating the vertical scrollbars here. This
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2333 gives us a performance increase while having minimal loss of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2334 quality to the scrollbar slider size and position since when this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2335 function is called we know that the changes to the buffer were
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2336 very localized. We have to update the horizontal scrollbars,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2337 though, because this routine could cause a change which has a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2338 larger impact on their sizing. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2339 /* #### See if we can get away with only calling this if
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2340 max_line_len is greater than the window_char_width. */
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 448
diff changeset
2341 /* #### BILL!!! Should we do this for GTK as well? */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2342 #if defined(HAVE_SCROLLBARS) && defined(HAVE_X_WINDOWS)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2343 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2344 extern int stupid_vertical_scrollbar_drag_hack;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2345
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2346 update_window_scrollbars (w, NULL, 1, stupid_vertical_scrollbar_drag_hack);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2347 stupid_vertical_scrollbar_drag_hack = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2348 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2349 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2350
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2351 redisplay_redraw_cursor (f, 0);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2352 MAYBE_DEVMETH (d, window_output_end, (w));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2353 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2354
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2355 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2356 redisplay_output_window
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2357
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2358 For the given window W, ensure that the current display lines are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2359 equal to the desired display lines, outputing changes as necessary.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2360
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2361 #### Fuck me. This just isn't going to cut it for tty's. The output
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2362 decisions for them must be based on the contents of the entire frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2363 because that is how the available output capabilities think. The
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2364 solution is relatively simple. Create redisplay_output_frame. This
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2365 will basically merge all of the separate window display structs into
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2366 a single one for the frame. This combination structure will be able
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2367 to be passed to the same output_display_line which works for windows
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2368 on X frames and the right things will happen. It just takes time to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2369 do.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2370 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2371 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2372 redisplay_output_window (struct window *w)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2373 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2374 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2375 struct device *d = XDEVICE (f->device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2376
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2377 display_line_dynarr *cdla = window_display_lines (w, CURRENT_DISP);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2378 display_line_dynarr *ddla = window_display_lines (w, DESIRED_DISP);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2379
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2380 int cdla_len = Dynarr_length (cdla);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2381 int ddla_len = Dynarr_length (ddla);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2382
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2383 int line;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2384 int need_to_clear_bottom = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2385 int need_to_clear_start = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2386 int need_to_clear_end = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2387
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2388 /* Backgrounds may have changed or windows may have gone away
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2389 leaving dividers lying around. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2390 if (f->faces_changed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2391 || f->windows_structure_changed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2392 || w->shadow_thickness_changed)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2393 need_to_clear_bottom = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2394
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2395 /* The first thing we do is determine if we are going to need to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2396 clear the bottom of the window. We only need to do this if the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2397 bottom of the current display lines is below the bottom of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2398 desired display lines. Note that the number of lines is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2399 irrelevant. Only the position matters. We also clear to the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2400 bottom of the window if the modeline has shifted position. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2401 /* #### We can't blindly not clear the bottom if f->clear is true
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2402 since there might be a window-local background. However, for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2403 those cases where there isn't, clearing the end of the window in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2404 this case sucks. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2405 if (!need_to_clear_bottom)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2406 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2407 struct display_line *cdl, *ddl;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2408
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2409 /* If the modeline has changed position or size, clear the bottom
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2410 of the window. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2411 if (!need_to_clear_bottom)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2412 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2413 cdl = ddl = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2414
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2415 if (cdla_len)
4967
0d4c9d0f6a8d rewrite dynarr code
Ben Wing <ben@xemacs.org>
parents: 4932
diff changeset
2416 cdl = Dynarr_begin (cdla);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2417 if (ddla_len)
4967
0d4c9d0f6a8d rewrite dynarr code
Ben Wing <ben@xemacs.org>
parents: 4932
diff changeset
2418 ddl = Dynarr_begin (ddla);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2419
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2420 if (!cdl || !ddl)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2421 need_to_clear_bottom = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2422 else if ((!cdl->modeline && ddl->modeline)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2423 || (cdl->modeline && !ddl->modeline))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2424 need_to_clear_bottom = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2425 else if (cdl->ypos != ddl->ypos ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2426 cdl->ascent != ddl->ascent ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2427 cdl->descent != ddl->descent ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2428 cdl->clip != ddl->clip)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2429 need_to_clear_bottom = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2430
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2431 /* #### This kludge is to make sure the modeline shadows get
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2432 redrawn if the modeline position shifts. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2433 if (need_to_clear_bottom)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2434 w->shadow_thickness_changed = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2435 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2436
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2437 if (!need_to_clear_bottom)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2438 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2439 cdl = ddl = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2440
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2441 if (cdla_len)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2442 cdl = Dynarr_atp (cdla, cdla_len - 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2443 if (ddla_len)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2444 ddl = Dynarr_atp (ddla, ddla_len - 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2445
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2446 if (!cdl || !ddl)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2447 need_to_clear_bottom = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2448 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2449 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2450 int cdl_bottom, ddl_bottom;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2451
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2452 cdl_bottom = cdl->ypos + cdl->descent;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2453 ddl_bottom = ddl->ypos + ddl->descent;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2454
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2455 if (cdl_bottom > ddl_bottom)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2456 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2457 need_to_clear_bottom = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2458 need_to_clear_start = ddl_bottom;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2459 need_to_clear_end = cdl_bottom;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2460 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2461 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2462 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2463 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2464
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2465 /* Perform any output initialization. */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2466 MAYBE_DEVMETH (d, window_output_begin, (w));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2467
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2468 /* If the window's structure has changed clear the internal border
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2469 above it if it is topmost (the function will check). */
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
2470 if (f->windows_structure_changed || f->faces_changed)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2471 redisplay_clear_top_of_window (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2472
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2473 /* Output each line. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2474 for (line = 0; line < Dynarr_length (ddla); line++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2475 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2476 output_display_line (w, cdla, ddla, line, -1, -1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2477 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2478
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2479 /* If the number of display lines has shrunk, adjust. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2480 if (cdla_len > ddla_len)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2481 {
5038
9410323e4b0d major dynarr fixes
Ben Wing <ben@xemacs.org>
parents: 4967
diff changeset
2482 Dynarr_set_lengthr (cdla, ddla_len);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2483 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2484
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2485 /* Output a vertical divider between windows, if necessary. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2486 if (window_needs_vertical_divider (w)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2487 && (f->windows_structure_changed || f->clear))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2488 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2489 MAYBE_DEVMETH (d, output_vertical_divider, (w, f->windows_structure_changed));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2490 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2491
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2492 /* Clear the rest of the window, if necessary. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2493 if (need_to_clear_bottom)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2494 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2495 redisplay_clear_bottom_of_window (w, ddla, need_to_clear_start,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2496 need_to_clear_end);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2497 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2498
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2499 w->window_end_pos[CURRENT_DISP] = w->window_end_pos[DESIRED_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2500 Fset_marker (w->start[CURRENT_DISP],
5581
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5515
diff changeset
2501 make_fixnum (marker_position (w->start[DESIRED_DISP])),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2502 w->buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2503 Fset_marker (w->pointm[CURRENT_DISP],
5581
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5515
diff changeset
2504 make_fixnum (marker_position (w->pointm[DESIRED_DISP])),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2505 w->buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2506 w->last_modified[CURRENT_DISP] = w->last_modified[DESIRED_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2507 w->last_facechange[CURRENT_DISP] = w->last_facechange[DESIRED_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2508 Fset_marker (w->last_start[CURRENT_DISP],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2509 Fmarker_position (w->last_start[DESIRED_DISP]), w->buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2510 Fset_marker (w->last_point[CURRENT_DISP],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2511 Fmarker_position (w->last_point[DESIRED_DISP]), w->buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2512 w->last_point_x[CURRENT_DISP] = w->last_point_x[DESIRED_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2513 w->last_point_y[CURRENT_DISP] = w->last_point_y[DESIRED_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2514 w->shadow_thickness_changed = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2515
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2516 set_window_display_buffer (w, XBUFFER (w->buffer));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2517 find_window_mirror (w)->truncate_win = window_truncation_on (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2518
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2519 /* Overkill on invalidating the cache. It is very bad for it to not
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2520 get invalidated when it should be. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2521 INVALIDATE_DEVICE_PIXEL_TO_GLYPH_CACHE (d);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2522
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2523 redisplay_redraw_cursor (f, 0);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2524 MAYBE_DEVMETH (d, window_output_end, (w));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2525
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2526 #ifdef HAVE_SCROLLBARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2527 update_window_scrollbars (w, NULL, !MINI_WINDOW_P (w), 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2528 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2529 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2530
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2531 /*****************************************************************************
1318
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2532 redisplay_redraw_exposed_window
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2533
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2534 Given a bounding box for an area that needs to be redrawn, determine
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2535 what parts of what lines are contained within and re-output their
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2536 contents.
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2537 ****************************************************************************/
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2538 static void
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2539 redisplay_redraw_exposed_window (struct window *w, int x, int y, int width,
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2540 int height)
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2541 {
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2542 struct frame *f = XFRAME (w->frame);
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2543 int line;
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2544 int start_x, start_y, end_x, end_y;
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2545 int orig_windows_structure_changed;
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2546
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2547 display_line_dynarr *cdla = window_display_lines (w, CURRENT_DISP);
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2548
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2549 if (!NILP (w->vchild))
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2550 {
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2551 redisplay_redraw_exposed_windows (w->vchild, x, y, width, height);
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2552 return;
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2553 }
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2554 else if (!NILP (w->hchild))
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2555 {
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2556 redisplay_redraw_exposed_windows (w->hchild, x, y, width, height);
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2557 return;
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2558 }
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2559
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2560 /* If the window doesn't intersect the exposed region, we're done here. */
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2561 if (x >= WINDOW_RIGHT (w) || (x + width) <= WINDOW_LEFT (w)
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2562 || y >= WINDOW_BOTTOM (w) || (y + height) <= WINDOW_TOP (w))
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2563 {
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2564 return;
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2565 }
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2566 else
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2567 {
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2568 start_x = max (WINDOW_LEFT (w), x);
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2569 end_x = min (WINDOW_RIGHT (w), (x + width));
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2570 start_y = max (WINDOW_TOP (w), y);
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2571 end_y = min (WINDOW_BOTTOM (w), y + height);
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2572
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2573 /* We do this to make sure that the 3D modelines get redrawn if
4187
26dccfc8fa60 [xemacs-hg @ 2007-09-26 13:27:59 by didierv]
didierv
parents: 3479
diff changeset
2574 they are in the exposed region. */
1318
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2575 orig_windows_structure_changed = f->windows_structure_changed;
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2576 f->windows_structure_changed = 1;
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2577 }
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2578
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2579 /* #### Not in GTK or MS Windows. I think is because of toolbars, which
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2580 are handled as widgets in GTK and MS Windows, but drawn ourselves in
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2581 X. For the moment I'm leaving this in, if it causes problems we have
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2582 some device method indicating whether we're drawing our own
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2583 toolbars. */
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2584 redisplay_clear_top_of_window (w);
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2585 if (window_needs_vertical_divider (w))
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2586 {
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2587 FRAMEMETH (f, output_vertical_divider, (w, 0));
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2588 }
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2589
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2590 for (line = 0; line < Dynarr_length (cdla); line++)
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2591 {
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2592 struct display_line *cdl = Dynarr_atp (cdla, line);
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2593 int top_y = DISPLAY_LINE_YPOS (cdl);
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2594 int bottom_y = DISPLAY_LINE_YPOS (cdl) + DISPLAY_LINE_HEIGHT (cdl);
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2595
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2596 if (bottom_y >= start_y)
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2597 {
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2598 if (top_y > end_y)
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2599 {
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2600 if (line == 0)
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2601 continue;
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2602 else
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2603 break;
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2604 }
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2605 else
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2606 {
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2607 output_display_line (w, 0, cdla, line, start_x, end_x);
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2608 }
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2609 }
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2610 }
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2611
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2612 f->windows_structure_changed = orig_windows_structure_changed;
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2613
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2614 /* If there have never been any face cache_elements created, then this
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2615 expose event doesn't actually have anything to do. */
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2616 if (Dynarr_largest (w->face_cachels))
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2617 redisplay_clear_bottom_of_window (w, cdla, start_y, end_y);
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2618
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2619 #ifdef HAVE_SCROLLBARS
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2620 MAYBE_FRAMEMETH (f, redisplay_deadbox, (w, x, y, width, height));
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2621 #endif
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2622 }
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2623
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2624
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2625 /*****************************************************************************
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2626 redisplay_redraw_exposed_windows
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2627
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2628 For each window beneath the given window in the window hierarchy,
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2629 ensure that it is redrawn if necessary after an Expose event.
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2630 ****************************************************************************/
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2631 static void
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2632 redisplay_redraw_exposed_windows (Lisp_Object window, int x, int y, int width,
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2633 int height)
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2634 {
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2635 for (; !NILP (window); window = XWINDOW (window)->next)
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2636 redisplay_redraw_exposed_window (XWINDOW (window), x, y, width, height);
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2637 }
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2638
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2639 static void
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2640 redisplay_redraw_exposed_area_1 (Lisp_Object arg)
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2641 {
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2642 assert (!in_display);
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2643 redisplay_redraw_exposed_area (XFRAME (X1ST (arg)),
5581
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5515
diff changeset
2644 XFIXNUM (X2ND (arg)),
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5515
diff changeset
2645 XFIXNUM (X3RD (arg)),
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5515
diff changeset
2646 XFIXNUM (X4TH (arg)),
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5515
diff changeset
2647 XFIXNUM (X5TH (arg)));
1318
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2648 free_list (arg);
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2649 }
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2650
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2651 /*****************************************************************************
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2652 redisplay_redraw_exposed_area
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2653
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2654 For each window on the given frame, ensure that any area in the
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2655 Exposed area is redrawn.
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2656 ****************************************************************************/
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2657 void
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2658 redisplay_redraw_exposed_area (struct frame *f, int x, int y, int width,
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2659 int height)
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2660 {
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2661 int depth;
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2662
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2663 if (in_display)
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2664 {
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2665 /* Not safe to do it now, so delay it */
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2666 register_post_redisplay_action (redisplay_redraw_exposed_area_1,
5581
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5515
diff changeset
2667 list5 (wrap_frame (f), make_fixnum (x),
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5515
diff changeset
2668 make_fixnum (y), make_fixnum (width),
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5515
diff changeset
2669 make_fixnum (height)));
1318
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2670 return;
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2671 }
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2672
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2673 depth = enter_redisplay_critical_section ();
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2674
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2675 MAYBE_FRAMEMETH (f, frame_output_begin, (f));
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2676
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2677 /* If any window on the frame has had its face cache reset then the
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2678 redisplay structures are effectively invalid. If we attempt to
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2679 use them we'll blow up. We mark the frame as changed to ensure
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2680 that redisplay will do a full update. This probably isn't
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2681 necessary but it can't hurt. */
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2682 #ifdef HAVE_TOOLBARS
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2683 /* #### We would rather put these off as well but there is currently
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2684 no combination of flags which will force an unchanged toolbar to
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2685 redraw anyhow. */
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2686 MAYBE_FRAMEMETH (f, redraw_exposed_toolbars, (f, x, y, width, height));
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2687 #endif
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2688 redraw_exposed_gutters (f, x, y, width, height);
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2689
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2690 if (!f->window_face_cache_reset)
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2691 {
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2692 redisplay_redraw_exposed_windows (f->root_window, x, y, width, height);
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2693 /* #### Why not call this always? */
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2694 MAYBE_FRAMEMETH (f, frame_output_end, (f));
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2695 }
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2696 else
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2697 MARK_FRAME_CHANGED (f);
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2698
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2699 exit_redisplay_critical_section (depth);
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2700 }
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2701
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1279
diff changeset
2702 /*****************************************************************************
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2703 bevel_modeline
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2704
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2705 Draw a 3d border around the modeline on window W.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2706 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2707 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2708 bevel_modeline (struct window *w, struct display_line *dl)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2709 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2710 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2711 struct device *d = XDEVICE (f->device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2712 int x, y, width, height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2713 int shadow_thickness = MODELINE_SHADOW_THICKNESS (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2714 enum edge_style style;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2715
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2716 x = WINDOW_MODELINE_LEFT (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2717 width = WINDOW_MODELINE_RIGHT (w) - x;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2718 y = dl->ypos - dl->ascent - shadow_thickness;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2719 height = dl->ascent + dl->descent + 2 * shadow_thickness;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2720
5581
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5515
diff changeset
2721 if (XFIXNUM (w->modeline_shadow_thickness) < 0)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2722 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2723 style = EDGE_BEVEL_IN;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2724 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2725 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2726 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2727 style = EDGE_BEVEL_OUT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2728 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2729
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
2730 MAYBE_DEVMETH (d, bevel_area,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2731 (w, MODELINE_INDEX, x, y, width, height, shadow_thickness,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2732 EDGE_ALL, style));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2733 }