annotate src/redisplay-tty.c @ 410:de805c49cfc1 r21-2-35

Import from CVS: tag r21-2-35
author cvs
date Mon, 13 Aug 2007 11:19:21 +0200
parents 501cfd01ee6d
children 697ef44129c6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 /* Communication module for TTY terminals.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 Copyright (C) 1995 Sun Microsystems, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 Copyright (C) 1995, 1996 Ben Wing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 Copyright (C) 1996 Chuck Thompson.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 under the terms of the GNU General Public License as published by the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 Free Software Foundation; either version 2, or (at your option) any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 XEmacs is distributed in the hope that it will be useful, but WITHOUT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 along with XEmacs; see the file COPYING. If not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 Boston, MA 02111-1307, USA. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 /* Synched up with: Not completely synched with FSF. Mostly divergent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 from FSF. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 /* This file has been Mule-ized. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 /* Written by Chuck Thompson. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 /* Color support added by Ben Wing. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 #include <config.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 #include "lisp.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 #include "buffer.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 #include "console-tty.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 #include "events.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 #include "faces.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 #include "frame.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 #include "glyphs.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 #include "lstream.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 #include "objects-tty.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 #include "redisplay.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 #include "sysdep.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 #include "window.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 /* These headers #define all kinds of common words like "columns"...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 What a bunch of losers. If we were to include them, we'd have to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 include them last to prevent them from messing up our own header
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 files (struct slot names, etc.). But it turns out that there are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 other conflicts as well on some systems, so screw it: we'll just
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 re-declare the routines we use and assume the code in this file is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 invoking them correctly. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 /* # include <curses.h> */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 /* # include <term.h> */
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 408
diff changeset
56 EXTERN_C int tgetent (const char *, const char *);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 408
diff changeset
57 EXTERN_C int tgetflag (const char *);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 408
diff changeset
58 EXTERN_C int tgetnum (const char *);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 408
diff changeset
59 EXTERN_C char *tgetstr (const char *, char **);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 408
diff changeset
60 EXTERN_C void tputs (const char *, int, void (*)(int));
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 408
diff changeset
61
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 #define FORCE_CURSOR_UPDATE(c) send_string_to_tty_console (c, 0, 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 #define OUTPUTN(c, a, n) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 do { \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 cmputc_console = c; \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 FORCE_CURSOR_UPDATE (c); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 tputs (a, n, cmputc); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 } while (0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 #define OUTPUT1(c, a) OUTPUTN (c, a, 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 #define OUTPUTN_IF(c, a, n) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 do { \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 cmputc_console = c; \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 FORCE_CURSOR_UPDATE (c); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 if (a) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 tputs (a, n, cmputc); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 } while (0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 #define OUTPUT1_IF(c, a) OUTPUTN_IF (c, a, 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 static void tty_output_emchar_dynarr (struct window *w,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 struct display_line *dl,
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
81 Emchar_dynarr *buf, int xpos,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 face_index findex,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 int cursor);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 static void tty_output_bufbyte_string (struct window *w,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 struct display_line *dl,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 Bufbyte *str, Bytecount len,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 int xpos, face_index findex,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 int cursor);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 static void tty_turn_on_face (struct window *w, face_index findex);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 static void tty_turn_off_face (struct window *w, face_index findex);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 static void tty_turn_on_frame_face (struct frame *f, Lisp_Object face);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 static void tty_turn_off_frame_face (struct frame *f, Lisp_Object face);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 static void term_get_fkeys (Lisp_Object keymap, char **address);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 tty_text_width
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 265
diff changeset
99 Non-Mule tty's don't have fonts (that we use at least), so everything
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 265
diff changeset
100 is considered to be fixed width -- in other words, we return LEN.
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 265
diff changeset
101 Under Mule, however, a character can still cover more than one
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 265
diff changeset
102 column, so we use emchar_string_displayed_columns().
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 static int
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
105 tty_text_width (struct frame *f, struct face_cachel *cachel, const Emchar *str,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 Charcount len)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 return emchar_string_displayed_columns (str, len);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 tty_divider_height
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 Return the width of the horizontal divider. This is a function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 because divider_height is a console method.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 tty_divider_height (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 return 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 tty_eol_cursor_width
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 Return the width of the end-of-line cursor. This is a function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 because eol_cursor_width is a console method.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 tty_eol_cursor_width (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 return 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 /*****************************************************************************
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
136 tty_frame_output_begin
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 Perform any necessary initialization prior to an update.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 #ifdef DEBUG_XEMACS
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
141 void tty_frame_output_begin (struct frame *f);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 #endif
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
146 tty_frame_output_begin (struct frame *f)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 #ifndef HAVE_TERMIOS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 /* Termcap requires `ospeed' to be a global variable so we have to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 always set it for whatever tty console we are actually currently
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 working with. */
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
152 ospeed = DEVICE_TTY_DATA (XDEVICE (FRAME_DEVICE (f)))->ospeed;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 /*****************************************************************************
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
157 tty_frame_output_end
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 Perform any necessary flushing of queues when an update has completed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 #ifdef DEBUG_XEMACS
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
162 void tty_frame_output_end (struct frame *f);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 #endif
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
167 tty_frame_output_end (struct frame *f)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 {
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
169 struct device *d = XDEVICE (FRAME_DEVICE (f));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 struct console *c = XCONSOLE (DEVICE_CONSOLE (d));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171
265
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents: 251
diff changeset
172 CONSOLE_TTY_CURSOR_X (c) = CONSOLE_TTY_FINAL_CURSOR_X (c);
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents: 251
diff changeset
173 CONSOLE_TTY_CURSOR_Y (c) = CONSOLE_TTY_FINAL_CURSOR_Y (c);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 FORCE_CURSOR_UPDATE (c);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 Lstream_flush (XLSTREAM (CONSOLE_TTY_DATA (c)->outstream));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177
265
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents: 251
diff changeset
178 static void
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents: 251
diff changeset
179 tty_set_final_cursor_coords (struct frame *f, int y, int x)
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents: 251
diff changeset
180 {
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents: 251
diff changeset
181 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents: 251
diff changeset
182
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents: 251
diff changeset
183 CONSOLE_TTY_FINAL_CURSOR_X (c) = x;
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents: 251
diff changeset
184 CONSOLE_TTY_FINAL_CURSOR_Y (c) = y;
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents: 251
diff changeset
185 }
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents: 251
diff changeset
186
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 tty_output_display_block
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 Given a display line, a block number for that start line, output all
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 runes between start and end in the specified display block.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 tty_output_display_block (struct window *w, struct display_line *dl, int block,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 int start, int end, int start_pixpos,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 int cursor_start, int cursor_width,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 int cursor_height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 struct frame *f = XFRAME (w->frame);
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
200 Emchar_dynarr *buf = Dynarr_new (Emchar);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 struct display_block *db = Dynarr_atp (dl->display_blocks, block);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 rune_dynarr *rba = db->runes;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 struct rune *rb;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 int elt = start;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 face_index findex;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 int xpos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 rb = Dynarr_atp (rba, elt);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 if (!rb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 /* Nothing to do so don't do anything. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 findex = rb->findex;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 xpos = rb->xpos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 if (end < 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 end = Dynarr_length (rba);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 Dynarr_reset (buf);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 while (elt < end && Dynarr_atp (rba, elt)->xpos < start_pixpos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 elt++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 findex = Dynarr_atp (rba, elt)->findex;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 xpos = Dynarr_atp (rba, elt)->xpos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 while (elt < end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 rb = Dynarr_atp (rba, elt);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 if (rb->findex == findex && rb->type == RUNE_CHAR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 && rb->object.chr.ch != '\n'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 && (rb->cursor_type != CURSOR_ON
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 || NILP (w->text_cursor_visible_p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 Dynarr_add (buf, rb->object.chr.ch);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 elt++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 if (Dynarr_length (buf))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 tty_output_emchar_dynarr (w, dl, buf, xpos, findex, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 xpos = rb->xpos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 Dynarr_reset (buf);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 if (rb->type == RUNE_CHAR)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 findex = rb->findex;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 xpos = rb->xpos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 if (rb->object.chr.ch == '\n')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 /* Clear in case a cursor was formerly here. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 Dynarr_add (buf, ' ');
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 tty_output_emchar_dynarr (w, dl, buf, rb->xpos,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 DEFAULT_INDEX, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 Dynarr_reset (buf);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 cmgoto (f, dl->ypos - 1, rb->xpos);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 elt++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 else if (rb->cursor_type == CURSOR_ON)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 /* There is not a distinct eol cursor on tty's. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 Dynarr_add (buf, rb->object.chr.ch);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 tty_output_emchar_dynarr (w, dl, buf, xpos, findex, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 Dynarr_reset (buf);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 cmgoto (f, dl->ypos - 1, xpos);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 xpos += rb->width;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 elt++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 }
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 284
diff changeset
288 /* #### RUNE_HLINE is actually a little more complicated than this
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 but at the moment it is only used to draw a turned off
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 modeline and this will suffice for that. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 else if (rb->type == RUNE_BLANK || rb->type == RUNE_HLINE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 Emchar ch_to_add;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 int size = rb->width;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 if (rb->type == RUNE_BLANK)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 ch_to_add = ' ';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 ch_to_add = '-';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 while (size--)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 Dynarr_add (buf, ch_to_add);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 tty_output_emchar_dynarr (w, dl, buf, rb->xpos, findex, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 if (xpos >= cursor_start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 && cursor_start < xpos + Dynarr_length (buf))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 cmgoto (f, dl->ypos - 1, cursor_start);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 Dynarr_reset (buf);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 elt++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 if (elt < end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 rb = Dynarr_atp (rba, elt);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 findex = rb->findex;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 xpos = rb->xpos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 else if (rb->type == RUNE_DGLYPH)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 Lisp_Object window;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 Lisp_Object instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 XSETWINDOW (window, w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 instance = glyph_image_instance (rb->object.dglyph.glyph,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 window, ERROR_ME_NOT, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 if (IMAGE_INSTANCEP (instance))
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
332 {
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
333 switch (XIMAGE_INSTANCE_TYPE (instance))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 {
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
335 case IMAGE_MONO_PIXMAP:
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
336 case IMAGE_COLOR_PIXMAP:
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
337 case IMAGE_SUBWINDOW:
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
338 case IMAGE_WIDGET:
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
339 /* just do nothing here */
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
340 break;
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
341
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
342 case IMAGE_NOTHING:
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
343 /* nothing is as nothing does */
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
344 break;
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
345
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
346 case IMAGE_TEXT:
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
347 case IMAGE_POINTER:
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
348 default:
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
349 abort ();
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 }
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
351 IMAGE_INSTANCE_OPTIMIZE_OUTPUT
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
352 (XIMAGE_INSTANCE (instance)) = 0;
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
353 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 xpos += rb->width;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 elt++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 if (Dynarr_length (buf))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 tty_output_emchar_dynarr (w, dl, buf, xpos, findex, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 Dynarr_free (buf);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 tty_output_vertical_divider
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 272
diff changeset
374 Draw a vertical divider down the right side of the given window.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 tty_output_vertical_divider (struct window *w, int clear)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 {
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 272
diff changeset
379 /* Divider width can either be 0 or 1 on TTYs */
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 272
diff changeset
380 if (window_divider_width (w))
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 272
diff changeset
381 {
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 272
diff changeset
382 struct frame *f = XFRAME (w->frame);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 272
diff changeset
383 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 272
diff changeset
384 int line;
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 272
diff changeset
385 int y_top = WINDOW_TEXT_TOP (w);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 272
diff changeset
386 int y_bot = WINDOW_TEXT_BOTTOM (w);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 272
diff changeset
387 unsigned char divv = '|';
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 272
diff changeset
389 tty_turn_on_face (w, MODELINE_INDEX);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 272
diff changeset
390 for (line = y_top; line < y_bot; line++)
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 272
diff changeset
391 {
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 272
diff changeset
392 cmgoto (f, line, WINDOW_TEXT_RIGHT (w));
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 272
diff changeset
393 send_string_to_tty_console (c, &divv, 1);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 272
diff changeset
394 TTY_INC_CURSOR_X (c, 1);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 272
diff changeset
395 }
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 272
diff changeset
396
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 272
diff changeset
397 /* Draw the divider in the modeline. */
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 272
diff changeset
398 cmgoto (f, y_bot, WINDOW_TEXT_RIGHT (w));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 send_string_to_tty_console (c, &divv, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 TTY_INC_CURSOR_X (c, 1);
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 272
diff changeset
401 tty_turn_off_face (w, MODELINE_INDEX);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 /****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 tty_clear_region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 Clear the area in the box defined by the given parameters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 static void
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
411 tty_clear_region (Lisp_Object window, struct device* d, struct frame * f,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
412 face_index findex, int x, int y,
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
413 int width, int height, Lisp_Object fcolor, Lisp_Object bcolor,
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
414 Lisp_Object background_pixmap)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 int line;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
418 struct window* w = XWINDOW (window);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 tty_turn_on_face (w, findex);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 for (line = y; line < y + height; line++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 int col;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 cmgoto (f, line, x);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 if (window_is_leftmost (w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 && window_is_rightmost (w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 && TTY_SE (c).clr_to_eol)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 OUTPUT1 (c, TTY_SE (c).clr_to_eol);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 unsigned char sp = ' ';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 /* #### Of course, this is all complete and utter crap. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 for (col = x; col < x + width; col++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 send_string_to_tty_console (c, &sp, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 TTY_INC_CURSOR_X (c, width);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 tty_turn_off_face (w, findex);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 cmgoto (f, y, x);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 tty_clear_to_window_end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 Clear the area between ypos1 and ypos2. Each margin area and the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 text area is handled separately since they may each have their own
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 background color.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 tty_clear_to_window_end (struct window *w, int ypos1, int ypos2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 struct frame *f = XFRAME (w->frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 int x, width;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 x = WINDOW_TEXT_LEFT (w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 width = WINDOW_TEXT_WIDTH (w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 if (window_is_rightmost (w))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 /* #### Optimize to use clr_to_eol function of tty if available, if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 the window is the entire width of the frame. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 /* #### Is this actually an optimization? */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 int line;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 tty_turn_on_face (w, DEFAULT_INDEX);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 for (line = ypos1; line < ypos2; line++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 cmgoto (XFRAME (w->frame), line, x);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 OUTPUT1 (c, TTY_SE (c).clr_to_eol);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 tty_turn_off_face (w, DEFAULT_INDEX);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 Lisp_Object window;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 XSETWINDOW (window, w);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
482 redisplay_clear_region (window, DEFAULT_INDEX, x, ypos1, width, ypos2 - ypos1);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 /****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 tty_clear_frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 Clear the entire frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 tty_clear_frame (struct frame *f)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 tty_turn_on_frame_face (f, Vdefault_face);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 if (TTY_SE (c).clr_frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 OUTPUT1 (c, TTY_SE (c).clr_frame);
265
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents: 251
diff changeset
500 CONSOLE_TTY_REAL_CURSOR_X (c) = 0;
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents: 251
diff changeset
501 CONSOLE_TTY_REAL_CURSOR_Y (c) = 0;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 #ifdef NOT_SURE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 FRAME_CURSOR_X (f) = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 FRAME_CURSOR_Y (f) = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 #ifdef NOT_SURE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 internal_cursor_to (f, 0, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 clear_to_end (f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 /* #### Not implemented. */
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
514 stderr_out ("Not yet.\n");
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 tty_turn_off_frame_face (f, Vdefault_face);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 tty_output_bufbyte_string (struct window *w, struct display_line *dl,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 Bufbyte *str, Bytecount len, int xpos,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 face_index findex, int cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 struct frame *f = XFRAME (w->frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 /* First position the cursor. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 cmgoto (f, dl->ypos - 1, xpos);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 /* Enable any face properties. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 tty_turn_on_face (w, findex);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 send_string_to_tty_console (c, str, len);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 TTY_INC_CURSOR_X (c, bufbyte_string_displayed_columns (str, len));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 /* Turn the face properties back off. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 tty_turn_off_face (w, findex);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
541 static Bufbyte_dynarr *tty_output_emchar_dynarr_dynarr;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 tty_output_emchar_dynarr
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 Given a string and a starting position, output that string in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 given face. If cursor is true, draw a cursor around the string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 tty_output_emchar_dynarr (struct window *w, struct display_line *dl,
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
551 Emchar_dynarr *buf, int xpos, face_index findex,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 int cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 if (!tty_output_emchar_dynarr_dynarr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 tty_output_emchar_dynarr_dynarr = Dynarr_new (Bufbyte);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 Dynarr_reset (tty_output_emchar_dynarr_dynarr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 convert_emchar_string_into_bufbyte_dynarr (Dynarr_atp (buf, 0),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 Dynarr_length (buf),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 tty_output_emchar_dynarr_dynarr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 tty_output_bufbyte_string (w, dl,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 Dynarr_atp (tty_output_emchar_dynarr_dynarr, 0),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 Dynarr_length (tty_output_emchar_dynarr_dynarr),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 xpos, findex, cursor);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 #if 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
571 static Bufbyte_dynarr *sidcs_dynarr;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 substitute_in_dynamic_color_string (Lisp_Object spec, Lisp_Object string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 int i;
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
577 Bufbyte *specdata = XSTRING_DATA (spec);
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
578 Bytecount speclen = XSTRING_LENGTH (spec);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 if (!sidcs_dynarr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 sidcs_dynarr = Dynarr_new (Bufbyte);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 Dynarr_reset (sidcs_dynarr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 for (i = 0; i < speclen; i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 if (specdata[i] == '%' && specdata[i+1] == '%')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 Dynarr_add (sidcs_dynarr, '%');
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 i++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 else if (specdata[i] == '%' && specdata[i+1] == 's')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 {
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
594 Dynarr_add_many (sidcs_dynarr,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
595 XSTRING_DATA (string),
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
596 XSTRING_LENGTH (string));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 i++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 Dynarr_add (sidcs_dynarr, specdata[i]);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 set_foreground_to (struct console *c, Lisp_Object sym)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 Lisp_Object result;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 Bufbyte *escseq = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 Bytecount escseqlen = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 result = assq_no_quit (sym, Vtty_color_alist);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 if (!NILP (result))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 Lisp_Object esc_seq = XCAR (XCDR (result));
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
617 escseq = XSTRING_DATA (esc_seq);
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
618 escseqlen = XSTRING_LENGTH (esc_seq);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 #if 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 else if (STRINGP (Vtty_dynamic_color_fg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 substitute_in_dynamic_color_string (Vtty_dynamic_color_fg,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 Fsymbol_name (sym));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 escseq = Dynarr_atp (sidcs_dynarr, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 escseqlen = Dynarr_length (sidcs_dynarr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 if (escseq)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 send_string_to_tty_console (c, escseq, escseqlen);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 set_background_to (struct console *c, Lisp_Object sym)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 Lisp_Object result;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 Bufbyte *escseq = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 Bytecount escseqlen = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 result = assq_no_quit (sym, Vtty_color_alist);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 if (!NILP (result))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 Lisp_Object esc_seq = XCDR (XCDR (result));
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
647 escseq = XSTRING_DATA (esc_seq);
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
648 escseqlen = XSTRING_LENGTH (esc_seq);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 #if 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 else if (STRINGP (Vtty_dynamic_color_bg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 substitute_in_dynamic_color_string (Vtty_dynamic_color_bg,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 Fsymbol_name (sym));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 escseq = Dynarr_atp (sidcs_dynarr, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 escseqlen = Dynarr_length (sidcs_dynarr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 if (escseq)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 send_string_to_tty_console (c, escseq, escseqlen);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 tty_turn_on_face_1 (struct console *c, int highlight_p,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 int blinking_p, int dim_p, int underline_p,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 int reverse_p, Lisp_Object cinst_fore,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 Lisp_Object cinst_back)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 if (highlight_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 OUTPUT1_IF (c, TTY_SD (c).turn_on_bold);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 if (blinking_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 OUTPUT1_IF (c, TTY_SD (c).turn_on_blinking);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 if (dim_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 OUTPUT1_IF (c, TTY_SD (c).turn_on_dim);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 if (underline_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689 /* #### punt for now if underline mode is glitchy */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690 if (!TTY_FLAGS (c).underline_width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 OUTPUT1_IF (c, TTY_SD (c).begin_underline);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 if (reverse_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 /* #### punt for now if standout mode is glitchy */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 if (!TTY_FLAGS (c).standout_width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701 OUTPUT1_IF (c, TTY_SD (c).begin_standout);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 reverse_p = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 if (reverse_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 Lisp_Object temp = cinst_fore;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 cinst_fore = cinst_back;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 cinst_back = temp;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 if (COLOR_INSTANCEP (cinst_fore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 && !EQ (cinst_fore, Vthe_null_color_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 set_foreground_to (c, COLOR_INSTANCE_TTY_SYMBOL
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 (XCOLOR_INSTANCE (cinst_fore)));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719 if (COLOR_INSTANCEP (cinst_back)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 && !EQ (cinst_back, Vthe_null_color_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 set_background_to (c, COLOR_INSTANCE_TTY_SYMBOL
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 (XCOLOR_INSTANCE (cinst_back)));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 tty_turn_on_face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 Turn on all set properties of the given face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 tty_turn_on_face (struct window *w, face_index findex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 struct frame *f = XFRAME (w->frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
736 tty_turn_on_face_1 (c,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 WINDOW_FACE_CACHEL_HIGHLIGHT_P (w, findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 WINDOW_FACE_CACHEL_BLINKING_P (w, findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 WINDOW_FACE_CACHEL_DIM_P (w, findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 WINDOW_FACE_CACHEL_UNDERLINE_P (w, findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 WINDOW_FACE_CACHEL_REVERSE_P (w, findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 WINDOW_FACE_CACHEL_FOREGROUND (w, findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 WINDOW_FACE_CACHEL_BACKGROUND (w, findex));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 tty_turn_off_face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 Turn off all set properties of the given face (revert to default
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 face). We assume that tty_turn_on_face has been called for the given
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 265
diff changeset
751 face so that its properties are actually active.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 tty_turn_off_face (struct window *w, face_index findex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 struct frame *f = XFRAME (w->frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759 if (WINDOW_FACE_CACHEL_REVERSE_P (w, findex))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761 /* #### punt for now if standout mode is glitchy */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 if (!TTY_FLAGS (c).standout_width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 OUTPUT1_IF (c, TTY_SD (c).end_standout);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 if (WINDOW_FACE_CACHEL_UNDERLINE_P (w, findex))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 /* #### punt for now if underline mode is glitchy */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 if (!TTY_FLAGS (c).underline_width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773 OUTPUT1_IF (c, TTY_SD (c).end_underline);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777 if (WINDOW_FACE_CACHEL_HIGHLIGHT_P (w, findex) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 WINDOW_FACE_CACHEL_BLINKING_P (w, findex) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 WINDOW_FACE_CACHEL_DIM_P (w, findex) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 !EQ (WINDOW_FACE_CACHEL_FOREGROUND (w, findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 Vthe_null_color_instance) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 !EQ (WINDOW_FACE_CACHEL_BACKGROUND (w, findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783 Vthe_null_color_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 OUTPUT1_IF (c, TTY_SD (c).turn_off_attributes);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 tty_turn_on_frame_face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792 Turn on all set properties of the given face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 tty_turn_on_frame_face (struct frame *f, Lisp_Object face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796 {
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 265
diff changeset
797 Lisp_Object frame;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
799
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800 XSETFRAME (frame, f);
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
801 tty_turn_on_face_1 (c,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 FACE_HIGHLIGHT_P (face, frame),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803 FACE_BLINKING_P (face, frame),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 FACE_DIM_P (face, frame),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 FACE_UNDERLINE_P (face, frame),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806 FACE_REVERSE_P (face, frame),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 FACE_FOREGROUND (face, frame),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 FACE_BACKGROUND (face, frame));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812 tty_turn_off_frame_face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 Turn off all set properties of the given face (revert to default
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815 face). We assume that tty_turn_on_face has been called for the given
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 265
diff changeset
816 face so that its properties are actually active.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 tty_turn_off_frame_face (struct frame *f, Lisp_Object face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820 {
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 265
diff changeset
821 Lisp_Object frame;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 XSETFRAME (frame, f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 if (FACE_REVERSE_P (face, frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 /* #### punt for now if standout mode is glitchy */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 if (!TTY_FLAGS (c).standout_width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 OUTPUT1_IF (c, TTY_SD (c).end_standout);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 if (FACE_UNDERLINE_P (face, frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 /* #### punt for now if underline mode is glitchy */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 if (!TTY_FLAGS (c).underline_width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 OUTPUT1_IF (c, TTY_SD (c).end_underline);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 if (FACE_HIGHLIGHT_P (face, frame) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 FACE_BLINKING_P (face, frame) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 FACE_DIM_P (face, frame) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 !EQ (FACE_FOREGROUND (face, frame), Vthe_null_color_instance) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 !EQ (FACE_BACKGROUND (face, frame), Vthe_null_color_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 OUTPUT1_IF (c, TTY_SD (c).turn_off_attributes);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 set_tty_modes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 Sets up various parameters on tty modes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 set_tty_modes (struct console *c)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 if (!CONSOLE_TTY_P (c))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865 OUTPUT1_IF (c, TTY_SD (c).init_motion);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 OUTPUT1_IF (c, TTY_SD (c).cursor_visible);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 OUTPUT1_IF (c, TTY_SD (c).keypad_on);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 reset_tty_modes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 Restore default state of tty.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 reset_tty_modes (struct console *c)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 if (!CONSOLE_TTY_P (c))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880
122
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 82
diff changeset
881 OUTPUT1_IF (c, TTY_SD (c).orig_pair);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 OUTPUT1_IF (c, TTY_SD (c).keypad_off);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 OUTPUT1_IF (c, TTY_SD (c).cursor_normal);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 OUTPUT1_IF (c, TTY_SD (c).end_motion);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
885 tty_frame_output_end (XFRAME (CONSOLE_SELECTED_FRAME (c)));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 tty_redisplay_shutdown
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891 Clear the frame and position the cursor properly for exiting.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 tty_redisplay_shutdown (struct console *c)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 Lisp_Object dev = CONSOLE_SELECTED_DEVICE (c);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
898 if (!NILP (dev))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 Lisp_Object frm = DEVICE_SELECTED_FRAME (XDEVICE (dev));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
902 if (!NILP (frm))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904 struct frame *f = XFRAME (frm);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906 /* Clear the bottom line of the frame. */
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
907 redisplay_clear_region (FRAME_SELECTED_WINDOW (f), DEFAULT_INDEX, 0,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908 f->height, f->width, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910 /* And then stick the cursor there. */
265
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents: 251
diff changeset
911 tty_set_final_cursor_coords (f, f->height, 0);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
912 tty_frame_output_end (f);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 /* #### Everything below here is old shit. It should either be moved
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 up or removed. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 /* FLAGS - these don't need to be console local since only one console
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
923 can be being updated at a time. */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 static int insert_mode_on; /* nonzero if in insert mode */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 static int standout_mode_on; /* nonzero if in standout mode */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 static int underline_mode_on; /* nonzero if in underline mode */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 static int alternate_mode_on; /* nonzero if in alternate char set */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 static int attributes_on; /* nonzero if any attributes on */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 #ifdef NOT_YET
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932 turn_on_insert (struct frame *f)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 if (!insert_mode_on)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 OUTPUT1_IF (c, TTY_SE (c).begin_ins_mode);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 insert_mode_on = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 turn_off_insert (struct frame *f)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 if (insert_mode_on)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 OUTPUT1 (c, TTY_SE (c).end_ins_mode);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 insert_mode_on = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 internal_cursor_to (struct frame *f, int row, int col)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 if (!TTY_FLAGS (c).insert_mode_motion)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 turn_off_insert (f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958 if (!TTY_FLAGS (c).standout_motion)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960 turn_off_standout (f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961 turn_off_underline (f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962 turn_off_alternate (f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965 cmgoto (f, row, col);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 clear_to_end (struct frame *f)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973 /* assumes cursor is already positioned */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 if (TTY_SE (c).clr_from_cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 OUTPUT1 (c, TTY_SE (c).clr_from_cursor);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 int line = FRAME_CURSOR_Y (f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982 while (line < FRAME_HEIGHT (f))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984 internal_cursor_to (f, line, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985 OUTPUT1 (c, TTY_SE (c).clr_to_eol);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 #endif /* 0 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991 #if 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993 * clear from last visible line on window to window end (presumably
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 * the line above window's modeline
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 tty_clear_window_end (struct window *w, int ystart, int yend)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 struct console *c = XCONSOLE (WINDOW_CONSOLE (w));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 int line;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002 for (line = ystart; line < yend; line++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1004 cmgoto (XFRAME (w->frame), line, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005 OUTPUT1 (c, TTY_SE (c).clr_to_eol);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009 #endif /* 0 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012 tty_flash (struct device *d)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014 struct console *c = XCONSOLE (DEVICE_CONSOLE (d));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 if (TTY_SD (c).visual_bell)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 OUTPUT1 (c, TTY_SD (c).visual_bell);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 Lstream_flush (XLSTREAM (CONSOLE_TTY_DATA (c)->outstream));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019 return 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026 * tty_ring_bell - sound an audio beep.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029 tty_ring_bell (struct device *d, int volume, int pitch, int duration)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 struct console *c = XCONSOLE (DEVICE_CONSOLE (d));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 74
diff changeset
1033 if (volume)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 74
diff changeset
1034 {
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 74
diff changeset
1035 OUTPUT1 (c, TTY_SD (c).audio_bell);
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 74
diff changeset
1036 Lstream_flush (XLSTREAM (CONSOLE_TTY_DATA (c)->outstream));
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 74
diff changeset
1037 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041 int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 init_tty_for_redisplay (struct device *d, char *terminal_type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044 int status;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045 char entry_buffer[2044];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046 /* char temp_buffer[2044]; */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047 char *bufptr;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048 struct console *c = XCONSOLE (DEVICE_CONSOLE (d));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050 /* What we should really do is allocate just enough space for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051 the actual strings that are stored; but this would require
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052 doing this after all the tgetstr()s and adjusting all the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053 pointers. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054 CONSOLE_TTY_DATA (c)->term_entry_buffer = (char *) xmalloc (2044);
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
1055 bufptr = CONSOLE_TTY_DATA (c)->term_entry_buffer;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 408
diff changeset
1057 #ifdef SIGTTOU
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 193
diff changeset
1058 /* SIGTT* don't exist under win32 */
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1059 EMACS_BLOCK_SIGNAL (SIGTTOU);
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 193
diff changeset
1060 #endif
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 status = tgetent (entry_buffer, terminal_type);
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 408
diff changeset
1062 #ifdef SIGTTOU
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1063 EMACS_UNBLOCK_SIGNAL (SIGTTOU);
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 193
diff changeset
1064 #endif
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065 #if 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066 if (status < 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067 return TTY_UNABLE_OPEN_DATABASE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1068 else if (status == 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069 return TTY_TYPE_UNDEFINED;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1071 /* Under Linux at least, <0 is returned for TTY_TYPE_UNDEFINED. --ben */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1072 if (status <= 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1073 return TTY_TYPE_UNDEFINED;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1074
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1076 * Establish the terminal size.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078 /* First try to get the info from the system. If that fails, check
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079 the termcap entry. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080 get_tty_device_size (d, &CONSOLE_TTY_DATA (c)->width,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081 &CONSOLE_TTY_DATA (c)->height);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083 if (CONSOLE_TTY_DATA (c)->width <= 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084 CONSOLE_TTY_DATA (c)->width = tgetnum ("co");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085 if (CONSOLE_TTY_DATA (c)->height <= 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086 CONSOLE_TTY_DATA (c)->height = tgetnum ("li");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088 if (CONSOLE_TTY_DATA (c)->width <= 0 || CONSOLE_TTY_DATA (c)->height <= 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089 return TTY_SIZE_UNSPECIFIED;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092 * Initialize cursor motion information.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1093 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095 /* local cursor movement */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096 TTY_CM (c).up = tgetstr ("up", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097 TTY_CM (c).down = tgetstr ("do", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098 TTY_CM (c).left = tgetstr ("le", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099 TTY_CM (c).right = tgetstr ("nd", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1100 TTY_CM (c).home = tgetstr ("ho", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1101 TTY_CM (c).low_left = tgetstr ("ll", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102 TTY_CM (c).car_return = tgetstr ("cr", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1103
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1104 /* absolute cursor motion */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1105 TTY_CM (c).abs = tgetstr ("cm", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1106 TTY_CM (c).hor_abs = tgetstr ("ch", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1107 TTY_CM (c).ver_abs = tgetstr ("cv", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1108
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109 /* Verify that the terminal is powerful enough to run Emacs */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1110 if (!TTY_CM (c).abs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1111 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1112 if (!TTY_CM (c).up || !TTY_CM (c).down
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1113 || !TTY_CM (c).left || !TTY_CM (c).right)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1114 return TTY_TYPE_INSUFFICIENT;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1115 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1116
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1117 /* parameterized local cursor movement */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1118 TTY_CM (c).multi_up = tgetstr ("UP", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1119 TTY_CM (c).multi_down = tgetstr ("DO", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1120 TTY_CM (c).multi_left = tgetstr ("LE", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1121 TTY_CM (c).multi_right = tgetstr ("RI", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1122
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1123 /* scrolling */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1124 TTY_CM (c).scroll_forw = tgetstr ("sf", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1125 TTY_CM (c).scroll_back = tgetstr ("sr", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1126 TTY_CM (c).multi_scroll_forw = tgetstr ("SF", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1127 TTY_CM (c).multi_scroll_back = tgetstr ("SR", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1128 TTY_CM (c).set_scroll_region = tgetstr ("cs", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1129
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1130
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1131 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1132 * Initialize screen editing information.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1133 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135 /* adding to the screen */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1136 TTY_SE (c).ins_line = tgetstr ("al", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137 TTY_SE (c).multi_ins_line = tgetstr ("AL", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138 TTY_SE (c).repeat = tgetstr ("rp", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139 TTY_SE (c).begin_ins_mode = tgetstr ("im", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140 TTY_SE (c).end_ins_mode = tgetstr ("ei", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1141 TTY_SE (c).ins_char = tgetstr ("ic", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1142 TTY_SE (c).multi_ins_char = tgetstr ("IC", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1143 TTY_SE (c).insert_pad = tgetstr ("ip", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1144
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1145 /* deleting from the screen */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1146 TTY_SE (c).clr_frame = tgetstr ("cl", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1147 TTY_SE (c).clr_from_cursor = tgetstr ("cd", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1148 TTY_SE (c).clr_to_eol = tgetstr ("ce", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1149 TTY_SE (c).del_line = tgetstr ("dl", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1150 TTY_SE (c).multi_del_line = tgetstr ("DL", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1151 TTY_SE (c).del_char = tgetstr ("dc", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1152 TTY_SE (c).multi_del_char = tgetstr ("DC", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1153 TTY_SE (c).begin_del_mode = tgetstr ("dm", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1154 TTY_SE (c).end_del_mode = tgetstr ("ed", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1155 TTY_SE (c).erase_at_cursor = tgetstr ("ec", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1156
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1157
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1158 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1159 * Initialize screen display information.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1160 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1161 TTY_SD (c).begin_standout = tgetstr ("so", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1162 TTY_SD (c).end_standout = tgetstr ("se", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1163 TTY_SD (c).begin_underline = tgetstr ("us", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1164 TTY_SD (c).end_underline = tgetstr ("ue", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1165 TTY_SD (c).begin_alternate = tgetstr ("as", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1166 TTY_SD (c).end_alternate = tgetstr ("ae", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1167 TTY_SD (c).turn_on_reverse = tgetstr ("mr", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1168 TTY_SD (c).turn_on_blinking = tgetstr ("mb", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1169 TTY_SD (c).turn_on_bold = tgetstr ("md", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1170 TTY_SD (c).turn_on_dim = tgetstr ("mh", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1171 TTY_SD (c).turn_off_attributes = tgetstr ("me", &bufptr);
122
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 82
diff changeset
1172 TTY_SD (c).orig_pair = tgetstr ("op", &bufptr);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1173
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1174 TTY_SD (c).visual_bell = tgetstr ("vb", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1175 TTY_SD (c).audio_bell = tgetstr ("bl", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1176 if (!TTY_SD (c).audio_bell)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1177 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1178 /* If audio_bell doesn't get set, then assume C-g. This is gross and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1179 ugly but is what Emacs has done from time immortal. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1180 TTY_SD (c).audio_bell = "\07";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1181 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1182
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1183 TTY_SD (c).cursor_visible = tgetstr ("ve", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1184 TTY_SD (c).cursor_normal = tgetstr ("vs", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1185 TTY_SD (c).init_motion = tgetstr ("ti", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1186 TTY_SD (c).end_motion = tgetstr ("te", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1187 TTY_SD (c).keypad_on = tgetstr ("ks", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1188 TTY_SD (c).keypad_off = tgetstr ("ke", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1189
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1190
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1191 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1192 * Initialize additional terminal information.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1193 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1194 TTY_FLAGS (c).must_write_spaces = tgetflag ("in");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1195 TTY_FLAGS (c).insert_mode_motion = tgetflag ("mi");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1196 TTY_FLAGS (c).standout_motion = tgetflag ("ms");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1197 TTY_FLAGS (c).memory_above_frame = tgetflag ("da");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1198 TTY_FLAGS (c).memory_below_frame = tgetflag ("db");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1199 TTY_FLAGS (c).standout_width = tgetnum ("sg");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1200 TTY_FLAGS (c).underline_width = tgetnum ("ug");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1201
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1202 if (TTY_FLAGS (c).standout_width == -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1203 TTY_FLAGS (c).standout_width = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1204 if (TTY_FLAGS (c).underline_width == -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1205 TTY_FLAGS (c).underline_width = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1206
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
1207 TTY_FLAGS (c).meta_key =
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1208 eight_bit_tty (d) ? tgetflag ("km") || tgetflag ("MT") ? 1 : 2 : 0;
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
1209
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
1210
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1211 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1212 * Setup the costs tables for this tty console.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1213 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1214 cm_cost_init (c);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1215
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1216 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1217 * Initialize local flags.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1218 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1219 insert_mode_on = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1220 standout_mode_on = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1221 underline_mode_on = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1222 alternate_mode_on = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1223 attributes_on = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1224
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1225 /*
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 265
diff changeset
1226 * Attempt to initialize the function_key_map to
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1227 * some kind of sensible value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1228 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1229
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1230 term_get_fkeys (c->function_key_map, &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1231
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1232 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1233 /* check for ANSI set-foreground and set-background strings,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1234 and assume color if so.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1235
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1236 #### we should support the other (non-ANSI) ways of specifying
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1237 color, too. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1238 char foobuf[500];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1239 char *fooptr = foobuf;
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
1240 if ((tgetstr ("AB", &fooptr) && tgetstr ("AF", &fooptr)) ||
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
1241 (tgetstr ("Sf", &fooptr) && tgetstr ("Sb", &fooptr)) ||
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
1242 ((tgetnum ("Co") > 0) && (tgetnum ("pa") > 0)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1243 DEVICE_CLASS (d) = Qcolor;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1244 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1245 DEVICE_CLASS (d) = Qmono;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1246 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1247
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1248 return TTY_INIT_SUCCESS;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1249 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1250
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1251 struct fkey_table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1252 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1253 const char *cap;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1254 const char *name;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1255 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1256
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1257 /* Termcap capability names that correspond directly to X keysyms.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1258 Some of these (marked "terminfo") aren't supplied by old-style
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1259 (Berkeley) termcap entries. They're listed in X keysym order;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1260 except we put the keypad keys first, so that if they clash with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1261 other keys (as on the IBM PC keyboard) they get overridden.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1262 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1263
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1264 static struct fkey_table keys[] =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1265 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1266 {"kh", "home"}, /* termcap */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1267 {"kl", "left"}, /* termcap */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1268 {"ku", "up"}, /* termcap */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1269 {"kr", "right"}, /* termcap */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1270 {"kd", "down"}, /* termcap */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1271 {"%8", "prior"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1272 {"%5", "next"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1273 {"@7", "end"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1274 {"@1", "begin"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1275 {"*6", "select"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1276 {"%9", "print"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1277 {"@4", "execute"}, /* terminfo --- actually the `command' key */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1278 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1279 * "insert" --- see below
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1280 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1281 {"&8", "undo"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1282 {"%0", "redo"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1283 {"%7", "menu"}, /* terminfo --- actually the `options' key */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1284 {"@0", "find"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1285 {"@2", "cancel"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1286 {"%1", "help"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1287 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1288 * "break" goes here, but can't be reliably intercepted with termcap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1289 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1290 {"&4", "reset"}, /* terminfo --- actually `restart' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1291 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1292 * "system" and "user" --- no termcaps
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1293 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1294 {"kE", "clearline"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1295 {"kA", "insertline"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1296 {"kL", "deleteline"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1297 {"kI", "insertchar"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1298 {"kD", "delete"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1299 {"kB", "backtab"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1300 /*
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1301 * "kp-backtab", "kp-space", "kp-tab" --- no termcaps
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1302 */
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1303 {"@8", "kp-enter"}, /* terminfo */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1304 /*
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1305 * "kp-f1", "kp-f2", "kp-f3" "kp-f4",
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1306 * "kp-multiply", "kp-add", "kp-separator",
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1307 * "kp-subtract", "kp-decimal", "kp-divide", "kp-0";
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1308 * --- no termcaps for any of these.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1309 */
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1310 {"K4", "kp-1"}, /* terminfo */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1311 /*
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1312 * "kp-2" --- no termcap
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1313 */
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1314 {"K5", "kp-3"}, /* terminfo */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1315 /*
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1316 * "kp-4" --- no termcap
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1317 */
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1318 {"K2", "kp-5"}, /* terminfo */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1319 /*
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1320 * "kp-6" --- no termcap
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1321 */
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1322 {"K1", "kp-7"}, /* terminfo */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1323 /*
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1324 * "kp-8" --- no termcap
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1325 */
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1326 {"K3", "kp-9"}, /* terminfo */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1327 /*
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1328 * "kp-equal" --- no termcap
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1329 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1330 {"k1", "f1"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1331 {"k2", "f2"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1332 {"k3", "f3"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1333 {"k4", "f4"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1334 {"k5", "f5"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1335 {"k6", "f6"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1336 {"k7", "f7"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1337 {"k8", "f8"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1338 {"k9", "f9"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1339 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1340
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1341 static char **term_get_fkeys_arg;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1342
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1343 static Lisp_Object term_get_fkeys_1 (Lisp_Object keymap);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1344 static Lisp_Object term_get_fkeys_error (Lisp_Object err, Lisp_Object arg);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1345
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1346 /* Find the escape codes sent by the function keys for Vfunction_key_map.
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
1347 This function scans the termcap function key sequence entries, and
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1348 adds entries to Vfunction_key_map for each function key it finds. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1349
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1350 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1351 term_get_fkeys (Lisp_Object keymap, char **address)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1352 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1353 /* We run the body of the function (term_get_fkeys_1) and ignore all Lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1354 errors during the call. The only errors should be from Fdefine_key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1355 when given a key sequence containing an invalid prefix key. If the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1356 termcap defines function keys which use a prefix that is already bound
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1357 to a command by the default bindings, we should silently ignore that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1358 function key specification, rather than giving the user an error and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1359 refusing to run at all on such a terminal. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1360
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1361 term_get_fkeys_arg = address;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1362
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1363 condition_case_1 (Qerror,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1364 term_get_fkeys_1, keymap,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1365 term_get_fkeys_error, Qnil);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1366 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1367
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1368 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1369 term_get_fkeys_error (Lisp_Object err, Lisp_Object arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1370 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1371 return arg;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1372 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1373
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1374 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1375 term_get_fkeys_1 (Lisp_Object function_key_map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1376 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1377 int i;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1378
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1379 char **address = term_get_fkeys_arg;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1380
193
f53b5ca2e663 Import from CVS: tag r20-3b23
cvs
parents: 185
diff changeset
1381 for (i = 0; i < countof (keys); i++)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1382 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1383 char *sequence = tgetstr (keys[i].cap, address);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1384 if (sequence)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1385 Fdefine_key (function_key_map,
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1386 build_ext_string (sequence, Qbinary),
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1387 vector1 (intern (keys[i].name)));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1388 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1389
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1390 /* The uses of the "k0" capability are inconsistent; sometimes it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1391 describes F10, whereas othertimes it describes F0 and "k;" describes F10.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1392 We will attempt to politely accommodate both systems by testing for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1393 "k;", and if it is present, assuming that "k0" denotes F0, otherwise F10.
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1394 */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1395 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1396 const char *k_semi = tgetstr ("k;", address);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1397 const char *k0 = tgetstr ("k0", address);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1398
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1399 if (k_semi)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1400 Fdefine_key (function_key_map, build_ext_string (k_semi, Qbinary),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1401 vector1 (intern ("f10")));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1402
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1403 if (k0)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1404 Fdefine_key (function_key_map, build_ext_string (k0, Qbinary),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1405 vector1 (intern (k_semi ? "f0" : "f10")));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1406 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1407
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1408 /* Set up cookies for numbered function keys above f10. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1409 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1410 char fcap[3], fkey[4];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1411
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1412 fcap[0] = 'F'; fcap[2] = '\0';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1413 for (i = 11; i < 64; i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1414 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1415 if (i <= 19)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1416 fcap[1] = '1' + i - 11;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1417 else if (i <= 45)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1418 fcap[1] = 'A' + i - 20;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1419 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1420 fcap[1] = 'a' + i - 46;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1421
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1422 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1423 char *sequence = tgetstr (fcap, address);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1424 if (sequence)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1425 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1426 sprintf (fkey, "f%d", i);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1427 Fdefine_key (function_key_map,
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1428 build_ext_string (sequence, Qbinary),
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1429 vector1 (intern (fkey)));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1430 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1431 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1432 }
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1433 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1434
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1435 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1436 * Various mappings to try and get a better fit.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1437 */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1438 #define CONDITIONAL_REASSIGN(cap1, cap2, keyname) do { \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1439 if (!tgetstr (cap1, address)) \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1440 { \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1441 char *sequence = tgetstr (cap2, address); \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1442 if (sequence) \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1443 Fdefine_key (function_key_map, \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1444 build_ext_string (sequence, Qbinary), \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1445 vector1 (intern (keyname))); \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1446 } \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1447 } while (0)
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
1448
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1449 /* if there's no key_next keycap, map key_npage to `next' keysym */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1450 CONDITIONAL_REASSIGN ("%5", "kN", "next");
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1451 /* if there's no key_prev keycap, map key_ppage to `previous' keysym */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1452 CONDITIONAL_REASSIGN ("%8", "kP", "prior");
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1453 /* if there's no key_dc keycap, map key_ic to `insert' keysym */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1454 CONDITIONAL_REASSIGN ("kD", "kI", "insert");
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1455
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1456 /* IBM has their own non-standard dialect of terminfo.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1457 If the standard name isn't found, try the IBM name. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1458 CONDITIONAL_REASSIGN ("kB", "KO", "backtab");
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1459 CONDITIONAL_REASSIGN ("@4", "kJ", "execute"); /* actually "action" */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1460 CONDITIONAL_REASSIGN ("@4", "kc", "execute"); /* actually "command" */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1461 CONDITIONAL_REASSIGN ("%7", "ki", "menu");
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1462 CONDITIONAL_REASSIGN ("@7", "kw", "end");
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1463 CONDITIONAL_REASSIGN ("F1", "k<", "f11");
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1464 CONDITIONAL_REASSIGN ("F2", "k>", "f12");
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1465 CONDITIONAL_REASSIGN ("%1", "kq", "help");
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 384
diff changeset
1466 CONDITIONAL_REASSIGN ("*6", "kU", "select");
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1467 #undef CONDITIONAL_REASSIGN
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1468
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1469 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1470 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1471
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1472
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1473 /************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1474 /* initialization */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1475 /************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1476
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1477 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1478 console_type_create_redisplay_tty (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1479 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1480 /* redisplay methods */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1481 CONSOLE_HAS_METHOD (tty, text_width);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1482 CONSOLE_HAS_METHOD (tty, output_display_block);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1483 CONSOLE_HAS_METHOD (tty, output_vertical_divider);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1484 CONSOLE_HAS_METHOD (tty, divider_height);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1485 CONSOLE_HAS_METHOD (tty, eol_cursor_width);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1486 CONSOLE_HAS_METHOD (tty, clear_to_window_end);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1487 CONSOLE_HAS_METHOD (tty, clear_region);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1488 CONSOLE_HAS_METHOD (tty, clear_frame);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1489 CONSOLE_HAS_METHOD (tty, frame_output_begin);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1490 CONSOLE_HAS_METHOD (tty, frame_output_end);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1491 CONSOLE_HAS_METHOD (tty, flash);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1492 CONSOLE_HAS_METHOD (tty, ring_bell);
265
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents: 251
diff changeset
1493 CONSOLE_HAS_METHOD (tty, set_final_cursor_coords);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1494 }