Mercurial > emacs
annotate src/term.c @ 97304:5a5628e1aa0f
(kmacro-exec-ring-item): Add autoload.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Tue, 05 Aug 2008 22:58:38 +0000 |
parents | c3512b2085a0 |
children | 53d01aafa957 |
rev | line source |
---|---|
37959
b53edc686faf
(tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37499
diff
changeset
|
1 /* Terminal control module for terminals described by TERMCAP |
64770
a0d1312ede66
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64084
diff
changeset
|
2 Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1998, 2000, 2001, |
79759 | 3 2002, 2003, 2004, 2005, 2006, 2007, 2008 |
4 Free Software Foundation, Inc. | |
253 | 5 |
6 This file is part of GNU Emacs. | |
7 | |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93984
diff
changeset
|
8 GNU Emacs is free software: you can redistribute it and/or modify |
253 | 9 it under the terms of the GNU General Public License as published by |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93984
diff
changeset
|
10 the Free Software Foundation, either version 3 of the License, or |
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93984
diff
changeset
|
11 (at your option) any later version. |
253 | 12 |
13 GNU Emacs is distributed in the hope that it will be useful, | |
14 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 GNU General Public License for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93984
diff
changeset
|
19 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
253 | 20 |
37959
b53edc686faf
(tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37499
diff
changeset
|
21 /* New redisplay, TTY faces by Gerd Moellmann <gerd@gnu.org>. */ |
253 | 22 |
7900
60795e826dad
Put stdio.h after config.h.
Richard M. Stallman <rms@gnu.org>
parents:
7649
diff
changeset
|
23 #include <config.h> |
253 | 24 #include <stdio.h> |
25 #include <ctype.h> | |
25002 | 26 #include <string.h> |
83498
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
27 #include <errno.h> |
53226
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
28 #include <sys/file.h> |
83644 | 29 |
81817
e6ed0991129c
Include unistd.h only if HAVE_UNISTD_H.
Richard M. Stallman <rms@gnu.org>
parents:
81811
diff
changeset
|
30 #ifdef HAVE_UNISTD_H |
81811
c10410a3aa36
Include unistd.h for ttyname, used in handle_one_term_event.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81308
diff
changeset
|
31 #include <unistd.h> |
81817
e6ed0991129c
Include unistd.h only if HAVE_UNISTD_H.
Richard M. Stallman <rms@gnu.org>
parents:
81811
diff
changeset
|
32 #endif |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39914
diff
changeset
|
33 |
83095
b448166f5664
Fix #include errors for FreeBSD (Frank Ruell)
Karoly Lorentey <lorentey@elte.hu>
parents:
83086
diff
changeset
|
34 #if HAVE_TERMIOS_H |
b448166f5664
Fix #include errors for FreeBSD (Frank Ruell)
Karoly Lorentey <lorentey@elte.hu>
parents:
83086
diff
changeset
|
35 #include <termios.h> /* For TIOCNOTTY. */ |
b448166f5664
Fix #include errors for FreeBSD (Frank Ruell)
Karoly Lorentey <lorentey@elte.hu>
parents:
83086
diff
changeset
|
36 #endif |
83086
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
37 |
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
38 #include <signal.h> |
86288
145903731829
* term.c: Include stdarg.h.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85614
diff
changeset
|
39 #include <stdarg.h> |
83032
b8237c556f0e
Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents:
83027
diff
changeset
|
40 |
53229
33c3c7c16e13
lib-src/emacsclient.c: Implemented --here option (open a new Emacs tty). Needs more work.
Karoly Lorentey <lorentey@elte.hu>
parents:
53227
diff
changeset
|
41 #include "lisp.h" |
253 | 42 #include "termchar.h" |
43 #include "termopts.h" | |
88391
1953d0d56cd7
Include "buffer.h" and "character.h".
Kenichi Handa <handa@m17n.org>
parents:
43073
diff
changeset
|
44 #include "buffer.h" |
1953d0d56cd7
Include "buffer.h" and "character.h".
Kenichi Handa <handa@m17n.org>
parents:
43073
diff
changeset
|
45 #include "character.h" |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
46 #include "charset.h" |
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
47 #include "coding.h" |
90638 | 48 #include "composite.h" |
31102
6a0caa788013
Include keyboard.h before frame.h.
Andrew Innes <andrewi@gnu.org>
parents:
30848
diff
changeset
|
49 #include "keyboard.h" |
765 | 50 #include "frame.h" |
253 | 51 #include "disptab.h" |
52 #include "termhooks.h" | |
21514 | 53 #include "dispextern.h" |
25002 | 54 #include "window.h" |
39697
0b986bb45526
Include keymap.h.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39682
diff
changeset
|
55 #include "keymap.h" |
76627
c53e7d075f1a
Include blockinput.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75348
diff
changeset
|
56 #include "blockinput.h" |
83086
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
57 #include "syssignal.h" |
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
58 #include "systty.h" |
81308
16181a4d64bf
Include intervals.h to declare Fget_text_property.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81127
diff
changeset
|
59 #include "intervals.h" |
25002 | 60 |
33672
a94852aef620
Don't try to include termcap.h; see comment there.
Gerd Moellmann <gerd@gnu.org>
parents:
33006
diff
changeset
|
61 /* For now, don't try to include termcap.h. On some systems, |
a94852aef620
Don't try to include termcap.h; see comment there.
Gerd Moellmann <gerd@gnu.org>
parents:
33006
diff
changeset
|
62 configure finds a non-standard termcap.h that the main build |
a94852aef620
Don't try to include termcap.h; see comment there.
Gerd Moellmann <gerd@gnu.org>
parents:
33006
diff
changeset
|
63 won't find. */ |
a94852aef620
Don't try to include termcap.h; see comment there.
Gerd Moellmann <gerd@gnu.org>
parents:
33006
diff
changeset
|
64 |
a94852aef620
Don't try to include termcap.h; see comment there.
Gerd Moellmann <gerd@gnu.org>
parents:
33006
diff
changeset
|
65 #if defined HAVE_TERMCAP_H && 0 |
25727
46fe79182b54
(OUTPUT_IF, OUTPUT1_IF): Use do-while.
Gerd Moellmann <gerd@gnu.org>
parents:
25675
diff
changeset
|
66 #include <termcap.h> |
29929
bb7557f86f5b
[!HAVE_TERMCAP_H]: Declare tputs, tgetent, tgetflag, tgetnum.
Dave Love <fx@gnu.org>
parents:
29462
diff
changeset
|
67 #else |
bb7557f86f5b
[!HAVE_TERMCAP_H]: Declare tputs, tgetent, tgetflag, tgetnum.
Dave Love <fx@gnu.org>
parents:
29462
diff
changeset
|
68 extern void tputs P_ ((const char *, int, int (*)(int))); |
bb7557f86f5b
[!HAVE_TERMCAP_H]: Declare tputs, tgetent, tgetflag, tgetnum.
Dave Love <fx@gnu.org>
parents:
29462
diff
changeset
|
69 extern int tgetent P_ ((char *, const char *)); |
bb7557f86f5b
[!HAVE_TERMCAP_H]: Declare tputs, tgetent, tgetflag, tgetnum.
Dave Love <fx@gnu.org>
parents:
29462
diff
changeset
|
70 extern int tgetflag P_ ((char *id)); |
bb7557f86f5b
[!HAVE_TERMCAP_H]: Declare tputs, tgetent, tgetflag, tgetnum.
Dave Love <fx@gnu.org>
parents:
29462
diff
changeset
|
71 extern int tgetnum P_ ((char *id)); |
25727
46fe79182b54
(OUTPUT_IF, OUTPUT1_IF): Use do-while.
Gerd Moellmann <gerd@gnu.org>
parents:
25675
diff
changeset
|
72 #endif |
46fe79182b54
(OUTPUT_IF, OUTPUT1_IF): Use do-while.
Gerd Moellmann <gerd@gnu.org>
parents:
25675
diff
changeset
|
73 |
21827
87c7f4bd99da
Include cm.h after dispextern.h to avoid name conflicts
Geoff Voelker <voelker@cs.washington.edu>
parents:
21624
diff
changeset
|
74 #include "cm.h" |
21514 | 75 #ifdef HAVE_X_WINDOWS |
76 #include "xterm.h" | |
77 #endif | |
8898 | 78 |
53226
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
79 #ifndef O_RDWR |
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
80 #define O_RDWR 2 |
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
81 #endif |
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
82 |
83032
b8237c556f0e
Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents:
83027
diff
changeset
|
83 #ifndef O_NOCTTY |
b8237c556f0e
Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents:
83027
diff
changeset
|
84 #define O_NOCTTY 0 |
b8237c556f0e
Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents:
83027
diff
changeset
|
85 #endif |
b8237c556f0e
Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents:
83027
diff
changeset
|
86 |
84779
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
87 /* The name of the default console device. */ |
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
88 #ifdef WINDOWSNT |
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
89 #define DEV_TTY "CONOUT$" |
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
90 #else |
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
91 #define DEV_TTY "/dev/tty" |
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
92 #endif |
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
93 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
94 static void tty_set_scroll_region P_ ((struct frame *f, int start, int stop)); |
25002 | 95 static void turn_on_face P_ ((struct frame *, int face_id)); |
96 static void turn_off_face P_ ((struct frame *, int face_id)); | |
82989
f3845715a5f6
Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
82988
diff
changeset
|
97 static void tty_show_cursor P_ ((struct tty_display_info *)); |
f3845715a5f6
Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
82988
diff
changeset
|
98 static void tty_hide_cursor P_ ((struct tty_display_info *)); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
99 static void tty_background_highlight P_ ((struct tty_display_info *tty)); |
83521
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
100 static void clear_tty_hooks P_ ((struct terminal *terminal)); |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
101 static void set_tty_hooks P_ ((struct terminal *terminal)); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
102 static void dissociate_if_controlling_tty P_ ((int fd)); |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
103 static void delete_tty P_ ((struct terminal *)); |
25002 | 104 |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
105 #define OUTPUT(tty, a) \ |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
106 emacs_tputs ((tty), a, \ |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
107 (int) (FRAME_LINES (XFRAME (selected_frame)) \ |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
108 - curY (tty)), \ |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
109 cmputc) |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
110 |
53226
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
111 #define OUTPUT1(tty, a) emacs_tputs ((tty), a, 1, cmputc) |
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
112 #define OUTPUTL(tty, a, lines) emacs_tputs ((tty), a, lines, cmputc) |
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
113 |
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
114 #define OUTPUT_IF(tty, a) \ |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
115 do { \ |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
116 if (a) \ |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
117 emacs_tputs ((tty), a, \ |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
118 (int) (FRAME_LINES (XFRAME (selected_frame)) \ |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
119 - curY (tty) ), \ |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
120 cmputc); \ |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
121 } while (0) |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
122 |
53226
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
123 #define OUTPUT1_IF(tty, a) do { if (a) emacs_tputs ((tty), a, 1, cmputc); } while (0) |
15974
61249a8fe735
(Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
15094
diff
changeset
|
124 |
67935
52bbc53dbce1
(visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66238
diff
changeset
|
125 /* If true, use "vs", otherwise use "ve" to make the cursor visible. */ |
52bbc53dbce1
(visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66238
diff
changeset
|
126 |
52bbc53dbce1
(visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66238
diff
changeset
|
127 static int visible_cursor; |
52bbc53dbce1
(visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66238
diff
changeset
|
128 |
54428
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
129 /* Display space properties */ |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
130 |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
131 extern Lisp_Object Qspace, QCalign_to, QCwidth; |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
132 |
83065
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
133 /* Functions to call after suspending a tty. */ |
83891
dab32bc3edc8
* server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83889
diff
changeset
|
134 Lisp_Object Vsuspend_tty_functions; |
83065
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
135 |
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
136 /* Functions to call after resuming a tty. */ |
83891
dab32bc3edc8
* server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83889
diff
changeset
|
137 Lisp_Object Vresume_tty_functions; |
83065
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
138 |
83004
7900111db01c
Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
82995
diff
changeset
|
139 /* Chain of all tty device parameters. */ |
82989
f3845715a5f6
Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
82988
diff
changeset
|
140 struct tty_display_info *tty_list; |
253 | 141 |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
142 /* Nonzero means no need to redraw the entire frame on resuming a |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
143 suspended Emacs. This is useful on terminals with multiple |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
144 pages, where one page is used for Emacs and another for all |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
145 else. */ |
253 | 146 int no_redraw_on_reenter; |
147 | |
28465
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
148 /* Meaning of bits in no_color_video. Each bit set means that the |
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
149 corresponding attribute cannot be combined with colors. */ |
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
150 |
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
151 enum no_color_bit |
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
152 { |
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
153 NC_STANDOUT = 1 << 0, |
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
154 NC_UNDERLINE = 1 << 1, |
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
155 NC_REVERSE = 1 << 2, |
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
156 NC_BLINK = 1 << 3, |
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
157 NC_DIM = 1 << 4, |
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
158 NC_BOLD = 1 << 5, |
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
159 NC_INVIS = 1 << 6, |
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
160 NC_PROTECT = 1 << 7, |
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
161 NC_ALT_CHARSET = 1 << 8 |
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
162 }; |
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
163 |
253 | 164 /* internal state */ |
165 | |
10771
d564078d10c6
(calculate_costs): Update max_frame_height, max_frame_width.
Richard M. Stallman <rms@gnu.org>
parents:
10481
diff
changeset
|
166 /* The largest frame width in any call to calculate_costs. */ |
25002 | 167 |
51212
332134065648
Make (some) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50227
diff
changeset
|
168 int max_frame_cols; |
25002 | 169 |
10771
d564078d10c6
(calculate_costs): Update max_frame_height, max_frame_width.
Richard M. Stallman <rms@gnu.org>
parents:
10481
diff
changeset
|
170 /* The largest frame height in any call to calculate_costs. */ |
25002 | 171 |
51212
332134065648
Make (some) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50227
diff
changeset
|
172 int max_frame_lines; |
10771
d564078d10c6
(calculate_costs): Update max_frame_height, max_frame_width.
Richard M. Stallman <rms@gnu.org>
parents:
10481
diff
changeset
|
173 |
83032
b8237c556f0e
Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents:
83027
diff
changeset
|
174 /* Non-zero if we have dropped our controlling tty and therefore |
b8237c556f0e
Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents:
83027
diff
changeset
|
175 should not open a frame on stdout. */ |
b8237c556f0e
Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents:
83027
diff
changeset
|
176 static int no_controlling_tty; |
253 | 177 |
6752
f9236145bad7
(system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
6652
diff
changeset
|
178 /* Provided for lisp packages. */ |
25002 | 179 |
6752
f9236145bad7
(system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
6652
diff
changeset
|
180 static int system_uses_terminfo; |
f9236145bad7
(system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
6652
diff
changeset
|
181 |
253 | 182 char *tparam (); |
8612
86065bec6fc9
(term_init): Added missing argument to tgetstr.
Richard M. Stallman <rms@gnu.org>
parents:
8027
diff
changeset
|
183 |
86065bec6fc9
(term_init): Added missing argument to tgetstr.
Richard M. Stallman <rms@gnu.org>
parents:
8027
diff
changeset
|
184 extern char *tgetstr (); |
253 | 185 |
9797
05d9072c5a38
(term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents:
9658
diff
changeset
|
186 |
80994
62b6aa7f8c37
Use HAVE_GPM instead of HAVE_GPM_H.
Nick Roberts <nickrob@snap.net.nz>
parents:
80979
diff
changeset
|
187 #ifdef HAVE_GPM |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
188 #include <sys/fcntl.h> |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
189 |
84981
a35153116cd0
(term_clear_mouse_face, term_mouse_highlight)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84969
diff
changeset
|
190 static void term_clear_mouse_face (); |
a35153116cd0
(term_clear_mouse_face, term_mouse_highlight)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84969
diff
changeset
|
191 static void term_mouse_highlight (struct frame *f, int x, int y); |
a35153116cd0
(term_clear_mouse_face, term_mouse_highlight)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84969
diff
changeset
|
192 |
84768
53194ec05789
* termhooks.h (term_gpm): Delete. Use gpm_tty's NULLness instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84692
diff
changeset
|
193 /* The device for which we have enabled gpm support (or NULL). */ |
53194ec05789
* termhooks.h (term_gpm): Delete. Use gpm_tty's NULLness instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84692
diff
changeset
|
194 struct tty_display_info *gpm_tty = NULL; |
83622 | 195 |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
196 /* These variables describe the range of text currently shown in its |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
197 mouse-face, together with the window they apply to. As long as |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
198 the mouse stays within this range, we need not redraw anything on |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
199 its account. Rows and columns are glyph matrix positions in |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
200 MOUSE_FACE_WINDOW. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
201 static int mouse_face_beg_row, mouse_face_beg_col; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
202 static int mouse_face_end_row, mouse_face_end_col; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
203 static int mouse_face_past_end; |
84968
85eb2660cbe3
(mouse_face_window): Rename from Qmouse_face_window. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84955
diff
changeset
|
204 static Lisp_Object mouse_face_window; |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
205 static int mouse_face_face_id; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
206 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
207 static int pos_x, pos_y; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
208 static int last_mouse_x, last_mouse_y; |
80994
62b6aa7f8c37
Use HAVE_GPM instead of HAVE_GPM_H.
Nick Roberts <nickrob@snap.net.nz>
parents:
80979
diff
changeset
|
209 #endif /* HAVE_GPM */ |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
210 |
83025
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
211 /* Ring the bell on a tty. */ |
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
212 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
213 static void |
83100
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
214 tty_ring_bell (struct frame *f) |
253 | 215 { |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
216 struct tty_display_info *tty = FRAME_TTY (f); |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
217 |
83167
69ebc75cb461
Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83161
diff
changeset
|
218 if (tty->output) |
15974
61249a8fe735
(Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
15094
diff
changeset
|
219 { |
83167
69ebc75cb461
Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83161
diff
changeset
|
220 OUTPUT (tty, (tty->TS_visible_bell && visible_bell |
69ebc75cb461
Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83161
diff
changeset
|
221 ? tty->TS_visible_bell |
69ebc75cb461
Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83161
diff
changeset
|
222 : tty->TS_bell)); |
69ebc75cb461
Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83161
diff
changeset
|
223 fflush (tty->output); |
15974
61249a8fe735
(Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
15094
diff
changeset
|
224 } |
253 | 225 } |
226 | |
83025
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
227 /* Set up termcap modes for Emacs. */ |
253 | 228 |
21514 | 229 void |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
230 tty_set_terminal_modes (struct terminal *terminal) |
253 | 231 { |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
232 struct tty_display_info *tty = terminal->display_info.tty; |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
233 |
83065
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
234 if (tty->output) |
253 | 235 { |
83353
532e0a9335a9
Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
236 if (tty->TS_termcap_modes) |
532e0a9335a9
Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
237 OUTPUT (tty, tty->TS_termcap_modes); |
64773
aebbf7125281
(set_terminal_modes): If no TS_termcap_modes string,
Richard M. Stallman <rms@gnu.org>
parents:
64770
diff
changeset
|
238 else |
83353
532e0a9335a9
Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
239 { |
532e0a9335a9
Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
240 /* Output enough newlines to scroll all the old screen contents |
532e0a9335a9
Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
241 off the screen, so it won't be overwritten and lost. */ |
532e0a9335a9
Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
242 int i; |
83382
7a3090aca393
Fix hardcoded stdout usage in term.c. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83370
diff
changeset
|
243 current_tty = tty; |
83353
532e0a9335a9
Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
244 for (i = 0; i < FRAME_LINES (XFRAME (selected_frame)); i++) |
83382
7a3090aca393
Fix hardcoded stdout usage in term.c. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83370
diff
changeset
|
245 cmputc ('\n'); |
83353
532e0a9335a9
Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
246 } |
532e0a9335a9
Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
247 |
83065
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
248 OUTPUT_IF (tty, tty->TS_termcap_modes); |
83450
c69d44922688
Merged from miles@gnu.org--gnu-2005 (patch 682)
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
249 OUTPUT_IF (tty, visible_cursor ? tty->TS_cursor_visible : tty->TS_cursor_normal); |
83065
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
250 OUTPUT_IF (tty, tty->TS_keypad_mode); |
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
251 losecursor (tty); |
83330
233c9974025b
Fix the original cause of the "arrow keys don't work on screen" bug.
Karoly Lorentey <lorentey@elte.hu>
parents:
83323
diff
changeset
|
252 fflush (tty->output); |
253 | 253 } |
254 } | |
255 | |
83025
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
256 /* Reset termcap modes before exiting Emacs. */ |
253 | 257 |
21514 | 258 void |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
259 tty_reset_terminal_modes (struct terminal *terminal) |
253 | 260 { |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
261 struct tty_display_info *tty = terminal->display_info.tty; |
83065
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
262 |
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
263 if (tty->output) |
253 | 264 { |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
265 tty_turn_off_highlight (tty); |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
266 tty_turn_off_insert (tty); |
83065
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
267 OUTPUT_IF (tty, tty->TS_end_keypad_mode); |
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
268 OUTPUT_IF (tty, tty->TS_cursor_normal); |
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
269 OUTPUT_IF (tty, tty->TS_end_termcap_modes); |
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
270 OUTPUT_IF (tty, tty->TS_orig_pair); |
37959
b53edc686faf
(tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37499
diff
changeset
|
271 /* Output raw CR so kernel can track the cursor hpos. */ |
83065
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
272 current_tty = tty; |
37959
b53edc686faf
(tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37499
diff
changeset
|
273 cmputc ('\r'); |
83330
233c9974025b
Fix the original cause of the "arrow keys don't work on screen" bug.
Karoly Lorentey <lorentey@elte.hu>
parents:
83323
diff
changeset
|
274 fflush (tty->output); |
253 | 275 } |
276 } | |
277 | |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
278 /* Flag the end of a display update on a termcap terminal. */ |
83025
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
279 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
280 static void |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
281 tty_update_end (struct frame *f) |
253 | 282 { |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
283 struct tty_display_info *tty = FRAME_TTY (f); |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
284 |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
285 if (!XWINDOW (selected_window)->cursor_off_p) |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
286 tty_show_cursor (tty); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
287 tty_turn_off_insert (tty); |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
288 tty_background_highlight (tty); |
253 | 289 } |
290 | |
83025
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
291 /* The implementation of set_terminal_window for termcap frames. */ |
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
292 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
293 static void |
83100
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
294 tty_set_terminal_window (struct frame *f, int size) |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
295 { |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
296 struct tty_display_info *tty = FRAME_TTY (f); |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
297 |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
298 tty->specified_window = size ? size : FRAME_LINES (f); |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
299 if (FRAME_SCROLL_REGION_OK (f)) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
300 tty_set_scroll_region (f, 0, tty->specified_window); |
253 | 301 } |
302 | |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
303 static void |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
304 tty_set_scroll_region (struct frame *f, int start, int stop) |
253 | 305 { |
306 char *buf; | |
82989
f3845715a5f6
Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
82988
diff
changeset
|
307 struct tty_display_info *tty = FRAME_TTY (f); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
308 |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
309 if (tty->TS_set_scroll_region) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
310 buf = tparam (tty->TS_set_scroll_region, 0, 0, start, stop - 1); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
311 else if (tty->TS_set_scroll_region_1) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
312 buf = tparam (tty->TS_set_scroll_region_1, 0, 0, |
53227
1595c5e1e9bb
Updating_frame vs. selected_frame in term.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
313 FRAME_LINES (f), start, |
1595c5e1e9bb
Updating_frame vs. selected_frame in term.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
314 FRAME_LINES (f) - stop, |
1595c5e1e9bb
Updating_frame vs. selected_frame in term.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
315 FRAME_LINES (f)); |
253 | 316 else |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
317 buf = tparam (tty->TS_set_window, 0, 0, start, 0, stop, FRAME_COLS (f)); |
53227
1595c5e1e9bb
Updating_frame vs. selected_frame in term.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
318 |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
319 OUTPUT (tty, buf); |
2439
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2243
diff
changeset
|
320 xfree (buf); |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
321 losecursor (tty); |
253 | 322 } |
37959
b53edc686faf
(tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37499
diff
changeset
|
323 |
253 | 324 |
37959
b53edc686faf
(tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37499
diff
changeset
|
325 static void |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
326 tty_turn_on_insert (struct tty_display_info *tty) |
253 | 327 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
328 if (!tty->insert_mode) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
329 OUTPUT (tty, tty->TS_insert_mode); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
330 tty->insert_mode = 1; |
253 | 331 } |
332 | |
21514 | 333 void |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
334 tty_turn_off_insert (struct tty_display_info *tty) |
253 | 335 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
336 if (tty->insert_mode) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
337 OUTPUT (tty, tty->TS_end_insert_mode); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
338 tty->insert_mode = 0; |
253 | 339 } |
340 | |
40086
050b19294988
(TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents:
40081
diff
changeset
|
341 /* Handle highlighting. */ |
253 | 342 |
21514 | 343 void |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
344 tty_turn_off_highlight (struct tty_display_info *tty) |
253 | 345 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
346 if (tty->standout_mode) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
347 OUTPUT_IF (tty, tty->TS_end_standout_mode); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
348 tty->standout_mode = 0; |
253 | 349 } |
350 | |
37959
b53edc686faf
(tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37499
diff
changeset
|
351 static void |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
352 tty_turn_on_highlight (struct tty_display_info *tty) |
253 | 353 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
354 if (!tty->standout_mode) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
355 OUTPUT_IF (tty, tty->TS_standout_mode); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
356 tty->standout_mode = 1; |
253 | 357 } |
358 | |
37477
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
359 static void |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
360 tty_toggle_highlight (struct tty_display_info *tty) |
37477
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
361 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
362 if (tty->standout_mode) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
363 tty_turn_off_highlight (tty); |
37477
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
364 else |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
365 tty_turn_on_highlight (tty); |
37477
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
366 } |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
367 |
25002 | 368 |
369 /* Make cursor invisible. */ | |
370 | |
371 static void | |
82989
f3845715a5f6
Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
82988
diff
changeset
|
372 tty_hide_cursor (struct tty_display_info *tty) |
25002 | 373 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
374 if (tty->cursor_hidden == 0) |
37959
b53edc686faf
(tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37499
diff
changeset
|
375 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
376 tty->cursor_hidden = 1; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
377 OUTPUT_IF (tty, tty->TS_cursor_invisible); |
37959
b53edc686faf
(tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37499
diff
changeset
|
378 } |
25002 | 379 } |
380 | |
381 | |
382 /* Ensure that cursor is visible. */ | |
383 | |
384 static void | |
82989
f3845715a5f6
Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
82988
diff
changeset
|
385 tty_show_cursor (struct tty_display_info *tty) |
25002 | 386 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
387 if (tty->cursor_hidden) |
37959
b53edc686faf
(tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37499
diff
changeset
|
388 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
389 tty->cursor_hidden = 0; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
390 OUTPUT_IF (tty, tty->TS_cursor_normal); |
67935
52bbc53dbce1
(visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66238
diff
changeset
|
391 if (visible_cursor) |
83450
c69d44922688
Merged from miles@gnu.org--gnu-2005 (patch 682)
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
392 OUTPUT_IF (tty, tty->TS_cursor_visible); |
37959
b53edc686faf
(tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37499
diff
changeset
|
393 } |
25002 | 394 } |
395 | |
396 | |
253 | 397 /* Set standout mode to the state it should be in for |
398 empty space inside windows. What this is, | |
399 depends on the user option inverse-video. */ | |
400 | |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
401 static void |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
402 tty_background_highlight (struct tty_display_info *tty) |
253 | 403 { |
404 if (inverse_video) | |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
405 tty_turn_on_highlight (tty); |
253 | 406 else |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
407 tty_turn_off_highlight (tty); |
253 | 408 } |
409 | |
410 /* Set standout mode to the mode specified for the text to be output. */ | |
411 | |
21514 | 412 static void |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
413 tty_highlight_if_desired (struct tty_display_info *tty) |
253 | 414 { |
40081
07d7dbf18784
(reassert_line_highlight_hook, change_line_highlight_hook): Variables removed.
Miles Bader <miles@gnu.org>
parents:
39988
diff
changeset
|
415 if (inverse_video) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
416 tty_turn_on_highlight (tty); |
40081
07d7dbf18784
(reassert_line_highlight_hook, change_line_highlight_hook): Variables removed.
Miles Bader <miles@gnu.org>
parents:
39988
diff
changeset
|
417 else |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
418 tty_turn_off_highlight (tty); |
253 | 419 } |
420 | |
421 | |
25002 | 422 /* Move cursor to row/column position VPOS/HPOS. HPOS/VPOS are |
423 frame-relative coordinates. */ | |
253 | 424 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
425 static void |
83100
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
426 tty_cursor_to (struct frame *f, int vpos, int hpos) |
253 | 427 { |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
428 struct tty_display_info *tty = FRAME_TTY (f); |
253 | 429 |
12071
f85f23c50344
(cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents:
11530
diff
changeset
|
430 /* Detect the case where we are called from reset_sys_modes |
f85f23c50344
(cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents:
11530
diff
changeset
|
431 and the costs have never been calculated. Do nothing. */ |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
432 if (! tty->costs_set) |
12071
f85f23c50344
(cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents:
11530
diff
changeset
|
433 return; |
f85f23c50344
(cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents:
11530
diff
changeset
|
434 |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
435 if (curY (tty) == vpos |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
436 && curX (tty) == hpos) |
253 | 437 return; |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
438 if (!tty->TF_standout_motion) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
439 tty_background_highlight (tty); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
440 if (!tty->TF_insmode_motion) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
441 tty_turn_off_insert (tty); |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
442 cmgoto (tty, vpos, hpos); |
253 | 443 } |
444 | |
445 /* Similar but don't take any account of the wasted characters. */ | |
446 | |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
447 static void |
83100
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
448 tty_raw_cursor_to (struct frame *f, int row, int col) |
253 | 449 { |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
450 struct tty_display_info *tty = FRAME_TTY (f); |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
451 |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
452 if (curY (tty) == row |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
453 && curX (tty) == col) |
253 | 454 return; |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
455 if (!tty->TF_standout_motion) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
456 tty_background_highlight (tty); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
457 if (!tty->TF_insmode_motion) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
458 tty_turn_off_insert (tty); |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
459 cmgoto (tty, row, col); |
253 | 460 } |
461 | |
462 /* Erase operations */ | |
463 | |
83025
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
464 /* Clear from cursor to end of frame on a termcap device. */ |
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
465 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
466 static void |
83100
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
467 tty_clear_to_end (struct frame *f) |
253 | 468 { |
469 register int i; | |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
470 struct tty_display_info *tty = FRAME_TTY (f); |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
471 |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
472 if (tty->TS_clr_to_bottom) |
253 | 473 { |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
474 tty_background_highlight (tty); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
475 OUTPUT (tty, tty->TS_clr_to_bottom); |
253 | 476 } |
477 else | |
478 { | |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
479 for (i = curY (tty); i < FRAME_LINES (f); i++) |
253 | 480 { |
83100
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
481 cursor_to (f, i, 0); |
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
482 clear_end_of_line (f, FRAME_COLS (f)); |
253 | 483 } |
484 } | |
485 } | |
486 | |
83025
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
487 /* Clear an entire termcap frame. */ |
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
488 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
489 static void |
83100
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
490 tty_clear_frame (struct frame *f) |
253 | 491 { |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
492 struct tty_display_info *tty = FRAME_TTY (f); |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
493 |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
494 if (tty->TS_clr_frame) |
253 | 495 { |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
496 tty_background_highlight (tty); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
497 OUTPUT (tty, tty->TS_clr_frame); |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
498 cmat (tty, 0, 0); |
253 | 499 } |
500 else | |
501 { | |
83100
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
502 cursor_to (f, 0, 0); |
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
503 clear_to_end (f); |
253 | 504 } |
505 } | |
506 | |
83025
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
507 /* An implementation of clear_end_of_line for termcap frames. |
253 | 508 |
509 Note that the cursor may be moved, on terminals lacking a `ce' string. */ | |
510 | |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
511 static void |
83100
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
512 tty_clear_end_of_line (struct frame *f, int first_unused_hpos) |
253 | 513 { |
514 register int i; | |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
515 struct tty_display_info *tty = FRAME_TTY (f); |
253 | 516 |
12071
f85f23c50344
(cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents:
11530
diff
changeset
|
517 /* Detect the case where we are called from reset_sys_modes |
f85f23c50344
(cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents:
11530
diff
changeset
|
518 and the costs have never been calculated. Do nothing. */ |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
519 if (! tty->costs_set) |
12071
f85f23c50344
(cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents:
11530
diff
changeset
|
520 return; |
f85f23c50344
(cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents:
11530
diff
changeset
|
521 |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
522 if (curX (tty) >= first_unused_hpos) |
253 | 523 return; |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
524 tty_background_highlight (tty); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
525 if (tty->TS_clr_line) |
253 | 526 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
527 OUTPUT1 (tty, tty->TS_clr_line); |
253 | 528 } |
529 else | |
530 { /* have to do it the hard way */ | |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
531 tty_turn_off_insert (tty); |
253 | 532 |
25002 | 533 /* Do not write in last row last col with Auto-wrap on. */ |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
534 if (AutoWrap (tty) |
53341 | 535 && curY (tty) == FrameRows (tty) - 1 |
536 && first_unused_hpos == FrameCols (tty)) | |
253 | 537 first_unused_hpos--; |
538 | |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
539 for (i = curX (tty); i < first_unused_hpos; i++) |
253 | 540 { |
83065
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
541 if (tty->termscript) |
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
542 fputc (' ', tty->termscript); |
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
543 fputc (' ', tty->output); |
253 | 544 } |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
545 cmplus (tty, first_unused_hpos - curX (tty)); |
253 | 546 } |
547 } | |
548 | |
90059
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
549 /* Buffers to store the source and result of code conversion for terminal. */ |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
550 static unsigned char *encode_terminal_src; |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
551 static unsigned char *encode_terminal_dst; |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
552 /* Allocated sizes of the above buffers. */ |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
553 static int encode_terminal_src_size; |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
554 static int encode_terminal_dst_size; |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
555 |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
556 /* Encode SRC_LEN glyphs starting at SRC to terminal output codes. |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
557 Set CODING->produced to the byte-length of the resulting byte |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
558 sequence, and return a pointer to that byte sequence. */ |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
559 |
58701
24c51e9d8586
(encode_terminal_code): Don't make it "static".
Kenichi Handa <handa@m17n.org>
parents:
58638
diff
changeset
|
560 unsigned char * |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
561 encode_terminal_code (src, src_len, coding) |
25002 | 562 struct glyph *src; |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
563 int src_len; |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
564 struct coding_system *coding; |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
565 { |
66238
d3f5aa0f18c4
(encode_terminal_code): Remove unused var src_start.
Kim F. Storm <storm@cua.dk>
parents:
65795
diff
changeset
|
566 struct glyph *src_end = src + src_len; |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
567 unsigned char *buf; |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
568 int nchars, nbytes, required; |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
569 register int tlen = GLYPH_TABLE_LENGTH; |
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
570 register Lisp_Object *tbase = GLYPH_TABLE_BASE; |
90059
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
571 Lisp_Object charset_list; |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
572 |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
573 /* Allocate sufficient size of buffer to store all characters in |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
574 multibyte-form. But, it may be enlarged on demand if |
90638 | 575 Vglyph_table contains a string or a composite glyph is |
576 encountered. */ | |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
577 required = MAX_MULTIBYTE_LENGTH * src_len; |
90059
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
578 if (encode_terminal_src_size < required) |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
579 { |
90059
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
580 if (encode_terminal_src_size == 0) |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
581 encode_terminal_src = xmalloc (required); |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
582 else |
90059
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
583 encode_terminal_src = xrealloc (encode_terminal_src, required); |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
584 encode_terminal_src_size = required; |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
585 } |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
586 |
90059
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
587 charset_list = coding_charset_list (coding); |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
588 |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
589 buf = encode_terminal_src; |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
590 nchars = 0; |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
591 while (src < src_end) |
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
592 { |
90638 | 593 if (src->type == COMPOSITE_GLYPH) |
594 { | |
595 struct composition *cmp = composition_table[src->u.cmp_id]; | |
596 int i; | |
597 | |
598 nbytes = buf - encode_terminal_src; | |
599 required = MAX_MULTIBYTE_LENGTH * cmp->glyph_len; | |
600 | |
601 if (encode_terminal_src_size < nbytes + required) | |
602 { | |
603 encode_terminal_src_size = nbytes + required; | |
604 encode_terminal_src = xrealloc (encode_terminal_src, | |
605 encode_terminal_src_size); | |
606 buf = encode_terminal_src + nbytes; | |
607 } | |
608 | |
609 for (i = 0; i < cmp->glyph_len; i++) | |
610 { | |
611 int c = COMPOSITION_GLYPH (cmp, i); | |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
612 |
90638 | 613 if (! char_charset (c, charset_list, NULL)) |
614 break; | |
615 buf += CHAR_STRING (c, buf); | |
616 nchars++; | |
617 } | |
618 if (i == 0) | |
619 { | |
620 /* The first character of the composition is not encodable. */ | |
621 *buf++ = '?'; | |
622 nchars++; | |
623 } | |
624 } | |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
625 /* We must skip glyphs to be padded for a wide character. */ |
90638 | 626 else if (! CHAR_GLYPH_PADDING_P (*src)) |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
627 { |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
628 GLYPH g; |
90059
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
629 int c; |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
630 Lisp_Object string; |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
631 |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
632 string = Qnil; |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
633 SET_GLYPH_FROM_CHAR_GLYPH (g, src[0]); |
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
634 |
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
635 if (GLYPH_INVALID_P (g) || GLYPH_SIMPLE_P (tbase, tlen, g)) |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
636 { |
26999
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
diff
changeset
|
637 /* This glyph doesn't has an entry in Vglyph_table. */ |
90059
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
638 c = src->u.ch; |
26871
aaf45e665b14
(encode_terminal_code): Delete codes for a composite
Kenichi Handa <handa@m17n.org>
parents:
26425
diff
changeset
|
639 } |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
640 else |
19035 | 641 { |
26999
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
diff
changeset
|
642 /* This glyph has an entry in Vglyph_table, |
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
diff
changeset
|
643 so process any alias before testing for simpleness. */ |
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
diff
changeset
|
644 GLYPH_FOLLOW_ALIASES (tbase, tlen, g); |
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
diff
changeset
|
645 |
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
diff
changeset
|
646 if (GLYPH_SIMPLE_P (tbase, tlen, g)) |
89563
d193de460ec1
(terminal_encode_buffer, terminal_encode_buf_size): New
Kenichi Handa <handa@m17n.org>
parents:
89483
diff
changeset
|
647 /* We set the multi-byte form of a character in G |
d193de460ec1
(terminal_encode_buffer, terminal_encode_buf_size): New
Kenichi Handa <handa@m17n.org>
parents:
89483
diff
changeset
|
648 (that should be an ASCII character) at WORKBUF. */ |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
649 c = GLYPH_CHAR (g); |
26999
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
diff
changeset
|
650 else |
89563
d193de460ec1
(terminal_encode_buffer, terminal_encode_buf_size): New
Kenichi Handa <handa@m17n.org>
parents:
89483
diff
changeset
|
651 /* We have a string in Vglyph_table. */ |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
652 string = tbase[GLYPH_CHAR (g)]; |
19035 | 653 } |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
654 |
89563
d193de460ec1
(terminal_encode_buffer, terminal_encode_buf_size): New
Kenichi Handa <handa@m17n.org>
parents:
89483
diff
changeset
|
655 if (NILP (string)) |
d193de460ec1
(terminal_encode_buffer, terminal_encode_buf_size): New
Kenichi Handa <handa@m17n.org>
parents:
89483
diff
changeset
|
656 { |
90638 | 657 nbytes = buf - encode_terminal_src; |
658 if (encode_terminal_src_size < nbytes + MAX_MULTIBYTE_LENGTH) | |
26999
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
diff
changeset
|
659 { |
90638 | 660 encode_terminal_src_size = nbytes + MAX_MULTIBYTE_LENGTH; |
661 encode_terminal_src = xrealloc (encode_terminal_src, | |
662 encode_terminal_src_size); | |
663 buf = encode_terminal_src + nbytes; | |
664 } | |
90059
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
665 if (char_charset (c, charset_list, NULL)) |
26999
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
diff
changeset
|
666 { |
89566
86c0ff434620
(encode_terminal_code): Don't handle glyph-table. Check
Kenichi Handa <handa@m17n.org>
parents:
89563
diff
changeset
|
667 /* Store the multibyte form of C at BUF. */ |
86c0ff434620
(encode_terminal_code): Don't handle glyph-table. Check
Kenichi Handa <handa@m17n.org>
parents:
89563
diff
changeset
|
668 buf += CHAR_STRING (c, buf); |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
669 nchars++; |
26999
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
diff
changeset
|
670 } |
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
diff
changeset
|
671 else |
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
diff
changeset
|
672 { |
90059
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
673 /* C is not encodable. */ |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
674 *buf++ = '?'; |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
675 nchars++; |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
676 while (src + 1 < src_end && CHAR_GLYPH_PADDING_P (src[1])) |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
677 { |
90059
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
678 *buf++ = '?'; |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
679 nchars++; |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
680 src++; |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
681 } |
26999
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
diff
changeset
|
682 } |
19035 | 683 } |
89563
d193de460ec1
(terminal_encode_buffer, terminal_encode_buf_size): New
Kenichi Handa <handa@m17n.org>
parents:
89483
diff
changeset
|
684 else |
23338
0a2b76b09162
(encode_terminal_code): Handle raw 8-bit codes correctly.
Kenichi Handa <handa@m17n.org>
parents:
23066
diff
changeset
|
685 { |
90059
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
686 unsigned char *p = SDATA (string), *pend = p + SBYTES (string); |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
687 |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
688 if (! STRING_MULTIBYTE (string)) |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
689 string = string_to_multibyte (string); |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
690 nbytes = buf - encode_terminal_src; |
90072
cb67264d6096
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-2
Miles Bader <miles@gnu.org>
diff
changeset
|
691 if (encode_terminal_src_size < nbytes + SBYTES (string)) |
89563
d193de460ec1
(terminal_encode_buffer, terminal_encode_buf_size): New
Kenichi Handa <handa@m17n.org>
parents:
89483
diff
changeset
|
692 { |
90059
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
693 encode_terminal_src_size = nbytes + SBYTES (string); |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
694 encode_terminal_src = xrealloc (encode_terminal_src, |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
695 encode_terminal_src_size); |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
696 buf = encode_terminal_src + nbytes; |
89563
d193de460ec1
(terminal_encode_buffer, terminal_encode_buf_size): New
Kenichi Handa <handa@m17n.org>
parents:
89483
diff
changeset
|
697 } |
90059
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
698 bcopy (SDATA (string), buf, SBYTES (string)); |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
699 buf += SBYTES (string); |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
700 nchars += SCHARS (string); |
23338
0a2b76b09162
(encode_terminal_code): Handle raw 8-bit codes correctly.
Kenichi Handa <handa@m17n.org>
parents:
23066
diff
changeset
|
701 } |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
702 } |
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
703 src++; |
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
704 } |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
705 |
90059
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
706 if (nchars == 0) |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
707 { |
90059
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
708 coding->produced = 0; |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
709 return NULL; |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
710 } |
90059
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
711 |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
712 nbytes = buf - encode_terminal_src; |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
713 coding->source = encode_terminal_src; |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
714 if (encode_terminal_dst_size == 0) |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
715 { |
90059
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
716 encode_terminal_dst_size = encode_terminal_src_size; |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
717 encode_terminal_dst = xmalloc (encode_terminal_dst_size); |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
718 } |
90059
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
719 coding->destination = encode_terminal_dst; |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
720 coding->dst_bytes = encode_terminal_dst_size; |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
721 encode_coding_object (coding, Qnil, 0, 0, nchars, nbytes, Qnil); |
89566
86c0ff434620
(encode_terminal_code): Don't handle glyph-table. Check
Kenichi Handa <handa@m17n.org>
parents:
89563
diff
changeset
|
722 /* coding->destination may have been reallocated. */ |
90059
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
723 encode_terminal_dst = coding->destination; |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
724 encode_terminal_dst_size = coding->dst_bytes; |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
725 |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
726 return (encode_terminal_dst); |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
727 } |
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
728 |
253 | 729 |
91041 | 730 |
83025
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
731 /* An implementation of write_glyphs for termcap frames. */ |
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
732 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
733 static void |
83100
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
734 tty_write_glyphs (struct frame *f, struct glyph *string, int len) |
253 | 735 { |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
736 unsigned char *conversion_buffer; |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
737 struct coding_system *coding; |
253 | 738 |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
739 struct tty_display_info *tty = FRAME_TTY (f); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
740 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
741 tty_turn_off_insert (tty); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
742 tty_hide_cursor (tty); |
253 | 743 |
25002 | 744 /* Don't dare write in last column of bottom line, if Auto-Wrap, |
765 | 745 since that would scroll the whole frame on some terminals. */ |
253 | 746 |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
747 if (AutoWrap (tty) |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
748 && curY (tty) + 1 == FRAME_LINES (f) |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
749 && (curX (tty) + len) == FRAME_COLS (f)) |
253 | 750 len --; |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
751 if (len <= 0) |
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
752 return; |
253 | 753 |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
754 cmplus (tty, len); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
755 |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
756 /* If terminal_coding does any conversion, use it, otherwise use |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
757 safe_terminal_coding. We can't use CODING_REQUIRE_ENCODING here |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
758 because it always return 1 if the member src_multibyte is 1. */ |
83231 | 759 coding = (FRAME_TERMINAL_CODING (f)->common_flags & CODING_REQUIRE_ENCODING_MASK |
760 ? FRAME_TERMINAL_CODING (f) : &safe_terminal_coding); | |
20711
9ab8e061c0bf
(encode_terminal_code): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
20223
diff
changeset
|
761 /* The mode bit CODING_MODE_LAST_BLOCK should be set to 1 only at |
9ab8e061c0bf
(encode_terminal_code): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
20223
diff
changeset
|
762 the tail. */ |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
763 coding->mode &= ~CODING_MODE_LAST_BLOCK; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
764 |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
765 while (len > 0) |
253 | 766 { |
25002 | 767 /* Identify a run of glyphs with the same face. */ |
26999
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
diff
changeset
|
768 int face_id = string->face_id; |
25002 | 769 int n; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
770 |
25002 | 771 for (n = 1; n < len; ++n) |
26999
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
diff
changeset
|
772 if (string[n].face_id != face_id) |
25002 | 773 break; |
774 | |
775 /* Turn appearance modes of the face of the run on. */ | |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
776 tty_highlight_if_desired (tty); |
25002 | 777 turn_on_face (f, face_id); |
778 | |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
779 if (n == len) |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
780 /* This is the last run. */ |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
781 coding->mode |= CODING_MODE_LAST_BLOCK; |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
782 conversion_buffer = encode_terminal_code (string, n, coding); |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
783 if (coding->produced > 0) |
253 | 784 { |
76627
c53e7d075f1a
Include blockinput.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75348
diff
changeset
|
785 BLOCK_INPUT; |
83231 | 786 fwrite (conversion_buffer, 1, coding->produced, tty->output); |
787 if (ferror (tty->output)) | |
788 clearerr (tty->output); | |
789 if (tty->termscript) | |
790 fwrite (conversion_buffer, 1, coding->produced, tty->termscript); | |
76627
c53e7d075f1a
Include blockinput.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75348
diff
changeset
|
791 UNBLOCK_INPUT; |
253 | 792 } |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
793 len -= n; |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
794 string += n; |
25002 | 795 |
796 /* Turn appearance modes off. */ | |
797 turn_off_face (f, face_id); | |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
798 tty_turn_off_highlight (tty); |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
799 } |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
800 |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
801 cmcheckmagic (tty); |
253 | 802 } |
803 | |
84981
a35153116cd0
(term_clear_mouse_face, term_mouse_highlight)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84969
diff
changeset
|
804 #ifdef HAVE_GPM /* Only used by GPM code. */ |
a35153116cd0
(term_clear_mouse_face, term_mouse_highlight)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84969
diff
changeset
|
805 |
83622 | 806 static void |
807 tty_write_glyphs_with_face (f, string, len, face_id) | |
808 register struct frame *f; | |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
809 register struct glyph *string; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
810 register int len, face_id; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
811 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
812 unsigned char *conversion_buffer; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
813 struct coding_system *coding; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
814 |
83622 | 815 struct tty_display_info *tty = FRAME_TTY (f); |
816 | |
817 tty_turn_off_insert (tty); | |
818 tty_hide_cursor (tty); | |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
819 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
820 /* Don't dare write in last column of bottom line, if Auto-Wrap, |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
821 since that would scroll the whole frame on some terminals. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
822 |
83622 | 823 if (AutoWrap (tty) |
824 && curY (tty) + 1 == FRAME_LINES (f) | |
825 && (curX (tty) + len) == FRAME_COLS (f)) | |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
826 len --; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
827 if (len <= 0) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
828 return; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
829 |
83622 | 830 cmplus (tty, len); |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
831 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
832 /* If terminal_coding does any conversion, use it, otherwise use |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
833 safe_terminal_coding. We can't use CODING_REQUIRE_ENCODING here |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
834 because it always return 1 if the member src_multibyte is 1. */ |
83622 | 835 coding = (FRAME_TERMINAL_CODING (f)->common_flags & CODING_REQUIRE_ENCODING_MASK |
836 ? FRAME_TERMINAL_CODING (f) : &safe_terminal_coding); | |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
837 /* The mode bit CODING_MODE_LAST_BLOCK should be set to 1 only at |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
838 the tail. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
839 coding->mode &= ~CODING_MODE_LAST_BLOCK; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
840 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
841 /* Turn appearance modes of the face. */ |
83622 | 842 tty_highlight_if_desired (tty); |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
843 turn_on_face (f, face_id); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
844 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
845 coding->mode |= CODING_MODE_LAST_BLOCK; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
846 conversion_buffer = encode_terminal_code (string, len, coding); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
847 if (coding->produced > 0) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
848 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
849 BLOCK_INPUT; |
83622 | 850 fwrite (conversion_buffer, 1, coding->produced, tty->output); |
851 if (ferror (tty->output)) | |
852 clearerr (tty->output); | |
853 if (tty->termscript) | |
854 fwrite (conversion_buffer, 1, coding->produced, tty->termscript); | |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
855 UNBLOCK_INPUT; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
856 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
857 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
858 /* Turn appearance modes off. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
859 turn_off_face (f, face_id); |
83622 | 860 tty_turn_off_highlight (tty); |
861 | |
862 cmcheckmagic (tty); | |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
863 } |
84981
a35153116cd0
(term_clear_mouse_face, term_mouse_highlight)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84969
diff
changeset
|
864 #endif |
83622 | 865 |
83025
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
866 /* An implementation of insert_glyphs for termcap frames. */ |
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
867 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
868 static void |
83100
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
869 tty_insert_glyphs (struct frame *f, struct glyph *start, int len) |
253 | 870 { |
871 char *buf; | |
31829
43566b0aec59
Avoid some more compiler warnings.
Gerd Moellmann <gerd@gnu.org>
parents:
31102
diff
changeset
|
872 struct glyph *glyph = NULL; |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
873 unsigned char *conversion_buffer; |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
874 unsigned char space[1]; |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
875 struct coding_system *coding; |
253 | 876 |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
877 struct tty_display_info *tty = FRAME_TTY (f); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
878 |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
879 if (tty->TS_ins_multi_chars) |
253 | 880 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
881 buf = tparam (tty->TS_ins_multi_chars, 0, 0, len); |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
882 OUTPUT1 (tty, buf); |
2439
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2243
diff
changeset
|
883 xfree (buf); |
253 | 884 if (start) |
83100
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
885 write_glyphs (f, start, len); |
253 | 886 return; |
887 } | |
25002 | 888 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
889 tty_turn_on_insert (tty); |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
890 cmplus (tty, len); |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
891 |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
892 if (! start) |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
893 space[0] = SPACEGLYPH; |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
894 |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
895 /* If terminal_coding does any conversion, use it, otherwise use |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
896 safe_terminal_coding. We can't use CODING_REQUIRE_ENCODING here |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
897 because it always return 1 if the member src_multibyte is 1. */ |
83231 | 898 coding = (FRAME_TERMINAL_CODING (f)->common_flags & CODING_REQUIRE_ENCODING_MASK |
899 ? FRAME_TERMINAL_CODING (f) : &safe_terminal_coding); | |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
900 /* The mode bit CODING_MODE_LAST_BLOCK should be set to 1 only at |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
901 the tail. */ |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
902 coding->mode &= ~CODING_MODE_LAST_BLOCK; |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
903 |
17191
36caec9c2e52
(insert_glyphs): Fix a bug which turns up when
Kenichi Handa <handa@m17n.org>
parents:
17180
diff
changeset
|
904 while (len-- > 0) |
253 | 905 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
906 OUTPUT1_IF (tty, tty->TS_ins_char); |
253 | 907 if (!start) |
26999
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
diff
changeset
|
908 { |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
909 conversion_buffer = space; |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
910 coding->produced = 1; |
26999
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
diff
changeset
|
911 } |
253 | 912 else |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
913 { |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
914 tty_highlight_if_desired (tty); |
26999
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
diff
changeset
|
915 turn_on_face (f, start->face_id); |
27085
59913a531d4e
(insert_glyphs): Pass glyph, not &glyph, to
Eli Zaretskii <eliz@gnu.org>
parents:
26999
diff
changeset
|
916 glyph = start; |
25002 | 917 ++start; |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
918 /* We must open sufficient space for a character which |
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
919 occupies more than one column. */ |
25002 | 920 while (len && CHAR_GLYPH_PADDING_P (*start)) |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
921 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
922 OUTPUT1_IF (tty, tty->TS_ins_char); |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
923 start++, len--; |
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
924 } |
26999
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
diff
changeset
|
925 |
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
diff
changeset
|
926 if (len <= 0) |
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
diff
changeset
|
927 /* This is the last glyph. */ |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
928 coding->mode |= CODING_MODE_LAST_BLOCK; |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
929 |
83231 | 930 conversion_buffer = encode_terminal_code (glyph, 1, coding); |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
931 } |
253 | 932 |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
933 if (coding->produced > 0) |
253 | 934 { |
76627
c53e7d075f1a
Include blockinput.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75348
diff
changeset
|
935 BLOCK_INPUT; |
83231 | 936 fwrite (conversion_buffer, 1, coding->produced, tty->output); |
83065
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
937 if (ferror (tty->output)) |
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
938 clearerr (tty->output); |
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
939 if (tty->termscript) |
83231 | 940 fwrite (conversion_buffer, 1, coding->produced, tty->termscript); |
76627
c53e7d075f1a
Include blockinput.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75348
diff
changeset
|
941 UNBLOCK_INPUT; |
253 | 942 } |
943 | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
944 OUTPUT1_IF (tty, tty->TS_pad_inserted_char); |
26999
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
diff
changeset
|
945 if (start) |
30848
fc80dcfc32cd
(write_glyphs): Also turn off inverse video after turning
Gerd Moellmann <gerd@gnu.org>
parents:
30836
diff
changeset
|
946 { |
fc80dcfc32cd
(write_glyphs): Also turn off inverse video after turning
Gerd Moellmann <gerd@gnu.org>
parents:
30836
diff
changeset
|
947 turn_off_face (f, glyph->face_id); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
948 tty_turn_off_highlight (tty); |
30848
fc80dcfc32cd
(write_glyphs): Also turn off inverse video after turning
Gerd Moellmann <gerd@gnu.org>
parents:
30836
diff
changeset
|
949 } |
10439
1fcbeb4410f6
(write_glyphs, insert_glyphs): Call checkmagic.
Karl Heuer <kwzh@gnu.org>
parents:
10332
diff
changeset
|
950 } |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
951 |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
952 cmcheckmagic (tty); |
253 | 953 } |
954 | |
83025
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
955 /* An implementation of delete_glyphs for termcap frames. */ |
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
956 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
957 static void |
83100
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
958 tty_delete_glyphs (struct frame *f, int n) |
253 | 959 { |
960 char *buf; | |
961 register int i; | |
962 | |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
963 struct tty_display_info *tty = FRAME_TTY (f); |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
964 |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
965 if (tty->delete_in_insert_mode) |
253 | 966 { |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
967 tty_turn_on_insert (tty); |
253 | 968 } |
969 else | |
970 { | |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
971 tty_turn_off_insert (tty); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
972 OUTPUT_IF (tty, tty->TS_delete_mode); |
253 | 973 } |
974 | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
975 if (tty->TS_del_multi_chars) |
253 | 976 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
977 buf = tparam (tty->TS_del_multi_chars, 0, 0, n); |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
978 OUTPUT1 (tty, buf); |
2439
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2243
diff
changeset
|
979 xfree (buf); |
253 | 980 } |
981 else | |
982 for (i = 0; i < n; i++) | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
983 OUTPUT1 (tty, tty->TS_del_char); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
984 if (!tty->delete_in_insert_mode) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
985 OUTPUT_IF (tty, tty->TS_end_delete_mode); |
253 | 986 } |
987 | |
83025
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
988 /* An implementation of ins_del_lines for termcap frames. */ |
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
989 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
990 static void |
83100
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
991 tty_ins_del_lines (struct frame *f, int vpos, int n) |
253 | 992 { |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
993 struct tty_display_info *tty = FRAME_TTY (f); |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
994 char *multi = n > 0 ? tty->TS_ins_multi_lines : tty->TS_del_multi_lines; |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
995 char *single = n > 0 ? tty->TS_ins_line : tty->TS_del_line; |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
996 char *scroll = n > 0 ? tty->TS_rev_scroll : tty->TS_fwd_scroll; |
253 | 997 |
998 register int i = n > 0 ? n : -n; | |
999 register char *buf; | |
1000 | |
1001 /* If the lines below the insertion are being pushed | |
1002 into the end of the window, this is the same as clearing; | |
1003 and we know the lines are already clear, since the matching | |
1004 deletion has already been done. So can ignore this. */ | |
1005 /* If the lines below the deletion are blank lines coming | |
1006 out of the end of the window, don't bother, | |
1007 as there will be a matching inslines later that will flush them. */ | |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
1008 if (FRAME_SCROLL_REGION_OK (f) |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
1009 && vpos + i >= tty->specified_window) |
253 | 1010 return; |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
1011 if (!FRAME_MEMORY_BELOW_FRAME (f) |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
1012 && vpos + i >= FRAME_LINES (f)) |
253 | 1013 return; |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
1014 |
253 | 1015 if (multi) |
1016 { | |
83102
a330cf2446ad
Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents:
83100
diff
changeset
|
1017 raw_cursor_to (f, vpos, 0); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
1018 tty_background_highlight (tty); |
253 | 1019 buf = tparam (multi, 0, 0, i); |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
1020 OUTPUT (tty, buf); |
2439
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2243
diff
changeset
|
1021 xfree (buf); |
253 | 1022 } |
1023 else if (single) | |
1024 { | |
83102
a330cf2446ad
Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents:
83100
diff
changeset
|
1025 raw_cursor_to (f, vpos, 0); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
1026 tty_background_highlight (tty); |
253 | 1027 while (--i >= 0) |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
1028 OUTPUT (tty, single); |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
1029 if (tty->TF_teleray) |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
1030 curX (tty) = 0; |
253 | 1031 } |
1032 else | |
1033 { | |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
1034 tty_set_scroll_region (f, vpos, tty->specified_window); |
253 | 1035 if (n < 0) |
83102
a330cf2446ad
Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents:
83100
diff
changeset
|
1036 raw_cursor_to (f, tty->specified_window - 1, 0); |
253 | 1037 else |
83102
a330cf2446ad
Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents:
83100
diff
changeset
|
1038 raw_cursor_to (f, vpos, 0); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
1039 tty_background_highlight (tty); |
253 | 1040 while (--i >= 0) |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
1041 OUTPUTL (tty, scroll, tty->specified_window - vpos); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
1042 tty_set_scroll_region (f, 0, tty->specified_window); |
253 | 1043 } |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
1044 |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
1045 if (!FRAME_SCROLL_REGION_OK (f) |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
1046 && FRAME_MEMORY_BELOW_FRAME (f) |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
1047 && n < 0) |
253 | 1048 { |
83100
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
1049 cursor_to (f, FRAME_LINES (f) + n, 0); |
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
1050 clear_to_end (f); |
253 | 1051 } |
1052 } | |
1053 | |
1054 /* Compute cost of sending "str", in characters, | |
1055 not counting any line-dependent padding. */ | |
1056 | |
1057 int | |
83102
a330cf2446ad
Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents:
83100
diff
changeset
|
1058 string_cost (char *str) |
253 | 1059 { |
1060 cost = 0; | |
1061 if (str) | |
1062 tputs (str, 0, evalcost); | |
1063 return cost; | |
1064 } | |
1065 | |
1066 /* Compute cost of sending "str", in characters, | |
1067 counting any line-dependent padding at one line. */ | |
1068 | |
1069 static int | |
83102
a330cf2446ad
Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents:
83100
diff
changeset
|
1070 string_cost_one_line (char *str) |
253 | 1071 { |
1072 cost = 0; | |
1073 if (str) | |
1074 tputs (str, 1, evalcost); | |
1075 return cost; | |
1076 } | |
1077 | |
1078 /* Compute per line amount of line-dependent padding, | |
1079 in tenths of characters. */ | |
1080 | |
1081 int | |
83102
a330cf2446ad
Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents:
83100
diff
changeset
|
1082 per_line_cost (char *str) |
253 | 1083 { |
1084 cost = 0; | |
1085 if (str) | |
1086 tputs (str, 0, evalcost); | |
1087 cost = - cost; | |
1088 if (str) | |
1089 tputs (str, 10, evalcost); | |
1090 return cost; | |
1091 } | |
1092 | |
1093 #ifndef old | |
1094 /* char_ins_del_cost[n] is cost of inserting N characters. | |
10771
d564078d10c6
(calculate_costs): Update max_frame_height, max_frame_width.
Richard M. Stallman <rms@gnu.org>
parents:
10481
diff
changeset
|
1095 char_ins_del_cost[-n] is cost of deleting N characters. |
51212
332134065648
Make (some) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50227
diff
changeset
|
1096 The length of this vector is based on max_frame_cols. */ |
253 | 1097 |
1098 int *char_ins_del_vector; | |
1099 | |
51212
332134065648
Make (some) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50227
diff
changeset
|
1100 #define char_ins_del_cost(f) (&char_ins_del_vector[FRAME_COLS ((f))]) |
253 | 1101 #endif |
1102 | |
1103 /* ARGSUSED */ | |
1104 static void | |
83102
a330cf2446ad
Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents:
83100
diff
changeset
|
1105 calculate_ins_del_char_costs (struct frame *f) |
253 | 1106 { |
82989
f3845715a5f6
Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
82988
diff
changeset
|
1107 struct tty_display_info *tty = FRAME_TTY (f); |
253 | 1108 int ins_startup_cost, del_startup_cost; |
1109 int ins_cost_per_char, del_cost_per_char; | |
1110 register int i; | |
1111 register int *p; | |
1112 | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1113 if (tty->TS_ins_multi_chars) |
253 | 1114 { |
1115 ins_cost_per_char = 0; | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1116 ins_startup_cost = string_cost_one_line (tty->TS_ins_multi_chars); |
253 | 1117 } |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1118 else if (tty->TS_ins_char || tty->TS_pad_inserted_char |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1119 || (tty->TS_insert_mode && tty->TS_end_insert_mode)) |
253 | 1120 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1121 ins_startup_cost = (30 * (string_cost (tty->TS_insert_mode) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1122 + string_cost (tty->TS_end_insert_mode))) / 100; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1123 ins_cost_per_char = (string_cost_one_line (tty->TS_ins_char) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1124 + string_cost_one_line (tty->TS_pad_inserted_char)); |
253 | 1125 } |
1126 else | |
1127 { | |
1128 ins_startup_cost = 9999; | |
1129 ins_cost_per_char = 0; | |
1130 } | |
1131 | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1132 if (tty->TS_del_multi_chars) |
253 | 1133 { |
1134 del_cost_per_char = 0; | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1135 del_startup_cost = string_cost_one_line (tty->TS_del_multi_chars); |
253 | 1136 } |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1137 else if (tty->TS_del_char) |
253 | 1138 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1139 del_startup_cost = (string_cost (tty->TS_delete_mode) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1140 + string_cost (tty->TS_end_delete_mode)); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1141 if (tty->delete_in_insert_mode) |
253 | 1142 del_startup_cost /= 2; |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1143 del_cost_per_char = string_cost_one_line (tty->TS_del_char); |
253 | 1144 } |
1145 else | |
1146 { | |
1147 del_startup_cost = 9999; | |
1148 del_cost_per_char = 0; | |
1149 } | |
1150 | |
1151 /* Delete costs are at negative offsets */ | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1152 p = &char_ins_del_cost (f)[0]; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1153 for (i = FRAME_COLS (f); --i >= 0;) |
253 | 1154 *--p = (del_startup_cost += del_cost_per_char); |
1155 | |
1156 /* Doing nothing is free */ | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1157 p = &char_ins_del_cost (f)[0]; |
253 | 1158 *p++ = 0; |
1159 | |
1160 /* Insert costs are at positive offsets */ | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1161 for (i = FRAME_COLS (f); --i >= 0;) |
253 | 1162 *p++ = (ins_startup_cost += ins_cost_per_char); |
1163 } | |
1164 | |
21514 | 1165 void |
83102
a330cf2446ad
Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents:
83100
diff
changeset
|
1166 calculate_costs (struct frame *frame) |
253 | 1167 { |
10121
3f9f77a9488d
(calculate_costs): Set FRAME_COST_BAUD_RATE.
Richard M. Stallman <rms@gnu.org>
parents:
9797
diff
changeset
|
1168 FRAME_COST_BAUD_RATE (frame) = baud_rate; |
253 | 1169 |
53226
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
1170 if (FRAME_TERMCAP_P (frame)) |
82990
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1171 { |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1172 struct tty_display_info *tty = FRAME_TTY (frame); |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1173 register char *f = (tty->TS_set_scroll_region |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1174 ? tty->TS_set_scroll_region |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1175 : tty->TS_set_scroll_region_1); |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1176 |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1177 FRAME_SCROLL_REGION_COST (frame) = string_cost (f); |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1178 |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1179 tty->costs_set = 1; |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1180 |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1181 /* These variables are only used for terminal stuff. They are |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1182 allocated once for the terminal frame of X-windows emacs, but not |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1183 used afterwards. |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1184 |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1185 char_ins_del_vector (i.e., char_ins_del_cost) isn't used because |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1186 X turns off char_ins_del_ok. */ |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1187 |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1188 max_frame_lines = max (max_frame_lines, FRAME_LINES (frame)); |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1189 max_frame_cols = max (max_frame_cols, FRAME_COLS (frame)); |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1190 |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1191 if (char_ins_del_vector != 0) |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1192 char_ins_del_vector |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1193 = (int *) xrealloc (char_ins_del_vector, |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1194 (sizeof (int) |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1195 + 2 * max_frame_cols * sizeof (int))); |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1196 else |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1197 char_ins_del_vector |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1198 = (int *) xmalloc (sizeof (int) |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1199 + 2 * max_frame_cols * sizeof (int)); |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1200 |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1201 bzero (char_ins_del_vector, (sizeof (int) |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1202 + 2 * max_frame_cols * sizeof (int))); |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1203 |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1204 |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1205 if (f && (!tty->TS_ins_line && !tty->TS_del_line)) |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1206 do_line_insertion_deletion_costs (frame, |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1207 tty->TS_rev_scroll, tty->TS_ins_multi_lines, |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1208 tty->TS_fwd_scroll, tty->TS_del_multi_lines, |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1209 f, f, 1); |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1210 else |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1211 do_line_insertion_deletion_costs (frame, |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1212 tty->TS_ins_line, tty->TS_ins_multi_lines, |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1213 tty->TS_del_line, tty->TS_del_multi_lines, |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1214 0, 0, 1); |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1215 |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1216 calculate_ins_del_char_costs (frame); |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1217 |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1218 /* Don't use TS_repeat if its padding is worse than sending the chars */ |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1219 if (tty->TS_repeat && per_line_cost (tty->TS_repeat) * baud_rate < 9000) |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1220 tty->RPov = string_cost (tty->TS_repeat); |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1221 else |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1222 tty->RPov = FRAME_COLS (frame) * 2; |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1223 |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1224 cmcostinit (FRAME_TTY (frame)); /* set up cursor motion costs */ |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1225 } |
253 | 1226 } |
1227 | |
1015
58c373be762c
* term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents:
969
diff
changeset
|
1228 struct fkey_table { |
58c373be762c
* term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents:
969
diff
changeset
|
1229 char *cap, *name; |
58c373be762c
* term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents:
969
diff
changeset
|
1230 }; |
58c373be762c
* term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents:
969
diff
changeset
|
1231 |
2137
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1232 /* Termcap capability names that correspond directly to X keysyms. |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1233 Some of these (marked "terminfo") aren't supplied by old-style |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1234 (Berkeley) termcap entries. They're listed in X keysym order; |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1235 except we put the keypad keys first, so that if they clash with |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1236 other keys (as on the IBM PC keyboard) they get overridden. |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1237 */ |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1238 |
25002 | 1239 static struct fkey_table keys[] = |
1240 { | |
42122
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1241 {"kh", "home"}, /* termcap */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1242 {"kl", "left"}, /* termcap */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1243 {"ku", "up"}, /* termcap */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1244 {"kr", "right"}, /* termcap */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1245 {"kd", "down"}, /* termcap */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1246 {"%8", "prior"}, /* terminfo */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1247 {"%5", "next"}, /* terminfo */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1248 {"@7", "end"}, /* terminfo */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1249 {"@1", "begin"}, /* terminfo */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1250 {"*6", "select"}, /* terminfo */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1251 {"%9", "print"}, /* terminfo */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1252 {"@4", "execute"}, /* terminfo --- actually the `command' key */ |
2137
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1253 /* |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1254 * "insert" --- see below |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1255 */ |
42122
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1256 {"&8", "undo"}, /* terminfo */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1257 {"%0", "redo"}, /* terminfo */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1258 {"%7", "menu"}, /* terminfo --- actually the `options' key */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1259 {"@0", "find"}, /* terminfo */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1260 {"@2", "cancel"}, /* terminfo */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1261 {"%1", "help"}, /* terminfo */ |
2137
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1262 /* |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1263 * "break" goes here, but can't be reliably intercepted with termcap |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1264 */ |
42122
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1265 {"&4", "reset"}, /* terminfo --- actually `restart' */ |
2137
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1266 /* |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1267 * "system" and "user" --- no termcaps |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1268 */ |
42122
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1269 {"kE", "clearline"}, /* terminfo */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1270 {"kA", "insertline"}, /* terminfo */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1271 {"kL", "deleteline"}, /* terminfo */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1272 {"kI", "insertchar"}, /* terminfo */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1273 {"kD", "deletechar"}, /* terminfo */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1274 {"kB", "backtab"}, /* terminfo */ |
2137
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1275 /* |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1276 * "kp_backtab", "kp-space", "kp-tab" --- no termcaps |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1277 */ |
42122
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1278 {"@8", "kp-enter"}, /* terminfo */ |
2137
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1279 /* |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1280 * "kp-f1", "kp-f2", "kp-f3" "kp-f4", |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1281 * "kp-multiply", "kp-add", "kp-separator", |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1282 * "kp-subtract", "kp-decimal", "kp-divide", "kp-0"; |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1283 * --- no termcaps for any of these. |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1284 */ |
42122
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1285 {"K4", "kp-1"}, /* terminfo */ |
2137
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1286 /* |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1287 * "kp-2" --- no termcap |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1288 */ |
42122
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1289 {"K5", "kp-3"}, /* terminfo */ |
2137
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1290 /* |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1291 * "kp-4" --- no termcap |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1292 */ |
42122
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1293 {"K2", "kp-5"}, /* terminfo */ |
2137
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1294 /* |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1295 * "kp-6" --- no termcap |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1296 */ |
42122
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1297 {"K1", "kp-7"}, /* terminfo */ |
2137
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1298 /* |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1299 * "kp-8" --- no termcap |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1300 */ |
42122
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1301 {"K3", "kp-9"}, /* terminfo */ |
2137
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1302 /* |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1303 * "kp-equal" --- no termcap |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1304 */ |
42122
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1305 {"k1", "f1"}, |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1306 {"k2", "f2"}, |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1307 {"k3", "f3"}, |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1308 {"k4", "f4"}, |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1309 {"k5", "f5"}, |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1310 {"k6", "f6"}, |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1311 {"k7", "f7"}, |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1312 {"k8", "f8"}, |
61591
b015e12637bc
(struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59382
diff
changeset
|
1313 {"k9", "f9"}, |
b015e12637bc
(struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59382
diff
changeset
|
1314 |
b015e12637bc
(struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59382
diff
changeset
|
1315 {"&0", "S-cancel"}, /*shifted cancel key*/ |
b015e12637bc
(struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59382
diff
changeset
|
1316 {"&9", "S-begin"}, /*shifted begin key*/ |
b015e12637bc
(struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59382
diff
changeset
|
1317 {"*0", "S-find"}, /*shifted find key*/ |
b015e12637bc
(struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59382
diff
changeset
|
1318 {"*1", "S-execute"}, /*shifted execute? actually shifted command key*/ |
b015e12637bc
(struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59382
diff
changeset
|
1319 {"*4", "S-delete"}, /*shifted delete-character key*/ |
b015e12637bc
(struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59382
diff
changeset
|
1320 {"*7", "S-end"}, /*shifted end key*/ |
b015e12637bc
(struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59382
diff
changeset
|
1321 {"*8", "S-clearline"}, /*shifted clear-to end-of-line key*/ |
b015e12637bc
(struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59382
diff
changeset
|
1322 {"#1", "S-help"}, /*shifted help key*/ |
b015e12637bc
(struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59382
diff
changeset
|
1323 {"#2", "S-home"}, /*shifted home key*/ |
b015e12637bc
(struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59382
diff
changeset
|
1324 {"#3", "S-insert"}, /*shifted insert-character key*/ |
b015e12637bc
(struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59382
diff
changeset
|
1325 {"#4", "S-left"}, /*shifted left-arrow key*/ |
b015e12637bc
(struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59382
diff
changeset
|
1326 {"%d", "S-menu"}, /*shifted menu? actually shifted options key*/ |
b015e12637bc
(struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59382
diff
changeset
|
1327 {"%c", "S-next"}, /*shifted next key*/ |
b015e12637bc
(struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59382
diff
changeset
|
1328 {"%e", "S-prior"}, /*shifted previous key*/ |
b015e12637bc
(struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59382
diff
changeset
|
1329 {"%f", "S-print"}, /*shifted print key*/ |
b015e12637bc
(struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59382
diff
changeset
|
1330 {"%g", "S-redo"}, /*shifted redo key*/ |
b015e12637bc
(struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59382
diff
changeset
|
1331 {"%i", "S-right"}, /*shifted right-arrow key*/ |
b015e12637bc
(struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59382
diff
changeset
|
1332 {"!3", "S-undo"} /*shifted undo key*/ |
1015
58c373be762c
* term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents:
969
diff
changeset
|
1333 }; |
58c373be762c
* term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents:
969
diff
changeset
|
1334 |
83317
e235da12dd03
Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents:
83315
diff
changeset
|
1335 static char **term_get_fkeys_address; |
e235da12dd03
Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents:
83315
diff
changeset
|
1336 static KBOARD *term_get_fkeys_kboard; |
6248
0e4319197d29
(term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents:
5933
diff
changeset
|
1337 static Lisp_Object term_get_fkeys_1 (); |
4543
929e4c850e76
(term_get_fkeys_define_1, term_get_fkeys_define): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
4499
diff
changeset
|
1338 |
85106
fd282fb888de
Add new `input-decode-map' keymap and use it for temrinal
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84981
diff
changeset
|
1339 /* Find the escape codes sent by the function keys for Vinput_decode_map. |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
1340 This function scans the termcap function key sequence entries, and |
85106
fd282fb888de
Add new `input-decode-map' keymap and use it for temrinal
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84981
diff
changeset
|
1341 adds entries to Vinput_decode_map for each function key it finds. */ |
2137
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1342 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
1343 static void |
83317
e235da12dd03
Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents:
83315
diff
changeset
|
1344 term_get_fkeys (address, kboard) |
533 | 1345 char **address; |
83317
e235da12dd03
Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents:
83315
diff
changeset
|
1346 KBOARD *kboard; |
533 | 1347 { |
6248
0e4319197d29
(term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents:
5933
diff
changeset
|
1348 /* We run the body of the function (term_get_fkeys_1) and ignore all Lisp |
0e4319197d29
(term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents:
5933
diff
changeset
|
1349 errors during the call. The only errors should be from Fdefine_key |
0e4319197d29
(term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents:
5933
diff
changeset
|
1350 when given a key sequence containing an invalid prefix key. If the |
0e4319197d29
(term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents:
5933
diff
changeset
|
1351 termcap defines function keys which use a prefix that is already bound |
0e4319197d29
(term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents:
5933
diff
changeset
|
1352 to a command by the default bindings, we should silently ignore that |
0e4319197d29
(term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents:
5933
diff
changeset
|
1353 function key specification, rather than giving the user an error and |
0e4319197d29
(term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents:
5933
diff
changeset
|
1354 refusing to run at all on such a terminal. */ |
0e4319197d29
(term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents:
5933
diff
changeset
|
1355 |
0e4319197d29
(term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents:
5933
diff
changeset
|
1356 extern Lisp_Object Fidentity (); |
83317
e235da12dd03
Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents:
83315
diff
changeset
|
1357 term_get_fkeys_address = address; |
e235da12dd03
Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents:
83315
diff
changeset
|
1358 term_get_fkeys_kboard = kboard; |
6248
0e4319197d29
(term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents:
5933
diff
changeset
|
1359 internal_condition_case (term_get_fkeys_1, Qerror, Fidentity); |
0e4319197d29
(term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents:
5933
diff
changeset
|
1360 } |
0e4319197d29
(term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents:
5933
diff
changeset
|
1361 |
0e4319197d29
(term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents:
5933
diff
changeset
|
1362 static Lisp_Object |
0e4319197d29
(term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents:
5933
diff
changeset
|
1363 term_get_fkeys_1 () |
0e4319197d29
(term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents:
5933
diff
changeset
|
1364 { |
533 | 1365 int i; |
1366 | |
83317
e235da12dd03
Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents:
83315
diff
changeset
|
1367 char **address = term_get_fkeys_address; |
e235da12dd03
Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents:
83315
diff
changeset
|
1368 KBOARD *kboard = term_get_fkeys_kboard; |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
1369 |
3359
ef29e2a4fc46
(term_get_fkeys): If not initialized, init Vfunction_key_map.
Richard M. Stallman <rms@gnu.org>
parents:
2961
diff
changeset
|
1370 /* This can happen if CANNOT_DUMP or with strange options. */ |
85106
fd282fb888de
Add new `input-decode-map' keymap and use it for temrinal
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84981
diff
changeset
|
1371 if (!KEYMAPP (kboard->Vinput_decode_map)) |
fd282fb888de
Add new `input-decode-map' keymap and use it for temrinal
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84981
diff
changeset
|
1372 kboard->Vinput_decode_map = Fmake_sparse_keymap (Qnil); |
3359
ef29e2a4fc46
(term_get_fkeys): If not initialized, init Vfunction_key_map.
Richard M. Stallman <rms@gnu.org>
parents:
2961
diff
changeset
|
1373 |
533 | 1374 for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++) |
1375 { | |
1376 char *sequence = tgetstr (keys[i].cap, address); | |
1377 if (sequence) | |
85106
fd282fb888de
Add new `input-decode-map' keymap and use it for temrinal
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84981
diff
changeset
|
1378 Fdefine_key (kboard->Vinput_decode_map, build_string (sequence), |
6248
0e4319197d29
(term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents:
5933
diff
changeset
|
1379 Fmake_vector (make_number (1), |
0e4319197d29
(term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents:
5933
diff
changeset
|
1380 intern (keys[i].name))); |
533 | 1381 } |
1015
58c373be762c
* term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents:
969
diff
changeset
|
1382 |
58c373be762c
* term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents:
969
diff
changeset
|
1383 /* The uses of the "k0" capability are inconsistent; sometimes it |
58c373be762c
* term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents:
969
diff
changeset
|
1384 describes F10, whereas othertimes it describes F0 and "k;" describes F10. |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
3489
diff
changeset
|
1385 We will attempt to politely accommodate both systems by testing for |
1015
58c373be762c
* term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents:
969
diff
changeset
|
1386 "k;", and if it is present, assuming that "k0" denotes F0, otherwise F10. |
58c373be762c
* term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents:
969
diff
changeset
|
1387 */ |
58c373be762c
* term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents:
969
diff
changeset
|
1388 { |
58c373be762c
* term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents:
969
diff
changeset
|
1389 char *k_semi = tgetstr ("k;", address); |
58c373be762c
* term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents:
969
diff
changeset
|
1390 char *k0 = tgetstr ("k0", address); |
58c373be762c
* term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents:
969
diff
changeset
|
1391 char *k0_name = "f10"; |
58c373be762c
* term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents:
969
diff
changeset
|
1392 |
58c373be762c
* term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents:
969
diff
changeset
|
1393 if (k_semi) |
58c373be762c
* term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents:
969
diff
changeset
|
1394 { |
43073
c9baf4b00820
(term_get_fkeys_1): If `k0' and `k;' are both specified and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42959
diff
changeset
|
1395 if (k0) |
c9baf4b00820
(term_get_fkeys_1): If `k0' and `k;' are both specified and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42959
diff
changeset
|
1396 /* Define f0 first, so that f10 takes precedence in case the |
c9baf4b00820
(term_get_fkeys_1): If `k0' and `k;' are both specified and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42959
diff
changeset
|
1397 key sequences happens to be the same. */ |
85106
fd282fb888de
Add new `input-decode-map' keymap and use it for temrinal
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84981
diff
changeset
|
1398 Fdefine_key (kboard->Vinput_decode_map, build_string (k0), |
43073
c9baf4b00820
(term_get_fkeys_1): If `k0' and `k;' are both specified and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42959
diff
changeset
|
1399 Fmake_vector (make_number (1), intern ("f0"))); |
85106
fd282fb888de
Add new `input-decode-map' keymap and use it for temrinal
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84981
diff
changeset
|
1400 Fdefine_key (kboard->Vinput_decode_map, build_string (k_semi), |
6248
0e4319197d29
(term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents:
5933
diff
changeset
|
1401 Fmake_vector (make_number (1), intern ("f10"))); |
1015
58c373be762c
* term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents:
969
diff
changeset
|
1402 } |
43073
c9baf4b00820
(term_get_fkeys_1): If `k0' and `k;' are both specified and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42959
diff
changeset
|
1403 else if (k0) |
85106
fd282fb888de
Add new `input-decode-map' keymap and use it for temrinal
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84981
diff
changeset
|
1404 Fdefine_key (kboard->Vinput_decode_map, build_string (k0), |
6248
0e4319197d29
(term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents:
5933
diff
changeset
|
1405 Fmake_vector (make_number (1), intern (k0_name))); |
1015
58c373be762c
* term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents:
969
diff
changeset
|
1406 } |
2137
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1407 |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1408 /* Set up cookies for numbered function keys above f10. */ |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1409 { |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1410 char fcap[3], fkey[4]; |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1411 |
3489
5c2b4797aab2
(term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents:
3359
diff
changeset
|
1412 fcap[0] = 'F'; fcap[2] = '\0'; |
2137
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1413 for (i = 11; i < 64; i++) |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1414 { |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1415 if (i <= 19) |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1416 fcap[1] = '1' + i - 11; |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1417 else if (i <= 45) |
10481
24756aef26e3
(term_get_fkeys_1): Bug fix for function key above f19.
Richard M. Stallman <rms@gnu.org>
parents:
10439
diff
changeset
|
1418 fcap[1] = 'A' + i - 20; |
2137
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1419 else |
10481
24756aef26e3
(term_get_fkeys_1): Bug fix for function key above f19.
Richard M. Stallman <rms@gnu.org>
parents:
10439
diff
changeset
|
1420 fcap[1] = 'a' + i - 46; |
2137
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1421 |
3489
5c2b4797aab2
(term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents:
3359
diff
changeset
|
1422 { |
5c2b4797aab2
(term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents:
3359
diff
changeset
|
1423 char *sequence = tgetstr (fcap, address); |
5c2b4797aab2
(term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents:
3359
diff
changeset
|
1424 if (sequence) |
5c2b4797aab2
(term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents:
3359
diff
changeset
|
1425 { |
4543
929e4c850e76
(term_get_fkeys_define_1, term_get_fkeys_define): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
4499
diff
changeset
|
1426 sprintf (fkey, "f%d", i); |
85106
fd282fb888de
Add new `input-decode-map' keymap and use it for temrinal
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84981
diff
changeset
|
1427 Fdefine_key (kboard->Vinput_decode_map, build_string (sequence), |
6248
0e4319197d29
(term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents:
5933
diff
changeset
|
1428 Fmake_vector (make_number (1), |
0e4319197d29
(term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents:
5933
diff
changeset
|
1429 intern (fkey))); |
3489
5c2b4797aab2
(term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents:
3359
diff
changeset
|
1430 } |
5c2b4797aab2
(term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents:
3359
diff
changeset
|
1431 } |
2137
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1432 } |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1433 } |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1434 |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1435 /* |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1436 * Various mappings to try and get a better fit. |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1437 */ |
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1438 { |
3489
5c2b4797aab2
(term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents:
3359
diff
changeset
|
1439 #define CONDITIONAL_REASSIGN(cap1, cap2, sym) \ |
5c2b4797aab2
(term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents:
3359
diff
changeset
|
1440 if (!tgetstr (cap1, address)) \ |
5c2b4797aab2
(term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents:
3359
diff
changeset
|
1441 { \ |
5c2b4797aab2
(term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents:
3359
diff
changeset
|
1442 char *sequence = tgetstr (cap2, address); \ |
83317
e235da12dd03
Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents:
83315
diff
changeset
|
1443 if (sequence) \ |
85106
fd282fb888de
Add new `input-decode-map' keymap and use it for temrinal
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84981
diff
changeset
|
1444 Fdefine_key (kboard->Vinput_decode_map, build_string (sequence), \ |
83317
e235da12dd03
Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents:
83315
diff
changeset
|
1445 Fmake_vector (make_number (1), \ |
e235da12dd03
Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents:
83315
diff
changeset
|
1446 intern (sym))); \ |
3489
5c2b4797aab2
(term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents:
3359
diff
changeset
|
1447 } |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
1448 |
2137
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1449 /* if there's no key_next keycap, map key_npage to `next' keysym */ |
2243
23228edebc59
Fix spacing conventions.
Richard M. Stallman <rms@gnu.org>
parents:
2239
diff
changeset
|
1450 CONDITIONAL_REASSIGN ("%5", "kN", "next"); |
2137
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1451 /* if there's no key_prev keycap, map key_ppage to `previous' keysym */ |
3706
5a563b062c0d
(term_get_fkeys): Use `prior', not `previous', for %8/kP.
Richard M. Stallman <rms@gnu.org>
parents:
3591
diff
changeset
|
1452 CONDITIONAL_REASSIGN ("%8", "kP", "prior"); |
2137
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1453 /* if there's no key_dc keycap, map key_ic to `insert' keysym */ |
2243
23228edebc59
Fix spacing conventions.
Richard M. Stallman <rms@gnu.org>
parents:
2239
diff
changeset
|
1454 CONDITIONAL_REASSIGN ("kD", "kI", "insert"); |
19385
8f58b5d12021
(term_get_fkeys_1): Use kH as alternate for move-to-last-line.
Richard M. Stallman <rms@gnu.org>
parents:
19277
diff
changeset
|
1455 /* if there's no key_end keycap, map key_ll to 'end' keysym */ |
8f58b5d12021
(term_get_fkeys_1): Use kH as alternate for move-to-last-line.
Richard M. Stallman <rms@gnu.org>
parents:
19277
diff
changeset
|
1456 CONDITIONAL_REASSIGN ("@7", "kH", "end"); |
9524
f42e5fd15f6f
(term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents:
8898
diff
changeset
|
1457 |
f42e5fd15f6f
(term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents:
8898
diff
changeset
|
1458 /* IBM has their own non-standard dialect of terminfo. |
f42e5fd15f6f
(term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents:
8898
diff
changeset
|
1459 If the standard name isn't found, try the IBM name. */ |
f42e5fd15f6f
(term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents:
8898
diff
changeset
|
1460 CONDITIONAL_REASSIGN ("kB", "KO", "backtab"); |
f42e5fd15f6f
(term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents:
8898
diff
changeset
|
1461 CONDITIONAL_REASSIGN ("@4", "kJ", "execute"); /* actually "action" */ |
f42e5fd15f6f
(term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents:
8898
diff
changeset
|
1462 CONDITIONAL_REASSIGN ("@4", "kc", "execute"); /* actually "command" */ |
f42e5fd15f6f
(term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents:
8898
diff
changeset
|
1463 CONDITIONAL_REASSIGN ("%7", "ki", "menu"); |
f42e5fd15f6f
(term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents:
8898
diff
changeset
|
1464 CONDITIONAL_REASSIGN ("@7", "kw", "end"); |
f42e5fd15f6f
(term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents:
8898
diff
changeset
|
1465 CONDITIONAL_REASSIGN ("F1", "k<", "f11"); |
f42e5fd15f6f
(term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents:
8898
diff
changeset
|
1466 CONDITIONAL_REASSIGN ("F2", "k>", "f12"); |
f42e5fd15f6f
(term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents:
8898
diff
changeset
|
1467 CONDITIONAL_REASSIGN ("%1", "kq", "help"); |
f42e5fd15f6f
(term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents:
8898
diff
changeset
|
1468 CONDITIONAL_REASSIGN ("*6", "kU", "select"); |
2224
49bda4cf498c
Supply second arg for tgetstr() calls.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2179
diff
changeset
|
1469 #undef CONDITIONAL_REASSIGN |
2137
8e4d2d1e7c66
Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1994
diff
changeset
|
1470 } |
25002 | 1471 |
1472 return Qnil; | |
533 | 1473 } |
1474 | |
1475 | |
25002 | 1476 /*********************************************************************** |
1477 Character Display Information | |
1478 ***********************************************************************/ | |
1479 | |
69637
8b3e0cacc358
Define aliases for append_glyph and produce_stretch_glyph
Kim F. Storm <storm@cua.dk>
parents:
68661
diff
changeset
|
1480 /* Avoid name clash with functions defined in xterm.c */ |
8b3e0cacc358
Define aliases for append_glyph and produce_stretch_glyph
Kim F. Storm <storm@cua.dk>
parents:
68661
diff
changeset
|
1481 #ifdef static |
8b3e0cacc358
Define aliases for append_glyph and produce_stretch_glyph
Kim F. Storm <storm@cua.dk>
parents:
68661
diff
changeset
|
1482 #define append_glyph append_glyph_term |
8b3e0cacc358
Define aliases for append_glyph and produce_stretch_glyph
Kim F. Storm <storm@cua.dk>
parents:
68661
diff
changeset
|
1483 #define produce_stretch_glyph produce_stretch_glyph_term |
90638 | 1484 #define append_composite_glyph append_composite_glyph_term |
1485 #define produce_composite_glyph produce_composite_glyph_term | |
69637
8b3e0cacc358
Define aliases for append_glyph and produce_stretch_glyph
Kim F. Storm <storm@cua.dk>
parents:
68661
diff
changeset
|
1486 #endif |
8b3e0cacc358
Define aliases for append_glyph and produce_stretch_glyph
Kim F. Storm <storm@cua.dk>
parents:
68661
diff
changeset
|
1487 |
25002 | 1488 static void append_glyph P_ ((struct it *)); |
54428
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1489 static void produce_stretch_glyph P_ ((struct it *)); |
90638 | 1490 static void append_composite_glyph P_ ((struct it *)); |
1491 static void produce_composite_glyph P_ ((struct it *)); | |
25002 | 1492 |
1493 /* Append glyphs to IT's glyph_row. Called from produce_glyphs for | |
68661
4e22dd401a52
(append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents:
68651
diff
changeset
|
1494 terminal frames if IT->glyph_row != NULL. IT->char_to_display is |
4e22dd401a52
(append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents:
68651
diff
changeset
|
1495 the character for which to produce glyphs; IT->face_id contains the |
4e22dd401a52
(append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents:
68651
diff
changeset
|
1496 character's face. Padding glyphs are appended if IT->c has a |
4e22dd401a52
(append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents:
68651
diff
changeset
|
1497 IT->pixel_width > 1. */ |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
1498 |
25002 | 1499 static void |
1500 append_glyph (it) | |
1501 struct it *it; | |
1502 { | |
1503 struct glyph *glyph, *end; | |
1504 int i; | |
1505 | |
1506 xassert (it->glyph_row); | |
1507 glyph = (it->glyph_row->glyphs[it->area] | |
1508 + it->glyph_row->used[it->area]); | |
1509 end = it->glyph_row->glyphs[1 + it->area]; | |
1510 | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
1511 for (i = 0; |
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
1512 i < it->pixel_width && glyph < end; |
25002 | 1513 ++i) |
1514 { | |
1515 glyph->type = CHAR_GLYPH; | |
29462
3306af2e4f3d
(append_glyph): Revert change of 2000-06-06.
Gerd Moellmann <gerd@gnu.org>
parents:
29448
diff
changeset
|
1516 glyph->pixel_width = 1; |
68661
4e22dd401a52
(append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents:
68651
diff
changeset
|
1517 glyph->u.ch = it->char_to_display; |
26999
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
diff
changeset
|
1518 glyph->face_id = it->face_id; |
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
diff
changeset
|
1519 glyph->padding_p = i > 0; |
25002 | 1520 glyph->charpos = CHARPOS (it->position); |
1521 glyph->object = it->object; | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
1522 |
25002 | 1523 ++it->glyph_row->used[it->area]; |
1524 ++glyph; | |
1525 } | |
1526 } | |
1527 | |
1528 | |
44372 | 1529 /* Produce glyphs for the display element described by IT. *IT |
1530 specifies what we want to produce a glyph for (character, image, ...), | |
1531 and where in the glyph matrix we currently are (glyph row and hpos). | |
1532 produce_glyphs fills in output fields of *IT with information such as the | |
1533 pixel width and height of a character, and maybe output actual glyphs at | |
25002 | 1534 the same time if IT->glyph_row is non-null. See the explanation of |
44372 | 1535 struct display_iterator in dispextern.h for an overview. |
1536 | |
1537 produce_glyphs also stores the result of glyph width, ascent | |
1538 etc. computations in *IT. | |
1539 | |
1540 IT->glyph_row may be null, in which case produce_glyphs does not | |
1541 actually fill in the glyphs. This is used in the move_* functions | |
1542 in xdisp.c for text width and height computations. | |
1543 | |
1544 Callers usually don't call produce_glyphs directly; | |
1545 instead they use the macro PRODUCE_GLYPHS. */ | |
25002 | 1546 |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
1547 void |
25002 | 1548 produce_glyphs (it) |
1549 struct it *it; | |
1550 { | |
1551 /* If a hook is installed, let it do the work. */ | |
90638 | 1552 |
1553 /* Nothing but characters are supported on terminal frames. */ | |
25002 | 1554 xassert (it->what == IT_CHARACTER |
26871
aaf45e665b14
(encode_terminal_code): Delete codes for a composite
Kenichi Handa <handa@m17n.org>
parents:
26425
diff
changeset
|
1555 || it->what == IT_COMPOSITION |
25002 | 1556 || it->what == IT_STRETCH); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
1557 |
54428
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1558 if (it->what == IT_STRETCH) |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1559 { |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1560 produce_stretch_glyph (it); |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1561 goto done; |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1562 } |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1563 |
90638 | 1564 if (it->what == IT_COMPOSITION) |
1565 { | |
1566 produce_composite_glyph (it); | |
1567 goto done; | |
1568 } | |
25002 | 1569 |
68661
4e22dd401a52
(append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents:
68651
diff
changeset
|
1570 /* Maybe translate single-byte characters to multibyte. */ |
4e22dd401a52
(append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents:
68651
diff
changeset
|
1571 it->char_to_display = it->c; |
4e22dd401a52
(append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents:
68651
diff
changeset
|
1572 |
25002 | 1573 if (it->c >= 040 && it->c < 0177) |
1574 { | |
1575 it->pixel_width = it->nglyphs = 1; | |
1576 if (it->glyph_row) | |
1577 append_glyph (it); | |
1578 } | |
1579 else if (it->c == '\n') | |
1580 it->pixel_width = it->nglyphs = 0; | |
1581 else if (it->c == '\t') | |
1582 { | |
28685
b4310b6f3b5e
(produce_glyphs): Remove reference to struct it's prompt_width.
Gerd Moellmann <gerd@gnu.org>
parents:
28507
diff
changeset
|
1583 int absolute_x = (it->current_x |
25002 | 1584 + it->continuation_lines_width); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
1585 int next_tab_x |
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
1586 = (((1 + absolute_x + it->tab_width - 1) |
25002 | 1587 / it->tab_width) |
1588 * it->tab_width); | |
1589 int nspaces; | |
1590 | |
1591 /* If part of the TAB has been displayed on the previous line | |
1592 which is continued now, continuation_lines_width will have | |
1593 been incremented already by the part that fitted on the | |
1594 continued line. So, we will get the right number of spaces | |
1595 here. */ | |
1596 nspaces = next_tab_x - absolute_x; | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
1597 |
25002 | 1598 if (it->glyph_row) |
1599 { | |
1600 int n = nspaces; | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
1601 |
68661
4e22dd401a52
(append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents:
68651
diff
changeset
|
1602 it->char_to_display = ' '; |
25002 | 1603 it->pixel_width = it->len = 1; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
1604 |
25002 | 1605 while (n--) |
1606 append_glyph (it); | |
1607 } | |
1608 | |
1609 it->pixel_width = nspaces; | |
1610 it->nglyphs = nspaces; | |
1611 } | |
89566
86c0ff434620
(encode_terminal_code): Don't handle glyph-table. Check
Kenichi Handa <handa@m17n.org>
parents:
89563
diff
changeset
|
1612 else if (CHAR_BYTE8_P (it->c)) |
29262
b7059c9f98ac
(produce_glyphs): Don't treat eight-bit-* charsets as multibyte.
Eli Zaretskii <eliz@gnu.org>
parents:
29097
diff
changeset
|
1613 { |
68661
4e22dd401a52
(append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents:
68651
diff
changeset
|
1614 if (unibyte_display_via_language_environment |
90301
1f534e44acca
(produce_glyphs): Sync to HEAD.
Kenichi Handa <handa@m17n.org>
parents:
90294
diff
changeset
|
1615 && (it->c >= 0240)) |
68661
4e22dd401a52
(append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents:
68651
diff
changeset
|
1616 { |
4e22dd401a52
(append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents:
68651
diff
changeset
|
1617 it->char_to_display = unibyte_char_to_multibyte (it->c); |
90301
1f534e44acca
(produce_glyphs): Sync to HEAD.
Kenichi Handa <handa@m17n.org>
parents:
90294
diff
changeset
|
1618 it->pixel_width = CHAR_WIDTH (it->char_to_display); |
68661
4e22dd401a52
(append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents:
68651
diff
changeset
|
1619 it->nglyphs = it->pixel_width; |
4e22dd401a52
(append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents:
68651
diff
changeset
|
1620 if (it->glyph_row) |
4e22dd401a52
(append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents:
68651
diff
changeset
|
1621 append_glyph (it); |
4e22dd401a52
(append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents:
68651
diff
changeset
|
1622 } |
4e22dd401a52
(append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents:
68651
diff
changeset
|
1623 else |
4e22dd401a52
(append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents:
68651
diff
changeset
|
1624 { |
90301
1f534e44acca
(produce_glyphs): Sync to HEAD.
Kenichi Handa <handa@m17n.org>
parents:
90294
diff
changeset
|
1625 /* Coming here means that it->c is from display table, thus |
1f534e44acca
(produce_glyphs): Sync to HEAD.
Kenichi Handa <handa@m17n.org>
parents:
90294
diff
changeset
|
1626 we must send the raw 8-bit byte as is to the terminal. |
1f534e44acca
(produce_glyphs): Sync to HEAD.
Kenichi Handa <handa@m17n.org>
parents:
90294
diff
changeset
|
1627 Although there's no way to know how many columns it |
1f534e44acca
(produce_glyphs): Sync to HEAD.
Kenichi Handa <handa@m17n.org>
parents:
90294
diff
changeset
|
1628 occupies on a screen, it is a good assumption that a |
1f534e44acca
(produce_glyphs): Sync to HEAD.
Kenichi Handa <handa@m17n.org>
parents:
90294
diff
changeset
|
1629 single byte code has 1-column width. */ |
68661
4e22dd401a52
(append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents:
68651
diff
changeset
|
1630 it->pixel_width = it->nglyphs = 1; |
4e22dd401a52
(append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents:
68651
diff
changeset
|
1631 if (it->glyph_row) |
4e22dd401a52
(append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents:
68651
diff
changeset
|
1632 append_glyph (it); |
4e22dd401a52
(append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents:
68651
diff
changeset
|
1633 } |
29262
b7059c9f98ac
(produce_glyphs): Don't treat eight-bit-* charsets as multibyte.
Eli Zaretskii <eliz@gnu.org>
parents:
29097
diff
changeset
|
1634 } |
25002 | 1635 else |
1636 { | |
88391
1953d0d56cd7
Include "buffer.h" and "character.h".
Kenichi Handa <handa@m17n.org>
parents:
43073
diff
changeset
|
1637 it->pixel_width = CHAR_WIDTH (it->c); |
25002 | 1638 it->nglyphs = it->pixel_width; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
1639 |
25002 | 1640 if (it->glyph_row) |
1641 append_glyph (it); | |
1642 } | |
1643 | |
54428
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1644 done: |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
1645 /* Advance current_x by the pixel width as a convenience for |
25002 | 1646 the caller. */ |
1647 if (it->area == TEXT_AREA) | |
1648 it->current_x += it->pixel_width; | |
25187
39feb68ed3c7
(produce_glyphs): Set iterator's physical height
Gerd Moellmann <gerd@gnu.org>
parents:
25002
diff
changeset
|
1649 it->ascent = it->max_ascent = it->phys_ascent = it->max_phys_ascent = 0; |
39feb68ed3c7
(produce_glyphs): Set iterator's physical height
Gerd Moellmann <gerd@gnu.org>
parents:
25002
diff
changeset
|
1650 it->descent = it->max_descent = it->phys_descent = it->max_phys_descent = 1; |
25002 | 1651 } |
1652 | |
1653 | |
54428
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1654 /* Produce a stretch glyph for iterator IT. IT->object is the value |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1655 of the glyph property displayed. The value must be a list |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1656 `(space KEYWORD VALUE ...)' with the following KEYWORD/VALUE pairs |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1657 being recognized: |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1658 |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1659 1. `:width WIDTH' specifies that the space should be WIDTH * |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1660 canonical char width wide. WIDTH may be an integer or floating |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1661 point number. |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1662 |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1663 2. `:align-to HPOS' specifies that the space should be wide enough |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1664 to reach HPOS, a value in canonical character units. */ |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1665 |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1666 static void |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1667 produce_stretch_glyph (it) |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1668 struct it *it; |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1669 { |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1670 /* (space :width WIDTH ...) */ |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1671 Lisp_Object prop, plist; |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1672 int width = 0, align_to = -1; |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1673 int zero_width_ok_p = 0; |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1674 double tem; |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1675 |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1676 /* List should start with `space'. */ |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1677 xassert (CONSP (it->object) && EQ (XCAR (it->object), Qspace)); |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1678 plist = XCDR (it->object); |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1679 |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1680 /* Compute the width of the stretch. */ |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1681 if ((prop = Fplist_get (plist, QCwidth), !NILP (prop)) |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1682 && calc_pixel_width_or_height (&tem, it, prop, 0, 1, 0)) |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1683 { |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1684 /* Absolute width `:width WIDTH' specified and valid. */ |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1685 zero_width_ok_p = 1; |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1686 width = (int)(tem + 0.5); |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1687 } |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1688 else if ((prop = Fplist_get (plist, QCalign_to), !NILP (prop)) |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1689 && calc_pixel_width_or_height (&tem, it, prop, 0, 1, &align_to)) |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1690 { |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1691 if (it->glyph_row == NULL || !it->glyph_row->mode_line_p) |
66238
d3f5aa0f18c4
(encode_terminal_code): Remove unused var src_start.
Kim F. Storm <storm@cua.dk>
parents:
65795
diff
changeset
|
1692 align_to = (align_to < 0 |
54428
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1693 ? 0 |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1694 : align_to - window_box_left_offset (it->w, TEXT_AREA)); |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1695 else if (align_to < 0) |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1696 align_to = window_box_left_offset (it->w, TEXT_AREA); |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1697 width = max (0, (int)(tem + 0.5) + align_to - it->current_x); |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1698 zero_width_ok_p = 1; |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1699 } |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1700 else |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1701 /* Nothing specified -> width defaults to canonical char width. */ |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1702 width = FRAME_COLUMN_WIDTH (it->f); |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1703 |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1704 if (width <= 0 && (width < 0 || !zero_width_ok_p)) |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1705 width = 1; |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1706 |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1707 if (width > 0 && it->glyph_row) |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1708 { |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1709 Lisp_Object o_object = it->object; |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1710 Lisp_Object object = it->stack[it->sp - 1].string; |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1711 int n = width; |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1712 |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1713 if (!STRINGP (object)) |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1714 object = it->w->buffer; |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1715 it->object = object; |
68661
4e22dd401a52
(append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents:
68651
diff
changeset
|
1716 it->char_to_display = ' '; |
54428
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1717 it->pixel_width = it->len = 1; |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1718 while (n--) |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1719 append_glyph (it); |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1720 it->object = o_object; |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1721 } |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1722 it->pixel_width = width; |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1723 it->nglyphs = width; |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1724 } |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1725 |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1726 |
90638 | 1727 /* Append glyphs to IT's glyph_row for the composition IT->cmp_id. |
1728 Called from produce_composite_glyph for terminal frames if | |
1729 IT->glyph_row != NULL. IT->face_id contains the character's | |
1730 face. */ | |
1731 | |
1732 static void | |
1733 append_composite_glyph (it) | |
1734 struct it *it; | |
1735 { | |
1736 struct glyph *glyph; | |
1737 | |
1738 xassert (it->glyph_row); | |
1739 glyph = it->glyph_row->glyphs[it->area] + it->glyph_row->used[it->area]; | |
1740 if (glyph < it->glyph_row->glyphs[1 + it->area]) | |
1741 { | |
1742 glyph->type = COMPOSITE_GLYPH; | |
1743 glyph->pixel_width = it->pixel_width; | |
1744 glyph->u.cmp_id = it->cmp_id; | |
1745 glyph->face_id = it->face_id; | |
1746 glyph->padding_p = 0; | |
1747 glyph->charpos = CHARPOS (it->position); | |
1748 glyph->object = it->object; | |
1749 | |
1750 ++it->glyph_row->used[it->area]; | |
1751 ++glyph; | |
1752 } | |
1753 } | |
1754 | |
1755 | |
1756 /* Produce a composite glyph for iterator IT. IT->cmp_id is the ID of | |
1757 the composition. We simply produces components of the composition | |
1758 assuming that that the terminal has a capability to layout/render | |
1759 it correctly. */ | |
1760 | |
1761 static void | |
1762 produce_composite_glyph (it) | |
1763 struct it *it; | |
1764 { | |
1765 struct composition *cmp = composition_table[it->cmp_id]; | |
1766 int c; | |
1767 | |
1768 xassert (cmp->glyph_len > 0); | |
1769 c = COMPOSITION_GLYPH (cmp, 0); | |
1770 it->pixel_width = CHAR_WIDTH (it->c); | |
1771 it->nglyphs = 1; | |
1772 | |
1773 if (it->glyph_row) | |
1774 append_composite_glyph (it); | |
1775 } | |
1776 | |
1777 | |
25002 | 1778 /* Get information about special display element WHAT in an |
1779 environment described by IT. WHAT is one of IT_TRUNCATION or | |
1780 IT_CONTINUATION. Maybe produce glyphs for WHAT if IT has a | |
1781 non-null glyph_row member. This function ensures that fields like | |
1782 face_id, c, len of IT are left untouched. */ | |
1783 | |
1784 void | |
1785 produce_special_glyphs (it, what) | |
1786 struct it *it; | |
1787 enum display_element_type what; | |
1788 { | |
1789 struct it temp_it; | |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
1790 Lisp_Object gc; |
63549
bda22724fc82
(produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents:
61591
diff
changeset
|
1791 GLYPH glyph; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
1792 |
25002 | 1793 temp_it = *it; |
1794 temp_it.dp = NULL; | |
1795 temp_it.what = IT_CHARACTER; | |
1796 temp_it.len = 1; | |
28507
b6f06a755c7d
make_number/XINT/XUINT conversions; EQ/== fixes; ==Qnil -> NILP
Ken Raeburn <raeburn@raeburn.org>
parents:
28465
diff
changeset
|
1797 temp_it.object = make_number (0); |
25002 | 1798 bzero (&temp_it.current, sizeof temp_it.current); |
1799 | |
1800 if (what == IT_CONTINUATION) | |
1801 { | |
1802 /* Continuation glyph. */ | |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
1803 SET_GLYPH_FROM_CHAR (glyph, '\\'); |
25002 | 1804 if (it->dp |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
1805 && (gc = DISP_CONTINUE_GLYPH (it->dp), GLYPH_CODE_P (gc)) |
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
1806 && GLYPH_CODE_CHAR_VALID_P (gc)) |
25002 | 1807 { |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
1808 SET_GLYPH_FROM_GLYPH_CODE (glyph, gc); |
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
1809 spec_glyph_lookup_face (XWINDOW (it->window), &glyph); |
25002 | 1810 } |
1811 } | |
1812 else if (what == IT_TRUNCATION) | |
1813 { | |
1814 /* Truncation glyph. */ | |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
1815 SET_GLYPH_FROM_CHAR (glyph, '$'); |
25002 | 1816 if (it->dp |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
1817 && (gc = DISP_TRUNC_GLYPH (it->dp), GLYPH_CODE_P (gc)) |
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
1818 && GLYPH_CODE_CHAR_VALID_P (gc)) |
25002 | 1819 { |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
1820 SET_GLYPH_FROM_GLYPH_CODE (glyph, gc); |
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
1821 spec_glyph_lookup_face (XWINDOW (it->window), &glyph); |
25002 | 1822 } |
1823 } | |
1824 else | |
1825 abort (); | |
63549
bda22724fc82
(produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents:
61591
diff
changeset
|
1826 |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
1827 temp_it.c = GLYPH_CHAR (glyph); |
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
1828 temp_it.face_id = GLYPH_FACE (glyph); |
63549
bda22724fc82
(produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents:
61591
diff
changeset
|
1829 temp_it.len = CHAR_BYTES (temp_it.c); |
bda22724fc82
(produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents:
61591
diff
changeset
|
1830 |
bda22724fc82
(produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents:
61591
diff
changeset
|
1831 produce_glyphs (&temp_it); |
bda22724fc82
(produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents:
61591
diff
changeset
|
1832 it->pixel_width = temp_it.pixel_width; |
bda22724fc82
(produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents:
61591
diff
changeset
|
1833 it->nglyphs = temp_it.pixel_width; |
25002 | 1834 } |
1835 | |
1836 | |
1837 | |
1838 /*********************************************************************** | |
1839 Faces | |
1840 ***********************************************************************/ | |
1841 | |
28465
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
1842 /* Value is non-zero if attribute ATTR may be used. ATTR should be |
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
1843 one of the enumerators from enum no_color_bit, or a bit set built |
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
1844 from them. Some display attributes may not be used together with |
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
1845 color; the termcap capability `NC' specifies which ones. */ |
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
1846 |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1847 #define MAY_USE_WITH_COLORS_P(tty, ATTR) \ |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1848 (tty->TN_max_colors > 0 \ |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1849 ? (tty->TN_no_color_video & (ATTR)) == 0 \ |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1850 : 1) |
25002 | 1851 |
63549
bda22724fc82
(produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents:
61591
diff
changeset
|
1852 /* Turn appearances of face FACE_ID on tty frame F on. |
bda22724fc82
(produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents:
61591
diff
changeset
|
1853 FACE_ID is a realized face ID number, in the face cache. */ |
25002 | 1854 |
1855 static void | |
1856 turn_on_face (f, face_id) | |
1857 struct frame *f; | |
1858 int face_id; | |
1859 { | |
1860 struct face *face = FACE_FROM_ID (f, face_id); | |
37477
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1861 long fg = face->foreground; |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1862 long bg = face->background; |
82989
f3845715a5f6
Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
82988
diff
changeset
|
1863 struct tty_display_info *tty = FRAME_TTY (f); |
25002 | 1864 |
37477
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1865 /* Do this first because TS_end_standout_mode may be the same |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1866 as TS_exit_attribute_mode, which turns all appearances off. */ |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1867 if (MAY_USE_WITH_COLORS_P (tty, NC_REVERSE)) |
37477
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1868 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1869 if (tty->TN_max_colors > 0) |
37477
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1870 { |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1871 if (fg >= 0 && bg >= 0) |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1872 { |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1873 /* If the terminal supports colors, we can set them |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1874 below without using reverse video. The face's fg |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1875 and bg colors are set as they should appear on |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1876 the screen, i.e. they take the inverse-video'ness |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1877 of the face already into account. */ |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1878 } |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1879 else if (inverse_video) |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1880 { |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1881 if (fg == FACE_TTY_DEFAULT_FG_COLOR |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1882 || bg == FACE_TTY_DEFAULT_BG_COLOR) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
1883 tty_toggle_highlight (tty); |
37477
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1884 } |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1885 else |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1886 { |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1887 if (fg == FACE_TTY_DEFAULT_BG_COLOR |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1888 || bg == FACE_TTY_DEFAULT_FG_COLOR) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
1889 tty_toggle_highlight (tty); |
37477
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1890 } |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1891 } |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1892 else |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1893 { |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1894 /* If we can't display colors, use reverse video |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1895 if the face specifies that. */ |
37499
b8ff92361366
(turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents:
37477
diff
changeset
|
1896 if (inverse_video) |
b8ff92361366
(turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents:
37477
diff
changeset
|
1897 { |
b8ff92361366
(turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents:
37477
diff
changeset
|
1898 if (fg == FACE_TTY_DEFAULT_FG_COLOR |
b8ff92361366
(turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents:
37477
diff
changeset
|
1899 || bg == FACE_TTY_DEFAULT_BG_COLOR) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
1900 tty_toggle_highlight (tty); |
37499
b8ff92361366
(turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents:
37477
diff
changeset
|
1901 } |
b8ff92361366
(turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents:
37477
diff
changeset
|
1902 else |
b8ff92361366
(turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents:
37477
diff
changeset
|
1903 { |
b8ff92361366
(turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents:
37477
diff
changeset
|
1904 if (fg == FACE_TTY_DEFAULT_BG_COLOR |
b8ff92361366
(turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents:
37477
diff
changeset
|
1905 || bg == FACE_TTY_DEFAULT_FG_COLOR) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
1906 tty_toggle_highlight (tty); |
37499
b8ff92361366
(turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents:
37477
diff
changeset
|
1907 } |
37477
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1908 } |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1909 } |
25002 | 1910 |
1911 if (face->tty_bold_p) | |
28465
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
1912 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1913 if (MAY_USE_WITH_COLORS_P (tty, NC_BOLD)) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1914 OUTPUT1_IF (tty, tty->TS_enter_bold_mode); |
28465
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
1915 } |
25002 | 1916 else if (face->tty_dim_p) |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1917 if (MAY_USE_WITH_COLORS_P (tty, NC_DIM)) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1918 OUTPUT1_IF (tty, tty->TS_enter_dim_mode); |
25002 | 1919 |
1920 /* Alternate charset and blinking not yet used. */ | |
28465
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
1921 if (face->tty_alt_charset_p |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1922 && MAY_USE_WITH_COLORS_P (tty, NC_ALT_CHARSET)) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1923 OUTPUT1_IF (tty, tty->TS_enter_alt_charset_mode); |
25002 | 1924 |
28465
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
1925 if (face->tty_blinking_p |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1926 && MAY_USE_WITH_COLORS_P (tty, NC_BLINK)) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1927 OUTPUT1_IF (tty, tty->TS_enter_blink_mode); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1928 |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1929 if (face->tty_underline_p && MAY_USE_WITH_COLORS_P (tty, NC_UNDERLINE)) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1930 OUTPUT1_IF (tty, tty->TS_enter_underline_mode); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1931 |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1932 if (tty->TN_max_colors > 0) |
25002 | 1933 { |
65072
462eb3df5c58
(turn_on_face): Check for TS_set_foreground and
Juri Linkov <juri@jurta.org>
parents:
64773
diff
changeset
|
1934 char *ts, *p; |
462eb3df5c58
(turn_on_face): Check for TS_set_foreground and
Juri Linkov <juri@jurta.org>
parents:
64773
diff
changeset
|
1935 |
83353
532e0a9335a9
Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
1936 ts = tty->standout_mode ? tty->TS_set_background : tty->TS_set_foreground; |
65072
462eb3df5c58
(turn_on_face): Check for TS_set_foreground and
Juri Linkov <juri@jurta.org>
parents:
64773
diff
changeset
|
1937 if (fg >= 0 && ts) |
25002 | 1938 { |
83353
532e0a9335a9
Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
1939 p = tparam (ts, NULL, 0, (int) fg); |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
1940 OUTPUT (tty, p); |
25002 | 1941 xfree (p); |
1942 } | |
1943 | |
83353
532e0a9335a9
Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
1944 ts = tty->standout_mode ? tty->TS_set_foreground : tty->TS_set_background; |
65072
462eb3df5c58
(turn_on_face): Check for TS_set_foreground and
Juri Linkov <juri@jurta.org>
parents:
64773
diff
changeset
|
1945 if (bg >= 0 && ts) |
25002 | 1946 { |
83353
532e0a9335a9
Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
1947 p = tparam (ts, NULL, 0, (int) bg); |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
1948 OUTPUT (tty, p); |
25002 | 1949 xfree (p); |
1950 } | |
1951 } | |
1952 } | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
1953 |
25002 | 1954 |
1955 /* Turn off appearances of face FACE_ID on tty frame F. */ | |
1956 | |
1957 static void | |
1958 turn_off_face (f, face_id) | |
1959 struct frame *f; | |
1960 int face_id; | |
1961 { | |
1962 struct face *face = FACE_FROM_ID (f, face_id); | |
82989
f3845715a5f6
Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
82988
diff
changeset
|
1963 struct tty_display_info *tty = FRAME_TTY (f); |
25002 | 1964 |
1965 xassert (face != NULL); | |
1966 | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1967 if (tty->TS_exit_attribute_mode) |
25002 | 1968 { |
1969 /* Capability "me" will turn off appearance modes double-bright, | |
1970 half-bright, reverse-video, standout, underline. It may or | |
1971 may not turn off alt-char-mode. */ | |
1972 if (face->tty_bold_p | |
1973 || face->tty_dim_p | |
1974 || face->tty_reverse_p | |
1975 || face->tty_alt_charset_p | |
1976 || face->tty_blinking_p | |
1977 || face->tty_underline_p) | |
30848
fc80dcfc32cd
(write_glyphs): Also turn off inverse video after turning
Gerd Moellmann <gerd@gnu.org>
parents:
30836
diff
changeset
|
1978 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1979 OUTPUT1_IF (tty, tty->TS_exit_attribute_mode); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1980 if (strcmp (tty->TS_exit_attribute_mode, tty->TS_end_standout_mode) == 0) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1981 tty->standout_mode = 0; |
30848
fc80dcfc32cd
(write_glyphs): Also turn off inverse video after turning
Gerd Moellmann <gerd@gnu.org>
parents:
30836
diff
changeset
|
1982 } |
25002 | 1983 |
1984 if (face->tty_alt_charset_p) | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1985 OUTPUT_IF (tty, tty->TS_exit_alt_charset_mode); |
25002 | 1986 } |
1987 else | |
1988 { | |
1989 /* If we don't have "me" we can only have those appearances | |
1990 that have exit sequences defined. */ | |
1991 if (face->tty_alt_charset_p) | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1992 OUTPUT_IF (tty, tty->TS_exit_alt_charset_mode); |
25002 | 1993 |
40086
050b19294988
(TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents:
40081
diff
changeset
|
1994 if (face->tty_underline_p) |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1995 OUTPUT_IF (tty, tty->TS_exit_underline_mode); |
25002 | 1996 } |
1997 | |
1998 /* Switch back to default colors. */ | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1999 if (tty->TN_max_colors > 0 |
26902
264b83a3a688
Changes for separate unspecified foreground and background colors
Eli Zaretskii <eliz@gnu.org>
parents:
26871
diff
changeset
|
2000 && ((face->foreground != FACE_TTY_DEFAULT_COLOR |
264b83a3a688
Changes for separate unspecified foreground and background colors
Eli Zaretskii <eliz@gnu.org>
parents:
26871
diff
changeset
|
2001 && face->foreground != FACE_TTY_DEFAULT_FG_COLOR) |
264b83a3a688
Changes for separate unspecified foreground and background colors
Eli Zaretskii <eliz@gnu.org>
parents:
26871
diff
changeset
|
2002 || (face->background != FACE_TTY_DEFAULT_COLOR |
264b83a3a688
Changes for separate unspecified foreground and background colors
Eli Zaretskii <eliz@gnu.org>
parents:
26871
diff
changeset
|
2003 && face->background != FACE_TTY_DEFAULT_BG_COLOR))) |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2004 OUTPUT1_IF (tty, tty->TS_orig_pair); |
25002 | 2005 } |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
2006 |
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
2007 |
45522
1513f6afe56f
(tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents:
44890
diff
changeset
|
2008 /* Return non-zero if the terminal on frame F supports all of the |
1513f6afe56f
(tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents:
44890
diff
changeset
|
2009 capabilities in CAPS simultaneously, with foreground and background |
1513f6afe56f
(tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents:
44890
diff
changeset
|
2010 colors FG and BG. */ |
1513f6afe56f
(tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents:
44890
diff
changeset
|
2011 |
45548 | 2012 int |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2013 tty_capable_p (tty, caps, fg, bg) |
82989
f3845715a5f6
Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
82988
diff
changeset
|
2014 struct tty_display_info *tty; |
45522
1513f6afe56f
(tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents:
44890
diff
changeset
|
2015 unsigned caps; |
1513f6afe56f
(tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents:
44890
diff
changeset
|
2016 unsigned long fg, bg; |
1513f6afe56f
(tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents:
44890
diff
changeset
|
2017 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2018 #define TTY_CAPABLE_P_TRY(tty, cap, TS, NC_bit) \ |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2019 if ((caps & (cap)) && (!(TS) || !MAY_USE_WITH_COLORS_P(tty, NC_bit))) \ |
45522
1513f6afe56f
(tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents:
44890
diff
changeset
|
2020 return 0; |
1513f6afe56f
(tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents:
44890
diff
changeset
|
2021 |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2022 TTY_CAPABLE_P_TRY (tty, TTY_CAP_INVERSE, tty->TS_standout_mode, NC_REVERSE); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2023 TTY_CAPABLE_P_TRY (tty, TTY_CAP_UNDERLINE, tty->TS_enter_underline_mode, NC_UNDERLINE); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2024 TTY_CAPABLE_P_TRY (tty, TTY_CAP_BOLD, tty->TS_enter_bold_mode, NC_BOLD); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2025 TTY_CAPABLE_P_TRY (tty, TTY_CAP_DIM, tty->TS_enter_dim_mode, NC_DIM); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2026 TTY_CAPABLE_P_TRY (tty, TTY_CAP_BLINK, tty->TS_enter_blink_mode, NC_BLINK); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2027 TTY_CAPABLE_P_TRY (tty, TTY_CAP_ALT_CHARSET, tty->TS_enter_alt_charset_mode, NC_ALT_CHARSET); |
45522
1513f6afe56f
(tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents:
44890
diff
changeset
|
2028 |
1513f6afe56f
(tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents:
44890
diff
changeset
|
2029 /* We can do it! */ |
1513f6afe56f
(tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents:
44890
diff
changeset
|
2030 return 1; |
1513f6afe56f
(tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents:
44890
diff
changeset
|
2031 } |
1513f6afe56f
(tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents:
44890
diff
changeset
|
2032 |
25002 | 2033 /* Return non-zero if the terminal is capable to display colors. */ |
2034 | |
2035 DEFUN ("tty-display-color-p", Ftty_display_color_p, Stty_display_color_p, | |
27087
8de2d17323c2
(Ftty_display_color_p): Accept an optional argument FRAME.
Eli Zaretskii <eliz@gnu.org>
parents:
27085
diff
changeset
|
2036 0, 1, 0, |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2037 doc: /* Return non-nil if the tty device TERMINAL can display colors. |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2038 |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2039 TERMINAL can be a terminal id, a frame or nil (meaning the selected |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2040 frame's terminal). This function always returns nil if TERMINAL |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2041 is not on a tty device. */) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2042 (terminal) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2043 Lisp_Object terminal; |
25002 | 2044 { |
83512
5d328dadd0f4
Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83502
diff
changeset
|
2045 struct terminal *t = get_tty_terminal (terminal, 0); |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2046 if (!t) |
83004
7900111db01c
Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
82995
diff
changeset
|
2047 return Qnil; |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
2048 else |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2049 return t->display_info.tty->TN_max_colors > 0 ? Qt : Qnil; |
25002 | 2050 } |
2051 | |
42954
e514d4931d6f
(Ftty_display_color_cells): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
42808
diff
changeset
|
2052 /* Return the number of supported colors. */ |
e514d4931d6f
(Ftty_display_color_cells): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
42808
diff
changeset
|
2053 DEFUN ("tty-display-color-cells", Ftty_display_color_cells, |
e514d4931d6f
(Ftty_display_color_cells): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
42808
diff
changeset
|
2054 Stty_display_color_cells, 0, 1, 0, |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2055 doc: /* Return the number of colors supported by the tty device TERMINAL. |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2056 |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2057 TERMINAL can be a terminal id, a frame or nil (meaning the selected |
83512
5d328dadd0f4
Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83502
diff
changeset
|
2058 frame's terminal). This function always returns 0 if TERMINAL |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2059 is not on a tty device. */) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2060 (terminal) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2061 Lisp_Object terminal; |
42954
e514d4931d6f
(Ftty_display_color_cells): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
42808
diff
changeset
|
2062 { |
83512
5d328dadd0f4
Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83502
diff
changeset
|
2063 struct terminal *t = get_tty_terminal (terminal, 0); |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2064 if (!t) |
83161
8d62eda26760
Fix byte-compile errors during bootstrap. (Reported by Juraj Kubelka.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83158
diff
changeset
|
2065 return make_number (0); |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
2066 else |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2067 return make_number (t->display_info.tty->TN_max_colors); |
42954
e514d4931d6f
(Ftty_display_color_cells): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
42808
diff
changeset
|
2068 } |
e514d4931d6f
(Ftty_display_color_cells): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
42808
diff
changeset
|
2069 |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2070 #ifndef WINDOWSNT |
25002 | 2071 |
78566
a23949b99eb1
Tweak previous change (don't init statics).
Glenn Morris <rgm@gnu.org>
parents:
78563
diff
changeset
|
2072 /* Declare here rather than in the function, as in the rest of Emacs, |
a23949b99eb1
Tweak previous change (don't init statics).
Glenn Morris <rgm@gnu.org>
parents:
78563
diff
changeset
|
2073 to work around an HPUX compiler bug (?). See |
78562 | 2074 http://lists.gnu.org/archive/html/emacs-devel/2007-08/msg00410.html */ |
78566
a23949b99eb1
Tweak previous change (don't init statics).
Glenn Morris <rgm@gnu.org>
parents:
78563
diff
changeset
|
2075 static int default_max_colors; |
a23949b99eb1
Tweak previous change (don't init statics).
Glenn Morris <rgm@gnu.org>
parents:
78563
diff
changeset
|
2076 static int default_max_pairs; |
a23949b99eb1
Tweak previous change (don't init statics).
Glenn Morris <rgm@gnu.org>
parents:
78563
diff
changeset
|
2077 static int default_no_color_video; |
a23949b99eb1
Tweak previous change (don't init statics).
Glenn Morris <rgm@gnu.org>
parents:
78563
diff
changeset
|
2078 static char *default_orig_pair; |
a23949b99eb1
Tweak previous change (don't init statics).
Glenn Morris <rgm@gnu.org>
parents:
78563
diff
changeset
|
2079 static char *default_set_foreground; |
a23949b99eb1
Tweak previous change (don't init statics).
Glenn Morris <rgm@gnu.org>
parents:
78563
diff
changeset
|
2080 static char *default_set_background; |
78560
44134c35ea57
Philippe Waroquiers <philippe.waroquiers at eurocontrol.int>
Glenn Morris <rgm@gnu.org>
parents:
78260
diff
changeset
|
2081 |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2082 /* Save or restore the default color-related capabilities of this |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2083 terminal. */ |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2084 static void |
82989
f3845715a5f6
Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
82988
diff
changeset
|
2085 tty_default_color_capabilities (struct tty_display_info *tty, int save) |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2086 { |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2087 |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2088 if (save) |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2089 { |
95481
4390d64d3328
Make "xfree (NULL)" a no-op; remove useless if-before-xfree.
Jim Meyering <jim@meyering.net>
parents:
94963
diff
changeset
|
2090 xfree (default_orig_pair); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2091 default_orig_pair = tty->TS_orig_pair ? xstrdup (tty->TS_orig_pair) : NULL; |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2092 |
95481
4390d64d3328
Make "xfree (NULL)" a no-op; remove useless if-before-xfree.
Jim Meyering <jim@meyering.net>
parents:
94963
diff
changeset
|
2093 xfree (default_set_foreground); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2094 default_set_foreground = tty->TS_set_foreground ? xstrdup (tty->TS_set_foreground) |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2095 : NULL; |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2096 |
95481
4390d64d3328
Make "xfree (NULL)" a no-op; remove useless if-before-xfree.
Jim Meyering <jim@meyering.net>
parents:
94963
diff
changeset
|
2097 xfree (default_set_background); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2098 default_set_background = tty->TS_set_background ? xstrdup (tty->TS_set_background) |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2099 : NULL; |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2100 |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2101 default_max_colors = tty->TN_max_colors; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2102 default_max_pairs = tty->TN_max_pairs; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2103 default_no_color_video = tty->TN_no_color_video; |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2104 } |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2105 else |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2106 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2107 tty->TS_orig_pair = default_orig_pair; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2108 tty->TS_set_foreground = default_set_foreground; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2109 tty->TS_set_background = default_set_background; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2110 tty->TN_max_colors = default_max_colors; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2111 tty->TN_max_pairs = default_max_pairs; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2112 tty->TN_no_color_video = default_no_color_video; |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2113 } |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2114 } |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2115 |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2116 /* Setup one of the standard tty color schemes according to MODE. |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2117 MODE's value is generally the number of colors which we want to |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2118 support; zero means set up for the default capabilities, the ones |
83341
76e51706154e
Rename term_init to init_tty.
Karoly Lorentey <lorentey@elte.hu>
parents:
83338
diff
changeset
|
2119 we saw at init_tty time; -1 means turn off color support. */ |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2120 static void |
82989
f3845715a5f6
Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
82988
diff
changeset
|
2121 tty_setup_colors (struct tty_display_info *tty, int mode) |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2122 { |
52652
31a3a92c1a03
(tty_setup_colors): Treat any negative argument as -1.
Eli Zaretskii <eliz@gnu.org>
parents:
52579
diff
changeset
|
2123 /* Canonicalize all negative values of MODE. */ |
31a3a92c1a03
(tty_setup_colors): Treat any negative argument as -1.
Eli Zaretskii <eliz@gnu.org>
parents:
52579
diff
changeset
|
2124 if (mode < -1) |
31a3a92c1a03
(tty_setup_colors): Treat any negative argument as -1.
Eli Zaretskii <eliz@gnu.org>
parents:
52579
diff
changeset
|
2125 mode = -1; |
31a3a92c1a03
(tty_setup_colors): Treat any negative argument as -1.
Eli Zaretskii <eliz@gnu.org>
parents:
52579
diff
changeset
|
2126 |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2127 switch (mode) |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2128 { |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2129 case -1: /* no colors at all */ |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2130 tty->TN_max_colors = 0; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2131 tty->TN_max_pairs = 0; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2132 tty->TN_no_color_video = 0; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2133 tty->TS_set_foreground = tty->TS_set_background = tty->TS_orig_pair = NULL; |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2134 break; |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2135 case 0: /* default colors, if any */ |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2136 default: |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2137 tty_default_color_capabilities (tty, 0); |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2138 break; |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2139 case 8: /* 8 standard ANSI colors */ |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2140 tty->TS_orig_pair = "\033[0m"; |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2141 #ifdef TERMINFO |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2142 tty->TS_set_foreground = "\033[3%p1%dm"; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2143 tty->TS_set_background = "\033[4%p1%dm"; |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2144 #else |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2145 tty->TS_set_foreground = "\033[3%dm"; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2146 tty->TS_set_background = "\033[4%dm"; |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2147 #endif |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2148 tty->TN_max_colors = 8; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2149 tty->TN_max_pairs = 64; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2150 tty->TN_no_color_video = 0; |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2151 break; |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2152 } |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2153 } |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2154 |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2155 void |
93883
722fdbc7a012
* xdisp.c (redisplay_internal): Reset tty's color_mode when switching
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92281
diff
changeset
|
2156 set_tty_color_mode (tty, f) |
722fdbc7a012
* xdisp.c (redisplay_internal): Reset tty's color_mode when switching
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92281
diff
changeset
|
2157 struct tty_display_info *tty; |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2158 struct frame *f; |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2159 { |
93883
722fdbc7a012
* xdisp.c (redisplay_internal): Reset tty's color_mode when switching
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92281
diff
changeset
|
2160 Lisp_Object tem, val, color_mode_spec; |
722fdbc7a012
* xdisp.c (redisplay_internal): Reset tty's color_mode when switching
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92281
diff
changeset
|
2161 Lisp_Object color_mode; |
722fdbc7a012
* xdisp.c (redisplay_internal): Reset tty's color_mode when switching
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92281
diff
changeset
|
2162 int mode; |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2163 extern Lisp_Object Qtty_color_mode; |
93883
722fdbc7a012
* xdisp.c (redisplay_internal): Reset tty's color_mode when switching
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92281
diff
changeset
|
2164 Lisp_Object tty_color_mode_alist |
722fdbc7a012
* xdisp.c (redisplay_internal): Reset tty's color_mode when switching
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92281
diff
changeset
|
2165 = Fintern_soft (build_string ("tty-color-mode-alist"), Qnil); |
722fdbc7a012
* xdisp.c (redisplay_internal): Reset tty's color_mode when switching
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92281
diff
changeset
|
2166 |
93984
ddcecf318c8a
(set_tty_color_mode): Left over typo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93883
diff
changeset
|
2167 tem = assq_no_quit (Qtty_color_mode, f->param_alist); |
93883
722fdbc7a012
* xdisp.c (redisplay_internal): Reset tty's color_mode when switching
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92281
diff
changeset
|
2168 val = CONSP (tem) ? XCDR (tem) : Qnil; |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2169 |
52579
611336925095
(set_tty_color_mode): Use INTEGERP to test whether a
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
2170 if (INTEGERP (val)) |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2171 color_mode = val; |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2172 else |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2173 { |
93883
722fdbc7a012
* xdisp.c (redisplay_internal): Reset tty's color_mode when switching
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92281
diff
changeset
|
2174 tem = (NILP (tty_color_mode_alist) ? Qnil |
722fdbc7a012
* xdisp.c (redisplay_internal): Reset tty's color_mode when switching
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92281
diff
changeset
|
2175 : Fassq (val, XSYMBOL (tty_color_mode_alist)->value)); |
722fdbc7a012
* xdisp.c (redisplay_internal): Reset tty's color_mode when switching
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92281
diff
changeset
|
2176 color_mode = CONSP (tem) ? XCDR (tem) : Qnil; |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2177 } |
52681
2036a4307b6c
(set_tty_color_mode): Calculate current_mode_spec regardless of value of VAL.
Richard M. Stallman <rms@gnu.org>
parents:
52652
diff
changeset
|
2178 |
93883
722fdbc7a012
* xdisp.c (redisplay_internal): Reset tty's color_mode when switching
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92281
diff
changeset
|
2179 mode = INTEGERP (color_mode) ? XINT (color_mode) : 0; |
722fdbc7a012
* xdisp.c (redisplay_internal): Reset tty's color_mode when switching
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92281
diff
changeset
|
2180 |
722fdbc7a012
* xdisp.c (redisplay_internal): Reset tty's color_mode when switching
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92281
diff
changeset
|
2181 if (mode != tty->previous_color_mode) |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2182 { |
93883
722fdbc7a012
* xdisp.c (redisplay_internal): Reset tty's color_mode when switching
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92281
diff
changeset
|
2183 Lisp_Object funsym = intern ("tty-set-up-initial-frame-faces"); |
722fdbc7a012
* xdisp.c (redisplay_internal): Reset tty's color_mode when switching
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92281
diff
changeset
|
2184 tty->previous_color_mode = mode; |
722fdbc7a012
* xdisp.c (redisplay_internal): Reset tty's color_mode when switching
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92281
diff
changeset
|
2185 tty_setup_colors (tty , mode); |
722fdbc7a012
* xdisp.c (redisplay_internal): Reset tty's color_mode when switching
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92281
diff
changeset
|
2186 /* This recomputes all the faces given the new color definitions. */ |
722fdbc7a012
* xdisp.c (redisplay_internal): Reset tty's color_mode when switching
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92281
diff
changeset
|
2187 safe_call (1, &funsym); |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2188 } |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2189 } |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2190 |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2191 #endif /* !WINDOWSNT */ |
25002 | 2192 |
2193 | |
53226
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
2194 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2195 /* Return the tty display object specified by TERMINAL. */ |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2196 |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2197 struct terminal * |
83512
5d328dadd0f4
Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83502
diff
changeset
|
2198 get_tty_terminal (Lisp_Object terminal, int throw) |
83167
69ebc75cb461
Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83161
diff
changeset
|
2199 { |
83512
5d328dadd0f4
Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83502
diff
changeset
|
2200 struct terminal *t = get_terminal (terminal, throw); |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2201 |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2202 if (t && t->type != output_termcap) |
83512
5d328dadd0f4
Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83502
diff
changeset
|
2203 { |
5d328dadd0f4
Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83502
diff
changeset
|
2204 if (throw) |
5d328dadd0f4
Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83502
diff
changeset
|
2205 error ("Device %d is not a termcap terminal device", t->id); |
5d328dadd0f4
Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83502
diff
changeset
|
2206 else |
5d328dadd0f4
Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83502
diff
changeset
|
2207 return NULL; |
5d328dadd0f4
Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83502
diff
changeset
|
2208 } |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2209 |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2210 return t; |
83167
69ebc75cb461
Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83161
diff
changeset
|
2211 } |
69ebc75cb461
Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83161
diff
changeset
|
2212 |
83525
b2e7507b55c6
Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents:
83522
diff
changeset
|
2213 /* Return an active termcap device that uses the tty device with the |
b2e7507b55c6
Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents:
83522
diff
changeset
|
2214 given name. |
83167
69ebc75cb461
Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83161
diff
changeset
|
2215 |
83342
9216636c02fc
Rename `struct display' to `struct device'. Update function, parameter and variable names accordingly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83341
diff
changeset
|
2216 This function ignores suspended devices. |
83025
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
2217 |
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
2218 Returns NULL if the named terminal device is not opened. */ |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
2219 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2220 struct terminal * |
83342
9216636c02fc
Rename `struct display' to `struct device'. Update function, parameter and variable names accordingly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83341
diff
changeset
|
2221 get_named_tty (name) |
53226
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
2222 char *name; |
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
2223 { |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2224 struct terminal *t; |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2225 |
83525
b2e7507b55c6
Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents:
83522
diff
changeset
|
2226 if (!name) |
b2e7507b55c6
Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents:
83522
diff
changeset
|
2227 abort (); |
b2e7507b55c6
Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents:
83522
diff
changeset
|
2228 |
b2e7507b55c6
Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents:
83522
diff
changeset
|
2229 for (t = terminal_list; t; t = t->next_terminal) |
b2e7507b55c6
Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents:
83522
diff
changeset
|
2230 { |
b2e7507b55c6
Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents:
83522
diff
changeset
|
2231 if (t->type == output_termcap |
b2e7507b55c6
Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents:
83522
diff
changeset
|
2232 && !strcmp (t->display_info.tty->name, name) |
b2e7507b55c6
Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents:
83522
diff
changeset
|
2233 && TERMINAL_ACTIVE_P (t)) |
b2e7507b55c6
Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents:
83522
diff
changeset
|
2234 return t; |
b2e7507b55c6
Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents:
83522
diff
changeset
|
2235 } |
53226
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
2236 |
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
2237 return 0; |
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
2238 } |
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
2239 |
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
2240 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2241 DEFUN ("tty-type", Ftty_type, Stty_type, 0, 1, 0, |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2242 doc: /* Return the type of the tty device that TERMINAL uses. |
83525
b2e7507b55c6
Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents:
83522
diff
changeset
|
2243 Returns nil if TERMINAL is not on a tty device. |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2244 |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2245 TERMINAL can be a terminal id, a frame or nil (meaning the selected |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2246 frame's terminal). */) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2247 (terminal) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2248 Lisp_Object terminal; |
82988
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
2249 { |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2250 struct terminal *t = get_terminal (terminal, 1); |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2251 |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2252 if (t->type != output_termcap) |
83525
b2e7507b55c6
Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents:
83522
diff
changeset
|
2253 return Qnil; |
b2e7507b55c6
Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents:
83522
diff
changeset
|
2254 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2255 if (t->display_info.tty->type) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2256 return build_string (t->display_info.tty->type); |
82988
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
2257 else |
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
2258 return Qnil; |
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
2259 } |
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
2260 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2261 DEFUN ("controlling-tty-p", Fcontrolling_tty_p, Scontrolling_tty_p, 0, 1, 0, |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2262 doc: /* Return non-nil if TERMINAL is on the controlling tty of the Emacs process. |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2263 |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2264 TERMINAL can be a terminal id, a frame or nil (meaning the selected |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2265 frame's terminal). This function always returns nil if TERMINAL |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2266 is not on a tty device. */) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2267 (terminal) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2268 Lisp_Object terminal; |
83173
6b4b299e2cd5
Fix suspend-frame on the controlling tty (reported by Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83168
diff
changeset
|
2269 { |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2270 struct terminal *t = get_terminal (terminal, 1); |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2271 |
84779
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
2272 if (t->type != output_termcap || strcmp (t->display_info.tty->name, DEV_TTY)) |
83173
6b4b299e2cd5
Fix suspend-frame on the controlling tty (reported by Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83168
diff
changeset
|
2273 return Qnil; |
6b4b299e2cd5
Fix suspend-frame on the controlling tty (reported by Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83168
diff
changeset
|
2274 else |
6b4b299e2cd5
Fix suspend-frame on the controlling tty (reported by Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83168
diff
changeset
|
2275 return Qt; |
6b4b299e2cd5
Fix suspend-frame on the controlling tty (reported by Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83168
diff
changeset
|
2276 } |
6b4b299e2cd5
Fix suspend-frame on the controlling tty (reported by Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83168
diff
changeset
|
2277 |
83311
c016d82bf02b
Merged from miles@gnu.org--gnu-2005 (patch 423-434)
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
2278 DEFUN ("tty-no-underline", Ftty_no_underline, Stty_no_underline, 0, 1, 0, |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2279 doc: /* Declare that the tty used by TERMINAL does not handle underlining. |
83311
c016d82bf02b
Merged from miles@gnu.org--gnu-2005 (patch 423-434)
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
2280 This is used to override the terminfo data, for certain terminals that |
c016d82bf02b
Merged from miles@gnu.org--gnu-2005 (patch 423-434)
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
2281 do not really do underlining, but say that they do. This function has |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2282 no effect if used on a non-tty terminal. |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2283 |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2284 TERMINAL can be a terminal id, a frame or nil (meaning the selected |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2285 frame's terminal). This function always returns nil if TERMINAL |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2286 is not on a tty device. */) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2287 (terminal) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2288 Lisp_Object terminal; |
83311
c016d82bf02b
Merged from miles@gnu.org--gnu-2005 (patch 423-434)
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
2289 { |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2290 struct terminal *t = get_terminal (terminal, 1); |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2291 |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2292 if (t->type == output_termcap) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2293 t->display_info.tty->TS_enter_underline_mode = 0; |
83311
c016d82bf02b
Merged from miles@gnu.org--gnu-2005 (patch 423-434)
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
2294 return Qnil; |
c016d82bf02b
Merged from miles@gnu.org--gnu-2005 (patch 423-434)
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
2295 } |
c016d82bf02b
Merged from miles@gnu.org--gnu-2005 (patch 423-434)
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
2296 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2297 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2298 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2299 DEFUN ("suspend-tty", Fsuspend_tty, Ssuspend_tty, 0, 1, 0, |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2300 doc: /* Suspend the terminal device TTY. |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2301 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2302 The device is restored to its default state, and Emacs ceases all |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2303 access to the tty device. Frames that use the device are not deleted, |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2304 but input is not read from them and if they change, their display is |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2305 not updated. |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2306 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2307 TTY may be a terminal id, a frame, or nil for the terminal device of |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2308 the currently selected frame. |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2309 |
83891
dab32bc3edc8
* server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83889
diff
changeset
|
2310 This function runs `suspend-tty-functions' after suspending the |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2311 device. The functions are run with one arg, the id of the suspended |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2312 terminal device. |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2313 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2314 `suspend-tty' does nothing if it is called on a device that is already |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2315 suspended. |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2316 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2317 A suspended tty may be resumed by calling `resume-tty' on it. */) |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2318 (tty) |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2319 Lisp_Object tty; |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2320 { |
83512
5d328dadd0f4
Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83502
diff
changeset
|
2321 struct terminal *t = get_tty_terminal (tty, 1); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2322 FILE *f; |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
2323 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2324 if (!t) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2325 error ("Unknown tty device"); |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2326 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2327 f = t->display_info.tty->input; |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
2328 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2329 if (f) |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2330 { |
84769
cbcb89640ef2
* xt-mouse.el (xterm-mouse-mode): Re-enable suspend-tty-functions.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
84768
diff
changeset
|
2331 /* First run `suspend-tty-functions' and then clean up the tty |
cbcb89640ef2
* xt-mouse.el (xterm-mouse-mode): Re-enable suspend-tty-functions.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
84768
diff
changeset
|
2332 state because `suspend-tty-functions' might need to change |
cbcb89640ef2
* xt-mouse.el (xterm-mouse-mode): Re-enable suspend-tty-functions.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
84768
diff
changeset
|
2333 the tty state. */ |
cbcb89640ef2
* xt-mouse.el (xterm-mouse-mode): Re-enable suspend-tty-functions.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
84768
diff
changeset
|
2334 if (!NILP (Vrun_hooks)) |
cbcb89640ef2
* xt-mouse.el (xterm-mouse-mode): Re-enable suspend-tty-functions.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
84768
diff
changeset
|
2335 { |
cbcb89640ef2
* xt-mouse.el (xterm-mouse-mode): Re-enable suspend-tty-functions.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
84768
diff
changeset
|
2336 Lisp_Object args[2]; |
cbcb89640ef2
* xt-mouse.el (xterm-mouse-mode): Re-enable suspend-tty-functions.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
84768
diff
changeset
|
2337 args[0] = intern ("suspend-tty-functions"); |
cbcb89640ef2
* xt-mouse.el (xterm-mouse-mode): Re-enable suspend-tty-functions.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
84768
diff
changeset
|
2338 XSETTERMINAL (args[1], t); |
cbcb89640ef2
* xt-mouse.el (xterm-mouse-mode): Re-enable suspend-tty-functions.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
84768
diff
changeset
|
2339 Frun_hook_with_args (2, args); |
cbcb89640ef2
* xt-mouse.el (xterm-mouse-mode): Re-enable suspend-tty-functions.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
84768
diff
changeset
|
2340 } |
cbcb89640ef2
* xt-mouse.el (xterm-mouse-mode): Re-enable suspend-tty-functions.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
84768
diff
changeset
|
2341 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2342 reset_sys_modes (t->display_info.tty); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2343 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2344 delete_keyboard_wait_descriptor (fileno (f)); |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
2345 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2346 fclose (f); |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2347 if (f != t->display_info.tty->output) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2348 fclose (t->display_info.tty->output); |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
2349 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2350 t->display_info.tty->input = 0; |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2351 t->display_info.tty->output = 0; |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2352 |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2353 if (FRAMEP (t->display_info.tty->top_frame)) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2354 FRAME_SET_VISIBLE (XFRAME (t->display_info.tty->top_frame), 0); |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
2355 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2356 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2357 |
83521
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
2358 /* Clear display hooks to prevent further output. */ |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
2359 clear_tty_hooks (t); |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
2360 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2361 return Qnil; |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2362 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2363 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2364 DEFUN ("resume-tty", Fresume_tty, Sresume_tty, 0, 1, 0, |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2365 doc: /* Resume the previously suspended terminal device TTY. |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2366 The terminal is opened and reinitialized. Frames that are on the |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2367 suspended terminal are revived. |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2368 |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2369 It is an error to resume a terminal while another terminal is active |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2370 on the same device. |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2371 |
83891
dab32bc3edc8
* server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83889
diff
changeset
|
2372 This function runs `resume-tty-functions' after resuming the terminal. |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2373 The functions are run with one arg, the id of the resumed terminal |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2374 device. |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2375 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2376 `resume-tty' does nothing if it is called on a device that is not |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2377 suspended. |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2378 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2379 TTY may be a terminal id, a frame, or nil for the terminal device of |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2380 the currently selected frame. */) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2381 (tty) |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2382 Lisp_Object tty; |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2383 { |
83512
5d328dadd0f4
Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83502
diff
changeset
|
2384 struct terminal *t = get_tty_terminal (tty, 1); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2385 int fd; |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2386 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2387 if (!t) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2388 error ("Unknown tty device"); |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2389 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2390 if (!t->display_info.tty->input) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2391 { |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2392 if (get_named_tty (t->display_info.tty->name)) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2393 error ("Cannot resume display while another display is active on the same device"); |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2394 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2395 fd = emacs_open (t->display_info.tty->name, O_RDWR | O_NOCTTY, 0); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2396 |
83498
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
2397 if (fd == -1) |
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
2398 error ("Can not reopen tty device %s: %s", t->display_info.tty->name, strerror (errno)); |
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
2399 |
84779
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
2400 if (strcmp (t->display_info.tty->name, DEV_TTY)) |
83498
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
2401 dissociate_if_controlling_tty (fd); |
84779
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
2402 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2403 t->display_info.tty->output = fdopen (fd, "w+"); |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2404 t->display_info.tty->input = t->display_info.tty->output; |
84779
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
2405 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2406 add_keyboard_wait_descriptor (fd); |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2407 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2408 if (FRAMEP (t->display_info.tty->top_frame)) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2409 FRAME_SET_VISIBLE (XFRAME (t->display_info.tty->top_frame), 1); |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2410 |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2411 init_sys_modes (t->display_info.tty); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2412 |
83891
dab32bc3edc8
* server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83889
diff
changeset
|
2413 /* Run `resume-tty-functions'. */ |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2414 if (!NILP (Vrun_hooks)) |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2415 { |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2416 Lisp_Object args[2]; |
83891
dab32bc3edc8
* server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83889
diff
changeset
|
2417 args[0] = intern ("resume-tty-functions"); |
84692
0d8dd9a91520
(get_tty_terminal): Don't treat output_initial specially.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84461
diff
changeset
|
2418 XSETTERMINAL (args[1], t); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2419 Frun_hook_with_args (2, args); |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2420 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2421 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2422 |
83521
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
2423 set_tty_hooks (t); |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
2424 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2425 return Qnil; |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2426 } |
83311
c016d82bf02b
Merged from miles@gnu.org--gnu-2005 (patch 423-434)
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
2427 |
82988
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
2428 |
25002 | 2429 /*********************************************************************** |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2430 Mouse |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2431 ***********************************************************************/ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2432 |
80994
62b6aa7f8c37
Use HAVE_GPM instead of HAVE_GPM_H.
Nick Roberts <nickrob@snap.net.nz>
parents:
80979
diff
changeset
|
2433 #ifdef HAVE_GPM |
81107 | 2434 void |
2435 term_mouse_moveto (int x, int y) | |
81102
a00e7c5f2faa
(mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
81083
diff
changeset
|
2436 { |
81811
c10410a3aa36
Include unistd.h for ttyname, used in handle_one_term_event.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81308
diff
changeset
|
2437 /* TODO: how to set mouse position? |
81102
a00e7c5f2faa
(mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
81083
diff
changeset
|
2438 const char *name; |
a00e7c5f2faa
(mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
81083
diff
changeset
|
2439 int fd; |
a00e7c5f2faa
(mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
81083
diff
changeset
|
2440 name = (const char *) ttyname (0); |
a00e7c5f2faa
(mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
81083
diff
changeset
|
2441 fd = open (name, O_WRONLY); |
81127
d620b28641cd
(term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
81107
diff
changeset
|
2442 SOME_FUNCTION (x, y, fd); |
81102
a00e7c5f2faa
(mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
81083
diff
changeset
|
2443 close (fd); |
a00e7c5f2faa
(mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
81083
diff
changeset
|
2444 last_mouse_x = x; |
81127
d620b28641cd
(term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
81107
diff
changeset
|
2445 last_mouse_y = y; */ |
81102
a00e7c5f2faa
(mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
81083
diff
changeset
|
2446 } |
a00e7c5f2faa
(mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
81083
diff
changeset
|
2447 |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2448 static void |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2449 term_show_mouse_face (enum draw_glyphs_face draw) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2450 { |
84968
85eb2660cbe3
(mouse_face_window): Rename from Qmouse_face_window. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84955
diff
changeset
|
2451 struct window *w = XWINDOW (mouse_face_window); |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2452 int save_x, save_y; |
81811
c10410a3aa36
Include unistd.h for ttyname, used in handle_one_term_event.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81308
diff
changeset
|
2453 int i; |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2454 |
83622 | 2455 struct frame *f = XFRAME (w->frame); |
2456 struct tty_display_info *tty = FRAME_TTY (f); | |
2457 | |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2458 if (/* If window is in the process of being destroyed, don't bother |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2459 to do anything. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2460 w->current_matrix != NULL |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2461 /* Recognize when we are called to operate on rows that don't exist |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2462 anymore. This can happen when a window is split. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2463 && mouse_face_end_row < w->current_matrix->nrows) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2464 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2465 /* write_glyphs writes at cursor position, so we need to |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2466 temporarily move cursor coordinates to the beginning of |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2467 the highlight region. */ |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
2468 |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2469 /* Save current cursor co-ordinates */ |
83622 | 2470 save_y = curY (tty); |
2471 save_x = curX (tty); | |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2472 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2473 /* Note that mouse_face_beg_row etc. are window relative. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2474 for (i = mouse_face_beg_row; i <= mouse_face_end_row; i++) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2475 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2476 int start_hpos, end_hpos, nglyphs; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2477 struct glyph_row *row = MATRIX_ROW (w->current_matrix, i); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2478 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2479 /* Don't do anything if row doesn't have valid contents. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2480 if (!row->enabled_p) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2481 continue; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2482 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2483 /* For all but the first row, the highlight starts at column 0. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2484 if (i == mouse_face_beg_row) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2485 start_hpos = mouse_face_beg_col; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2486 else |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2487 start_hpos = 0; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2488 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2489 if (i == mouse_face_end_row) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2490 end_hpos = mouse_face_end_col; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2491 else |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2492 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2493 end_hpos = row->used[TEXT_AREA]; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2494 if (draw == DRAW_NORMAL_TEXT) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2495 row->fill_line_p = 1; /* Clear to end of line */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2496 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2497 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2498 if (end_hpos <= start_hpos) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2499 continue; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2500 /* Record that some glyphs of this row are displayed in |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2501 mouse-face. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2502 row->mouse_face_p = draw > 0; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2503 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2504 nglyphs = end_hpos - start_hpos; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2505 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2506 if (end_hpos >= row->used[TEXT_AREA]) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2507 nglyphs = row->used[TEXT_AREA] - start_hpos; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2508 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2509 pos_y = row->y + WINDOW_TOP_EDGE_Y (w); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2510 pos_x = row->used[LEFT_MARGIN_AREA] + start_hpos |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2511 + WINDOW_LEFT_EDGE_X (w); |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
2512 |
83622 | 2513 cursor_to (f, pos_y, pos_x); |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2514 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2515 if (draw == DRAW_MOUSE_FACE) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2516 { |
83622 | 2517 tty_write_glyphs_with_face (f, row->glyphs[TEXT_AREA] + start_hpos, |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2518 nglyphs, mouse_face_face_id); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2519 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2520 else /* draw == DRAW_NORMAL_TEXT */ |
83622 | 2521 write_glyphs (f, row->glyphs[TEXT_AREA] + start_hpos, nglyphs); |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2522 } |
83622 | 2523 cursor_to (f, save_y, save_x); |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2524 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2525 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2526 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2527 static void |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2528 term_clear_mouse_face () |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2529 { |
84968
85eb2660cbe3
(mouse_face_window): Rename from Qmouse_face_window. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84955
diff
changeset
|
2530 if (!NILP (mouse_face_window)) |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2531 term_show_mouse_face (DRAW_NORMAL_TEXT); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2532 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2533 mouse_face_beg_row = mouse_face_beg_col = -1; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2534 mouse_face_end_row = mouse_face_end_col = -1; |
84968
85eb2660cbe3
(mouse_face_window): Rename from Qmouse_face_window. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84955
diff
changeset
|
2535 mouse_face_window = Qnil; |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2536 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2537 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2538 /* Find the glyph matrix position of buffer position POS in window W. |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2539 *HPOS and *VPOS are set to the positions found. W's current glyphs |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2540 must be up to date. If POS is above window start return (0, 0). |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2541 If POS is after end of W, return end of last line in W. |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2542 - taken from msdos.c */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2543 static int |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2544 fast_find_position (struct window *w, int pos, int *hpos, int *vpos) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2545 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2546 int i, lastcol, line_start_position, maybe_next_line_p = 0; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2547 int yb = window_text_bottom_y (w); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2548 struct glyph_row *row = MATRIX_ROW (w->current_matrix, 0), *best_row = row; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2549 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2550 while (row->y < yb) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2551 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2552 if (row->used[TEXT_AREA]) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2553 line_start_position = row->glyphs[TEXT_AREA]->charpos; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2554 else |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2555 line_start_position = 0; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2556 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2557 if (line_start_position > pos) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2558 break; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2559 /* If the position sought is the end of the buffer, |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2560 don't include the blank lines at the bottom of the window. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2561 else if (line_start_position == pos |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2562 && pos == BUF_ZV (XBUFFER (w->buffer))) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2563 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2564 maybe_next_line_p = 1; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2565 break; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2566 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2567 else if (line_start_position > 0) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2568 best_row = row; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2569 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2570 /* Don't overstep the last matrix row, lest we get into the |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2571 never-never land... */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2572 if (row->y + 1 >= yb) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2573 break; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2574 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2575 ++row; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2576 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2577 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2578 /* Find the right column within BEST_ROW. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2579 lastcol = 0; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2580 row = best_row; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2581 for (i = 0; i < row->used[TEXT_AREA]; i++) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2582 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2583 struct glyph *glyph = row->glyphs[TEXT_AREA] + i; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2584 int charpos; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2585 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2586 charpos = glyph->charpos; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2587 if (charpos == pos) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2588 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2589 *hpos = i; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2590 *vpos = row->y; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2591 return 1; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2592 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2593 else if (charpos > pos) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2594 break; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2595 else if (charpos > 0) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2596 lastcol = i; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2597 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2598 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2599 /* If we're looking for the end of the buffer, |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2600 and we didn't find it in the line we scanned, |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2601 use the start of the following line. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2602 if (maybe_next_line_p) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2603 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2604 ++row; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2605 lastcol = 0; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2606 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2607 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2608 *vpos = row->y; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2609 *hpos = lastcol + 1; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2610 return 0; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2611 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2612 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2613 static void |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2614 term_mouse_highlight (struct frame *f, int x, int y) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2615 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2616 enum window_part part; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2617 Lisp_Object window; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2618 struct window *w; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2619 struct buffer *b; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2620 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2621 if (NILP (Vmouse_highlight) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2622 || !f->glyphs_initialized_p) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2623 return; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2624 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2625 /* Which window is that in? */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2626 window = window_from_coordinates (f, x, y, &part, &x, &y, 0); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2627 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2628 /* Not on a window -> return. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2629 if (!WINDOWP (window)) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2630 return; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2631 |
84968
85eb2660cbe3
(mouse_face_window): Rename from Qmouse_face_window. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84955
diff
changeset
|
2632 if (!EQ (window, mouse_face_window)) |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2633 term_clear_mouse_face (); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2634 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2635 w = XWINDOW (window); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2636 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2637 /* Are we in a window whose display is up to date? |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2638 And verify the buffer's text has not changed. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2639 b = XBUFFER (w->buffer); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2640 if (part == ON_TEXT |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2641 && EQ (w->window_end_valid, w->buffer) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2642 && XFASTINT (w->last_modified) == BUF_MODIFF (b) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2643 && XFASTINT (w->last_overlay_modified) == BUF_OVERLAY_MODIFF (b)) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2644 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2645 int pos, i, nrows = w->current_matrix->nrows; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2646 struct glyph_row *row; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2647 struct glyph *glyph; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2648 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2649 /* Find the glyph under X/Y. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2650 glyph = NULL; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2651 if (y >= 0 && y < nrows) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2652 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2653 row = MATRIX_ROW (w->current_matrix, y); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2654 /* Give up if some row before the one we are looking for is |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2655 not enabled. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2656 for (i = 0; i <= y; i++) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2657 if (!MATRIX_ROW (w->current_matrix, i)->enabled_p) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2658 break; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2659 if (i > y /* all rows upto and including the one at Y are enabled */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2660 && row->displays_text_p |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2661 && x < window_box_width (w, TEXT_AREA)) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2662 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2663 glyph = row->glyphs[TEXT_AREA]; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2664 if (x >= row->used[TEXT_AREA]) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2665 glyph = NULL; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2666 else |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2667 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2668 glyph += x; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2669 if (!BUFFERP (glyph->object)) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2670 glyph = NULL; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2671 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2672 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2673 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2674 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2675 /* Clear mouse face if X/Y not over text. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2676 if (glyph == NULL) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2677 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2678 term_clear_mouse_face (); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2679 return; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2680 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2681 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2682 if (!BUFFERP (glyph->object)) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2683 abort (); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2684 pos = glyph->charpos; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2685 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2686 /* Check for mouse-face. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2687 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2688 extern Lisp_Object Qmouse_face; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2689 Lisp_Object mouse_face, overlay, position, *overlay_vec; |
81083
223bb8e66f74
* xfaces.c (syms_of_xfaces): Delete stray semicolon.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
80994
diff
changeset
|
2690 int noverlays, obegv, ozv; |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2691 struct buffer *obuf; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2692 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2693 /* If we get an out-of-range value, return now; avoid an error. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2694 if (pos > BUF_Z (b)) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2695 return; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2696 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2697 /* Make the window's buffer temporarily current for |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2698 overlays_at and compute_char_face. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2699 obuf = current_buffer; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2700 current_buffer = b; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2701 obegv = BEGV; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2702 ozv = ZV; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2703 BEGV = BEG; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2704 ZV = Z; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2705 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2706 /* Is this char mouse-active? */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2707 XSETINT (position, pos); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2708 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2709 /* Put all the overlays we want in a vector in overlay_vec. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2710 GET_OVERLAYS_AT (pos, overlay_vec, noverlays, NULL, 0); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2711 /* Sort overlays into increasing priority order. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2712 noverlays = sort_overlays (overlay_vec, noverlays, w); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2713 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2714 /* Check mouse-face highlighting. */ |
84968
85eb2660cbe3
(mouse_face_window): Rename from Qmouse_face_window. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84955
diff
changeset
|
2715 if (!(EQ (window, mouse_face_window) |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2716 && y >= mouse_face_beg_row |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2717 && y <= mouse_face_end_row |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2718 && (y > mouse_face_beg_row |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2719 || x >= mouse_face_beg_col) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2720 && (y < mouse_face_end_row |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2721 || x < mouse_face_end_col |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2722 || mouse_face_past_end))) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2723 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2724 /* Clear the display of the old active region, if any. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2725 term_clear_mouse_face (); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2726 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2727 /* Find the highest priority overlay that has a mouse-face |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2728 property. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2729 overlay = Qnil; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2730 for (i = noverlays - 1; i >= 0; --i) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2731 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2732 mouse_face = Foverlay_get (overlay_vec[i], Qmouse_face); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2733 if (!NILP (mouse_face)) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2734 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2735 overlay = overlay_vec[i]; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2736 break; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2737 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2738 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2739 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2740 /* If no overlay applies, get a text property. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2741 if (NILP (overlay)) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2742 mouse_face = Fget_text_property (position, Qmouse_face, |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2743 w->buffer); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2744 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2745 /* Handle the overlay case. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2746 if (!NILP (overlay)) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2747 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2748 /* Find the range of text around this char that |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2749 should be active. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2750 Lisp_Object before, after; |
92237
ce06567a933d
* dispextern.h (face_at_buffer_position, face_for_overlay_string)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91327
diff
changeset
|
2751 EMACS_INT ignore; |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2752 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2753 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2754 before = Foverlay_start (overlay); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2755 after = Foverlay_end (overlay); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2756 /* Record this as the current active region. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2757 fast_find_position (w, XFASTINT (before), |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2758 &mouse_face_beg_col, |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2759 &mouse_face_beg_row); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2760 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2761 mouse_face_past_end |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2762 = !fast_find_position (w, XFASTINT (after), |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2763 &mouse_face_end_col, |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2764 &mouse_face_end_row); |
84968
85eb2660cbe3
(mouse_face_window): Rename from Qmouse_face_window. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84955
diff
changeset
|
2765 mouse_face_window = window; |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2766 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2767 mouse_face_face_id |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2768 = face_at_buffer_position (w, pos, 0, 0, |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2769 &ignore, pos + 1, 1); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2770 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2771 /* Display it as active. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2772 term_show_mouse_face (DRAW_MOUSE_FACE); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2773 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2774 /* Handle the text property case. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2775 else if (!NILP (mouse_face)) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2776 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2777 /* Find the range of text around this char that |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2778 should be active. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2779 Lisp_Object before, after, beginning, end; |
92237
ce06567a933d
* dispextern.h (face_at_buffer_position, face_for_overlay_string)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91327
diff
changeset
|
2780 EMACS_INT ignore; |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2781 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2782 beginning = Fmarker_position (w->start); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2783 XSETINT (end, (BUF_Z (b) - XFASTINT (w->window_end_pos))); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2784 before |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2785 = Fprevious_single_property_change (make_number (pos + 1), |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2786 Qmouse_face, |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2787 w->buffer, beginning); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2788 after |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2789 = Fnext_single_property_change (position, Qmouse_face, |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2790 w->buffer, end); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2791 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2792 /* Record this as the current active region. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2793 fast_find_position (w, XFASTINT (before), |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2794 &mouse_face_beg_col, |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2795 &mouse_face_beg_row); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2796 mouse_face_past_end |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2797 = !fast_find_position (w, XFASTINT (after), |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2798 &mouse_face_end_col, |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2799 &mouse_face_end_row); |
84968
85eb2660cbe3
(mouse_face_window): Rename from Qmouse_face_window. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84955
diff
changeset
|
2800 mouse_face_window = window; |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2801 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2802 mouse_face_face_id |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2803 = face_at_buffer_position (w, pos, 0, 0, |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2804 &ignore, pos + 1, 1); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2805 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2806 /* Display it as active. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2807 term_show_mouse_face (DRAW_MOUSE_FACE); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2808 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2809 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2810 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2811 /* Look for a `help-echo' property. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2812 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2813 Lisp_Object help; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2814 extern Lisp_Object Qhelp_echo; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2815 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2816 /* Check overlays first. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2817 help = Qnil; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2818 for (i = noverlays - 1; i >= 0 && NILP (help); --i) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2819 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2820 overlay = overlay_vec[i]; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2821 help = Foverlay_get (overlay, Qhelp_echo); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2822 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2823 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2824 if (!NILP (help)) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2825 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2826 help_echo_string = help; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2827 help_echo_window = window; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2828 help_echo_object = overlay; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2829 help_echo_pos = pos; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2830 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2831 /* Try text properties. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2832 else if (NILP (help) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2833 && ((STRINGP (glyph->object) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2834 && glyph->charpos >= 0 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2835 && glyph->charpos < SCHARS (glyph->object)) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2836 || (BUFFERP (glyph->object) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2837 && glyph->charpos >= BEGV |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2838 && glyph->charpos < ZV))) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2839 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2840 help = Fget_text_property (make_number (glyph->charpos), |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2841 Qhelp_echo, glyph->object); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2842 if (!NILP (help)) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2843 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2844 help_echo_string = help; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2845 help_echo_window = window; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2846 help_echo_object = glyph->object; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2847 help_echo_pos = glyph->charpos; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2848 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2849 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2850 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2851 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2852 BEGV = obegv; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2853 ZV = ozv; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2854 current_buffer = obuf; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2855 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2856 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2857 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2858 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2859 static int |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2860 term_mouse_movement (FRAME_PTR frame, Gpm_Event *event) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2861 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2862 /* Has the mouse moved off the glyph it was on at the last sighting? */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2863 if (event->x != last_mouse_x || event->y != last_mouse_y) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2864 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2865 frame->mouse_moved = 1; |
81127
d620b28641cd
(term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
81107
diff
changeset
|
2866 term_mouse_highlight (frame, event->x, event->y); |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2867 /* Remember which glyph we're now on. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2868 last_mouse_x = event->x; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2869 last_mouse_y = event->y; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2870 return 1; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2871 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2872 return 0; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2873 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2874 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2875 /* Return the current position of the mouse. |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2876 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2877 Set *f to the frame the mouse is in, or zero if the mouse is in no |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2878 Emacs frame. If it is set to zero, all the other arguments are |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2879 garbage. |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2880 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2881 Set *bar_window to Qnil, and *x and *y to the column and |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2882 row of the character cell the mouse is over. |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2883 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2884 Set *time to the time the mouse was at the returned position. |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2885 |
81127
d620b28641cd
(term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
81107
diff
changeset
|
2886 This clears mouse_moved until the next motion |
81102
a00e7c5f2faa
(mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
81083
diff
changeset
|
2887 event arrives. */ |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2888 static void |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2889 term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2890 enum scroll_bar_part *part, Lisp_Object *x, |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2891 Lisp_Object *y, unsigned long *time) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2892 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2893 struct timeval now; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2894 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2895 *fp = SELECTED_FRAME (); |
81102
a00e7c5f2faa
(mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
81083
diff
changeset
|
2896 (*fp)->mouse_moved = 0; |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2897 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2898 *bar_window = Qnil; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2899 *part = 0; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2900 |
81127
d620b28641cd
(term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
81107
diff
changeset
|
2901 XSETINT (*x, last_mouse_x); |
81102
a00e7c5f2faa
(mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
81083
diff
changeset
|
2902 XSETINT (*y, last_mouse_y); |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2903 gettimeofday(&now, 0); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2904 *time = (now.tv_sec * 1000) + (now.tv_usec / 1000); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2905 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2906 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2907 /* Prepare a mouse-event in *RESULT for placement in the input queue. |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2908 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2909 If the event is a button press, then note that we have grabbed |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2910 the mouse. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2911 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2912 static Lisp_Object |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2913 term_mouse_click (struct input_event *result, Gpm_Event *event, |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2914 struct frame *f) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2915 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2916 struct timeval now; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2917 int i, j; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2918 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2919 result->kind = GPM_CLICK_EVENT; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2920 for (i = 0, j = GPM_B_LEFT; i < 3; i++, j >>= 1 ) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2921 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2922 if (event->buttons & j) { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2923 result->code = i; /* button number */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2924 break; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2925 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2926 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2927 gettimeofday(&now, 0); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2928 result->timestamp = (now.tv_sec * 1000) + (now.tv_usec / 1000); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2929 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2930 if (event->type & GPM_UP) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2931 result->modifiers = up_modifier; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2932 else if (event->type & GPM_DOWN) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2933 result->modifiers = down_modifier; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2934 else |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2935 result->modifiers = 0; |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
2936 |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2937 if (event->type & GPM_SINGLE) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2938 result->modifiers |= click_modifier; |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
2939 |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2940 if (event->type & GPM_DOUBLE) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2941 result->modifiers |= double_modifier; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2942 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2943 if (event->type & GPM_TRIPLE) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2944 result->modifiers |= triple_modifier; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2945 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2946 if (event->type & GPM_DRAG) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2947 result->modifiers |= drag_modifier; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2948 |
81127
d620b28641cd
(term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
81107
diff
changeset
|
2949 if (!(event->type & (GPM_MOVE | GPM_DRAG))) { |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2950 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2951 /* 1 << KG_SHIFT */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2952 if (event->modifiers & (1 << 0)) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2953 result->modifiers |= shift_modifier; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2954 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2955 /* 1 << KG_CTRL */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2956 if (event->modifiers & (1 << 2)) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2957 result->modifiers |= ctrl_modifier; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2958 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2959 /* 1 << KG_ALT || KG_ALTGR */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2960 if (event->modifiers & (1 << 3) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2961 || event->modifiers & (1 << 1)) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2962 result->modifiers |= meta_modifier; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2963 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2964 |
81127
d620b28641cd
(term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
81107
diff
changeset
|
2965 XSETINT (result->x, event->x); |
d620b28641cd
(term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
81107
diff
changeset
|
2966 XSETINT (result->y, event->y); |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2967 XSETFRAME (result->frame_or_window, f); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2968 result->arg = Qnil; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2969 return Qnil; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2970 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2971 |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
2972 int |
83622 | 2973 handle_one_term_event (struct tty_display_info *tty, Gpm_Event *event, struct input_event* hold_quit) |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2974 { |
83622 | 2975 struct frame *f = XFRAME (tty->top_frame); |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2976 struct input_event ie; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2977 int do_help = 0; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2978 int count = 0; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2979 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2980 EVENT_INIT (ie); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2981 ie.kind = NO_EVENT; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2982 ie.arg = Qnil; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2983 |
81127
d620b28641cd
(term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
81107
diff
changeset
|
2984 if (event->type & (GPM_MOVE | GPM_DRAG)) { |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2985 previous_help_echo_string = help_echo_string; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2986 help_echo_string = Qnil; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2987 |
84968
85eb2660cbe3
(mouse_face_window): Rename from Qmouse_face_window. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84955
diff
changeset
|
2988 Gpm_DrawPointer (event->x, event->y, fileno (tty->output)); |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2989 |
81127
d620b28641cd
(term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
81107
diff
changeset
|
2990 if (!term_mouse_movement (f, event)) |
d620b28641cd
(term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
81107
diff
changeset
|
2991 help_echo_string = previous_help_echo_string; |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2992 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2993 /* If the contents of the global variable help_echo_string |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2994 has changed, generate a HELP_EVENT. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2995 if (!NILP (help_echo_string) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2996 || !NILP (previous_help_echo_string)) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2997 do_help = 1; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2998 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2999 goto done; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3000 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3001 else { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3002 f->mouse_moved = 0; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3003 term_mouse_click (&ie, event, f); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3004 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3005 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3006 done: |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3007 if (ie.kind != NO_EVENT) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3008 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3009 kbd_buffer_store_event_hold (&ie, hold_quit); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3010 count++; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3011 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3012 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3013 if (do_help |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3014 && !(hold_quit && hold_quit->kind != NO_EVENT)) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3015 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3016 Lisp_Object frame; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3017 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3018 if (f) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3019 XSETFRAME (frame, f); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3020 else |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3021 frame = Qnil; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3022 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3023 gen_help_event (help_echo_string, frame, help_echo_window, |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3024 help_echo_object, help_echo_pos); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3025 count++; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3026 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3027 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3028 return count; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3029 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3030 |
84968
85eb2660cbe3
(mouse_face_window): Rename from Qmouse_face_window. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84955
diff
changeset
|
3031 DEFUN ("gpm-mouse-start", Fgpm_mouse_start, Sgpm_mouse_start, |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3032 0, 0, 0, |
84768
53194ec05789
* termhooks.h (term_gpm): Delete. Use gpm_tty's NULLness instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84692
diff
changeset
|
3033 doc: /* Open a connection to Gpm. |
84968
85eb2660cbe3
(mouse_face_window): Rename from Qmouse_face_window. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84955
diff
changeset
|
3034 Gpm-mouse can only be activated for one tty at a time. */) |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3035 () |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3036 { |
84768
53194ec05789
* termhooks.h (term_gpm): Delete. Use gpm_tty's NULLness instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84692
diff
changeset
|
3037 struct frame *f = SELECTED_FRAME (); |
53194ec05789
* termhooks.h (term_gpm): Delete. Use gpm_tty's NULLness instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84692
diff
changeset
|
3038 struct tty_display_info *tty |
53194ec05789
* termhooks.h (term_gpm): Delete. Use gpm_tty's NULLness instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84692
diff
changeset
|
3039 = ((f)->output_method == output_termcap |
53194ec05789
* termhooks.h (term_gpm): Delete. Use gpm_tty's NULLness instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84692
diff
changeset
|
3040 ? (f)->terminal->display_info.tty : NULL); |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3041 Gpm_Connect connection; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3042 |
84969
6e58c1c8c0fc
(Fgpm_mouse_start): Don't signal an error if already activated on this tty.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84968
diff
changeset
|
3043 if (!tty) |
6e58c1c8c0fc
(Fgpm_mouse_start): Don't signal an error if already activated on this tty.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84968
diff
changeset
|
3044 error ("Gpm-mouse only works in the GNU/Linux console"); |
6e58c1c8c0fc
(Fgpm_mouse_start): Don't signal an error if already activated on this tty.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84968
diff
changeset
|
3045 if (gpm_tty == tty) |
6e58c1c8c0fc
(Fgpm_mouse_start): Don't signal an error if already activated on this tty.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84968
diff
changeset
|
3046 return Qnil; /* Already activated, nothing to do. */ |
84968
85eb2660cbe3
(mouse_face_window): Rename from Qmouse_face_window. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84955
diff
changeset
|
3047 if (gpm_tty) |
85eb2660cbe3
(mouse_face_window): Rename from Qmouse_face_window. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84955
diff
changeset
|
3048 error ("Gpm-mouse can only be activated for one tty at a time"); |
84768
53194ec05789
* termhooks.h (term_gpm): Delete. Use gpm_tty's NULLness instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84692
diff
changeset
|
3049 |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3050 connection.eventMask = ~0; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3051 connection.defaultMask = ~GPM_HARD; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3052 connection.maxMod = ~0; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3053 connection.minMod = 0; |
81127
d620b28641cd
(term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
81107
diff
changeset
|
3054 gpm_zerobased = 1; |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3055 |
84768
53194ec05789
* termhooks.h (term_gpm): Delete. Use gpm_tty's NULLness instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84692
diff
changeset
|
3056 if (Gpm_Open (&connection, 0) < 0) |
84968
85eb2660cbe3
(mouse_face_window): Rename from Qmouse_face_window. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84955
diff
changeset
|
3057 error ("Gpm-mouse failed to connect to the gpm daemon"); |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3058 else |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3059 { |
84768
53194ec05789
* termhooks.h (term_gpm): Delete. Use gpm_tty's NULLness instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84692
diff
changeset
|
3060 gpm_tty = tty; |
84955
dfbee4931a6a
(Fterm_open_connection): Add comment.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84849
diff
changeset
|
3061 /* `init_sys_modes' arranges for mouse movements sent through gpm_fd |
dfbee4931a6a
(Fterm_open_connection): Add comment.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84849
diff
changeset
|
3062 to generate SIGIOs. Apparently we need to call reset_sys_modes |
dfbee4931a6a
(Fterm_open_connection): Add comment.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84849
diff
changeset
|
3063 before calling init_sys_modes. */ |
83622 | 3064 reset_sys_modes (tty); |
3065 init_sys_modes (tty); | |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3066 add_gpm_wait_descriptor (gpm_fd); |
84968
85eb2660cbe3
(mouse_face_window): Rename from Qmouse_face_window. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84955
diff
changeset
|
3067 return Qnil; |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3068 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3069 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3070 |
84968
85eb2660cbe3
(mouse_face_window): Rename from Qmouse_face_window. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84955
diff
changeset
|
3071 DEFUN ("gpm-mouse-stop", Fgpm_mouse_stop, Sgpm_mouse_stop, |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3072 0, 0, 0, |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3073 doc: /* Close a connection to Gpm. */) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3074 () |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3075 { |
84969
6e58c1c8c0fc
(Fgpm_mouse_start): Don't signal an error if already activated on this tty.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84968
diff
changeset
|
3076 struct frame *f = SELECTED_FRAME (); |
6e58c1c8c0fc
(Fgpm_mouse_start): Don't signal an error if already activated on this tty.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84968
diff
changeset
|
3077 struct tty_display_info *tty |
6e58c1c8c0fc
(Fgpm_mouse_start): Don't signal an error if already activated on this tty.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84968
diff
changeset
|
3078 = ((f)->output_method == output_termcap |
6e58c1c8c0fc
(Fgpm_mouse_start): Don't signal an error if already activated on this tty.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84968
diff
changeset
|
3079 ? (f)->terminal->display_info.tty : NULL); |
6e58c1c8c0fc
(Fgpm_mouse_start): Don't signal an error if already activated on this tty.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84968
diff
changeset
|
3080 |
6e58c1c8c0fc
(Fgpm_mouse_start): Don't signal an error if already activated on this tty.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84968
diff
changeset
|
3081 if (!tty || gpm_tty != tty) |
6e58c1c8c0fc
(Fgpm_mouse_start): Don't signal an error if already activated on this tty.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84968
diff
changeset
|
3082 return Qnil; /* Not activated on this terminal, nothing to do. */ |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
3083 |
84968
85eb2660cbe3
(mouse_face_window): Rename from Qmouse_face_window. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84955
diff
changeset
|
3084 if (gpm_fd >= 0) |
85eb2660cbe3
(mouse_face_window): Rename from Qmouse_face_window. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84955
diff
changeset
|
3085 delete_gpm_wait_descriptor (gpm_fd); |
85eb2660cbe3
(mouse_face_window): Rename from Qmouse_face_window. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84955
diff
changeset
|
3086 while (Gpm_Close()); /* close all the stack */ |
85eb2660cbe3
(mouse_face_window): Rename from Qmouse_face_window. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84955
diff
changeset
|
3087 gpm_tty = NULL; |
85eb2660cbe3
(mouse_face_window): Rename from Qmouse_face_window. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84955
diff
changeset
|
3088 return Qnil; |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3089 } |
80994
62b6aa7f8c37
Use HAVE_GPM instead of HAVE_GPM_H.
Nick Roberts <nickrob@snap.net.nz>
parents:
80979
diff
changeset
|
3090 #endif /* HAVE_GPM */ |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3091 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3092 |
25002 | 3093 /*********************************************************************** |
3094 Initialization | |
3095 ***********************************************************************/ | |
3096 | |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3097 /* Initialize the tty-dependent part of frame F. The frame must |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3098 already have its device initialized. */ |
83025
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
3099 |
21514 | 3100 void |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3101 create_tty_output (struct frame *f) |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3102 { |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3103 struct tty_output *t; |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3104 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3105 if (! FRAME_TERMCAP_P (f)) |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3106 abort (); |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3107 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3108 t = xmalloc (sizeof (struct tty_output)); |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3109 bzero (t, sizeof (struct tty_output)); |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3110 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3111 t->display_info = FRAME_TERMINAL (f)->display_info.tty; |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3112 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3113 f->output_data.tty = t; |
53226
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
3114 } |
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
3115 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3116 /* Delete the tty-dependent part of frame F. */ |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3117 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3118 static void |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3119 delete_tty_output (struct frame *f) |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3120 { |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3121 if (! FRAME_TERMCAP_P (f)) |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3122 abort (); |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3123 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3124 xfree (f->output_data.tty); |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3125 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3126 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3127 |
84461
7ec30b352b6e
* xterm.c (x_create_terminal): Add comment.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
84359
diff
changeset
|
3128 /* Reset the hooks in TERMINAL. */ |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3129 |
83521
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3130 static void |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3131 clear_tty_hooks (struct terminal *terminal) |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3132 { |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3133 terminal->rif = 0; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3134 terminal->cursor_to_hook = 0; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3135 terminal->raw_cursor_to_hook = 0; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3136 terminal->clear_to_end_hook = 0; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3137 terminal->clear_frame_hook = 0; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3138 terminal->clear_end_of_line_hook = 0; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3139 terminal->ins_del_lines_hook = 0; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3140 terminal->insert_glyphs_hook = 0; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3141 terminal->write_glyphs_hook = 0; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3142 terminal->delete_glyphs_hook = 0; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3143 terminal->ring_bell_hook = 0; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3144 terminal->reset_terminal_modes_hook = 0; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3145 terminal->set_terminal_modes_hook = 0; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3146 terminal->update_begin_hook = 0; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3147 terminal->update_end_hook = 0; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3148 terminal->set_terminal_window_hook = 0; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3149 terminal->mouse_position_hook = 0; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3150 terminal->frame_rehighlight_hook = 0; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3151 terminal->frame_raise_lower_hook = 0; |
83548
c71725faff1a
Merged from emacs@sv.gnu.org. Last-minute emacsclient rewrites be damned!
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
3152 terminal->fullscreen_hook = 0; |
83521
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3153 terminal->set_vertical_scroll_bar_hook = 0; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3154 terminal->condemn_scroll_bars_hook = 0; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3155 terminal->redeem_scroll_bar_hook = 0; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3156 terminal->judge_scroll_bars_hook = 0; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3157 terminal->read_socket_hook = 0; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3158 terminal->frame_up_to_date_hook = 0; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3159 |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3160 /* Leave these two set, or suspended frames are not deleted |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3161 correctly. */ |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3162 terminal->delete_frame_hook = &delete_tty_output; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3163 terminal->delete_terminal_hook = &delete_tty; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3164 } |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3165 |
84461
7ec30b352b6e
* xterm.c (x_create_terminal): Add comment.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
84359
diff
changeset
|
3166 /* Initialize hooks in TERMINAL with the values needed for a tty. */ |
7ec30b352b6e
* xterm.c (x_create_terminal): Add comment.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
84359
diff
changeset
|
3167 |
83521
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3168 static void |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3169 set_tty_hooks (struct terminal *terminal) |
253 | 3170 { |
83521
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3171 terminal->rif = 0; /* ttys don't support window-based redisplay. */ |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3172 |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3173 terminal->cursor_to_hook = &tty_cursor_to; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3174 terminal->raw_cursor_to_hook = &tty_raw_cursor_to; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3175 |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3176 terminal->clear_to_end_hook = &tty_clear_to_end; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3177 terminal->clear_frame_hook = &tty_clear_frame; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3178 terminal->clear_end_of_line_hook = &tty_clear_end_of_line; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3179 |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3180 terminal->ins_del_lines_hook = &tty_ins_del_lines; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3181 |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3182 terminal->insert_glyphs_hook = &tty_insert_glyphs; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3183 terminal->write_glyphs_hook = &tty_write_glyphs; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3184 terminal->delete_glyphs_hook = &tty_delete_glyphs; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3185 |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3186 terminal->ring_bell_hook = &tty_ring_bell; |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
3187 |
83521
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3188 terminal->reset_terminal_modes_hook = &tty_reset_terminal_modes; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3189 terminal->set_terminal_modes_hook = &tty_set_terminal_modes; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3190 terminal->update_begin_hook = 0; /* Not needed. */ |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3191 terminal->update_end_hook = &tty_update_end; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3192 terminal->set_terminal_window_hook = &tty_set_terminal_window; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3193 |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3194 terminal->mouse_position_hook = 0; /* Not needed. */ |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3195 terminal->frame_rehighlight_hook = 0; /* Not needed. */ |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3196 terminal->frame_raise_lower_hook = 0; /* Not needed. */ |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3197 |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3198 terminal->set_vertical_scroll_bar_hook = 0; /* Not needed. */ |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3199 terminal->condemn_scroll_bars_hook = 0; /* Not needed. */ |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3200 terminal->redeem_scroll_bar_hook = 0; /* Not needed. */ |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3201 terminal->judge_scroll_bars_hook = 0; /* Not needed. */ |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3202 |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3203 terminal->read_socket_hook = &tty_read_avail_input; /* keyboard.c */ |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3204 terminal->frame_up_to_date_hook = 0; /* Not needed. */ |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
3205 |
83521
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3206 terminal->delete_frame_hook = &delete_tty_output; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3207 terminal->delete_terminal_hook = &delete_tty; |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3208 } |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3209 |
83086
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
3210 /* Drop the controlling terminal if fd is the same device. */ |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3211 static void |
83086
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
3212 dissociate_if_controlling_tty (int fd) |
253 | 3213 { |
83582
a6ca8e4443e4
(dissociate_if_controlling_tty) [WINDOWSNT]: Don't define function body.
Jason Rumney <jasonr@gnu.org>
parents:
83560
diff
changeset
|
3214 #ifndef WINDOWSNT |
83086
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
3215 int pgid; |
83154
ae72b7a6c292
Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents:
83147
diff
changeset
|
3216 EMACS_GET_TTY_PGRP (fd, &pgid); /* If tcgetpgrp succeeds, fd is the ctty. */ |
83086
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
3217 if (pgid != -1) |
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
3218 { |
83154
ae72b7a6c292
Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents:
83147
diff
changeset
|
3219 #if defined (USG) && !defined (BSD_PGRPS) |
83086
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
3220 setpgrp (); |
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
3221 no_controlling_tty = 1; |
84359
b651dc7c54ac
* term.c (dissociate_if_controlling_tty): Call setsid on CYGWIN.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83891
diff
changeset
|
3222 #elif defined (CYGWIN) |
b651dc7c54ac
* term.c (dissociate_if_controlling_tty): Call setsid on CYGWIN.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83891
diff
changeset
|
3223 setsid (); |
b651dc7c54ac
* term.c (dissociate_if_controlling_tty): Call setsid on CYGWIN.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83891
diff
changeset
|
3224 no_controlling_tty = 1; |
83086
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
3225 #else |
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
3226 #ifdef TIOCNOTTY /* Try BSD ioctls. */ |
83154
ae72b7a6c292
Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents:
83147
diff
changeset
|
3227 sigblock (sigmask (SIGTTOU)); |
84779
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
3228 fd = emacs_open (DEV_TTY, O_RDWR, 0); |
83154
ae72b7a6c292
Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents:
83147
diff
changeset
|
3229 if (fd != -1 && ioctl (fd, TIOCNOTTY, 0) != -1) |
ae72b7a6c292
Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents:
83147
diff
changeset
|
3230 { |
ae72b7a6c292
Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents:
83147
diff
changeset
|
3231 no_controlling_tty = 1; |
ae72b7a6c292
Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents:
83147
diff
changeset
|
3232 } |
ae72b7a6c292
Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents:
83147
diff
changeset
|
3233 if (fd != -1) |
ae72b7a6c292
Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents:
83147
diff
changeset
|
3234 emacs_close (fd); |
ae72b7a6c292
Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents:
83147
diff
changeset
|
3235 sigunblock (sigmask (SIGTTOU)); |
ae72b7a6c292
Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents:
83147
diff
changeset
|
3236 #else |
ae72b7a6c292
Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents:
83147
diff
changeset
|
3237 /* Unknown system. */ |
ae72b7a6c292
Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents:
83147
diff
changeset
|
3238 croak (); |
ae72b7a6c292
Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents:
83147
diff
changeset
|
3239 #endif /* ! TIOCNOTTY */ |
83158
f948c9fd910c
Fix parse error in term.c (ARISAWA Akihiro).
Karoly Lorentey <lorentey@elte.hu>
parents:
83154
diff
changeset
|
3240 #endif /* ! USG */ |
83086
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
3241 } |
84779
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
3242 #endif /* !WINDOWSNT */ |
83086
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
3243 } |
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
3244 |
83338
5f293f92f85e
Fix compilation error in src/term.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83332
diff
changeset
|
3245 static void maybe_fatal(); |
5f293f92f85e
Fix compilation error in src/term.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83332
diff
changeset
|
3246 |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3247 /* Create a termcap display on the tty device with the given name and |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3248 type. |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3249 |
83525
b2e7507b55c6
Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents:
83522
diff
changeset
|
3250 If NAME is NULL, then use the controlling tty, i.e., "/dev/tty". |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3251 Otherwise NAME should be a path to the tty device file, |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3252 e.g. "/dev/pts/7". |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3253 |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3254 TERMINAL_TYPE is the termcap type of the device, e.g. "vt100". |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3255 |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3256 If MUST_SUCCEED is true, then all errors are fatal. */ |
83025
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
3257 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3258 struct terminal * |
83341
76e51706154e
Rename term_init to init_tty.
Karoly Lorentey <lorentey@elte.hu>
parents:
83338
diff
changeset
|
3259 init_tty (char *name, char *terminal_type, int must_succeed) |
253 | 3260 { |
83498
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3261 char *area = NULL; |
253 | 3262 char **address = &area; |
52265
84e49afb2178
(term_init): Use a buffer of size 4096 for tgetent since
Richard M. Stallman <rms@gnu.org>
parents:
51212
diff
changeset
|
3263 char *buffer = NULL; |
52314
529dd59ee898
(term_init): Remove `const' from buffer_size's declaration.
Eli Zaretskii <eliz@gnu.org>
parents:
52294
diff
changeset
|
3264 int buffer_size = 4096; |
83498
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3265 register char *p = NULL; |
253 | 3266 int status; |
83498
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3267 struct tty_display_info *tty = NULL; |
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3268 struct terminal *terminal = NULL; |
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3269 int ctty = 0; /* 1 if asked to open controlling tty. */ |
83004
7900111db01c
Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
82995
diff
changeset
|
3270 |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3271 if (!terminal_type) |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3272 maybe_fatal (must_succeed, 0, 0, |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3273 "Unknown terminal type", |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3274 "Unknown terminal type"); |
83167
69ebc75cb461
Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83161
diff
changeset
|
3275 |
83525
b2e7507b55c6
Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents:
83522
diff
changeset
|
3276 if (name == NULL) |
84779
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
3277 name = DEV_TTY; |
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
3278 if (!strcmp (name, DEV_TTY)) |
83525
b2e7507b55c6
Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents:
83522
diff
changeset
|
3279 ctty = 1; |
b2e7507b55c6
Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents:
83522
diff
changeset
|
3280 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3281 /* If we already have a terminal on the given device, use that. If |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3282 all such terminals are suspended, create a new one instead. */ |
83341
76e51706154e
Rename term_init to init_tty.
Karoly Lorentey <lorentey@elte.hu>
parents:
83338
diff
changeset
|
3283 /* XXX Perhaps this should be made explicit by having init_tty |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3284 always create a new terminal and separating terminal and frame |
83167
69ebc75cb461
Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83161
diff
changeset
|
3285 creation on Lisp level. */ |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3286 terminal = get_named_tty (name); |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3287 if (terminal) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3288 return terminal; |
84779
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
3289 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3290 terminal = create_terminal (); |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3291 tty = (struct tty_display_info *) xmalloc (sizeof (struct tty_display_info)); |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3292 bzero (tty, sizeof (struct tty_display_info)); |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3293 tty->next = tty_list; |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3294 tty_list = tty; |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3295 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3296 terminal->type = output_termcap; |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3297 terminal->display_info.tty = tty; |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3298 tty->terminal = terminal; |
53226
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
3299 |
82991
2b26656ff804
MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82990
diff
changeset
|
3300 tty->Wcm = (struct cm *) xmalloc (sizeof (struct cm)); |
2b26656ff804
MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82990
diff
changeset
|
3301 Wcm_clear (tty); |
2b26656ff804
MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82990
diff
changeset
|
3302 |
83616
b78afd4acd43
* term.c (init_tty): Better initialize ttys in windows.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83582
diff
changeset
|
3303 #ifndef WINDOWSNT |
83521
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3304 set_tty_hooks (terminal); |
84779
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
3305 |
83498
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3306 { |
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3307 int fd; |
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3308 FILE *file; |
83032
b8237c556f0e
Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents:
83027
diff
changeset
|
3309 |
b8237c556f0e
Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents:
83027
diff
changeset
|
3310 #ifdef O_IGNORE_CTTY |
83498
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3311 if (!ctty) |
83032
b8237c556f0e
Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents:
83027
diff
changeset
|
3312 /* Open the terminal device. Don't recognize it as our |
b8237c556f0e
Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents:
83027
diff
changeset
|
3313 controlling terminal, and don't make it the controlling tty |
b8237c556f0e
Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents:
83027
diff
changeset
|
3314 if we don't have one at the moment. */ |
b8237c556f0e
Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents:
83027
diff
changeset
|
3315 fd = emacs_open (name, O_RDWR | O_IGNORE_CTTY | O_NOCTTY, 0); |
83498
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3316 else |
83032
b8237c556f0e
Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents:
83027
diff
changeset
|
3317 #else |
83074
34a7a8f40548
Fix background-mode on terminal frames (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83065
diff
changeset
|
3318 /* Alas, O_IGNORE_CTTY is a GNU extension that seems to be only |
83498
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3319 defined on Hurd. On other systems, we need to explicitly |
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3320 dissociate ourselves from the controlling tty when we want to |
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3321 open a frame on the same terminal. */ |
83032
b8237c556f0e
Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents:
83027
diff
changeset
|
3322 fd = emacs_open (name, O_RDWR | O_NOCTTY, 0); |
b8237c556f0e
Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents:
83027
diff
changeset
|
3323 #endif /* O_IGNORE_CTTY */ |
b8237c556f0e
Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents:
83027
diff
changeset
|
3324 |
83498
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3325 if (fd < 0) |
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3326 maybe_fatal (must_succeed, buffer, terminal, |
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3327 "Could not open file: %s", |
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3328 "Could not open file: %s", |
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3329 name); |
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3330 if (!isatty (fd)) |
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3331 { |
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3332 close (fd); |
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3333 maybe_fatal (must_succeed, buffer, terminal, |
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3334 "Not a tty device: %s", |
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3335 "Not a tty device: %s", |
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3336 name); |
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3337 } |
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3338 |
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3339 #ifndef O_IGNORE_CTTY |
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3340 if (!ctty) |
83086
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
3341 dissociate_if_controlling_tty (fd); |
83498
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3342 #endif |
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3343 |
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3344 file = fdopen (fd, "w+"); |
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3345 tty->name = xstrdup (name); |
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3346 terminal->name = xstrdup (name); |
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3347 tty->input = file; |
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3348 tty->output = file; |
f0987e2f27e2
Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents:
83468
diff
changeset
|
3349 } |
84779
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
3350 |
82989
f3845715a5f6
Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
82988
diff
changeset
|
3351 tty->type = xstrdup (terminal_type); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3352 |
82988
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
3353 add_keyboard_wait_descriptor (fileno (tty->input)); |
253 | 3354 |
83616
b78afd4acd43
* term.c (init_tty): Better initialize ttys in windows.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83582
diff
changeset
|
3355 #endif |
253 | 3356 |
90059
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
3357 encode_terminal_src_size = 0; |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
3358 encode_terminal_dst_size = 0; |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
3359 |
80994
62b6aa7f8c37
Use HAVE_GPM instead of HAVE_GPM_H.
Nick Roberts <nickrob@snap.net.nz>
parents:
80979
diff
changeset
|
3360 #ifdef HAVE_GPM |
83630
28201311b297
* term.c (init_tty): Use terminal specific mouse_position_hook.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83629
diff
changeset
|
3361 terminal->mouse_position_hook = term_mouse_position; |
84968
85eb2660cbe3
(mouse_face_window): Rename from Qmouse_face_window. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84955
diff
changeset
|
3362 mouse_face_window = Qnil; |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3363 #endif |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3364 |
9797
05d9072c5a38
(term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents:
9658
diff
changeset
|
3365 #ifdef WINDOWSNT |
83883
cbc88cef4fca
(init_tty) [WINDOWSNT]: Pass terminal to
Jason Rumney <jasonr@gnu.org>
parents:
83875
diff
changeset
|
3366 initialize_w32_display (terminal); |
83889
2855c55ba18b
(init_tty) [WINDOWSNT]: Add hooks that are not accessible
Jason Rumney <jasonr@gnu.org>
parents:
83883
diff
changeset
|
3367 /* The following two are inaccessible from w32console.c. */ |
2855c55ba18b
(init_tty) [WINDOWSNT]: Add hooks that are not accessible
Jason Rumney <jasonr@gnu.org>
parents:
83883
diff
changeset
|
3368 terminal->delete_frame_hook = &delete_tty_output; |
2855c55ba18b
(init_tty) [WINDOWSNT]: Add hooks that are not accessible
Jason Rumney <jasonr@gnu.org>
parents:
83883
diff
changeset
|
3369 terminal->delete_terminal_hook = &delete_tty; |
9797
05d9072c5a38
(term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents:
9658
diff
changeset
|
3370 |
84779
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
3371 tty->name = xstrdup (name); |
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
3372 terminal->name = xstrdup (name); |
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
3373 tty->type = xstrdup (terminal_type); |
83616
b78afd4acd43
* term.c (init_tty): Better initialize ttys in windows.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83582
diff
changeset
|
3374 |
b78afd4acd43
* term.c (init_tty): Better initialize ttys in windows.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83582
diff
changeset
|
3375 tty->output = stdout; |
83889
2855c55ba18b
(init_tty) [WINDOWSNT]: Add hooks that are not accessible
Jason Rumney <jasonr@gnu.org>
parents:
83883
diff
changeset
|
3376 tty->input = stdin; |
2855c55ba18b
(init_tty) [WINDOWSNT]: Add hooks that are not accessible
Jason Rumney <jasonr@gnu.org>
parents:
83883
diff
changeset
|
3377 add_keyboard_wait_descriptor (0); |
2855c55ba18b
(init_tty) [WINDOWSNT]: Add hooks that are not accessible
Jason Rumney <jasonr@gnu.org>
parents:
83883
diff
changeset
|
3378 |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3379 Wcm_clear (tty); |
9797
05d9072c5a38
(term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents:
9658
diff
changeset
|
3380 |
83582
a6ca8e4443e4
(dissociate_if_controlling_tty) [WINDOWSNT]: Don't define function body.
Jason Rumney <jasonr@gnu.org>
parents:
83560
diff
changeset
|
3381 { |
a6ca8e4443e4
(dissociate_if_controlling_tty) [WINDOWSNT]: Don't define function body.
Jason Rumney <jasonr@gnu.org>
parents:
83560
diff
changeset
|
3382 struct frame *f = XFRAME (selected_frame); |
a6ca8e4443e4
(dissociate_if_controlling_tty) [WINDOWSNT]: Don't define function body.
Jason Rumney <jasonr@gnu.org>
parents:
83560
diff
changeset
|
3383 |
83889
2855c55ba18b
(init_tty) [WINDOWSNT]: Add hooks that are not accessible
Jason Rumney <jasonr@gnu.org>
parents:
83883
diff
changeset
|
3384 FrameRows (tty) = FRAME_LINES (f); |
2855c55ba18b
(init_tty) [WINDOWSNT]: Add hooks that are not accessible
Jason Rumney <jasonr@gnu.org>
parents:
83883
diff
changeset
|
3385 FrameCols (tty) = FRAME_COLS (f); |
2855c55ba18b
(init_tty) [WINDOWSNT]: Add hooks that are not accessible
Jason Rumney <jasonr@gnu.org>
parents:
83883
diff
changeset
|
3386 tty->specified_window = FRAME_LINES (f); |
2855c55ba18b
(init_tty) [WINDOWSNT]: Add hooks that are not accessible
Jason Rumney <jasonr@gnu.org>
parents:
83883
diff
changeset
|
3387 |
2855c55ba18b
(init_tty) [WINDOWSNT]: Add hooks that are not accessible
Jason Rumney <jasonr@gnu.org>
parents:
83883
diff
changeset
|
3388 FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; |
2855c55ba18b
(init_tty) [WINDOWSNT]: Add hooks that are not accessible
Jason Rumney <jasonr@gnu.org>
parents:
83883
diff
changeset
|
3389 FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; |
83582
a6ca8e4443e4
(dissociate_if_controlling_tty) [WINDOWSNT]: Don't define function body.
Jason Rumney <jasonr@gnu.org>
parents:
83560
diff
changeset
|
3390 } |
a6ca8e4443e4
(dissociate_if_controlling_tty) [WINDOWSNT]: Don't define function body.
Jason Rumney <jasonr@gnu.org>
parents:
83560
diff
changeset
|
3391 tty->delete_in_insert_mode = 1; |
82990
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
3392 |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
3393 UseTabs (tty) = 0; |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3394 terminal->scroll_region_ok = 0; |
83342
9216636c02fc
Rename `struct display' to `struct device'. Update function, parameter and variable names accordingly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83341
diff
changeset
|
3395 |
9216636c02fc
Rename `struct display' to `struct device'. Update function, parameter and variable names accordingly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83341
diff
changeset
|
3396 /* Seems to insert lines when it's not supposed to, messing up the |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3397 display. In doing a trace, it didn't seem to be called much, so I |
83342
9216636c02fc
Rename `struct display' to `struct device'. Update function, parameter and variable names accordingly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83341
diff
changeset
|
3398 don't think we're losing anything by turning it off. */ |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3399 terminal->line_ins_del_ok = 0; |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3400 terminal->char_ins_del_ok = 1; |
9797
05d9072c5a38
(term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents:
9658
diff
changeset
|
3401 |
05d9072c5a38
(term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents:
9658
diff
changeset
|
3402 baud_rate = 19200; |
05d9072c5a38
(term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents:
9658
diff
changeset
|
3403 |
83582
a6ca8e4443e4
(dissociate_if_controlling_tty) [WINDOWSNT]: Don't define function body.
Jason Rumney <jasonr@gnu.org>
parents:
83560
diff
changeset
|
3404 tty->TN_max_colors = 16; /* Required to be non-zero for tty-display-color-p */ |
9797
05d9072c5a38
(term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents:
9658
diff
changeset
|
3405 |
21827
87c7f4bd99da
Include cm.h after dispextern.h to avoid name conflicts
Geoff Voelker <voelker@cs.washington.edu>
parents:
21624
diff
changeset
|
3406 #else /* not WINDOWSNT */ |
9797
05d9072c5a38
(term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents:
9658
diff
changeset
|
3407 |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3408 Wcm_clear (tty); |
253 | 3409 |
52265
84e49afb2178
(term_init): Use a buffer of size 4096 for tgetent since
Richard M. Stallman <rms@gnu.org>
parents:
51212
diff
changeset
|
3410 buffer = (char *) xmalloc (buffer_size); |
84779
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
3411 |
83086
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
3412 /* On some systems, tgetent tries to access the controlling |
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
3413 terminal. */ |
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
3414 sigblock (sigmask (SIGTTOU)); |
253 | 3415 status = tgetent (buffer, terminal_type); |
83086
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
3416 sigunblock (sigmask (SIGTTOU)); |
84779
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
3417 |
253 | 3418 if (status < 0) |
10824
894369e950f5
(term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents:
10771
diff
changeset
|
3419 { |
894369e950f5
(term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents:
10771
diff
changeset
|
3420 #ifdef TERMINFO |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3421 maybe_fatal (must_succeed, buffer, terminal, |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3422 "Cannot open terminfo database file", |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3423 "Cannot open terminfo database file"); |
10824
894369e950f5
(term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents:
10771
diff
changeset
|
3424 #else |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3425 maybe_fatal (must_succeed, buffer, terminal, |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3426 "Cannot open termcap database file", |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3427 "Cannot open termcap database file"); |
10824
894369e950f5
(term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents:
10771
diff
changeset
|
3428 #endif |
894369e950f5
(term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents:
10771
diff
changeset
|
3429 } |
253 | 3430 if (status == 0) |
10824
894369e950f5
(term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents:
10771
diff
changeset
|
3431 { |
894369e950f5
(term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents:
10771
diff
changeset
|
3432 #ifdef TERMINFO |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3433 maybe_fatal (must_succeed, buffer, terminal, |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3434 "Terminal type %s is not defined", |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3435 "Terminal type %s is not defined.\n\ |
10824
894369e950f5
(term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents:
10771
diff
changeset
|
3436 If that is not the actual type of terminal you have,\n\ |
894369e950f5
(term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents:
10771
diff
changeset
|
3437 use the Bourne shell command `TERM=... export TERM' (C-shell:\n\ |
894369e950f5
(term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents:
10771
diff
changeset
|
3438 `setenv TERM ...') to specify the correct type. It may be necessary\n\ |
16894
cd8d6bf6b320
(fatal): Print a newline at the end.
Richard M. Stallman <rms@gnu.org>
parents:
16885
diff
changeset
|
3439 to do `unset TERMINFO' (C-shell: `unsetenv TERMINFO') as well.", |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3440 terminal_type); |
10824
894369e950f5
(term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents:
10771
diff
changeset
|
3441 #else |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3442 maybe_fatal (must_succeed, buffer, terminal, |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3443 "Terminal type %s is not defined", |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3444 "Terminal type %s is not defined.\n\ |
4499
c7bfd863aefd
(term_init): Improve error messages (give sh commands).
Richard M. Stallman <rms@gnu.org>
parents:
3706
diff
changeset
|
3445 If that is not the actual type of terminal you have,\n\ |
c7bfd863aefd
(term_init): Improve error messages (give sh commands).
Richard M. Stallman <rms@gnu.org>
parents:
3706
diff
changeset
|
3446 use the Bourne shell command `TERM=... export TERM' (C-shell:\n\ |
c7bfd863aefd
(term_init): Improve error messages (give sh commands).
Richard M. Stallman <rms@gnu.org>
parents:
3706
diff
changeset
|
3447 `setenv TERM ...') to specify the correct type. It may be necessary\n\ |
16894
cd8d6bf6b320
(fatal): Print a newline at the end.
Richard M. Stallman <rms@gnu.org>
parents:
16885
diff
changeset
|
3448 to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3449 terminal_type); |
10824
894369e950f5
(term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents:
10771
diff
changeset
|
3450 #endif |
894369e950f5
(term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents:
10771
diff
changeset
|
3451 } |
52265
84e49afb2178
(term_init): Use a buffer of size 4096 for tgetent since
Richard M. Stallman <rms@gnu.org>
parents:
51212
diff
changeset
|
3452 |
52294
d9ae4cdf1ed1
(term_init): Fix previous change
Kenichi Handa <handa@m17n.org>
parents:
52293
diff
changeset
|
3453 #ifndef TERMINFO |
52265
84e49afb2178
(term_init): Use a buffer of size 4096 for tgetent since
Richard M. Stallman <rms@gnu.org>
parents:
51212
diff
changeset
|
3454 if (strlen (buffer) >= buffer_size) |
84e49afb2178
(term_init): Use a buffer of size 4096 for tgetent since
Richard M. Stallman <rms@gnu.org>
parents:
51212
diff
changeset
|
3455 abort (); |
52294
d9ae4cdf1ed1
(term_init): Fix previous change
Kenichi Handa <handa@m17n.org>
parents:
52293
diff
changeset
|
3456 buffer_size = strlen (buffer); |
52293
473d34d4814c
(term_init): Fix previous change; don't rely on the
Kenichi Handa <handa@m17n.org>
parents:
52265
diff
changeset
|
3457 #endif |
52294
d9ae4cdf1ed1
(term_init): Fix previous change
Kenichi Handa <handa@m17n.org>
parents:
52293
diff
changeset
|
3458 area = (char *) xmalloc (buffer_size); |
253 | 3459 |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3460 tty->TS_ins_line = tgetstr ("al", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3461 tty->TS_ins_multi_lines = tgetstr ("AL", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3462 tty->TS_bell = tgetstr ("bl", address); |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3463 BackTab (tty) = tgetstr ("bt", address); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3464 tty->TS_clr_to_bottom = tgetstr ("cd", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3465 tty->TS_clr_line = tgetstr ("ce", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3466 tty->TS_clr_frame = tgetstr ("cl", address); |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3467 ColPosition (tty) = NULL; /* tgetstr ("ch", address); */ |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3468 AbsPosition (tty) = tgetstr ("cm", address); |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3469 CR (tty) = tgetstr ("cr", address); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3470 tty->TS_set_scroll_region = tgetstr ("cs", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3471 tty->TS_set_scroll_region_1 = tgetstr ("cS", address); |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3472 RowPosition (tty) = tgetstr ("cv", address); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3473 tty->TS_del_char = tgetstr ("dc", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3474 tty->TS_del_multi_chars = tgetstr ("DC", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3475 tty->TS_del_line = tgetstr ("dl", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3476 tty->TS_del_multi_lines = tgetstr ("DL", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3477 tty->TS_delete_mode = tgetstr ("dm", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3478 tty->TS_end_delete_mode = tgetstr ("ed", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3479 tty->TS_end_insert_mode = tgetstr ("ei", address); |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3480 Home (tty) = tgetstr ("ho", address); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3481 tty->TS_ins_char = tgetstr ("ic", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3482 tty->TS_ins_multi_chars = tgetstr ("IC", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3483 tty->TS_insert_mode = tgetstr ("im", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3484 tty->TS_pad_inserted_char = tgetstr ("ip", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3485 tty->TS_end_keypad_mode = tgetstr ("ke", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3486 tty->TS_keypad_mode = tgetstr ("ks", address); |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3487 LastLine (tty) = tgetstr ("ll", address); |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3488 Right (tty) = tgetstr ("nd", address); |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3489 Down (tty) = tgetstr ("do", address); |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3490 if (!Down (tty)) |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3491 Down (tty) = tgetstr ("nl", address); /* Obsolete name for "do" */ |
253 | 3492 if (tgetflag ("bs")) |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3493 Left (tty) = "\b"; /* can't possibly be longer! */ |
253 | 3494 else /* (Actually, "bs" is obsolete...) */ |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3495 Left (tty) = tgetstr ("le", address); |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3496 if (!Left (tty)) |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3497 Left (tty) = tgetstr ("bc", address); /* Obsolete name for "le" */ |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3498 tty->TS_pad_char = tgetstr ("pc", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3499 tty->TS_repeat = tgetstr ("rp", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3500 tty->TS_end_standout_mode = tgetstr ("se", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3501 tty->TS_fwd_scroll = tgetstr ("sf", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3502 tty->TS_standout_mode = tgetstr ("so", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3503 tty->TS_rev_scroll = tgetstr ("sr", address); |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3504 tty->Wcm->cm_tab = tgetstr ("ta", address); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3505 tty->TS_end_termcap_modes = tgetstr ("te", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3506 tty->TS_termcap_modes = tgetstr ("ti", address); |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3507 Up (tty) = tgetstr ("up", address); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3508 tty->TS_visible_bell = tgetstr ("vb", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3509 tty->TS_cursor_normal = tgetstr ("ve", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3510 tty->TS_cursor_visible = tgetstr ("vs", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3511 tty->TS_cursor_invisible = tgetstr ("vi", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3512 tty->TS_set_window = tgetstr ("wi", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3513 |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3514 tty->TS_enter_underline_mode = tgetstr ("us", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3515 tty->TS_exit_underline_mode = tgetstr ("ue", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3516 tty->TS_enter_bold_mode = tgetstr ("md", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3517 tty->TS_enter_dim_mode = tgetstr ("mh", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3518 tty->TS_enter_blink_mode = tgetstr ("mb", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3519 tty->TS_enter_reverse_mode = tgetstr ("mr", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3520 tty->TS_enter_alt_charset_mode = tgetstr ("as", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3521 tty->TS_exit_alt_charset_mode = tgetstr ("ae", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3522 tty->TS_exit_attribute_mode = tgetstr ("me", address); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
3523 |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3524 MultiUp (tty) = tgetstr ("UP", address); |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3525 MultiDown (tty) = tgetstr ("DO", address); |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3526 MultiLeft (tty) = tgetstr ("LE", address); |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3527 MultiRight (tty) = tgetstr ("RI", address); |
253 | 3528 |
26425
08c26156186a
(term_init): If "op" isn't available, don't support color
Gerd Moellmann <gerd@gnu.org>
parents:
25727
diff
changeset
|
3529 /* SVr4/ANSI color suppert. If "op" isn't available, don't support |
08c26156186a
(term_init): If "op" isn't available, don't support color
Gerd Moellmann <gerd@gnu.org>
parents:
25727
diff
changeset
|
3530 color because we can't switch back to the default foreground and |
08c26156186a
(term_init): If "op" isn't available, don't support color
Gerd Moellmann <gerd@gnu.org>
parents:
25727
diff
changeset
|
3531 background. */ |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3532 tty->TS_orig_pair = tgetstr ("op", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3533 if (tty->TS_orig_pair) |
25002 | 3534 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3535 tty->TS_set_foreground = tgetstr ("AF", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3536 tty->TS_set_background = tgetstr ("AB", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3537 if (!tty->TS_set_foreground) |
26425
08c26156186a
(term_init): If "op" isn't available, don't support color
Gerd Moellmann <gerd@gnu.org>
parents:
25727
diff
changeset
|
3538 { |
08c26156186a
(term_init): If "op" isn't available, don't support color
Gerd Moellmann <gerd@gnu.org>
parents:
25727
diff
changeset
|
3539 /* SVr4. */ |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3540 tty->TS_set_foreground = tgetstr ("Sf", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3541 tty->TS_set_background = tgetstr ("Sb", address); |
26425
08c26156186a
(term_init): If "op" isn't available, don't support color
Gerd Moellmann <gerd@gnu.org>
parents:
25727
diff
changeset
|
3542 } |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
3543 |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3544 tty->TN_max_colors = tgetnum ("Co"); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3545 tty->TN_max_pairs = tgetnum ("pa"); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3546 |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3547 tty->TN_no_color_video = tgetnum ("NC"); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3548 if (tty->TN_no_color_video == -1) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3549 tty->TN_no_color_video = 0; |
25002 | 3550 } |
3551 | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3552 tty_default_color_capabilities (tty, 1); |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
3553 |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3554 MagicWrap (tty) = tgetflag ("xn"); |
11530
a265aaa699e0
(term_init): MagicWrap implies AutoWrap.
Karl Heuer <kwzh@gnu.org>
parents:
11235
diff
changeset
|
3555 /* Since we make MagicWrap terminals look like AutoWrap, we need to have |
a265aaa699e0
(term_init): MagicWrap implies AutoWrap.
Karl Heuer <kwzh@gnu.org>
parents:
11235
diff
changeset
|
3556 the former flag imply the latter. */ |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3557 AutoWrap (tty) = MagicWrap (tty) || tgetflag ("am"); |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3558 terminal->memory_below_frame = tgetflag ("db"); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3559 tty->TF_hazeltine = tgetflag ("hz"); |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3560 terminal->must_write_spaces = tgetflag ("in"); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3561 tty->meta_key = tgetflag ("km") || tgetflag ("MT"); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3562 tty->TF_insmode_motion = tgetflag ("mi"); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3563 tty->TF_standout_motion = tgetflag ("ms"); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3564 tty->TF_underscore = tgetflag ("ul"); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3565 tty->TF_teleray = tgetflag ("xt"); |
253 | 3566 |
83883
cbc88cef4fca
(init_tty) [WINDOWSNT]: Pass terminal to
Jason Rumney <jasonr@gnu.org>
parents:
83875
diff
changeset
|
3567 #endif /* !WINDOWSNT */ |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3568 terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3569 init_kboard (terminal->kboard); |
85614
9f3a25157e4f
Make `window-system' into a keyboard-local variable (rather than
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85106
diff
changeset
|
3570 terminal->kboard->Vwindow_system = Qnil; |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3571 terminal->kboard->next_kboard = all_kboards; |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3572 all_kboards = terminal->kboard; |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3573 terminal->kboard->reference_count++; |
83317
e235da12dd03
Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents:
83315
diff
changeset
|
3574 /* Don't let the initial kboard remain current longer than necessary. |
e235da12dd03
Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents:
83315
diff
changeset
|
3575 That would cause problems if a file loaded on startup tries to |
e235da12dd03
Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents:
83315
diff
changeset
|
3576 prompt in the mini-buffer. */ |
e235da12dd03
Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents:
83315
diff
changeset
|
3577 if (current_kboard == initial_kboard) |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3578 current_kboard = terminal->kboard; |
83883
cbc88cef4fca
(init_tty) [WINDOWSNT]: Pass terminal to
Jason Rumney <jasonr@gnu.org>
parents:
83875
diff
changeset
|
3579 #ifndef WINDOWSNT |
83619
5da6a46ddbd6
* s/darwin.h (SYSTEM_PURESIZE_EXTRA): Define here.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83616
diff
changeset
|
3580 term_get_fkeys (address, terminal->kboard); |
97141
840bd675fd85
* s/ms-w32.h (MULTI_KBOARD): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97043
diff
changeset
|
3581 |
765 | 3582 /* Get frame size from system, or else from termcap. */ |
16093
4c74d7f1cfa6
(term_init): Avoid type-mismatch calling get_frame_size.
Richard M. Stallman <rms@gnu.org>
parents:
15974
diff
changeset
|
3583 { |
4c74d7f1cfa6
(term_init): Avoid type-mismatch calling get_frame_size.
Richard M. Stallman <rms@gnu.org>
parents:
15974
diff
changeset
|
3584 int height, width; |
83065
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
3585 get_tty_size (fileno (tty->input), &width, &height); |
53341 | 3586 FrameCols (tty) = width; |
3587 FrameRows (tty) = height; | |
16093
4c74d7f1cfa6
(term_init): Avoid type-mismatch calling get_frame_size.
Richard M. Stallman <rms@gnu.org>
parents:
15974
diff
changeset
|
3588 } |
4c74d7f1cfa6
(term_init): Avoid type-mismatch calling get_frame_size.
Richard M. Stallman <rms@gnu.org>
parents:
15974
diff
changeset
|
3589 |
53341 | 3590 if (FrameCols (tty) <= 0) |
3591 FrameCols (tty) = tgetnum ("co"); | |
3592 if (FrameRows (tty) <= 0) | |
3593 FrameRows (tty) = tgetnum ("li"); | |
3594 | |
3595 if (FrameRows (tty) < 3 || FrameCols (tty) < 3) | |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3596 maybe_fatal (must_succeed, NULL, terminal, |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3597 "Screen size %dx%d is too small" |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3598 "Screen size %dx%d is too small", |
53341 | 3599 FrameCols (tty), FrameRows (tty)); |
10332
e14daed4a820
(term_init): Fatal error if screen is too small.
Richard M. Stallman <rms@gnu.org>
parents:
10261
diff
changeset
|
3600 |
53225
4250e7e26247
Add a level of indirection to terminal characteristics.
Karoly Lorentey <lorentey@elte.hu>
parents:
52681
diff
changeset
|
3601 #if 0 /* This is not used anywhere. */ |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3602 tty->terminal->min_padding_speed = tgetnum ("pb"); |
53225
4250e7e26247
Add a level of indirection to terminal characteristics.
Karoly Lorentey <lorentey@elte.hu>
parents:
52681
diff
changeset
|
3603 #endif |
53226
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
3604 |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3605 TabWidth (tty) = tgetnum ("tw"); |
253 | 3606 |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3607 if (!tty->TS_bell) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3608 tty->TS_bell = "\07"; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3609 |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3610 if (!tty->TS_fwd_scroll) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3611 tty->TS_fwd_scroll = Down (tty); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3612 |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3613 PC = tty->TS_pad_char ? *tty->TS_pad_char : 0; |
253 | 3614 |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3615 if (TabWidth (tty) < 0) |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3616 TabWidth (tty) = 8; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
3617 |
253 | 3618 /* Turned off since /etc/termcap seems to have :ta= for most terminals |
3619 and newer termcap doc does not seem to say there is a default. | |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3620 if (!tty->Wcm->cm_tab) |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3621 tty->Wcm->cm_tab = "\t"; |
253 | 3622 */ |
3623 | |
40086
050b19294988
(TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents:
40081
diff
changeset
|
3624 /* We don't support standout modes that use `magic cookies', so |
050b19294988
(TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents:
40081
diff
changeset
|
3625 turn off any that do. */ |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3626 if (tty->TS_standout_mode && tgetnum ("sg") >= 0) |
40086
050b19294988
(TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents:
40081
diff
changeset
|
3627 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3628 tty->TS_standout_mode = 0; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3629 tty->TS_end_standout_mode = 0; |
40086
050b19294988
(TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents:
40081
diff
changeset
|
3630 } |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3631 if (tty->TS_enter_underline_mode && tgetnum ("ug") >= 0) |
40086
050b19294988
(TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents:
40081
diff
changeset
|
3632 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3633 tty->TS_enter_underline_mode = 0; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3634 tty->TS_exit_underline_mode = 0; |
40086
050b19294988
(TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents:
40081
diff
changeset
|
3635 } |
050b19294988
(TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents:
40081
diff
changeset
|
3636 |
050b19294988
(TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents:
40081
diff
changeset
|
3637 /* If there's no standout mode, try to use underlining instead. */ |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3638 if (tty->TS_standout_mode == 0) |
253 | 3639 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3640 tty->TS_standout_mode = tty->TS_enter_underline_mode; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3641 tty->TS_end_standout_mode = tty->TS_exit_underline_mode; |
253 | 3642 } |
3643 | |
5933
560cee2048ed
(term_init): If no `se', use `me';
Richard M. Stallman <rms@gnu.org>
parents:
5648
diff
changeset
|
3644 /* If no `se' string, try using a `me' string instead. |
560cee2048ed
(term_init): If no `se', use `me';
Richard M. Stallman <rms@gnu.org>
parents:
5648
diff
changeset
|
3645 If that fails, we can't use standout mode at all. */ |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3646 if (tty->TS_end_standout_mode == 0) |
5933
560cee2048ed
(term_init): If no `se', use `me';
Richard M. Stallman <rms@gnu.org>
parents:
5648
diff
changeset
|
3647 { |
8612
86065bec6fc9
(term_init): Added missing argument to tgetstr.
Richard M. Stallman <rms@gnu.org>
parents:
8027
diff
changeset
|
3648 char *s = tgetstr ("me", address); |
5933
560cee2048ed
(term_init): If no `se', use `me';
Richard M. Stallman <rms@gnu.org>
parents:
5648
diff
changeset
|
3649 if (s != 0) |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3650 tty->TS_end_standout_mode = s; |
5933
560cee2048ed
(term_init): If no `se', use `me';
Richard M. Stallman <rms@gnu.org>
parents:
5648
diff
changeset
|
3651 else |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3652 tty->TS_standout_mode = 0; |
5933
560cee2048ed
(term_init): If no `se', use `me';
Richard M. Stallman <rms@gnu.org>
parents:
5648
diff
changeset
|
3653 } |
560cee2048ed
(term_init): If no `se', use `me';
Richard M. Stallman <rms@gnu.org>
parents:
5648
diff
changeset
|
3654 |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3655 if (tty->TF_teleray) |
253 | 3656 { |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3657 tty->Wcm->cm_tab = 0; |
40086
050b19294988
(TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents:
40081
diff
changeset
|
3658 /* We can't support standout mode, because it uses magic cookies. */ |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3659 tty->TS_standout_mode = 0; |
253 | 3660 /* But that means we cannot rely on ^M to go to column zero! */ |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3661 CR (tty) = 0; |
253 | 3662 /* LF can't be trusted either -- can alter hpos */ |
3663 /* if move at column 0 thru a line with TS_standout_mode */ | |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3664 Down (tty) = 0; |
253 | 3665 } |
3666 | |
3667 /* Special handling for certain terminal types known to need it */ | |
3668 | |
3669 if (!strcmp (terminal_type, "supdup")) | |
3670 { | |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3671 terminal->memory_below_frame = 1; |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3672 tty->Wcm->cm_losewrap = 1; |
253 | 3673 } |
3674 if (!strncmp (terminal_type, "c10", 3) | |
3675 || !strcmp (terminal_type, "perq")) | |
3676 { | |
3677 /* Supply a makeshift :wi string. | |
3678 This string is not valid in general since it works only | |
3679 for windows starting at the upper left corner; | |
3680 but that is all Emacs uses. | |
3681 | |
765 | 3682 This string works only if the frame is using |
253 | 3683 the top of the video memory, because addressing is memory-relative. |
3684 So first check the :ti string to see if that is true. | |
3685 | |
3686 It would be simpler if the :wi string could go in the termcap | |
3687 entry, but it can't because it is not fully valid. | |
3688 If it were in the termcap entry, it would confuse other programs. */ | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3689 if (!tty->TS_set_window) |
253 | 3690 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3691 p = tty->TS_termcap_modes; |
253 | 3692 while (*p && strcmp (p, "\033v ")) |
3693 p++; | |
3694 if (*p) | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3695 tty->TS_set_window = "\033v%C %C %C %C "; |
253 | 3696 } |
3697 /* Termcap entry often fails to have :in: flag */ | |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3698 terminal->must_write_spaces = 1; |
253 | 3699 /* :ti string typically fails to have \E^G! in it */ |
3700 /* This limits scope of insert-char to one line. */ | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3701 strcpy (area, tty->TS_termcap_modes); |
253 | 3702 strcat (area, "\033\007!"); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3703 tty->TS_termcap_modes = area; |
253 | 3704 area += strlen (area) + 1; |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3705 p = AbsPosition (tty); |
253 | 3706 /* Change all %+ parameters to %C, to handle |
53226
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
3707 values above 96 correctly for the C100. */ |
253 | 3708 while (*p) |
53226
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
3709 { |
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
3710 if (p[0] == '%' && p[1] == '+') |
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
3711 p[1] = 'C'; |
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
3712 p++; |
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
3713 } |
253 | 3714 } |
3715 | |
53341 | 3716 tty->specified_window = FrameRows (tty); |
253 | 3717 |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3718 if (Wcm_init (tty) == -1) /* can't do cursor motion */ |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3719 { |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3720 maybe_fatal (must_succeed, NULL, terminal, |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3721 "Terminal type \"%s\" is not powerful enough to run Emacs", |
12412
7f2c068121d8
(term_init): Alternative error messages for TERMCAP/TERMINFO.
Richard M. Stallman <rms@gnu.org>
parents:
12071
diff
changeset
|
3722 # ifdef TERMINFO |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3723 "Terminal type \"%s\" is not powerful enough to run Emacs.\n\ |
12412
7f2c068121d8
(term_init): Alternative error messages for TERMCAP/TERMINFO.
Richard M. Stallman <rms@gnu.org>
parents:
12071
diff
changeset
|
3724 It lacks the ability to position the cursor.\n\ |
7f2c068121d8
(term_init): Alternative error messages for TERMCAP/TERMINFO.
Richard M. Stallman <rms@gnu.org>
parents:
12071
diff
changeset
|
3725 If that is not the actual type of terminal you have,\n\ |
7f2c068121d8
(term_init): Alternative error messages for TERMCAP/TERMINFO.
Richard M. Stallman <rms@gnu.org>
parents:
12071
diff
changeset
|
3726 use the Bourne shell command `TERM=... export TERM' (C-shell:\n\ |
7f2c068121d8
(term_init): Alternative error messages for TERMCAP/TERMINFO.
Richard M. Stallman <rms@gnu.org>
parents:
12071
diff
changeset
|
3727 `setenv TERM ...') to specify the correct type. It may be necessary\n\ |
16894
cd8d6bf6b320
(fatal): Print a newline at the end.
Richard M. Stallman <rms@gnu.org>
parents:
16885
diff
changeset
|
3728 to do `unset TERMINFO' (C-shell: `unsetenv TERMINFO') as well.", |
12412
7f2c068121d8
(term_init): Alternative error messages for TERMCAP/TERMINFO.
Richard M. Stallman <rms@gnu.org>
parents:
12071
diff
changeset
|
3729 # else /* TERMCAP */ |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3730 "Terminal type \"%s\" is not powerful enough to run Emacs.\n\ |
253 | 3731 It lacks the ability to position the cursor.\n\ |
3732 If that is not the actual type of terminal you have,\n\ | |
4499
c7bfd863aefd
(term_init): Improve error messages (give sh commands).
Richard M. Stallman <rms@gnu.org>
parents:
3706
diff
changeset
|
3733 use the Bourne shell command `TERM=... export TERM' (C-shell:\n\ |
c7bfd863aefd
(term_init): Improve error messages (give sh commands).
Richard M. Stallman <rms@gnu.org>
parents:
3706
diff
changeset
|
3734 `setenv TERM ...') to specify the correct type. It may be necessary\n\ |
16894
cd8d6bf6b320
(fatal): Print a newline at the end.
Richard M. Stallman <rms@gnu.org>
parents:
16885
diff
changeset
|
3735 to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", |
12412
7f2c068121d8
(term_init): Alternative error messages for TERMCAP/TERMINFO.
Richard M. Stallman <rms@gnu.org>
parents:
12071
diff
changeset
|
3736 # endif /* TERMINFO */ |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3737 terminal_type); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3738 } |
82990
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
3739 |
53341 | 3740 if (FrameRows (tty) <= 0 || FrameCols (tty) <= 0) |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3741 maybe_fatal (must_succeed, NULL, terminal, |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3742 "Could not determine the frame size", |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3743 "Could not determine the frame size"); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3744 |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3745 tty->delete_in_insert_mode |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3746 = tty->TS_delete_mode && tty->TS_insert_mode |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3747 && !strcmp (tty->TS_delete_mode, tty->TS_insert_mode); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3748 |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3749 tty->se_is_so = (tty->TS_standout_mode |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3750 && tty->TS_end_standout_mode |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3751 && !strcmp (tty->TS_standout_mode, tty->TS_end_standout_mode)); |
253 | 3752 |
83065
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
3753 UseTabs (tty) = tabs_safe_p (fileno (tty->input)) && TabWidth (tty) == 8; |
253 | 3754 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3755 terminal->scroll_region_ok |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3756 = (tty->Wcm->cm_abs |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3757 && (tty->TS_set_window || tty->TS_set_scroll_region || tty->TS_set_scroll_region_1)); |
253 | 3758 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3759 terminal->line_ins_del_ok |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3760 = (((tty->TS_ins_line || tty->TS_ins_multi_lines) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3761 && (tty->TS_del_line || tty->TS_del_multi_lines)) |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3762 || (terminal->scroll_region_ok |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3763 && tty->TS_fwd_scroll && tty->TS_rev_scroll)); |
53226
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
3764 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3765 terminal->char_ins_del_ok |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3766 = ((tty->TS_ins_char || tty->TS_insert_mode |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3767 || tty->TS_pad_inserted_char || tty->TS_ins_multi_chars) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3768 && (tty->TS_del_char || tty->TS_del_multi_chars)); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3769 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3770 terminal->fast_clear_end_of_line = tty->TS_clr_line != 0; |
253 | 3771 |
83065
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
3772 init_baud_rate (fileno (tty->input)); |
83004
7900111db01c
Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
82995
diff
changeset
|
3773 |
53341 | 3774 /* Don't do this. I think termcap may still need the buffer. */ |
3775 /* xfree (buffer); */ | |
3776 | |
84849
ba20cee1aec0
(init_tty): Call init_sys_modes on WINDOWSNT also.
Jason Rumney <jasonr@gnu.org>
parents:
84779
diff
changeset
|
3777 #endif /* not WINDOWSNT */ |
ba20cee1aec0
(init_tty): Call init_sys_modes on WINDOWSNT also.
Jason Rumney <jasonr@gnu.org>
parents:
84779
diff
changeset
|
3778 |
53341 | 3779 /* Init system terminal modes (RAW or CBREAK, etc.). */ |
3780 init_sys_modes (tty); | |
82990
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
3781 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3782 return terminal; |
253 | 3783 } |
3784 | |
83341
76e51706154e
Rename term_init to init_tty.
Karoly Lorentey <lorentey@elte.hu>
parents:
83338
diff
changeset
|
3785 /* Auxiliary error-handling function for init_tty. |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3786 Free BUFFER and delete TERMINAL, then call error or fatal |
83025
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
3787 with str1 or str2, respectively, according to MUST_SUCCEED. */ |
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
3788 |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3789 static void |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3790 maybe_fatal (must_succeed, buffer, terminal, str1, str2, arg1, arg2) |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3791 int must_succeed; |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3792 char *buffer; |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3793 struct terminal *terminal; |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3794 char *str1, *str2, *arg1, *arg2; |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3795 { |
95481
4390d64d3328
Make "xfree (NULL)" a no-op; remove useless if-before-xfree.
Jim Meyering <jim@meyering.net>
parents:
94963
diff
changeset
|
3796 xfree (buffer); |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3797 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3798 if (terminal) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3799 delete_tty (terminal); |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
3800 |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3801 if (must_succeed) |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3802 fatal (str2, arg1, arg2); |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3803 else |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3804 error (str1, arg1, arg2); |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3805 |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3806 abort (); |
253 | 3807 } |
3808 | |
21514 | 3809 void |
86288
145903731829
* term.c: Include stdarg.h.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85614
diff
changeset
|
3810 fatal (const char *str, ...) |
253 | 3811 { |
86288
145903731829
* term.c: Include stdarg.h.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85614
diff
changeset
|
3812 va_list ap; |
145903731829
* term.c: Include stdarg.h.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85614
diff
changeset
|
3813 va_start (ap, str); |
253 | 3814 fprintf (stderr, "emacs: "); |
86288
145903731829
* term.c: Include stdarg.h.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85614
diff
changeset
|
3815 vfprintf (stderr, str, ap); |
145903731829
* term.c: Include stdarg.h.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85614
diff
changeset
|
3816 va_end (ap); |
253 | 3817 fflush (stderr); |
3818 exit (1); | |
3819 } | |
6752
f9236145bad7
(system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
6652
diff
changeset
|
3820 |
82988
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
3821 |
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
3822 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3823 /* Delete the given tty terminal, closing all frames on it. */ |
83025
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
3824 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3825 static void |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3826 delete_tty (struct terminal *terminal) |
63549
bda22724fc82
(produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents:
61591
diff
changeset
|
3827 { |
83004
7900111db01c
Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
82995
diff
changeset
|
3828 struct tty_display_info *tty; |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3829 Lisp_Object tail, frame; |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3830 int last_terminal; |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
3831 |
83525
b2e7507b55c6
Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents:
83522
diff
changeset
|
3832 /* Protect against recursive calls. Fdelete_frame in |
b2e7507b55c6
Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents:
83522
diff
changeset
|
3833 delete_terminal calls us back when it deletes our last frame. */ |
84692
0d8dd9a91520
(get_tty_terminal): Don't treat output_initial specially.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84461
diff
changeset
|
3834 if (!terminal->name) |
53341 | 3835 return; |
3836 | |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3837 if (terminal->type != output_termcap) |
83004
7900111db01c
Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
82995
diff
changeset
|
3838 abort (); |
7900111db01c
Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
82995
diff
changeset
|
3839 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3840 tty = terminal->display_info.tty; |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
3841 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3842 last_terminal = 1; |
83050
85e5a786f728
Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83041
diff
changeset
|
3843 FOR_EACH_FRAME (tail, frame) |
85e5a786f728
Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83041
diff
changeset
|
3844 { |
85e5a786f728
Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83041
diff
changeset
|
3845 struct frame *f = XFRAME (frame); |
85e5a786f728
Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83041
diff
changeset
|
3846 if (FRAME_LIVE_P (f) && (!FRAME_TERMCAP_P (f) || FRAME_TTY (f) != tty)) |
85e5a786f728
Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83041
diff
changeset
|
3847 { |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3848 last_terminal = 0; |
83050
85e5a786f728
Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83041
diff
changeset
|
3849 break; |
85e5a786f728
Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83041
diff
changeset
|
3850 } |
85e5a786f728
Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83041
diff
changeset
|
3851 } |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3852 if (last_terminal) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3853 error ("Attempt to delete the sole terminal device with live frames"); |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
3854 |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3855 if (tty == tty_list) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3856 tty_list = tty->next; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3857 else |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3858 { |
82989
f3845715a5f6
Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
82988
diff
changeset
|
3859 struct tty_display_info *p; |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3860 for (p = tty_list; p && p->next != tty; p = p->next) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3861 ; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3862 |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3863 if (! p) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3864 /* This should not happen. */ |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3865 abort (); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3866 |
53341 | 3867 p->next = tty->next; |
3868 tty->next = 0; | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3869 } |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3870 |
83342
9216636c02fc
Rename `struct display' to `struct device'. Update function, parameter and variable names accordingly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83341
diff
changeset
|
3871 /* reset_sys_modes needs a valid device, so this call needs to be |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3872 before delete_terminal. */ |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3873 reset_sys_modes (tty); |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3874 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3875 delete_terminal (terminal); |
83004
7900111db01c
Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
82995
diff
changeset
|
3876 |
95481
4390d64d3328
Make "xfree (NULL)" a no-op; remove useless if-before-xfree.
Jim Meyering <jim@meyering.net>
parents:
94963
diff
changeset
|
3877 xfree (tty->name); |
4390d64d3328
Make "xfree (NULL)" a no-op; remove useless if-before-xfree.
Jim Meyering <jim@meyering.net>
parents:
94963
diff
changeset
|
3878 xfree (tty->type); |
82990
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
3879 |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3880 if (tty->input) |
82988
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
3881 { |
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
3882 delete_keyboard_wait_descriptor (fileno (tty->input)); |
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
3883 if (tty->input != stdin) |
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
3884 fclose (tty->input); |
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
3885 } |
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
3886 if (tty->output && tty->output != stdout && tty->output != tty->input) |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3887 fclose (tty->output); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3888 if (tty->termscript) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3889 fclose (tty->termscript); |
82990
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
3890 |
95481
4390d64d3328
Make "xfree (NULL)" a no-op; remove useless if-before-xfree.
Jim Meyering <jim@meyering.net>
parents:
94963
diff
changeset
|
3891 xfree (tty->old_tty); |
4390d64d3328
Make "xfree (NULL)" a no-op; remove useless if-before-xfree.
Jim Meyering <jim@meyering.net>
parents:
94963
diff
changeset
|
3892 xfree (tty->Wcm); |
82990
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
3893 |
82989
f3845715a5f6
Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
82988
diff
changeset
|
3894 bzero (tty, sizeof (struct tty_display_info)); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3895 xfree (tty); |
63549
bda22724fc82
(produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents:
61591
diff
changeset
|
3896 } |
bda22724fc82
(produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents:
61591
diff
changeset
|
3897 |
83004
7900111db01c
Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
82995
diff
changeset
|
3898 |
7900111db01c
Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
82995
diff
changeset
|
3899 |
82989
f3845715a5f6
Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
82988
diff
changeset
|
3900 /* Mark the pointers in the tty_display_info objects. |
82988
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
3901 Called by the Fgarbage_collector. */ |
83025
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
3902 |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3903 void |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3904 mark_ttys (void) |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3905 { |
82989
f3845715a5f6
Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
82988
diff
changeset
|
3906 struct tty_display_info *tty; |
83032
b8237c556f0e
Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents:
83027
diff
changeset
|
3907 |
82988
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
3908 for (tty = tty_list; tty; tty = tty->next) |
83762
ffb5395e8445
(mark_ttys): Don't bother checking top_frame (incorrectly)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83653
diff
changeset
|
3909 mark_object (tty->top_frame); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3910 } |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3911 |
83004
7900111db01c
Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
82995
diff
changeset
|
3912 |
7900111db01c
Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
82995
diff
changeset
|
3913 |
21514 | 3914 void |
6752
f9236145bad7
(system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
6652
diff
changeset
|
3915 syms_of_term () |
f9236145bad7
(system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
6652
diff
changeset
|
3916 { |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39914
diff
changeset
|
3917 DEFVAR_BOOL ("system-uses-terminfo", &system_uses_terminfo, |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39914
diff
changeset
|
3918 doc: /* Non-nil means the system uses terminfo rather than termcap. |
39914
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39697
diff
changeset
|
3919 This variable can be used by terminal emulator packages. */); |
6752
f9236145bad7
(system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
6652
diff
changeset
|
3920 #ifdef TERMINFO |
f9236145bad7
(system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
6652
diff
changeset
|
3921 system_uses_terminfo = 1; |
f9236145bad7
(system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
6652
diff
changeset
|
3922 #else |
f9236145bad7
(system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
6652
diff
changeset
|
3923 system_uses_terminfo = 0; |
f9236145bad7
(system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
6652
diff
changeset
|
3924 #endif |
15974
61249a8fe735
(Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
15094
diff
changeset
|
3925 |
83891
dab32bc3edc8
* server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83889
diff
changeset
|
3926 DEFVAR_LISP ("suspend-tty-functions", &Vsuspend_tty_functions, |
dab32bc3edc8
* server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83889
diff
changeset
|
3927 doc: /* Functions to be run after suspending a tty. |
83525
b2e7507b55c6
Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents:
83522
diff
changeset
|
3928 The functions are run with one argument, the terminal id to be suspended. |
83065
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
3929 See `suspend-tty'. */); |
83891
dab32bc3edc8
* server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83889
diff
changeset
|
3930 Vsuspend_tty_functions = Qnil; |
dab32bc3edc8
* server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83889
diff
changeset
|
3931 |
dab32bc3edc8
* server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83889
diff
changeset
|
3932 |
dab32bc3edc8
* server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83889
diff
changeset
|
3933 DEFVAR_LISP ("resume-tty-functions", &Vresume_tty_functions, |
dab32bc3edc8
* server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83889
diff
changeset
|
3934 doc: /* Functions to be run after resuming a tty. |
83525
b2e7507b55c6
Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents:
83522
diff
changeset
|
3935 The functions are run with one argument, the terminal id that was revived. |
83065
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
3936 See `resume-tty'. */); |
83891
dab32bc3edc8
* server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83889
diff
changeset
|
3937 Vresume_tty_functions = Qnil; |
25002 | 3938 |
67935
52bbc53dbce1
(visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66238
diff
changeset
|
3939 DEFVAR_BOOL ("visible-cursor", &visible_cursor, |
52bbc53dbce1
(visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66238
diff
changeset
|
3940 doc: /* Non-nil means to make the cursor very visible. |
52bbc53dbce1
(visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66238
diff
changeset
|
3941 This only has an effect when running in a text terminal. |
52bbc53dbce1
(visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66238
diff
changeset
|
3942 What means \"very visible\" is up to your terminal. It may make the cursor |
52bbc53dbce1
(visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66238
diff
changeset
|
3943 bigger, or it may make it blink, or it may do nothing at all. */); |
52bbc53dbce1
(visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66238
diff
changeset
|
3944 visible_cursor = 1; |
52bbc53dbce1
(visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66238
diff
changeset
|
3945 |
25002 | 3946 defsubr (&Stty_display_color_p); |
42954
e514d4931d6f
(Ftty_display_color_cells): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
42808
diff
changeset
|
3947 defsubr (&Stty_display_color_cells); |
63549
bda22724fc82
(produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents:
61591
diff
changeset
|
3948 defsubr (&Stty_no_underline); |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3949 defsubr (&Stty_type); |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3950 defsubr (&Scontrolling_tty_p); |
83065
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
3951 defsubr (&Ssuspend_tty); |
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
3952 defsubr (&Sresume_tty); |
80994
62b6aa7f8c37
Use HAVE_GPM instead of HAVE_GPM_H.
Nick Roberts <nickrob@snap.net.nz>
parents:
80979
diff
changeset
|
3953 #ifdef HAVE_GPM |
84968
85eb2660cbe3
(mouse_face_window): Rename from Qmouse_face_window. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84955
diff
changeset
|
3954 defsubr (&Sgpm_mouse_start); |
85eb2660cbe3
(mouse_face_window): Rename from Qmouse_face_window. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84955
diff
changeset
|
3955 defsubr (&Sgpm_mouse_stop); |
85eb2660cbe3
(mouse_face_window): Rename from Qmouse_face_window. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84955
diff
changeset
|
3956 |
85eb2660cbe3
(mouse_face_window): Rename from Qmouse_face_window. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84955
diff
changeset
|
3957 staticpro (&mouse_face_window); |
80994
62b6aa7f8c37
Use HAVE_GPM instead of HAVE_GPM_H.
Nick Roberts <nickrob@snap.net.nz>
parents:
80979
diff
changeset
|
3958 #endif /* HAVE_GPM */ |
97021
fb376eec83a9
(syms_of_term): Initialize default_orig_pair, default_set_foreground,
Chong Yidong <cyd@stupidchicken.com>
parents:
96303
diff
changeset
|
3959 |
97026
aebbea50eef4
* term.c (syms_of_term): Don't initialize default_orig_pair,
Juanma Barranquero <lekktu@gmail.com>
parents:
97021
diff
changeset
|
3960 #ifndef WINDOWSNT |
97021
fb376eec83a9
(syms_of_term): Initialize default_orig_pair, default_set_foreground,
Chong Yidong <cyd@stupidchicken.com>
parents:
96303
diff
changeset
|
3961 default_orig_pair = NULL; |
fb376eec83a9
(syms_of_term): Initialize default_orig_pair, default_set_foreground,
Chong Yidong <cyd@stupidchicken.com>
parents:
96303
diff
changeset
|
3962 default_set_foreground = NULL; |
fb376eec83a9
(syms_of_term): Initialize default_orig_pair, default_set_foreground,
Chong Yidong <cyd@stupidchicken.com>
parents:
96303
diff
changeset
|
3963 default_set_background = NULL; |
97026
aebbea50eef4
* term.c (syms_of_term): Don't initialize default_orig_pair,
Juanma Barranquero <lekktu@gmail.com>
parents:
97021
diff
changeset
|
3964 #endif /* WINDOWSNT */ |
6752
f9236145bad7
(system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
6652
diff
changeset
|
3965 } |
25002 | 3966 |
82988
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
3967 |
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
3968 |
52401 | 3969 /* arch-tag: 498e7449-6f2e-45e2-91dd-b7d4ca488193 |
3970 (do not change this comment) */ |