annotate src/redisplay-output.c @ 826:6728e641994e

[xemacs-hg @ 2002-05-05 11:30:15 by ben] syntax cache, 8-bit-format, lots of code cleanup README.packages: Update info about --package-path. i.c: Create an inheritable event and pass it on to XEmacs, so that ^C can be handled properly. Intercept ^C and signal the event. "Stop Build" in VC++ now works. bytecomp-runtime.el: Doc string changes. compat.el: Some attempts to redo this to make it truly useful and fix the "multiple versions interacting with each other" problem. Not yet done. Currently doesn't work. files.el: Use with-obsolete-variable to avoid warnings in new revert-buffer code. xemacs.mak: Split up CFLAGS into a version without flags specifying the C library. The problem seems to be that minitar depends on zlib, which depends specifically on libc.lib, not on any of the other C libraries. Unless you compile with libc.lib, you get errors -- specifically, no _errno in the other libraries, which must make it something other than an int. (#### But this doesn't seem to obtain in XEmacs, which also uses zlib, and can be linked with any of the C libraries. Maybe zlib is used differently and doesn't need errno, or maybe XEmacs provides an int errno; ... I don't understand. Makefile.in.in: Fix so that packages are around when testing. abbrev.c, alloc.c, buffer.c, buffer.h, bytecode.c, callint.c, casefiddle.c, casetab.c, casetab.h, charset.h, chartab.c, chartab.h, cmds.c, console-msw.h, console-stream.c, console-x.c, console.c, console.h, data.c, device-msw.c, device.c, device.h, dialog-msw.c, dialog-x.c, dired-msw.c, dired.c, doc.c, doprnt.c, dumper.c, editfns.c, elhash.c, emacs.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, events.c, events.h, extents.c, extents.h, faces.c, file-coding.c, file-coding.h, fileio.c, fns.c, font-lock.c, frame-gtk.c, frame-msw.c, frame-x.c, frame.c, frame.h, glade.c, glyphs-gtk.c, glyphs-msw.c, glyphs-msw.h, glyphs-x.c, glyphs.c, glyphs.h, gui-msw.c, gui-x.c, gui.h, gutter.h, hash.h, indent.c, insdel.c, intl-win32.c, intl.c, keymap.c, lisp-disunion.h, lisp-union.h, lisp.h, lread.c, lrecord.h, lstream.c, lstream.h, marker.c, menubar-gtk.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, mule-ccl.c, mule-charset.c, mule-coding.c, mule-wnnfns.c, nas.c, objects-msw.c, objects-x.c, opaque.c, postgresql.c, print.c, process-nt.c, process-unix.c, process.c, process.h, profile.c, rangetab.c, redisplay-gtk.c, redisplay-msw.c, redisplay-output.c, redisplay-x.c, redisplay.c, redisplay.h, regex.c, regex.h, scrollbar-msw.c, search.c, select-x.c, specifier.c, specifier.h, symbols.c, symsinit.h, syntax.c, syntax.h, syswindows.h, tests.c, text.c, text.h, tooltalk.c, ui-byhand.c, ui-gtk.c, unicode.c, win32.c, window.c: Another big Ben patch. -- FUNCTIONALITY CHANGES: add partial support for 8-bit-fixed, 16-bit-fixed, and 32-bit-fixed formats. not quite done yet. (in particular, needs functions to actually convert the buffer.) NOTE: lots of changes to regex.c here. also, many new *_fmt() inline funs that take an Internal_Format argument. redo syntax cache code. make the cache per-buffer; keep the cache valid across calls to functions that use it. also keep it valid across insertions/deletions and extent changes, as much as is possible. eliminate the junky regex-reentrancy code by passing in the relevant lisp info to the regex routines as local vars. add general mechanism in extents code for signalling extent changes. fix numerous problems with the case-table implementation; yoshiki never properly transferred many algorithms from old-style to new-style case tables. redo char tables to support a default argument, so that mapping only occurs over changed args. change many chartab functions to accept Lisp_Object instead of Lisp_Char_Table *. comment out the code in font-lock.c by default, because font-lock.el no longer uses it. we should consider eliminating it entirely. Don't output bell as ^G in console-stream when not a TTY. add -mswindows-termination-handle to interface with i.c, so we can properly kill a build. add more error-checking to buffer/string macros. add some additional buffer_or_string_() funs. -- INTERFACE CHANGES AFFECTING MORE CODE: switch the arguments of write_c_string and friends to be consistent with write_fmt_string, which must have printcharfun first. change BI_* macros to BYTE_* for increased clarity; similarly for bi_* local vars. change VOID_TO_LISP to be a one-argument function. eliminate no-longer-needed CVOID_TO_LISP. -- char/string macro changes: rename MAKE_CHAR() to make_emchar() for slightly less confusion with make_char(). (The former generates an Emchar, the latter a Lisp object. Conceivably we should rename make_char() -> wrap_char() and similarly for make_int(), make_float().) Similar changes for other *CHAR* macros -- we now consistently use names with `emchar' whenever we are working with Emchars. Any remaining name with just `char' always refers to a Lisp object. rename macros with XSTRING_* to string_* except for those that reference actual fields in the Lisp_String object, following conventions used elsewhere. rename set_string_{data,length} macros (the only ones to work with a Lisp_String_* instead of a Lisp_Object) to set_lispstringp_* to make the difference clear. try to be consistent about caps vs. lowercase in macro/inline-fun names for chars and such, which wasn't the case before. we now reserve caps either for XFOO_ macros that reference object fields (e.g. XSTRING_DATA) or for things that have non-function semantics, e.g. directly modifying an arg (BREAKUP_EMCHAR) or evaluating an arg (any arg) more than once. otherwise, use lowercase. here is a summary of most of the macros/inline funs changed by all of the above changes: BYTE_*_P -> byte_*_p XSTRING_BYTE -> string_byte set_string_data/length -> set_lispstringp_data/length XSTRING_CHAR_LENGTH -> string_char_length XSTRING_CHAR -> string_emchar INTBYTE_FIRST_BYTE_P -> intbyte_first_byte_p INTBYTE_LEADING_BYTE_P -> intbyte_leading_byte_p charptr_copy_char -> charptr_copy_emchar LEADING_BYTE_* -> leading_byte_* CHAR_* -> EMCHAR_* *_CHAR_* -> *_EMCHAR_* *_CHAR -> *_EMCHAR CHARSET_BY_ -> charset_by_* BYTE_SHIFT_JIS* -> byte_shift_jis* BYTE_BIG5* -> byte_big5* REP_BYTES_BY_FIRST_BYTE -> rep_bytes_by_first_byte char_to_unicode -> emchar_to_unicode valid_char_p -> valid_emchar_p Change intbyte_strcmp -> qxestrcmp_c (duplicated functionality). -- INTERFACE CHANGES AFFECTING LESS CODE: use DECLARE_INLINE_HEADER in various places. remove '#ifdef emacs' from XEmacs-only files. eliminate CHAR_TABLE_VALUE(), which duplicated the functionality of get_char_table(). add BUFFER_TEXT_LOOP to simplify iterations over buffer text. define typedefs for signed and unsigned types of fixed sizes (INT_32_BIT, UINT_32_BIT, etc.). create ALIGN_FOR_TYPE as a higher-level interface onto ALIGN_SIZE; fix code to use it. add charptr_emchar_len to return the text length of the character pointed to by a ptr; use it in place of charcount_to_bytecount(..., 1). add emchar_len to return the text length of a given character. add types Bytexpos and Charxpos to generalize Bytebpos/Bytecount and Charbpos/Charcount, in code (particularly, the extents code and redisplay code) that works with either kind of index. rename redisplay struct params with names such as `charbpos' to e.g. `charpos' when they are e.g. a Charxpos, not a Charbpos. eliminate xxDEFUN in place of DEFUN; no longer necessary with changes awhile back to doc.c. split up big ugly combined list of EXFUNs in lisp.h on a file-by-file basis, since other prototypes are similarly split. rewrite some "*_UNSAFE" macros as inline funs and eliminate the _UNSAFE suffix. move most string code from lisp.h to text.h; the string code and text.h code is now intertwined in such a fashion that they need to be in the same place and partially interleaved. (you can't create forward references for inline funs) automated/lisp-tests.el, automated/symbol-tests.el, automated/test-harness.el: Fix test harness to output FAIL messages to stderr when in batch mode. Fix up some problems in lisp-tests/symbol-tests that were causing spurious failures.
author ben
date Sun, 05 May 2002 11:33:57 +0000
parents 6504113e7c2d
children e7ee5f8bde58
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.
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 665
diff changeset
3 Copyright (C) 1995, 1996, 2002 Ben Wing.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 Copyright (C) 1996 Chuck Thompson.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 Copyright (C) 1999 Andy Piper.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 under the terms of the GNU General Public License as published by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 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
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 /* Synched up with: Not in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 /* This file has been Mule-ized. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 /* Author: Chuck Thompson */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 /* Heavily hacked for modularity, gutter and subwindow support by Andy
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 Piper. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 #include "lisp.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 #include "buffer.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 #include "window.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 #include "frame.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 #include "device.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 #include "glyphs.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 #include "redisplay.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 #include "faces.h"
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
43 #include "gutter.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 static int compare_runes (struct window *w, struct rune *crb,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 struct rune *drb);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 static void redraw_cursor_in_window (struct window *w,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 int run_end_begin_glyphs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 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
50 int block, int start, int end, int start_pixpos,
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
51 int cursor_start, int cursor_width,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 int cursor_height);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
53 static void redisplay_normalize_display_box (struct display_box* dest,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 struct display_glyph_area* src);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 static int redisplay_display_boxes_in_window_p (struct window* w,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 struct display_box* db,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 struct display_glyph_area* dga);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
58 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
59 struct display_box* dest,
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
60 struct display_glyph_area* glyphsrc,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 int fullheight_p, Lisp_Object);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62
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 sync_rune_structs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 Synchronize the given rune blocks.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 sync_rune_structs (struct window *w, rune_dynarr *cra, rune_dynarr *dra)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 int rune_elt;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 int max_move = ((Dynarr_length (dra) > Dynarr_largest (cra))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 ? Dynarr_largest (cra)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 : Dynarr_length (dra));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 if (max_move)
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 /* #### Doing this directly breaks the encapsulation. But, the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 running time of this function has a measurable impact on
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 redisplay performance so avoiding all excess overhead is a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 good thing. Is all of this true? */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 memcpy (cra->base, dra->base, sizeof (struct rune) * max_move);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 Dynarr_set_size (cra, max_move);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 Dynarr_reset (cra);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 for (rune_elt = max_move; rune_elt < Dynarr_length (dra); rune_elt++)
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 struct rune rb, *crb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 struct rune *drb = Dynarr_atp (dra, rune_elt);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 crb = &rb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 memcpy (crb, drb, sizeof (struct rune));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 Dynarr_add (cra, *crb);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 }
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 sync_display_line_structs
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 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
103 the desired display line.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 ****************************************************************************/
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
105 void
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 sync_display_line_structs (struct window *w, int line, int do_blocks,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 display_line_dynarr *cdla,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 display_line_dynarr *ddla)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 struct display_line dl, *clp, *dlp;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 int db_elt;
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
112 int local = 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 dlp = Dynarr_atp (ddla, line);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 if (line >= Dynarr_largest (cdla))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 clp = &dl;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 clp->display_blocks = Dynarr_new (display_block);
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
119 local = 1;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 clp = Dynarr_atp (cdla, line);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 if (clp->display_blocks)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 Dynarr_reset (clp->display_blocks);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 if (clp->left_glyphs)
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 Dynarr_free (clp->left_glyphs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 clp->left_glyphs = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 if (clp->right_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->right_glyphs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 clp->right_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 }
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 display_block_dynarr *tdb = clp->display_blocks;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 memcpy (clp, dlp, sizeof (struct display_line));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 clp->display_blocks = tdb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 clp->left_glyphs = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 clp->right_glyphs = 0;
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
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
146 if (do_blocks || line < Dynarr_length (cdla))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 {
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
148 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
149 {
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
150 struct display_block db, *cdb;
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
151 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
152
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
153 if (db_elt >= Dynarr_largest (clp->display_blocks))
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 cdb = &db;
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
156 memcpy (cdb, ddb, sizeof (struct display_block));
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
157 cdb->runes = Dynarr_new (rune);
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
158 Dynarr_add (clp->display_blocks, *cdb);
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 else
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
161 {
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
162 rune_dynarr *tr;
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
163
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
164 cdb = Dynarr_atp (clp->display_blocks, db_elt);
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
165 tr = cdb->runes;
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
166 memcpy (cdb, ddb, sizeof (struct display_block));
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
167 cdb->runes = tr;
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
168 Dynarr_increment (clp->display_blocks);
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
169 }
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
170
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
171 sync_rune_structs (w, cdb->runes, ddb->runes);
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
172 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
175 if (local)
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
176 Dynarr_add (cdla, *clp);
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
177 else if (line >= Dynarr_length (cdla))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 {
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
179 assert (line == Dynarr_length (cdla));
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
180 Dynarr_increment (cdla);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185 compare_runes
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
187 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
188 return true otherwise return false.
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 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191 compare_runes (struct window *w, struct rune *crb, struct rune *drb)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 {
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 638
diff changeset
193 /* 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
194 affect the display characteristics. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 /* Note: (hanoi 6) spends 95% of its time in redisplay, and about
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 30% here. Not using bitfields for rune.type alone gives a redisplay
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 speed up of 10%.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 #### In profile arcs run of a normal Gnus session this function
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 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
202 those.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 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
205 doing a good job here.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 1. The function is not inlined (too complicated?)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 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
208 time.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 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
210 are really a switch statement.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 So I (JV) conjecture
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 #### It would really be worth it to arrange for this function to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 be (almost) a single call to memcmp. */
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
216
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
217 if (crb->xpos != drb->xpos)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 else if (crb->width != drb->width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 else if (crb->cursor_type != drb->cursor_type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 else if (crb->type != drb->type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 else if (crb->type == RUNE_CHAR &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 (crb->object.chr.ch != drb->object.chr.ch))
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 == RUNE_HLINE &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 (crb->object.hline.thickness != drb->object.hline.thickness ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 crb->object.hline.yoffset != drb->object.hline.yoffset))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 return 0;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
232 else if (crb->type == RUNE_DGLYPH &&
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 (!EQ (crb->object.dglyph.glyph, drb->object.dglyph.glyph) ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 !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
235 crb->object.dglyph.xoffset != drb->object.dglyph.xoffset ||
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
236 crb->object.dglyph.yoffset != drb->object.dglyph.yoffset ||
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
237 crb->object.dglyph.ascent != drb->object.dglyph.ascent ||
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
238 crb->object.dglyph.descent != drb->object.dglyph.descent))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 /* Only check dirtiness if we know something has changed. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 else if (crb->type == RUNE_DGLYPH &&
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
242 (XGLYPH_DIRTYP (crb->object.dglyph.glyph) ||
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
243 crb->findex != drb->findex))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
245 /* We need some way of telling redisplay_output_layout () that the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
246 only reason we are outputting it is because something has
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
247 changed internally. That way we can optimize whether we need
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
248 to clear the layout first and also only output the components
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
249 that have changed. The image_instance dirty flag and
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
250 display_hash are no good to us because these will invariably
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
251 have been set anyway if the layout has changed. So it looks
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
252 like we need yet another change flag that we can set here and
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
253 then clear in redisplay_output_layout (). */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
254 Lisp_Object window, image;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
255 Lisp_Image_Instance* ii;
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 665
diff changeset
256 window = wrap_window (w);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
257 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
258 window, ERROR_ME_DEBUG_WARN, 1);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
259
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
260 if (!IMAGE_INSTANCEP (image))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
261 return 0;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
262 ii = XIMAGE_INSTANCE (image);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
263
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
264 if (TEXT_IMAGE_INSTANCEP (image) &&
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
265 (crb->findex != drb->findex ||
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
266 WINDOW_FACE_CACHEL_DIRTY (w, drb->findex)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 return 0;
442
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 /* 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
270 cases they will actually be the same object. This does not
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
271 mean, however, that nothing has changed. We therefore need to
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
272 check the current hash of the glyph against the last recorded
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
273 display hash and the pending display items. See
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
274 update_subwindow (). */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
275 if (image_instance_changed (image) ||
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
276 crb->findex != drb->findex ||
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
277 WINDOW_FACE_CACHEL_DIRTY (w, drb->findex))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
278 {
638
373ced43e288 [xemacs-hg @ 2001-07-26 21:10:44 by adrian]
adrian
parents: 462
diff changeset
279 /* 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
280 this is for some internal reason not related to geometry
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
281 changes, send a hint to the output routines that they can
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
282 take some short cuts. This is most useful for
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
283 layouts. This flag should get reset by the output
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
284 routines.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
285
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
286 #### It is possible for us to get here when the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
287 face_cachel is dirty. I do not know what the implications
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
288 of this are.*/
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
289 IMAGE_INSTANCE_OPTIMIZE_OUTPUT (ii) = 1;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
290 return 0;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
291 }
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
292 else
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294 }
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
295 /* 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
296 for face changes. Face changes quite often happen when we are
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
297 trying to output something in the gutter, this would normally
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
298 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
299 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
300 re-output in this instance. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
301 else if (crb->findex != drb->findex ||
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
302 WINDOW_FACE_CACHEL_DIRTY (w, drb->findex))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
303 return 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 get_next_display_block
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311 Return the next display starting at or overlapping START_POS. Return
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312 the start of the next region in NEXT_START.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314 int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 get_next_display_block (layout_bounds bounds, display_block_dynarr *dba,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316 int start_pos, int *next_start)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318 int next_display_block = NO_BLOCK;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319 int priority = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 int block;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 /* If we don't find a display block covering or starting at
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 start_pos, then we return the starting point of the next display
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324 block or the next division boundary, whichever is closer to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325 start_pos. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326 if (next_start)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328 if (start_pos >= bounds.left_out && start_pos < bounds.left_in)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329 *next_start = bounds.left_in;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330 else if (start_pos < bounds.left_white)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331 *next_start = bounds.left_white;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332 else if (start_pos < bounds.right_white)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333 *next_start = bounds.right_white;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334 else if (start_pos < bounds.right_in)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335 *next_start = bounds.right_in;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336 else if (start_pos <= bounds.right_out)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337 *next_start = bounds.right_out;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339 abort ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342 for (block = 0; block < Dynarr_length (dba); block++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
343 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
344 struct display_block *db = Dynarr_atp (dba, block);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
345
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
346 if (db->start_pos <= start_pos && db->end_pos > start_pos)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348 if ((int) db->type > priority)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
350 priority = db->type;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351 next_display_block = block;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
352 if (next_start)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
353 *next_start = db->end_pos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356 else if (next_start && db->start_pos > start_pos)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358 if (db->start_pos < *next_start)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
359 *next_start = db->start_pos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
360 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
361 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
362
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363 return next_display_block;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
364 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
365
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
366 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
367 get_cursor_size_and_location
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
368
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
369 Return the information defining the pixel location of the cursor.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
370 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
371 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
372 get_cursor_size_and_location (struct window *w, struct display_block *db,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
373 int cursor_location,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
374 int *cursor_start, int *cursor_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
375 int *cursor_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
376 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
377 struct rune *rb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
378 Lisp_Object window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
379 int defheight, defwidth;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
381 if (Dynarr_length (db->runes) <= cursor_location)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
382 abort ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
383
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 665
diff changeset
384 window = wrap_window (w);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
385
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
386 rb = Dynarr_atp (db->runes, cursor_location);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
387 *cursor_start = rb->xpos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
388
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
389 default_face_height_and_width (window, &defheight, &defwidth);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
390 *cursor_height = defheight;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
391
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
392 if (rb->type == RUNE_BLANK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 *cursor_width = defwidth;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395 *cursor_width = rb->width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397
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 compare_display_blocks
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401 Given two display blocks, output only those areas where they differ.
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 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
404 compare_display_blocks (struct window *w, struct display_line *cdl,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
405 struct display_line *ddl, int c_block, int d_block,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406 int start_pixpos, int cursor_start, int cursor_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407 int cursor_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410 struct display_block *cdb, *ddb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411 int start_pos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412 int stop_pos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
413 int force = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414 int block_end;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416 cdb = Dynarr_atp (cdl->display_blocks, c_block);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417 ddb = Dynarr_atp (ddl->display_blocks, d_block);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
419 assert (cdb->type == ddb->type);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421 start_pos = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
422 stop_pos = min (Dynarr_length (cdb->runes), Dynarr_length (ddb->runes));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
423
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
424 block_end =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
425 (!Dynarr_length (ddb->runes)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
426 ? 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
427 : (Dynarr_atp (ddb->runes, Dynarr_length (ddb->runes) - 1)->xpos +
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
428 Dynarr_atp (ddb->runes, Dynarr_length (ddb->runes) - 1)->width));
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 /* 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
431 changing and it overlaps the position of this block then force a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432 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
433 updated properly. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
434 if (ddb->type != TEXT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
435 #if 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
436 /* 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
437 * 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
438 * 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
439 * I've replaced it with the more conservative test below.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
440 * -dkindred@cs.cmu.edu 23-Mar-1997 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
441 && ((cdl->cursor_elt == -1 && ddl->cursor_elt != -1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
442 || (cdl->cursor_elt != -1 && ddl->cursor_elt == -1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
443 && (ddl->cursor_elt == -1 ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
444 (cursor_start
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
445 && cursor_width
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
446 && (cursor_start + cursor_width) >= start_pixpos
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
447 && cursor_start <= block_end))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
448 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
449 && (cdl->cursor_elt != ddl->cursor_elt)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
451 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
452 force = 1;
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 if (f->windows_structure_changed ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455 /* #### Why is this so? We have face cachels so that we don't
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
456 have to recalculate all the display blocks when faces
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
457 change. I have fixed this for glyphs and am inclined to think
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
458 that faces should "Just Work", but I'm not feeling brave
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
459 today. Maybe its because the face cachels represent merged
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
460 faces rather than simply instantiations in a particular
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
461 domain. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
462 f->faces_changed ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
463 cdl->ypos != ddl->ypos ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
464 cdl->ascent != ddl->ascent ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
465 cdl->descent != ddl->descent ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
466 cdl->clip != ddl->clip ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
467 force)
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 start_pos = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
470 force = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
471 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
472 else
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 int elt = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
475
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
476 while (start_pos < 0 && elt < stop_pos)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
477 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
478 if (!compare_runes (w, Dynarr_atp (cdb->runes, elt),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479 Dynarr_atp (ddb->runes, elt)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
480 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481 start_pos = elt;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
482 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483 else
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 elt++;
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 }
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 /* If nothing has changed in the area where the blocks overlap, but
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
490 there are new blocks in the desired block, then adjust the start
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
491 point accordingly. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
492 if (elt == stop_pos && stop_pos < Dynarr_length (ddb->runes))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
493 start_pos = stop_pos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
494 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
495
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
496 if (start_pos >= 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
497 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498 if ((Dynarr_length (ddb->runes) != Dynarr_length (cdb->runes))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
499 || force)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
500 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
501 stop_pos = Dynarr_length (ddb->runes);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
502 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
503 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
504 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
505 /* 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
506 forcing a full redraw because the display line has
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
507 changed position then we try and optimize how much of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
508 line we actually redraw by scanning backwards from the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
509 end for the first changed rune. This optimization is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
510 almost always triggered by face changes. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
511
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
512 int elt = Dynarr_length (ddb->runes) - 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
513
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
514 while (elt > start_pos)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
515 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
516 if (!compare_runes (w, Dynarr_atp (cdb->runes, elt),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
517 Dynarr_atp (ddb->runes, elt)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
518 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
519 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
520 elt--;
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 stop_pos = elt + 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
523 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
524
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
525 redisplay_output_display_block (w, ddl, d_block, start_pos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
526 stop_pos, start_pixpos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
527 cursor_start, cursor_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
528 cursor_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
529 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
530 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
531
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
532 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
533 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
534
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
535 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
536 clear_left_border
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
537
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
538 Clear the lefthand outside border.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
539 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
540 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
541 clear_left_border (struct window *w, int y, int height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
542 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
543 struct frame *f = XFRAME (w->frame);
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 665
diff changeset
544 Lisp_Object window = wrap_window (w);
428
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 redisplay_clear_region (window, DEFAULT_INDEX,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
547 FRAME_LEFT_BORDER_START (f), y,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
548 FRAME_BORDER_WIDTH (f), height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
549 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
550
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
551 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
552 clear_right_border
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
553
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
554 Clear the righthand outside border.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
555 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
556 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
557 clear_right_border (struct window *w, int y, int height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
558 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
559 struct frame *f = XFRAME (w->frame);
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 665
diff changeset
560 Lisp_Object window = wrap_window (w);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
561
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
562 redisplay_clear_region (window, DEFAULT_INDEX,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
563 FRAME_RIGHT_BORDER_START (f),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
564 y, FRAME_BORDER_WIDTH (f), height);
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
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 output_display_line
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 Ensure that the contents of the given display line is correct
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
571 on-screen. The force_ parameters are used by redisplay_move_cursor
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
572 to correctly update cursor locations and only cursor locations.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
573 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
574 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
575 output_display_line (struct window *w, display_line_dynarr *cdla,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
576 display_line_dynarr *ddla, int line, int force_start,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
577 int force_end)
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 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
581 struct buffer *b = XBUFFER (w->buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
582 struct buffer *old_b = window_display_buffer (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
583 struct display_line *cdl, *ddl;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
584 display_block_dynarr *cdba, *ddba;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
585 int start_pixpos, end_pixpos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
586 int cursor_start, cursor_width, cursor_height;
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 int force = (force_start >= 0 || force_end >= 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
589 int clear_border = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
590 int must_sync = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
591
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
592 if (cdla && line < Dynarr_length (cdla))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
593 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
594 cdl = Dynarr_atp (cdla, line);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
595 cdba = cdl->display_blocks;
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 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
598 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
599 cdl = NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
600 cdba = NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
601 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
602
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
603 ddl = Dynarr_atp (ddla, line); /* assert line < Dynarr_length (ddla) */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
604 ddba = ddl->display_blocks;
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 if (force_start >= 0 && force_start >= ddl->bounds.left_out)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
607 start_pixpos = force_start;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
608 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
609 start_pixpos = ddl->bounds.left_out;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
610
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
611 if (force_end >= 0 && force_end < ddl->bounds.right_out)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
612 end_pixpos = force_end;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
613 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
614 end_pixpos = ddl->bounds.right_out;
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 /* Get the cursor parameters. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
617 if (ddl->cursor_elt != -1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
618 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
619 struct display_block *db;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
620
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
621 /* If the lines cursor parameter is not -1 then it indicates
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
622 which rune in the TEXT block contains the cursor. This means
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
623 that there must be at least one display block. The TEXT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
624 block, if present, must always be the first display block. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
625 assert (Dynarr_length (ddba) != 0);
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 db = Dynarr_atp (ddba, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
628 assert (db->type == TEXT);
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 get_cursor_size_and_location (w, db, ddl->cursor_elt, &cursor_start,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
631 &cursor_width, &cursor_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
632 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
633 else
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 cursor_start = cursor_width = cursor_height = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
636 }
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 /* 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
639 a TEXT block. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
640 if (ddl->modeline)
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 /* The shadow thickness check is necessary if only the sign of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
643 the size changed. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
644 if (cdba && !w->shadow_thickness_changed)
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 must_sync |= compare_display_blocks (w, cdl, ddl, 0, 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
647 start_pixpos, 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
648 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
649 else
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 redisplay_output_display_block (w, ddl, 0, 0, -1, start_pixpos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
652 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
653 must_sync = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
654 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
655
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
656 if (must_sync)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
657 clear_border = 1;
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 while (!ddl->modeline && start_pixpos < end_pixpos)
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 int block;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
663 int next_start_pixpos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
664
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
665 block = get_next_display_block (ddl->bounds, ddba, start_pixpos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
666 &next_start_pixpos);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
667
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
668 /* If we didn't find a block then we should blank the area
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
669 between start_pos and next_start if necessary. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
670 if (block == NO_BLOCK)
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 /* We only erase those areas which were actually previously
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
673 covered by a display block unless the window structure
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
674 changed. In that case we clear all areas since the current
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
675 structures may actually represent a different buffer. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
676 while (start_pixpos < next_start_pixpos)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
677 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
678 int block_end;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
679 int old_block;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
680
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
681 if (cdba)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
682 old_block = get_next_display_block (ddl->bounds, cdba,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
683 start_pixpos, &block_end);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
684 else
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 old_block = NO_BLOCK;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
687 block_end = next_start_pixpos;
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
690 if (!cdba || old_block != NO_BLOCK || b != old_b ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
691 f->windows_structure_changed ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
692 f->faces_changed ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
693 force ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
694 (cdl && (cdl->ypos != ddl->ypos ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
695 cdl->ascent != ddl->ascent ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
696 cdl->descent != ddl->descent ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
697 cdl->top_clip != ddl->top_clip ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
698 cdl->clip != ddl->clip)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
699 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
700 int x, y, width, height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
701 face_index findex;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
702
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
703 must_sync = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
704 x = start_pixpos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
705 y = DISPLAY_LINE_YPOS (ddl);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
706 width = min (next_start_pixpos, block_end) - x;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
707 height = DISPLAY_LINE_HEIGHT (ddl);
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 if (x < ddl->bounds.left_in)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
710 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
711 findex = ddl->left_margin_findex ?
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
712 ddl->left_margin_findex
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
713 : get_builtin_face_cache_index (w, Vleft_margin_face);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
714 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
715 else if (x < ddl->bounds.right_in)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
716 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
717 /* no check here because DEFAULT_INDEX == 0 anyway */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
718 findex = ddl->default_findex;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
719 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
720 else if (x < ddl->bounds.right_out)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
721 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
722 findex = ddl->right_margin_findex ?
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
723 ddl->right_margin_findex
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
724 : get_builtin_face_cache_index (w, Vright_margin_face);
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 findex = (face_index) -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
728
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
729 if (findex != (face_index) -1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
730 {
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 665
diff changeset
731 Lisp_Object window = wrap_window (w);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
732
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
733
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
734 /* Clear the empty area. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
735 redisplay_clear_region (window, findex, x, y, width, height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
736
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
737 /* Mark that we should clear the border. This is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
738 necessary because italic fonts may leave
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
739 droppings in the border. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
740 clear_border = 1;
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 }
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 start_pixpos = min (next_start_pixpos, block_end);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
745 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
746 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
747 else
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 struct display_block *cdb, *ddb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
750 int block_end;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
751 int old_block;
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 if (cdba)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
754 old_block = get_next_display_block (ddl->bounds, cdba,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
755 start_pixpos, &block_end);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
756 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
757 old_block = NO_BLOCK;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
758
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
759 ddb = Dynarr_atp (ddba, block);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
760 cdb = (old_block != NO_BLOCK ? Dynarr_atp (cdba, old_block) : 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
761
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
762 /* If there was formerly no block over the current
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
763 region or if it was a block of a different type, then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
764 output the entire ddb. Otherwise, compare cdb and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
765 ddb and output only the changed region. */
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
766 if (!force && cdb && ddb->type == cdb->type
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
767 /* If there was no buffer being display before the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
768 compare anyway as we might be outputting a gutter. */
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
769 &&
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
770 (b == old_b || !old_b))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
771 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
772 must_sync |= compare_display_blocks (w, cdl, ddl, old_block,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
773 block, start_pixpos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
774 cursor_start, cursor_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
775 cursor_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
776 }
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 int elt;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
780 int first_elt = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
781 int last_elt = -1;
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 for (elt = 0; elt < Dynarr_length (ddb->runes); elt++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
784 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
785 struct rune *rb = Dynarr_atp (ddb->runes, elt);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
786
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
787 if (start_pixpos >= rb->xpos
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
788 && start_pixpos < rb->xpos + rb->width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
789 first_elt = elt;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
790
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
791 if (end_pixpos > rb->xpos
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
792 && end_pixpos <= rb->xpos + rb->width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
793 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
794 last_elt = elt + 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
795 if (last_elt > Dynarr_length (ddb->runes))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
796 last_elt = Dynarr_length (ddb->runes);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
797 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
798 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
799 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
800
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
801 must_sync = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
802 redisplay_output_display_block (w, ddl, block, first_elt,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
803 last_elt,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
804 start_pixpos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
805 cursor_start, cursor_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
806 cursor_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
807 }
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
808
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
809 start_pixpos = next_start_pixpos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
810 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
811 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
812
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
813 /* 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
814 structure or frame size has changed or if something caused
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
815 clear_border to be tripped. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
816 /* #### Doing this on f->clear sucks but is necessary because of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
817 window-local background values. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
818 if (f->windows_structure_changed || f->faces_changed || clear_border
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
819 || f->clear)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
820 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
821 int y = DISPLAY_LINE_YPOS (ddl);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
822 int height = DISPLAY_LINE_HEIGHT (ddl);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
823
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
824 /* 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
825 if (y >= WINDOW_TEXT_TOP (w) && (y + height) <= WINDOW_TEXT_BOTTOM (w))
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 if (ddl->modeline)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
828 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
829 y -= MODELINE_SHADOW_THICKNESS (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
830 height += (2 * MODELINE_SHADOW_THICKNESS (w));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
831 }
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
832
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
833 if (window_is_leftmost (w))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
834 clear_left_border (w, y, height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
835 if (window_is_rightmost (w))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
836 clear_right_border (w, y, height);
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 }
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 if (cdla)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
841 sync_display_line_structs (w, line, must_sync, cdla, ddla);
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
844 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
845 redisplay_move_cursor
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 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
848 boolean indicating success or failure.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
849 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
850
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 819
diff changeset
851 #define ADJ_CHARPOS (rb->charpos + dl->offset)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
852 #define ADJ_ENDPOS (rb->endpos + dl->offset)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
853
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
854 int
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 638
diff changeset
855 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
856 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
857 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
858 struct device *d = XDEVICE (f->device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
859
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
860 display_line_dynarr *cla = window_display_lines (w, CURRENT_DISP);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
861 struct display_line *dl;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
862 struct display_block *db;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
863 struct rune *rb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
864 int x = w->last_point_x[CURRENT_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
865 int y = w->last_point_y[CURRENT_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
866
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
867 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
868 * 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
869 * the cursor in a non-active minibuffer window, since that is a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
870 * special case that is handled elsewhere and this function need
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
871 * not handle it. Return 1 so the caller will assume we
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
872 * succeeded.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
873 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
874 if (cursor_in_echo_area && MINI_WINDOW_P (w) &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
875 w != XWINDOW (FRAME_SELECTED_WINDOW (f)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
876 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
877
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
878 if (y < 0 || y >= Dynarr_length (cla))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
879 return 0;
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 dl = Dynarr_atp (cla, y);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
882 db = get_display_block_from_line (dl, TEXT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
883
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
884 if (x < 0 || x >= Dynarr_length (db->runes))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
885 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
886
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
887 rb = Dynarr_atp (db->runes, x);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
888
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
889 if (rb->cursor_type == CURSOR_OFF)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
890 return 0;
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 819
diff changeset
891 else if (ADJ_CHARPOS == new_point
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 819
diff changeset
892 || (ADJ_ENDPOS && (new_point >= ADJ_CHARPOS)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
893 && (new_point <= ADJ_ENDPOS)))
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 w->last_point_x[CURRENT_DISP] = x;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
896 w->last_point_y[CURRENT_DISP] = y;
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 819
diff changeset
897 Fset_marker (w->last_point[CURRENT_DISP], make_int (ADJ_CHARPOS),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
898 w->buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
899 dl->cursor_elt = x;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
900 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
901 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
902 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
903 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
904 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
905 MAYBE_DEVMETH (d, frame_output_begin, (f));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
906 MAYBE_DEVMETH (d, window_output_begin, (w));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
907 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
908 rb->cursor_type = CURSOR_OFF;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
909 dl->cursor_elt = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
910 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
911 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
912
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
913 w->last_point_x[CURRENT_DISP] = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
914 w->last_point_y[CURRENT_DISP] = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
915 Fset_marker (w->last_point[CURRENT_DISP], Qnil, w->buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
916
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
917 /* 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
918 all we actually had to do. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
919 if (w != XWINDOW (FRAME_SELECTED_WINDOW (device_selected_frame (d))))
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 (!no_output_end)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
922 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
923 MAYBE_DEVMETH (d, window_output_end, (w));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
924 MAYBE_DEVMETH (d, frame_output_end, (f));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
925 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
926
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
927 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
928 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
929
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
930 /* This should only occur in the minibuffer. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
931 if (new_point == 0)
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 w->last_point_x[CURRENT_DISP] = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
934 w->last_point_y[CURRENT_DISP] = y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
935 Fset_marker (w->last_point[CURRENT_DISP], Qzero, w->buffer);
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 rb = Dynarr_atp (db->runes, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
938 rb->cursor_type = CURSOR_ON;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
939 dl->cursor_elt = 0;
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 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
942
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
943 if (!no_output_end)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
944 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
945 MAYBE_DEVMETH (d, window_output_end, (w));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
946 MAYBE_DEVMETH (d, frame_output_end, (f));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
947 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
948 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
949 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
950 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
951 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
952 int cur_rb = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
953 int first = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
954 int cur_dl, up;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
955
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 819
diff changeset
956 if (ADJ_CHARPOS < new_point)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
957 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
958 up = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
959 cur_rb = x + 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
960 cur_dl = y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
961 }
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 638
diff changeset
962 else /* (rb->charbpos + dl->offset) > new_point */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
963 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
964 up = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
965
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
966 if (!x)
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 cur_dl = y - 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
969 first = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
970 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
971 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
972 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
973 cur_rb = x - 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
974 cur_dl = y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
975 first = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
976 }
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
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
979 while (up ? (cur_dl < Dynarr_length (cla)) : (cur_dl >= 0))
428
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 dl = Dynarr_atp (cla, cur_dl);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
982 db = get_display_block_from_line (dl, TEXT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
983
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
984 if (!up && !first)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
985 cur_rb = Dynarr_length (db->runes) - 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
986
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
987 while ((!scroll_on_clipped_lines || !dl->clip) &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
988 (up ? (cur_rb < Dynarr_length (db->runes)) : (cur_rb >= 0)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
989 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
990 rb = Dynarr_atp (db->runes, cur_rb);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
991
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
992 if (rb->cursor_type != IGNORE_CURSOR
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
993 && rb->cursor_type != NO_CURSOR &&
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 819
diff changeset
994 (ADJ_CHARPOS == new_point
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 819
diff changeset
995 || (ADJ_ENDPOS && (new_point >= ADJ_CHARPOS)
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 819
diff changeset
996 && (new_point <= ADJ_CHARPOS))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
997 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
998 rb->cursor_type = CURSOR_ON;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
999 dl->cursor_elt = cur_rb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1000
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1001
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1002 output_display_line (w, 0, cla, cur_dl, rb->xpos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1003 rb->xpos + rb->width);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1004
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1005 w->last_point_x[CURRENT_DISP] = cur_rb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1006 w->last_point_y[CURRENT_DISP] = cur_dl;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1007 Fset_marker (w->last_point[CURRENT_DISP],
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 819
diff changeset
1008 make_int (ADJ_CHARPOS), w->buffer);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1009
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1010 if (!no_output_end)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1011 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1012 MAYBE_DEVMETH (d, window_output_end, (w));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1013 MAYBE_DEVMETH (d, frame_output_end, (f));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1014 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1015 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1016 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1017
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1018 (up ? cur_rb++ : cur_rb--);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1019 }
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 (up ? (cur_rb = 0) : (first = 0));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1022 (up ? cur_dl++ : cur_dl--);
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 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1025
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1026 if (!no_output_end)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1027 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1028 MAYBE_DEVMETH (d, window_output_end, (w));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1029 MAYBE_DEVMETH (d, frame_output_end, (f));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1030 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1031 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1032 }
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 819
diff changeset
1033 #undef ADJ_CHARPOS
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1034 #undef ADJ_ENDPOS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1035
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 redraw_cursor_in_window
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1038
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1039 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
1040 the window.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1041 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1042 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1043 redraw_cursor_in_window (struct window *w, int run_end_begin_meths)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1044 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1045 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1046 struct device *d = XDEVICE (f->device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1047
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1048 display_line_dynarr *dla = window_display_lines (w, CURRENT_DISP);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1049 struct display_line *dl;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1050 struct display_block *db;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1051 struct rune *rb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1052
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1053 int x = w->last_point_x[CURRENT_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1054 int y = w->last_point_y[CURRENT_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1055
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1056 if (cursor_in_echo_area && MINI_WINDOW_P (w) &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1057 !echo_area_active (f) && minibuf_level == 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1058 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1059 MAYBE_DEVMETH (d, set_final_cursor_coords, (f, w->pixel_top, 0));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1060 }
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 if (y < 0 || y >= Dynarr_length (dla))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1063 return;
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 if (MINI_WINDOW_P (w) && f != device_selected_frame (d) &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1066 !is_surrogate_for_selected_frame (f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1067 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1068
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1069 dl = Dynarr_atp (dla, y);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1070 db = get_display_block_from_line (dl, TEXT);
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 if (x < 0 || x >= Dynarr_length (db->runes))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1073 return;
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 rb = Dynarr_atp (db->runes, x);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1076
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1077 /* 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
1078 cursor. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1079 if (rb->cursor_type == CURSOR_ON)
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 MAYBE_DEVMETH (d, set_final_cursor_coords,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1082 (f, dl->ypos - 1, rb->xpos));
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 if (run_end_begin_meths)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1085 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1086 MAYBE_DEVMETH (d, frame_output_begin, (f));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1087 MAYBE_DEVMETH (d, window_output_begin, (w));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1088 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1089
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1090 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
1091
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1092 if (run_end_begin_meths)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1093 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1094 MAYBE_DEVMETH (d, window_output_end, (w));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1095 MAYBE_DEVMETH (d, frame_output_end, (f));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1096 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1097 }
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1100 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1101 redisplay_redraw_cursor
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1102
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1103 For the given frame F, redraw the cursor on the selected window.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1104 This is used to update the cursor after focus changes.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1105 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1106 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1107 redisplay_redraw_cursor (struct frame *f, int run_end_begin_meths)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1108 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1109 Lisp_Object window;
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 if (!cursor_in_echo_area)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1112 window = FRAME_SELECTED_WINDOW (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1113 else if (FRAME_HAS_MINIBUF_P (f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1114 window = FRAME_MINIBUF_WINDOW (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1115 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1116 return;
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 redraw_cursor_in_window (XWINDOW (window), run_end_begin_meths);
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1121 /****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1122 redisplay_output_display_block
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1123
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1124 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
1125 runes between start and end in the specified display block.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1126 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1127 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1128 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
1129 int start, int end, int start_pixpos, int cursor_start,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1130 int cursor_width, int cursor_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1131 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1132 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1133 struct device *d = XDEVICE (f->device);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1134 /* Temporarily disabled until generalization is done. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1135 #if 0
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1136 struct display_block *db = Dynarr_atp (dl->display_blocks, block);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1137 rune_dynarr *rba = db->runes;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1138 struct rune *rb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1139 int xpos, width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1140 rb = Dynarr_atp (rba, start);
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 if (!rb)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1143 /* Nothing to do so don't do anything. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1144 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1145
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1146 xpos = max (start_pixpos, rb->xpos);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1147
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1148 if (end < 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1149 end = Dynarr_length (rba);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1150
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1151 rb = Dynarr_atp (rba, end - 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1152 width = rb->xpos + rb->width - xpos;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1153 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1154 /* now actually output the block. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1155 DEVMETH (d, output_display_block, (w, dl, block, start,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1156 end, start_pixpos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1157 cursor_start, cursor_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1158 cursor_height));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1159 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1160
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1161 /****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1162 redisplay_unmap_subwindows
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1163
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1164 Remove subwindows from the area in the box defined by the given
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1165 parameters.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1166 ****************************************************************************/
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1167 static void
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1168 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
1169 Lisp_Object ignored_window)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1170 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1171 Lisp_Object rest;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1172
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1173 LIST_LOOP (rest, XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1174 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1175 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (XCAR (rest));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1176 if (IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (ii)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1177 &&
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1178 IMAGE_INSTANCE_DISPLAY_X (ii)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1179 + IMAGE_INSTANCE_DISPLAY_WIDTH (ii) > x
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1180 &&
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1181 IMAGE_INSTANCE_DISPLAY_X (ii) < x + width
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1182 &&
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1183 IMAGE_INSTANCE_DISPLAY_Y (ii)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1184 + IMAGE_INSTANCE_DISPLAY_HEIGHT (ii) > y
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1185 &&
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1186 IMAGE_INSTANCE_DISPLAY_Y (ii) < y + height
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 !EQ (XCAR (rest), ignored_window))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1189 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1190 unmap_subwindow (XCAR (rest));
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 /****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1196 redisplay_unmap_subwindows_maybe
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1197
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1198 Potentially subwindows from the area in the box defined by the given
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1199 parameters.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1200 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1201 void redisplay_unmap_subwindows_maybe (struct frame* f, int x, int y, int width, int height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1202 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1203 if (!NILP (XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f))))
428
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 redisplay_unmap_subwindows (f, x, y, width, height, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1206 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1207 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1208
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1209 static void redisplay_unmap_subwindows_except_us (struct frame* f, int x, int y, int width,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1210 int height, Lisp_Object subwindow)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1211 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1212 if (!NILP (XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f))))
428
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 redisplay_unmap_subwindows (f, x, y, width, height, subwindow);
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 }
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 /****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1219 redisplay_output_subwindow
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 output a subwindow. This code borrows heavily from the pixmap stuff,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1222 although is much simpler not needing to account for partial
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1223 pixmaps, backgrounds etc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1224 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1225 void
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1226 redisplay_output_subwindow (struct window *w,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1227 Lisp_Object image_instance,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1228 struct display_box* db, struct display_glyph_area* dga,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1229 face_index findex, int cursor_start, int cursor_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1230 int cursor_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1231 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1232 Lisp_Image_Instance *p = XIMAGE_INSTANCE (image_instance);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1233 Lisp_Object window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1234 struct display_glyph_area sdga;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1235
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1236 dga->height = IMAGE_INSTANCE_HEIGHT (p);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1237 dga->width = IMAGE_INSTANCE_WIDTH (p);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1238
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1239 /* 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
1240 characteristics of the subwindow. This also clears the dirty
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1241 flags as a side effect. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1242 redisplay_subwindow (image_instance);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1243
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1244 /* This makes the glyph area fit into the display area. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1245 if (!redisplay_normalize_glyph_area (db, dga))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1246 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1247
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 665
diff changeset
1248 window = wrap_window (w);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1249
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1250 /* Clear the area the subwindow is going into. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1251 redisplay_clear_clipped_region (window, findex,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1252 db, dga, 0, image_instance);
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 /* This shrinks the display box to exactly enclose the glyph
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1255 area. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1256 redisplay_normalize_display_box (db, dga);
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 /* 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
1259 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
1260 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
1261 need to allow this case and map the entire subwindow. We also
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1262 need to be careful since the subwindow could be outside the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1263 window in the gutter or modeline - we also need to allow these
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1264 cases.*/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1265 sdga.xoffset = -dga->xoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1266 sdga.yoffset = -dga->yoffset;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1267 sdga.height = IMAGE_INSTANCE_HEIGHT (p);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1268 sdga.width = IMAGE_INSTANCE_WIDTH (p);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1269
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
1270 if (redisplay_display_boxes_in_window_p (w, db, &sdga) == 0
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
1271 ||
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
1272 /* We only want to do full subwindow display for windows that
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
1273 are completely in the gutter, otherwise we must clip to be
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
1274 safe. */
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
1275 display_boxes_in_gutter_p (XFRAME (w->frame), db, &sdga) <= 0)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1276 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1277 map_subwindow (image_instance, db->xpos, db->ypos, dga);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1278 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1279 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1280 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1281 sdga.xoffset = sdga.yoffset = 0;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1282 map_subwindow (image_instance, db->xpos - dga->xoffset,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1283 db->ypos - dga->yoffset, &sdga);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1284 }
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 redisplay_output_layout
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 Output a widget hierarchy. This can safely call itself recursively.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1291
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1292 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
1293 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
1294 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
1295 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
1296 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
1297 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
1298 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
1299 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
1300 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
1301 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
1302 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
1303 redisplay everything, or we redisplay nothing. These are exactly the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1304 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
1305 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
1306 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
1307 necessary changes in update_subwindow. This has all now been
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1308 implemented, Viva la revolution!
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1309 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1310 void
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1311 redisplay_output_layout (Lisp_Object domain,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1312 Lisp_Object image_instance,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1313 struct display_box* db, struct display_glyph_area* dga,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1314 face_index findex, int cursor_start, int cursor_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1315 int cursor_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1316 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1317 Lisp_Image_Instance *p = XIMAGE_INSTANCE (image_instance);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1318 Lisp_Object rest, window = DOMAIN_WINDOW (domain);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1319 Emchar_dynarr *buf = Dynarr_new (Emchar);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1320 struct window *w = XWINDOW (window);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1321 struct device *d = DOMAIN_XDEVICE (domain);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1322 int layout_height, layout_width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1323
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1324 layout_height = glyph_height (image_instance, domain);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1325 layout_width = glyph_width (image_instance, domain);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1326
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1327 dga->height = layout_height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1328 dga->width = layout_width;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1329 #ifdef DEBUG_WIDGET_OUTPUT
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1330 printf ("outputing layout glyph %p\n", p);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1331 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1332 /* This makes the glyph area fit into the display area. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1333 if (!redisplay_normalize_glyph_area (db, dga))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1334 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1335
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1336 /* Highly dodgy optimization. We want to only output the whole
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1337 layout if we really have to. */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1338 if (!IMAGE_INSTANCE_OPTIMIZE_OUTPUT (p)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1339 || IMAGE_INSTANCE_LAYOUT_CHANGED (p)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1340 || IMAGE_INSTANCE_WIDGET_FACE_CHANGED (p)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1341 || IMAGE_INSTANCE_SIZE_CHANGED (p)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1342 || IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (p))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1343 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1344 /* First clear the area we are drawing into. This is the easiest
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1345 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
1346 filled in. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1347 redisplay_clear_clipped_region (window, findex, db, dga, 1, Qnil);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1348
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1349 /* Output a border if required */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1350 if (!NILP (IMAGE_INSTANCE_LAYOUT_BORDER (p)))
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 int edges = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1353 enum edge_style style;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1354 int ypos = db->ypos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1355 int height = dga->height;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1356
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1357 if (dga->xoffset >= 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1358 edges |= EDGE_LEFT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1359 if (dga->width - dga->xoffset == layout_width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1360 edges |= EDGE_RIGHT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1361 if (dga->yoffset >= 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1362 edges |= EDGE_TOP;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1363 if (dga->height - dga->yoffset == layout_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1364 edges |= EDGE_BOTTOM;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1365
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1366 if (EQ (IMAGE_INSTANCE_LAYOUT_BORDER (p), Qetched_in))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1367 style = EDGE_ETCHED_IN;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1368 else if (EQ (IMAGE_INSTANCE_LAYOUT_BORDER (p), Qetched_out))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1369 style = EDGE_ETCHED_OUT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1370 else if (EQ (IMAGE_INSTANCE_LAYOUT_BORDER (p), Qbevel_in))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1371 style = EDGE_BEVEL_IN;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1372 else if (INTP (IMAGE_INSTANCE_LAYOUT_BORDER (p)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1373 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1374 style = EDGE_ETCHED_IN;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1375 if (edges & EDGE_TOP)
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 ypos += XINT (IMAGE_INSTANCE_LAYOUT_BORDER (p));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1378 height -= XINT (IMAGE_INSTANCE_LAYOUT_BORDER (p));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1379 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1380 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1381 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1382 style = EDGE_BEVEL_OUT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1383
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1384 MAYBE_DEVMETH (d, bevel_area,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1385 (w, findex, db->xpos,
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1386 ypos,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1387 dga->width, height, 2, edges, style));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1388 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1389 }
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1390
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1391 /* This shrinks the display box to exactly enclose the glyph
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1392 area. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1393 redisplay_normalize_display_box (db, dga);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1394
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1395 /* Flip through the widgets in the layout displaying as necessary */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1396 LIST_LOOP (rest, IMAGE_INSTANCE_LAYOUT_CHILDREN (p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1397 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1398 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
1399 ERROR_ME_DEBUG_WARN, 1);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1400
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1401 struct display_box cdb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1402 /* For losing HP-UX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1403 cdb.xpos = db->xpos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1404 cdb.ypos = db->ypos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1405 cdb.width = db->width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1406 cdb.height = db->height;
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 /* First determine if the image is visible at all */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1409 if (IMAGE_INSTANCEP (child))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1410 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1411 Lisp_Image_Instance* childii = XIMAGE_INSTANCE (child);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1412
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1413 /* The enclosing layout offsets are +ve at this point */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1414 struct display_glyph_area cdga;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1415 cdga.xoffset = IMAGE_INSTANCE_XOFFSET (childii) - dga->xoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1416 cdga.yoffset = IMAGE_INSTANCE_YOFFSET (childii) - dga->yoffset;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1417 cdga.width = glyph_width (child, image_instance);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1418 cdga.height = glyph_height (child, image_instance);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1419
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1420 IMAGE_INSTANCE_OPTIMIZE_OUTPUT (childii) =
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1421 IMAGE_INSTANCE_OPTIMIZE_OUTPUT (p);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1422
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1423 /* Although normalization is done by the output routines
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1424 we have to do it here so that they don't try and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1425 clear all of db. This is true below also. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1426 if (redisplay_normalize_glyph_area (&cdb, &cdga))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1427 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1428 redisplay_normalize_display_box (&cdb, &cdga);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1429 /* Since the display boxes will now be totally in the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1430 window if they are visible at all we can now check this easily. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1431 if (cdb.xpos < db->xpos || cdb.ypos < db->ypos
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1432 || cdb.xpos + cdb.width > db->xpos + db->width
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1433 || cdb.ypos + cdb.height > db->ypos + db->height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1434 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1435 /* We have to invert the offset here as normalization
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1436 will have made them positive which the output
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1437 routines will treat as a truly +ve offset. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1438 cdga.xoffset = -cdga.xoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1439 cdga.yoffset = -cdga.yoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1440
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1441 switch (IMAGE_INSTANCE_TYPE (childii))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1442 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1443 case IMAGE_TEXT:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1444 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1445 /* #### This is well hacked and could use some
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1446 generalisation.*/
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1447 if (redisplay_normalize_glyph_area (&cdb, &cdga)
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1448 &&
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1449 (!IMAGE_INSTANCE_OPTIMIZE_OUTPUT (childii) ||
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1450 IMAGE_INSTANCE_DIRTYP (childii)))
428
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 struct display_line dl; /* this is fake */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1453 Lisp_Object string =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1454 IMAGE_INSTANCE_TEXT_STRING (childii);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1455 unsigned char charsets[NUM_LEADING_BYTES];
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1456 struct face_cachel *cachel = WINDOW_FACE_CACHEL (w, findex);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1457
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 638
diff changeset
1458 find_charsets_in_intbyte_string (charsets,
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1459 XSTRING_DATA (string),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1460 XSTRING_LENGTH (string));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1461 ensure_face_cachel_complete (cachel, window, charsets);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1462
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 638
diff changeset
1463 convert_intbyte_string_into_emchar_dynarr
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1464 (XSTRING_DATA (string), XSTRING_LENGTH (string), buf);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1465
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1466 redisplay_normalize_display_box (&cdb, &cdga);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1467 /* Offsets are now +ve again so be careful
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1468 when fixing up the display line. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1469 xzero (dl);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1470 /* Munge boxes into display lines. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1471 dl.ypos = (cdb.ypos - cdga.yoffset)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1472 + glyph_ascent (child, image_instance);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1473 dl.ascent = glyph_ascent (child, image_instance);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1474 dl.descent = glyph_descent (child, image_instance);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1475 dl.top_clip = cdga.yoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1476 dl.clip = (dl.ypos + dl.descent) - (cdb.ypos + cdb.height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1477 /* output_string doesn't understand offsets in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1478 the same way as other routines - we have to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1479 add the offset to the width so that we
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1480 output the full string. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1481 MAYBE_DEVMETH (d, output_string, (w, &dl, buf, cdb.xpos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1482 cdga.xoffset, cdb.xpos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1483 cdga.width + cdga.xoffset,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1484 findex, 0, 0, 0, 0));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1485 Dynarr_reset (buf);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1486 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1487 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1488 break;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1489
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1490 case IMAGE_MONO_PIXMAP:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1491 case IMAGE_COLOR_PIXMAP:
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1492 if (!IMAGE_INSTANCE_OPTIMIZE_OUTPUT (childii)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1493 || IMAGE_INSTANCE_DIRTYP (childii))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1494 redisplay_output_pixmap (w, child, &cdb, &cdga, findex,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1495 0, 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1496 break;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1497
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1498 case IMAGE_WIDGET:
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1499 if (EQ (IMAGE_INSTANCE_WIDGET_TYPE (childii), Qlayout))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1500 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1501 redisplay_output_layout (image_instance, child, &cdb, &cdga, findex,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1502 0, 0, 0);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1503 break;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1504 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1505 case IMAGE_SUBWINDOW:
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1506 if (!IMAGE_INSTANCE_OPTIMIZE_OUTPUT (childii) ||
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1507 IMAGE_INSTANCE_DIRTYP (childii))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1508 redisplay_output_subwindow (w, child, &cdb, &cdga, findex,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1509 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1510 break;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1511
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1512 case IMAGE_NOTHING:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1513 /* nothing is as nothing does */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1514 break;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1515
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1516 case IMAGE_POINTER:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1517 default:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1518 abort ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1519 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1520 }
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1521 IMAGE_INSTANCE_OPTIMIZE_OUTPUT (childii) = 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1522 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1523 }
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1524
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1525 /* Update any display properties. I'm not sure whether this actually
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1526 does anything for layouts except clear the changed flags. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1527 redisplay_subwindow (image_instance);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1528
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1529 Dynarr_free (buf);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1530 }
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 /****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1533 redisplay_output_pixmap
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1534
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1535
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1536 output a pixmap.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1537 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1538 void
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1539 redisplay_output_pixmap (struct window *w,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1540 Lisp_Object image_instance,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1541 struct display_box* db, struct display_glyph_area* dga,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1542 face_index findex, int cursor_start, int cursor_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1543 int cursor_height, int offset_bitmap)
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 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1546 struct device *d = XDEVICE (f->device);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1547 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
1548 Lisp_Object window = wrap_window (w);
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 665
diff changeset
1549
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1550
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1551 dga->height = IMAGE_INSTANCE_PIXMAP_HEIGHT (p);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1552 dga->width = IMAGE_INSTANCE_PIXMAP_WIDTH (p);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1553
819
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1554 #ifdef DEBUG_REDISPLAY
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1555 printf ("redisplay_output_pixmap(request) \
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1556 [%dx%d@%d+%d] in [%dx%d@%d+%d]\n",
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1557 db->width, db->height, db->xpos, db->ypos,
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1558 dga->width, dga->height, dga->xoffset, dga->yoffset);
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1559 #endif
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1560
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1561 /* This makes the glyph area fit into the display area. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1562 if (!redisplay_normalize_glyph_area (db, dga))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1563 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1564
819
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1565 #ifdef DEBUG_REDISPLAY
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1566 printf ("redisplay_output_pixmap(normalized) \
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1567 [%dx%d@%d+%d] in [%dx%d@%d+%d]\n",
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1568 db->width, db->height, db->xpos, db->ypos,
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1569 dga->width, dga->height, dga->xoffset, dga->yoffset);
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1570 #endif
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1571
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1572 /* Clear the area the pixmap is going into. The pixmap itself will
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1573 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
1574 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
1575 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
1576 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
1577 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
1578 mask. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1579 if (!offset_bitmap)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1580 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1581 redisplay_clear_clipped_region (window, findex,
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1582 db, dga,
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1583 (IMAGE_INSTANCE_PIXMAP_MASK (p) != 0),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1584 Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1585
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1586 /* This shrinks the display box to exactly enclose the glyph
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1587 area. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1588 redisplay_normalize_display_box (db, dga);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1589 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1590 assert (db->xpos >= 0 && db->ypos >= 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1591
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1592 MAYBE_DEVMETH (d, output_pixmap, (w, image_instance,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1593 db, dga,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1594 findex, cursor_start,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1595 cursor_width, cursor_height,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1596 offset_bitmap));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1597 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1598
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1599 /****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1600 redisplay_clear_region
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1601
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1602 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
1603 given face. This has been generalised so that subwindows can be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1604 coped with effectively.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1605 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1606 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1607 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
1608 int width, int height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1609 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1610 struct window *w = NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1611 struct frame *f = NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1612 struct device *d;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1613 Lisp_Object background_pixmap = Qunbound;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1614 Lisp_Object fcolor = Qnil, bcolor = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1615
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1616 if (!width || !height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1617 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1618
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1619 if (WINDOWP (locale))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1620 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1621 w = XWINDOW (locale);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1622 f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1623 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1624 else if (FRAMEP (locale))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1625 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1626 w = NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1627 f = XFRAME (locale);
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 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1630 abort ();
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 d = XDEVICE (f->device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1633
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1634 /* if we have subwindows in the region we have to unmap them */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1635 redisplay_unmap_subwindows_maybe (f, x, y, width, height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1636
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1637 /* #### This isn't quite right for when this function is called
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1638 from the toolbar code. */
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1639
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1640 /* Don't use a backing pixmap in the border area */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1641 if (x >= FRAME_LEFT_BORDER_END (f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1642 && x < FRAME_RIGHT_BORDER_START (f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1643 && y >= FRAME_TOP_BORDER_END (f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1644 && y < FRAME_BOTTOM_BORDER_START (f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1645 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1646 Lisp_Object temp;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1647
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1648 if (w)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1649 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1650 temp = WINDOW_FACE_CACHEL_BACKGROUND_PIXMAP (w, findex);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1651
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1652 if (IMAGE_INSTANCEP (temp)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1653 && IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (temp)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1654 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1655 /* #### maybe we could implement such that a string
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1656 can be a background pixmap? */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1657 background_pixmap = temp;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1658 }
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 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1661 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1662 temp = FACE_BACKGROUND_PIXMAP (Vdefault_face, locale);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1663
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1664 if (IMAGE_INSTANCEP (temp)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1665 && IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (temp)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1666 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1667 background_pixmap = temp;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1668 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1669 }
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1670 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1671
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1672 if (!UNBOUNDP (background_pixmap) &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1673 XIMAGE_INSTANCE_PIXMAP_DEPTH (background_pixmap) == 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1674 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1675 if (w)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1676 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1677 fcolor = WINDOW_FACE_CACHEL_FOREGROUND (w, findex);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1678 bcolor = WINDOW_FACE_CACHEL_BACKGROUND (w, findex);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1679 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1680 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1681 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1682 fcolor = FACE_FOREGROUND (Vdefault_face, locale);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1683 bcolor = FACE_BACKGROUND (Vdefault_face, locale);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1684 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1685 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1686 else
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 fcolor = (w ?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1689 WINDOW_FACE_CACHEL_BACKGROUND (w, findex) :
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1690 FACE_BACKGROUND (Vdefault_face, locale));
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1691
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1692 }
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1693
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1694 if (UNBOUNDP (background_pixmap))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1695 background_pixmap = Qnil;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1696
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1697 DEVMETH (d, clear_region,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1698 (locale, d, f, findex, x, y, width, height, fcolor, bcolor, background_pixmap));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1699 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1700
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1701 /****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1702 redisplay_clear_clipped_region
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1703
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1704 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
1705 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
1706 for images shorter than the display line. Clipping can be played
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1707 around with by altering these. glyphsrc should be normalized.
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 static void
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1710 redisplay_clear_clipped_region (Lisp_Object window, face_index findex,
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1711 struct display_box* dest, struct display_glyph_area* glyphsrc,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1712 int fullheight_p, Lisp_Object ignored_subwindow)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1713 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1714 /* assume dest->xpos >= 0 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1715 int clear_x;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1716 struct frame* f = XFRAME (XWINDOW (window)->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1717
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1718 if (glyphsrc->xoffset > 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1719 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1720 clear_x = dest->xpos + glyphsrc->xoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1721 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1722 else
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 clear_x = dest->xpos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1725 }
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 we need the whole height cleared then just do it. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1728 if (fullheight_p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1729 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1730 redisplay_clear_region (window, findex, clear_x, dest->ypos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1731 glyphsrc->width, dest->height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1732 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1733 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1734 {
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1735 int yoffset = (glyphsrc->yoffset > 0 ? glyphsrc->yoffset : 0);
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1736
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1737 /* We need to make sure that subwindows are unmapped from the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1738 whole area. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1739 redisplay_unmap_subwindows_except_us (f, clear_x, dest->ypos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1740 glyphsrc->width, dest->height,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1741 ignored_subwindow);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1742 /* first the top box */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1743 if (yoffset > 0)
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 redisplay_clear_region (window, findex, clear_x, dest->ypos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1746 glyphsrc->width, yoffset);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1747
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1748 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1749 /* Then the bottom box */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1750 if (yoffset + glyphsrc->height < dest->height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1751 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1752 redisplay_clear_region (window, findex, clear_x,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1753 dest->ypos + yoffset + glyphsrc->height,
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1754 glyphsrc->width,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1755 dest->height - (yoffset + glyphsrc->height));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1756
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1757 }
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 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1760
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1761 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1762 redisplay_normalize_glyph_area
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1763 redisplay_normalize_display_box
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1764
819
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1765 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
1766
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1767 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
1768 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
1769 combinations of clipping and position can be accommodated.
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1770
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1771 dest - display_box
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1772
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1773 xpos - absolute horizontal position of area.
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1774
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1775 ypos - absolute vertical position of area.
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1776
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1777 glyphsrc - display_glyph_area
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1778
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1779 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
1780 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
1781 display starting xoffset into the glyph.
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1782
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1783 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
1784 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
1785 starting xoffset into the glyph.
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1786
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 int
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1789 redisplay_normalize_glyph_area (struct display_box* dest,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1790 struct display_glyph_area* glyphsrc)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1791 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1792 if (dest->xpos + glyphsrc->xoffset > dest->xpos + dest->width
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1793 ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1794 dest->ypos + glyphsrc->yoffset > dest->ypos + dest->height
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1795 ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1796 -glyphsrc->xoffset >= glyphsrc->width
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1797 ||
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1798 -glyphsrc->yoffset >= glyphsrc->height
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1799 ||
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1800 /* #### Not sure why this wasn't coped with before but normalizing
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1801 to zero width or height is definitely wrong. */
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1802 (dest->xpos + glyphsrc->xoffset + glyphsrc->width > dest->xpos + dest->width
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1803 &&
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1804 dest->width - glyphsrc->xoffset <= 0)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1805 ||
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1806 (dest->ypos + glyphsrc->yoffset + glyphsrc->height > dest->ypos + dest->height
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1807 &&
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1808 dest->height - glyphsrc->yoffset <= 0))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1809 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1810 /* It's all clipped out */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1811 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1812 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1813
819
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1814 /* 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
1815 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
1816 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
1817 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
1818 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
1819 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
1820 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
1821 if (dest->xpos + glyphsrc->xoffset + glyphsrc->width > dest->xpos + dest->width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1822 {
819
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1823 /* 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
1824 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
1825 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
1826 glyphsrc->xoffset. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1827 if (glyphsrc->xoffset > 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1828 glyphsrc->width = dest->width - glyphsrc->xoffset;
819
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1829 /* 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
1830 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
1831 xoffset.*/
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1832 else if (glyphsrc->xoffset < 0)
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1833 {
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1834 glyphsrc->width += glyphsrc->xoffset;
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1835 glyphsrc->width = min (glyphsrc->width, dest->width);
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1836 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1837 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1838 glyphsrc->width = dest->width;
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
819
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1841 else if (glyphsrc->xoffset < 0)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1842 glyphsrc->width += glyphsrc->xoffset;
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 /* 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
1845 if (dest->ypos + glyphsrc->yoffset + glyphsrc->height > dest->ypos + dest->height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1846 {
819
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1847 if ((glyphsrc->yoffset > 0) && (dest->height > glyphsrc->yoffset))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1848 glyphsrc->height = dest->height - glyphsrc->yoffset;
819
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1849 else if (glyphsrc->yoffset < 0)
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1850 {
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1851 glyphsrc->height += glyphsrc->yoffset;
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1852 glyphsrc->height = min (glyphsrc->height, dest->height);
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1853 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1854 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1855 glyphsrc->height = dest->height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1856 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1857
819
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1858 else if (glyphsrc->yoffset < 0)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1859 glyphsrc->height += glyphsrc->yoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1860
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1861 return 1;
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1864 static void
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1865 redisplay_normalize_display_box (struct display_box* dest,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1866 struct display_glyph_area* glyphsrc)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1867 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1868 /* Adjust the destination area. At the end of this the destination
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1869 area will exactly enclose the glyph area. The only remaining
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1870 adjustment will be offsets into the glyph area. */
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 /* Horizontal adjustment. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1873 if (glyphsrc->xoffset > 0)
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 dest->xpos += glyphsrc->xoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1876 dest->width -= glyphsrc->xoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1877 glyphsrc->xoffset = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1878 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1879 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1880 glyphsrc->xoffset = -glyphsrc->xoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1881
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1882 if (glyphsrc->width < dest->width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1883 dest->width = glyphsrc->width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1884
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1885 /* Vertical adjustment. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1886 if (glyphsrc->yoffset > 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1887 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1888 dest->ypos += glyphsrc->yoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1889 dest->height -= glyphsrc->yoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1890 glyphsrc->yoffset = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1891 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1892 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1893 glyphsrc->yoffset = -glyphsrc->yoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1894
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1895 if (glyphsrc->height < dest->height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1896 dest->height = glyphsrc->height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1897 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1898
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1899 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1900 redisplay_display_boxes_in_window_p
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1901
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
1902 Determine whether the required display_glyph_area is completely inside
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
1903 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
1904 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
1905 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
1906 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1907 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1908 redisplay_display_boxes_in_window_p (struct window* w,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1909 struct display_box* db,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1910 struct display_glyph_area* dga)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1911 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1912 int left = WINDOW_TEXT_LEFT (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1913 int right = WINDOW_TEXT_RIGHT (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1914 int top = WINDOW_TEXT_TOP (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1915 int bottom = WINDOW_TEXT_BOTTOM (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1916
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1917 if (db->xpos < left || db->ypos < top
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1918 || db->xpos + db->width > right
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1919 || db->ypos + db->height > bottom)
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
1920 /* We are not displaying in a window at all */
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
1921 return -1;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1922
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1923 if (db->xpos + dga->xoffset >= left
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1924 &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1925 db->ypos + dga->yoffset >= top
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 db->xpos + dga->xoffset + dga->width <= right
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1928 &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1929 db->ypos + dga->yoffset + dga->height <= bottom)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1930 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1931
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
1932 return 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1933 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1934
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1935 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1936 redisplay_calculate_display_boxes
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1937
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1938 Convert from rune/display_line co-ordinates to display_box
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1939 co-ordinates.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1940 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1941 int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1942 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
1943 int xoffset, int yoffset, int start_pixpos,
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1944 int width, struct display_box* dest,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1945 struct display_glyph_area* src)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1946 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1947 dest->xpos = xpos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1948 dest->ypos = DISPLAY_LINE_YPOS (dl);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1949 dest->width = width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1950 dest->height = DISPLAY_LINE_HEIGHT (dl);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1951
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1952 src->xoffset = -xoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1953 src->width = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1954 src->height = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1955
819
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1956 src->yoffset = -dl->top_clip + yoffset;
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 800
diff changeset
1957
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1958 if (start_pixpos >=0 && start_pixpos > xpos)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1959 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1960 /* Oops, we're asking for a start outside of the displayable
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1961 area. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1962 if (start_pixpos > xpos + width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1963 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1964 dest->xpos = start_pixpos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1965 dest->width -= (start_pixpos - xpos);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1966 /* Offsets are -ve when we want to clip pixels off the displayed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1967 glyph. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1968 src->xoffset -= (start_pixpos - xpos);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1969 }
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 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1972 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1973
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 redisplay_clear_top_of_window
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 If window is topmost, clear the internal border above it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1978 ****************************************************************************/
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
1979 void
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1980 redisplay_clear_top_of_window (struct window *w)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1981 {
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 665
diff changeset
1982 Lisp_Object window = wrap_window (w);
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 665
diff changeset
1983
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1984
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1985 if (!NILP (Fwindow_highest_p (window)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1986 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1987 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1988 int x, y, width, height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1989
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1990 x = w->pixel_left;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1991 width = w->pixel_width;
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 if (window_is_leftmost (w))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1994 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1995 x -= FRAME_BORDER_WIDTH (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1996 width += FRAME_BORDER_WIDTH (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1997 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1998 if (window_is_rightmost (w))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1999 width += FRAME_BORDER_WIDTH (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2000
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2001 y = FRAME_TOP_BORDER_START (f) - 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2002 height = FRAME_BORDER_HEIGHT (f) + 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2003
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2004 redisplay_clear_region (window, DEFAULT_INDEX, x, y, width, height);
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 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2007
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 redisplay_clear_to_window_end
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2010
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2011 Clear the area between ypos1 and ypos2. Each margin area and the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2012 text area is handled separately since they may each have their own
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2013 background color.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2014 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2015 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2016 redisplay_clear_to_window_end (struct window *w, int ypos1, int ypos2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2017 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2018 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2019 struct device *d = XDEVICE (f->device);
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 if (HAS_DEVMETH_P (d, clear_to_window_end))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2022 DEVMETH (d, clear_to_window_end, (w, ypos1, ypos2));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2023 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2024 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2025 int height = ypos2 - ypos1;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
2026
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2027 if (height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2028 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2029 Lisp_Object window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2030 int bflag = 0 ; /* (window_needs_vertical_divider (w) ? 0 : 1);*/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2031 layout_bounds bounds;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
2032
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2033 bounds = calculate_display_line_boundaries (w, bflag);
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 665
diff changeset
2034 window = wrap_window (w);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2035
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2036 if (window_is_leftmost (w))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2037 redisplay_clear_region (window, DEFAULT_INDEX, FRAME_LEFT_BORDER_START (f),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2038 ypos1, FRAME_BORDER_WIDTH (f), height);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
2039
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2040 if (bounds.left_in - bounds.left_out > 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2041 redisplay_clear_region (window,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2042 get_builtin_face_cache_index (w, Vleft_margin_face),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2043 bounds.left_out, ypos1,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2044 bounds.left_in - bounds.left_out, height);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
2045
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2046 if (bounds.right_in - bounds.left_in > 0)
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
2047 redisplay_clear_region (window,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2048 DEFAULT_INDEX,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2049 bounds.left_in, ypos1,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2050 bounds.right_in - bounds.left_in, height);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
2051
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2052 if (bounds.right_out - bounds.right_in > 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2053 redisplay_clear_region (window,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2054 get_builtin_face_cache_index (w, Vright_margin_face),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2055 bounds.right_in, ypos1,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2056 bounds.right_out - bounds.right_in, height);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
2057
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2058 if (window_is_rightmost (w))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2059 redisplay_clear_region (window, DEFAULT_INDEX, FRAME_RIGHT_BORDER_START (f),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2060 ypos1, FRAME_BORDER_WIDTH (f), height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2061 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2062 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2063 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2064
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 redisplay_clear_bottom_of_window
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2067
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2068 Clear window from right below the last display line to right above
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2069 the modeline. The calling function can limit the area actually
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2070 erased by setting min_start and/or max_end to positive values.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2071 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2072 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2073 redisplay_clear_bottom_of_window (struct window *w, display_line_dynarr *ddla,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2074 int min_start, int max_end)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2075 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2076 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2077 int ypos1, ypos2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2078 int ddla_len = Dynarr_length (ddla);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2079
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2080 ypos2 = WINDOW_TEXT_BOTTOM (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2081 #ifdef HAVE_SCROLLBARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2082 /* This adjustment is to catch the intersection of any scrollbars. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2083 if (f->windows_structure_changed && NILP (w->scrollbar_on_top_p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2084 ypos2 += window_scrollbar_height (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2085 #endif
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 if (ddla_len)
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 if (ddla_len == 1 && Dynarr_atp (ddla, 0)->modeline)
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 ypos1 = WINDOW_TEXT_TOP (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2092 #ifdef HAVE_SCROLLBARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2093 /* This adjustment is to catch the intersection of any scrollbars. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2094 if (f->windows_structure_changed && !NILP (w->scrollbar_on_top_p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2095 ypos1 -= window_scrollbar_height (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2096 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2097 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2098 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2099 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2100 struct display_line *dl = Dynarr_atp (ddla, ddla_len - 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2101 ypos1 = dl->ypos + dl->descent - dl->clip;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2102 }
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 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2105 ypos1 = WINDOW_TEXT_TOP (w);
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 /* #### See if this can be made conditional on the frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2108 changing size. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2109 if (MINI_WINDOW_P (w))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2110 ypos2 += FRAME_BORDER_HEIGHT (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2111
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2112 if (min_start >= 0 && ypos1 < min_start)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2113 ypos1 = min_start;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2114 if (max_end >= 0 && ypos2 > max_end)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2115 ypos2 = max_end;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2116
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2117 if (ypos2 <= ypos1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2118 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2119
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2120 redisplay_clear_to_window_end (w, ypos1, ypos2);
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
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 redisplay_update_line
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 This is used during incremental updates to update a single line and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2127 correct the offsets on all lines below it. At the moment
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2128 update_values is false if we are only updating the modeline.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2129 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2130 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2131 redisplay_update_line (struct window *w, int first_line, int last_line,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2132 int update_values)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2133 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2134 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2135 struct device *d = XDEVICE (f->device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2136
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2137 display_line_dynarr *cdla = window_display_lines (w, CURRENT_DISP);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2138 display_line_dynarr *ddla = window_display_lines (w, DESIRED_DISP);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2139
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2140 MAYBE_DEVMETH (d, window_output_begin, (w));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2141
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2142 while (first_line <= last_line)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2143 {
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 819
diff changeset
2144 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
2145 Dynarr_atp (cdla, first_line)->charpos);
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 819
diff changeset
2146 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
2147 Dynarr_atp (ddla, first_line)->charpos);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2148
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2149 assert (Dynarr_length (cdla) == Dynarr_length (ddla));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2150
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2151 /* Output the changes. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2152 output_display_line (w, cdla, ddla, first_line, -1, -1);
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 /* Update the offsets. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2155 if (update_values)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2156 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2157 int cur_line = first_line + 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2158 while (cur_line < Dynarr_length (cdla))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2159 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2160 Dynarr_atp (cdla, cur_line)->offset += (new_len - old_len);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2161 Dynarr_atp (ddla, cur_line)->offset += (new_len - old_len);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2162 cur_line++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2163 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2164 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2165
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2166 /* Update the window_end_pos and other settings. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2167 if (update_values)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2168 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2169 w->window_end_pos[CURRENT_DISP] -= (new_len - old_len);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2170
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2171 if (Dynarr_atp (ddla, first_line)->cursor_elt != -1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2172 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2173 w->last_point_x[CURRENT_DISP] = w->last_point_x[DESIRED_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2174 w->last_point_y[CURRENT_DISP] = w->last_point_y[DESIRED_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2175 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2176 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2177
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2178 first_line++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2179 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2180
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2181 /* Update the window max line length. We have to scan the entire
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2182 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
2183 supposed to shrink. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2184 if (update_values)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2185 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2186 int line = 0;
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 w->max_line_len = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2189 while (line < Dynarr_length (ddla))
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 struct display_line *dl = Dynarr_atp (ddla, line);
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 if (!dl->modeline)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2194 w->max_line_len = max (dl->num_chars, w->max_line_len);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2195
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2196 line++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2197 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2198 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2199
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2200 w->last_modified[CURRENT_DISP] = w->last_modified[DESIRED_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2201 w->last_facechange[CURRENT_DISP] = w->last_facechange[DESIRED_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2202 Fset_marker (w->last_point[CURRENT_DISP],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2203 Fmarker_position (w->last_point[DESIRED_DISP]), w->buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2204 Fset_marker (w->last_start[CURRENT_DISP],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2205 Fmarker_position (w->last_start[DESIRED_DISP]), w->buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2206
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2207 /* We don't bother updating the vertical scrollbars here. This
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2208 gives us a performance increase while having minimal loss of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2209 quality to the scrollbar slider size and position since when this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2210 function is called we know that the changes to the buffer were
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2211 very localized. We have to update the horizontal scrollbars,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2212 though, because this routine could cause a change which has a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2213 larger impact on their sizing. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2214 /* #### See if we can get away with only calling this if
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2215 max_line_len is greater than the window_char_width. */
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 448
diff changeset
2216 /* #### BILL!!! Should we do this for GTK as well? */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2217 #if defined(HAVE_SCROLLBARS) && defined(HAVE_X_WINDOWS)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2218 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2219 extern int stupid_vertical_scrollbar_drag_hack;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2220
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2221 update_window_scrollbars (w, NULL, 1, stupid_vertical_scrollbar_drag_hack);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2222 stupid_vertical_scrollbar_drag_hack = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2223 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2224 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2225
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2226 redisplay_redraw_cursor (f, 0);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2227 MAYBE_DEVMETH (d, window_output_end, (w));
428
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2230 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2231 redisplay_output_window
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2232
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2233 For the given window W, ensure that the current display lines are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2234 equal to the desired display lines, outputing changes as necessary.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2235
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2236 #### 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
2237 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
2238 because that is how the available output capabilities think. The
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2239 solution is relatively simple. Create redisplay_output_frame. This
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2240 will basically merge all of the separate window display structs into
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2241 a single one for the frame. This combination structure will be able
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2242 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
2243 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
2244 do.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2245 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2246 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2247 redisplay_output_window (struct window *w)
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 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2250 struct device *d = XDEVICE (f->device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2251
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2252 display_line_dynarr *cdla = window_display_lines (w, CURRENT_DISP);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2253 display_line_dynarr *ddla = window_display_lines (w, DESIRED_DISP);
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 int cdla_len = Dynarr_length (cdla);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2256 int ddla_len = Dynarr_length (ddla);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2257
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2258 int line;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2259 int need_to_clear_bottom = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2260 int need_to_clear_start = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2261 int need_to_clear_end = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2262
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2263 /* Backgrounds may have changed or windows may have gone away
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2264 leaving dividers lying around. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2265 if (f->faces_changed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2266 || f->windows_structure_changed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2267 || w->shadow_thickness_changed)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2268 need_to_clear_bottom = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2269
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2270 /* 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
2271 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
2272 bottom of the current display lines is below the bottom of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2273 desired display lines. Note that the number of lines is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2274 irrelevant. Only the position matters. We also clear to the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2275 bottom of the window if the modeline has shifted position. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2276 /* #### 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
2277 since there might be a window-local background. However, for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2278 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
2279 this case sucks. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2280 if (!need_to_clear_bottom)
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 struct display_line *cdl, *ddl;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2283
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2284 /* If the modeline has changed position or size, clear the bottom
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2285 of the window. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2286 if (!need_to_clear_bottom)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2287 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2288 cdl = ddl = 0;
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 if (cdla_len)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2291 cdl = Dynarr_atp (cdla, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2292 if (ddla_len)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2293 ddl = Dynarr_atp (ddla, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2294
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2295 if (!cdl || !ddl)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2296 need_to_clear_bottom = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2297 else if ((!cdl->modeline && ddl->modeline)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2298 || (cdl->modeline && !ddl->modeline))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2299 need_to_clear_bottom = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2300 else if (cdl->ypos != ddl->ypos ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2301 cdl->ascent != ddl->ascent ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2302 cdl->descent != ddl->descent ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2303 cdl->clip != ddl->clip)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2304 need_to_clear_bottom = 1;
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 /* #### This kludge is to make sure the modeline shadows get
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2307 redrawn if the modeline position shifts. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2308 if (need_to_clear_bottom)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2309 w->shadow_thickness_changed = 1;
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2312 if (!need_to_clear_bottom)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2313 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2314 cdl = ddl = 0;
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 if (cdla_len)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2317 cdl = Dynarr_atp (cdla, cdla_len - 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2318 if (ddla_len)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2319 ddl = Dynarr_atp (ddla, ddla_len - 1);
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 if (!cdl || !ddl)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2322 need_to_clear_bottom = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2323 else
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 int cdl_bottom, ddl_bottom;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2326
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2327 cdl_bottom = cdl->ypos + cdl->descent;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2328 ddl_bottom = ddl->ypos + ddl->descent;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2329
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2330 if (cdl_bottom > ddl_bottom)
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 need_to_clear_bottom = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2333 need_to_clear_start = ddl_bottom;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2334 need_to_clear_end = cdl_bottom;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2335 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2336 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2337 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2338 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2339
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2340 /* Perform any output initialization. */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2341 MAYBE_DEVMETH (d, window_output_begin, (w));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2342
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2343 /* If the window's structure has changed clear the internal border
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2344 above it if it is topmost (the function will check). */
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
2345 if (f->windows_structure_changed || f->faces_changed)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2346 redisplay_clear_top_of_window (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2347
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2348 /* Output each line. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2349 for (line = 0; line < Dynarr_length (ddla); line++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2350 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2351 output_display_line (w, cdla, ddla, line, -1, -1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2352 }
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 /* If the number of display lines has shrunk, adjust. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2355 if (cdla_len > ddla_len)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2356 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2357 Dynarr_length (cdla) = ddla_len;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2358 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2359
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2360 /* Output a vertical divider between windows, if necessary. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2361 if (window_needs_vertical_divider (w)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2362 && (f->windows_structure_changed || f->clear))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2363 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2364 MAYBE_DEVMETH (d, output_vertical_divider, (w, f->windows_structure_changed));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2365 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2366
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2367 /* Clear the rest of the window, if necessary. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2368 if (need_to_clear_bottom)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2369 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2370 redisplay_clear_bottom_of_window (w, ddla, need_to_clear_start,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2371 need_to_clear_end);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2372 }
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 w->window_end_pos[CURRENT_DISP] = w->window_end_pos[DESIRED_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2375 Fset_marker (w->start[CURRENT_DISP],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2376 make_int (marker_position (w->start[DESIRED_DISP])),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2377 w->buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2378 Fset_marker (w->pointm[CURRENT_DISP],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2379 make_int (marker_position (w->pointm[DESIRED_DISP])),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2380 w->buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2381 w->last_modified[CURRENT_DISP] = w->last_modified[DESIRED_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2382 w->last_facechange[CURRENT_DISP] = w->last_facechange[DESIRED_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2383 Fset_marker (w->last_start[CURRENT_DISP],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2384 Fmarker_position (w->last_start[DESIRED_DISP]), w->buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2385 Fset_marker (w->last_point[CURRENT_DISP],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2386 Fmarker_position (w->last_point[DESIRED_DISP]), w->buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2387 w->last_point_x[CURRENT_DISP] = w->last_point_x[DESIRED_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2388 w->last_point_y[CURRENT_DISP] = w->last_point_y[DESIRED_DISP];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2389 w->shadow_thickness_changed = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2390
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2391 set_window_display_buffer (w, XBUFFER (w->buffer));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2392 find_window_mirror (w)->truncate_win = window_truncation_on (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2393
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2394 /* 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
2395 get invalidated when it should be. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2396 INVALIDATE_DEVICE_PIXEL_TO_GLYPH_CACHE (d);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2397
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2398 redisplay_redraw_cursor (f, 0);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2399 MAYBE_DEVMETH (d, window_output_end, (w));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2400
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2401 #ifdef HAVE_SCROLLBARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2402 update_window_scrollbars (w, NULL, !MINI_WINDOW_P (w), 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2403 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2404 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2405
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 bevel_modeline
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 Draw a 3d border around the modeline on window W.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2410 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2411 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2412 bevel_modeline (struct window *w, struct display_line *dl)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2413 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2414 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2415 struct device *d = XDEVICE (f->device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2416 int x, y, width, height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2417 int shadow_thickness = MODELINE_SHADOW_THICKNESS (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2418 enum edge_style style;
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 x = WINDOW_MODELINE_LEFT (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2421 width = WINDOW_MODELINE_RIGHT (w) - x;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2422 y = dl->ypos - dl->ascent - shadow_thickness;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2423 height = dl->ascent + dl->descent + 2 * shadow_thickness;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2424
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2425 if (XINT (w->modeline_shadow_thickness) < 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2426 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2427 style = EDGE_BEVEL_IN;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2428 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2429 else
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 style = EDGE_BEVEL_OUT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2432 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2433
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
2434 MAYBE_DEVMETH (d, bevel_area,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2435 (w, MODELINE_INDEX, x, y, width, height, shadow_thickness,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2436 EDGE_ALL, style));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2437 }