Mercurial > emacs
annotate src/term.c @ 106656:5b3e8e51b723
Merge: update nt/INSTALL for CVS->Bazaar switchover too.
author | Karl Fogel <kfogel@red-bean.com> |
---|---|
date | Sun, 27 Dec 2009 18:40:41 -0500 |
parents | af182a117edd |
children | 1d1d5d9bd884 4bad2c6338cc |
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, |
100951 | 3 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 |
79759 | 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> |
105669
68dd71358159
* alloc.c: Do not define struct catchtag.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105661
diff
changeset
|
40 #include <setjmp.h> |
83032
b8237c556f0e
Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents:
83027
diff
changeset
|
41 |
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
|
42 #include "lisp.h" |
253 | 43 #include "termchar.h" |
44 #include "termopts.h" | |
88391
1953d0d56cd7
Include "buffer.h" and "character.h".
Kenichi Handa <handa@m17n.org>
parents:
43073
diff
changeset
|
45 #include "buffer.h" |
1953d0d56cd7
Include "buffer.h" and "character.h".
Kenichi Handa <handa@m17n.org>
parents:
43073
diff
changeset
|
46 #include "character.h" |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
47 #include "charset.h" |
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
48 #include "coding.h" |
90638 | 49 #include "composite.h" |
31102
6a0caa788013
Include keyboard.h before frame.h.
Andrew Innes <andrewi@gnu.org>
parents:
30848
diff
changeset
|
50 #include "keyboard.h" |
765 | 51 #include "frame.h" |
253 | 52 #include "disptab.h" |
53 #include "termhooks.h" | |
21514 | 54 #include "dispextern.h" |
25002 | 55 #include "window.h" |
39697
0b986bb45526
Include keymap.h.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39682
diff
changeset
|
56 #include "keymap.h" |
76627
c53e7d075f1a
Include blockinput.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75348
diff
changeset
|
57 #include "blockinput.h" |
83086
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
58 #include "syssignal.h" |
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
59 #include "systty.h" |
81308
16181a4d64bf
Include intervals.h to declare Fget_text_property.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81127
diff
changeset
|
60 #include "intervals.h" |
97658 | 61 #ifdef MSDOS |
62 #include "msdos.h" | |
63 static int been_here = -1; | |
64 #endif | |
25002 | 65 |
33672
a94852aef620
Don't try to include termcap.h; see comment there.
Gerd Moellmann <gerd@gnu.org>
parents:
33006
diff
changeset
|
66 /* 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
|
67 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
|
68 won't find. */ |
a94852aef620
Don't try to include termcap.h; see comment there.
Gerd Moellmann <gerd@gnu.org>
parents:
33006
diff
changeset
|
69 |
a94852aef620
Don't try to include termcap.h; see comment there.
Gerd Moellmann <gerd@gnu.org>
parents:
33006
diff
changeset
|
70 #if defined HAVE_TERMCAP_H && 0 |
25727
46fe79182b54
(OUTPUT_IF, OUTPUT1_IF): Use do-while.
Gerd Moellmann <gerd@gnu.org>
parents:
25675
diff
changeset
|
71 #include <termcap.h> |
29929
bb7557f86f5b
[!HAVE_TERMCAP_H]: Declare tputs, tgetent, tgetflag, tgetnum.
Dave Love <fx@gnu.org>
parents:
29462
diff
changeset
|
72 #else |
bb7557f86f5b
[!HAVE_TERMCAP_H]: Declare tputs, tgetent, tgetflag, tgetnum.
Dave Love <fx@gnu.org>
parents:
29462
diff
changeset
|
73 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
|
74 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
|
75 extern int tgetflag P_ ((char *id)); |
bb7557f86f5b
[!HAVE_TERMCAP_H]: Declare tputs, tgetent, tgetflag, tgetnum.
Dave Love <fx@gnu.org>
parents:
29462
diff
changeset
|
76 extern int tgetnum P_ ((char *id)); |
25727
46fe79182b54
(OUTPUT_IF, OUTPUT1_IF): Use do-while.
Gerd Moellmann <gerd@gnu.org>
parents:
25675
diff
changeset
|
77 #endif |
46fe79182b54
(OUTPUT_IF, OUTPUT1_IF): Use do-while.
Gerd Moellmann <gerd@gnu.org>
parents:
25675
diff
changeset
|
78 |
21827
87c7f4bd99da
Include cm.h after dispextern.h to avoid name conflicts
Geoff Voelker <voelker@cs.washington.edu>
parents:
21624
diff
changeset
|
79 #include "cm.h" |
21514 | 80 #ifdef HAVE_X_WINDOWS |
81 #include "xterm.h" | |
82 #endif | |
8898 | 83 |
53226
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
84 #ifndef O_RDWR |
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
85 #define O_RDWR 2 |
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
86 #endif |
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
87 |
83032
b8237c556f0e
Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents:
83027
diff
changeset
|
88 #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
|
89 #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
|
90 #endif |
b8237c556f0e
Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents:
83027
diff
changeset
|
91 |
84779
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
92 /* 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
|
93 #ifdef WINDOWSNT |
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
94 #define DEV_TTY "CONOUT$" |
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
95 #else |
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
96 #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
|
97 #endif |
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
98 |
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_set_scroll_region P_ ((struct frame *f, int start, int stop)); |
25002 | 100 static void turn_on_face P_ ((struct frame *, int face_id)); |
101 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
|
102 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
|
103 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
|
104 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
|
105 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
|
106 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
|
107 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
|
108 static void delete_tty P_ ((struct terminal *)); |
25002 | 109 |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
110 #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
|
111 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
|
112 (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
|
113 - curY (tty)), \ |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
114 cmputc) |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
115 |
53226
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
116 #define OUTPUT1(tty, a) emacs_tputs ((tty), a, 1, cmputc) |
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
117 #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
|
118 |
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
119 #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
|
120 do { \ |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
121 if (a) \ |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
122 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
|
123 (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
|
124 - curY (tty) ), \ |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
125 cmputc); \ |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
126 } while (0) |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
127 |
53226
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
128 #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
|
129 |
67935
52bbc53dbce1
(visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66238
diff
changeset
|
130 /* 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
|
131 |
52bbc53dbce1
(visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66238
diff
changeset
|
132 static int visible_cursor; |
52bbc53dbce1
(visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66238
diff
changeset
|
133 |
54428
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
134 /* Display space properties */ |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
135 |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
136 extern Lisp_Object Qspace, QCalign_to, QCwidth; |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
137 |
83065
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
138 /* 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
|
139 Lisp_Object Vsuspend_tty_functions; |
83065
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
140 |
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
141 /* 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
|
142 Lisp_Object Vresume_tty_functions; |
83065
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
143 |
83004
7900111db01c
Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
82995
diff
changeset
|
144 /* 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
|
145 struct tty_display_info *tty_list; |
253 | 146 |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
147 /* 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
|
148 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
|
149 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
|
150 else. */ |
253 | 151 int no_redraw_on_reenter; |
152 | |
28465
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
153 /* 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
|
154 corresponding attribute cannot be combined with colors. */ |
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
155 |
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
156 enum no_color_bit |
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
157 { |
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
158 NC_STANDOUT = 1 << 0, |
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
159 NC_UNDERLINE = 1 << 1, |
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
160 NC_REVERSE = 1 << 2, |
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
161 NC_BLINK = 1 << 3, |
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
162 NC_DIM = 1 << 4, |
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
163 NC_BOLD = 1 << 5, |
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
164 NC_INVIS = 1 << 6, |
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
165 NC_PROTECT = 1 << 7, |
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
166 NC_ALT_CHARSET = 1 << 8 |
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
167 }; |
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
168 |
253 | 169 /* internal state */ |
170 | |
10771
d564078d10c6
(calculate_costs): Update max_frame_height, max_frame_width.
Richard M. Stallman <rms@gnu.org>
parents:
10481
diff
changeset
|
171 /* The largest frame width in any call to calculate_costs. */ |
25002 | 172 |
51212
332134065648
Make (some) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50227
diff
changeset
|
173 int max_frame_cols; |
25002 | 174 |
10771
d564078d10c6
(calculate_costs): Update max_frame_height, max_frame_width.
Richard M. Stallman <rms@gnu.org>
parents:
10481
diff
changeset
|
175 /* The largest frame height in any call to calculate_costs. */ |
25002 | 176 |
51212
332134065648
Make (some) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50227
diff
changeset
|
177 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
|
178 |
83032
b8237c556f0e
Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents:
83027
diff
changeset
|
179 /* 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
|
180 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
|
181 static int no_controlling_tty; |
253 | 182 |
6752
f9236145bad7
(system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
6652
diff
changeset
|
183 /* Provided for lisp packages. */ |
25002 | 184 |
6752
f9236145bad7
(system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
6652
diff
changeset
|
185 static int system_uses_terminfo; |
f9236145bad7
(system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
6652
diff
changeset
|
186 |
253 | 187 char *tparam (); |
8612
86065bec6fc9
(term_init): Added missing argument to tgetstr.
Richard M. Stallman <rms@gnu.org>
parents:
8027
diff
changeset
|
188 |
86065bec6fc9
(term_init): Added missing argument to tgetstr.
Richard M. Stallman <rms@gnu.org>
parents:
8027
diff
changeset
|
189 extern char *tgetstr (); |
253 | 190 |
9797
05d9072c5a38
(term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents:
9658
diff
changeset
|
191 |
80994
62b6aa7f8c37
Use HAVE_GPM instead of HAVE_GPM_H.
Nick Roberts <nickrob@snap.net.nz>
parents:
80979
diff
changeset
|
192 #ifdef HAVE_GPM |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
193 #include <sys/fcntl.h> |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
194 |
84981
a35153116cd0
(term_clear_mouse_face, term_mouse_highlight)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84969
diff
changeset
|
195 static void term_clear_mouse_face (); |
a35153116cd0
(term_clear_mouse_face, term_mouse_highlight)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84969
diff
changeset
|
196 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
|
197 |
84768
53194ec05789
* termhooks.h (term_gpm): Delete. Use gpm_tty's NULLness instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84692
diff
changeset
|
198 /* 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
|
199 struct tty_display_info *gpm_tty = NULL; |
83622 | 200 |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
201 /* 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
|
202 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
|
203 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
|
204 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
|
205 MOUSE_FACE_WINDOW. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
206 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
|
207 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
|
208 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
|
209 static Lisp_Object mouse_face_window; |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
210 static int mouse_face_face_id; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
211 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
212 static int pos_x, pos_y; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
213 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
|
214 #endif /* HAVE_GPM */ |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
215 |
83025
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
216 /* 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
|
217 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
218 static void |
83100
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
219 tty_ring_bell (struct frame *f) |
253 | 220 { |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
221 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
|
222 |
83167
69ebc75cb461
Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83161
diff
changeset
|
223 if (tty->output) |
15974
61249a8fe735
(Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
15094
diff
changeset
|
224 { |
83167
69ebc75cb461
Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83161
diff
changeset
|
225 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
|
226 ? 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
|
227 : 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
|
228 fflush (tty->output); |
15974
61249a8fe735
(Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
15094
diff
changeset
|
229 } |
253 | 230 } |
231 | |
83025
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
232 /* Set up termcap modes for Emacs. */ |
253 | 233 |
21514 | 234 void |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
235 tty_set_terminal_modes (struct terminal *terminal) |
253 | 236 { |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
237 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
|
238 |
83065
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
239 if (tty->output) |
253 | 240 { |
83353
532e0a9335a9
Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
241 if (tty->TS_termcap_modes) |
532e0a9335a9
Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
242 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
|
243 else |
83353
532e0a9335a9
Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
244 { |
532e0a9335a9
Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
245 /* 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
|
246 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
|
247 int i; |
83382
7a3090aca393
Fix hardcoded stdout usage in term.c. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83370
diff
changeset
|
248 current_tty = tty; |
83353
532e0a9335a9
Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
249 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
|
250 cmputc ('\n'); |
83353
532e0a9335a9
Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
251 } |
532e0a9335a9
Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
252 |
83065
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
253 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
|
254 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
|
255 OUTPUT_IF (tty, tty->TS_keypad_mode); |
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
256 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
|
257 fflush (tty->output); |
253 | 258 } |
259 } | |
260 | |
83025
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
261 /* Reset termcap modes before exiting Emacs. */ |
253 | 262 |
21514 | 263 void |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
264 tty_reset_terminal_modes (struct terminal *terminal) |
253 | 265 { |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
266 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
|
267 |
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
268 if (tty->output) |
253 | 269 { |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
270 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
|
271 tty_turn_off_insert (tty); |
83065
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
272 OUTPUT_IF (tty, tty->TS_end_keypad_mode); |
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
273 OUTPUT_IF (tty, tty->TS_cursor_normal); |
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
274 OUTPUT_IF (tty, tty->TS_end_termcap_modes); |
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
275 OUTPUT_IF (tty, tty->TS_orig_pair); |
37959
b53edc686faf
(tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37499
diff
changeset
|
276 /* 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
|
277 current_tty = tty; |
37959
b53edc686faf
(tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37499
diff
changeset
|
278 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
|
279 fflush (tty->output); |
253 | 280 } |
281 } | |
282 | |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
283 /* 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
|
284 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
285 static void |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
286 tty_update_end (struct frame *f) |
253 | 287 { |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
288 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
|
289 |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
290 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
|
291 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
|
292 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
|
293 tty_background_highlight (tty); |
253 | 294 } |
295 | |
83025
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
296 /* 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
|
297 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
298 static void |
83100
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
299 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
|
300 { |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
301 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
|
302 |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
303 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
|
304 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
|
305 tty_set_scroll_region (f, 0, tty->specified_window); |
253 | 306 } |
307 | |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
308 static void |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
309 tty_set_scroll_region (struct frame *f, int start, int stop) |
253 | 310 { |
311 char *buf; | |
82989
f3845715a5f6
Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
82988
diff
changeset
|
312 struct tty_display_info *tty = FRAME_TTY (f); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
313 |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
314 if (tty->TS_set_scroll_region) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
315 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
|
316 else if (tty->TS_set_scroll_region_1) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
317 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
|
318 FRAME_LINES (f), start, |
1595c5e1e9bb
Updating_frame vs. selected_frame in term.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
319 FRAME_LINES (f) - stop, |
1595c5e1e9bb
Updating_frame vs. selected_frame in term.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
53226
diff
changeset
|
320 FRAME_LINES (f)); |
253 | 321 else |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
322 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
|
323 |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
324 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
|
325 xfree (buf); |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
326 losecursor (tty); |
253 | 327 } |
37959
b53edc686faf
(tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37499
diff
changeset
|
328 |
253 | 329 |
37959
b53edc686faf
(tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37499
diff
changeset
|
330 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
|
331 tty_turn_on_insert (struct tty_display_info *tty) |
253 | 332 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
333 if (!tty->insert_mode) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
334 OUTPUT (tty, tty->TS_insert_mode); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
335 tty->insert_mode = 1; |
253 | 336 } |
337 | |
21514 | 338 void |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
339 tty_turn_off_insert (struct tty_display_info *tty) |
253 | 340 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
341 if (tty->insert_mode) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
342 OUTPUT (tty, tty->TS_end_insert_mode); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
343 tty->insert_mode = 0; |
253 | 344 } |
345 | |
40086
050b19294988
(TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents:
40081
diff
changeset
|
346 /* Handle highlighting. */ |
253 | 347 |
21514 | 348 void |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
349 tty_turn_off_highlight (struct tty_display_info *tty) |
253 | 350 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
351 if (tty->standout_mode) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
352 OUTPUT_IF (tty, tty->TS_end_standout_mode); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
353 tty->standout_mode = 0; |
253 | 354 } |
355 | |
37959
b53edc686faf
(tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37499
diff
changeset
|
356 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
|
357 tty_turn_on_highlight (struct tty_display_info *tty) |
253 | 358 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
359 if (!tty->standout_mode) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
360 OUTPUT_IF (tty, tty->TS_standout_mode); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
361 tty->standout_mode = 1; |
253 | 362 } |
363 | |
37477
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
364 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
|
365 tty_toggle_highlight (struct tty_display_info *tty) |
37477
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
366 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
367 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
|
368 tty_turn_off_highlight (tty); |
37477
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
369 else |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
370 tty_turn_on_highlight (tty); |
37477
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
371 } |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
372 |
25002 | 373 |
374 /* Make cursor invisible. */ | |
375 | |
376 static void | |
82989
f3845715a5f6
Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
82988
diff
changeset
|
377 tty_hide_cursor (struct tty_display_info *tty) |
25002 | 378 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
379 if (tty->cursor_hidden == 0) |
37959
b53edc686faf
(tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37499
diff
changeset
|
380 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
381 tty->cursor_hidden = 1; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
382 OUTPUT_IF (tty, tty->TS_cursor_invisible); |
37959
b53edc686faf
(tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37499
diff
changeset
|
383 } |
25002 | 384 } |
385 | |
386 | |
387 /* Ensure that cursor is visible. */ | |
388 | |
389 static void | |
82989
f3845715a5f6
Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
82988
diff
changeset
|
390 tty_show_cursor (struct tty_display_info *tty) |
25002 | 391 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
392 if (tty->cursor_hidden) |
37959
b53edc686faf
(tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37499
diff
changeset
|
393 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
394 tty->cursor_hidden = 0; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
395 OUTPUT_IF (tty, tty->TS_cursor_normal); |
67935
52bbc53dbce1
(visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66238
diff
changeset
|
396 if (visible_cursor) |
83450
c69d44922688
Merged from miles@gnu.org--gnu-2005 (patch 682)
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
397 OUTPUT_IF (tty, tty->TS_cursor_visible); |
37959
b53edc686faf
(tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37499
diff
changeset
|
398 } |
25002 | 399 } |
400 | |
401 | |
253 | 402 /* Set standout mode to the state it should be in for |
403 empty space inside windows. What this is, | |
404 depends on the user option inverse-video. */ | |
405 | |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
406 static void |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
407 tty_background_highlight (struct tty_display_info *tty) |
253 | 408 { |
409 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
|
410 tty_turn_on_highlight (tty); |
253 | 411 else |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
412 tty_turn_off_highlight (tty); |
253 | 413 } |
414 | |
415 /* Set standout mode to the mode specified for the text to be output. */ | |
416 | |
21514 | 417 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
|
418 tty_highlight_if_desired (struct tty_display_info *tty) |
253 | 419 { |
40081
07d7dbf18784
(reassert_line_highlight_hook, change_line_highlight_hook): Variables removed.
Miles Bader <miles@gnu.org>
parents:
39988
diff
changeset
|
420 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
|
421 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
|
422 else |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
423 tty_turn_off_highlight (tty); |
253 | 424 } |
425 | |
426 | |
25002 | 427 /* Move cursor to row/column position VPOS/HPOS. HPOS/VPOS are |
428 frame-relative coordinates. */ | |
253 | 429 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
430 static void |
83100
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
431 tty_cursor_to (struct frame *f, int vpos, int hpos) |
253 | 432 { |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
433 struct tty_display_info *tty = FRAME_TTY (f); |
253 | 434 |
12071
f85f23c50344
(cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents:
11530
diff
changeset
|
435 /* 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
|
436 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
|
437 if (! tty->costs_set) |
12071
f85f23c50344
(cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents:
11530
diff
changeset
|
438 return; |
f85f23c50344
(cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents:
11530
diff
changeset
|
439 |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
440 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
|
441 && curX (tty) == hpos) |
253 | 442 return; |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
443 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
|
444 tty_background_highlight (tty); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
445 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
|
446 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
|
447 cmgoto (tty, vpos, hpos); |
253 | 448 } |
449 | |
450 /* Similar but don't take any account of the wasted characters. */ | |
451 | |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
452 static void |
83100
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
453 tty_raw_cursor_to (struct frame *f, int row, int col) |
253 | 454 { |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
455 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
|
456 |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
457 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
|
458 && curX (tty) == col) |
253 | 459 return; |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
460 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
|
461 tty_background_highlight (tty); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
462 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
|
463 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
|
464 cmgoto (tty, row, col); |
253 | 465 } |
466 | |
467 /* Erase operations */ | |
468 | |
83025
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
469 /* 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
|
470 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
471 static void |
83100
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
472 tty_clear_to_end (struct frame *f) |
253 | 473 { |
474 register int i; | |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
475 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
|
476 |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
477 if (tty->TS_clr_to_bottom) |
253 | 478 { |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
479 tty_background_highlight (tty); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
480 OUTPUT (tty, tty->TS_clr_to_bottom); |
253 | 481 } |
482 else | |
483 { | |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
484 for (i = curY (tty); i < FRAME_LINES (f); i++) |
253 | 485 { |
83100
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
486 cursor_to (f, i, 0); |
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
487 clear_end_of_line (f, FRAME_COLS (f)); |
253 | 488 } |
489 } | |
490 } | |
491 | |
83025
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
492 /* Clear an entire termcap frame. */ |
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
493 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
494 static void |
83100
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
495 tty_clear_frame (struct frame *f) |
253 | 496 { |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
497 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
|
498 |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
499 if (tty->TS_clr_frame) |
253 | 500 { |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
501 tty_background_highlight (tty); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
502 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
|
503 cmat (tty, 0, 0); |
253 | 504 } |
505 else | |
506 { | |
83100
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
507 cursor_to (f, 0, 0); |
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
508 clear_to_end (f); |
253 | 509 } |
510 } | |
511 | |
83025
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
512 /* An implementation of clear_end_of_line for termcap frames. |
253 | 513 |
514 Note that the cursor may be moved, on terminals lacking a `ce' string. */ | |
515 | |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
516 static void |
83100
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
517 tty_clear_end_of_line (struct frame *f, int first_unused_hpos) |
253 | 518 { |
519 register int i; | |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
520 struct tty_display_info *tty = FRAME_TTY (f); |
253 | 521 |
12071
f85f23c50344
(cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents:
11530
diff
changeset
|
522 /* 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
|
523 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
|
524 if (! tty->costs_set) |
12071
f85f23c50344
(cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents:
11530
diff
changeset
|
525 return; |
f85f23c50344
(cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents:
11530
diff
changeset
|
526 |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
527 if (curX (tty) >= first_unused_hpos) |
253 | 528 return; |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
529 tty_background_highlight (tty); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
530 if (tty->TS_clr_line) |
253 | 531 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
532 OUTPUT1 (tty, tty->TS_clr_line); |
253 | 533 } |
534 else | |
535 { /* 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
|
536 tty_turn_off_insert (tty); |
253 | 537 |
25002 | 538 /* 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
|
539 if (AutoWrap (tty) |
53341 | 540 && curY (tty) == FrameRows (tty) - 1 |
541 && first_unused_hpos == FrameCols (tty)) | |
253 | 542 first_unused_hpos--; |
543 | |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
544 for (i = curX (tty); i < first_unused_hpos; i++) |
253 | 545 { |
83065
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
546 if (tty->termscript) |
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
547 fputc (' ', tty->termscript); |
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
548 fputc (' ', tty->output); |
253 | 549 } |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
550 cmplus (tty, first_unused_hpos - curX (tty)); |
253 | 551 } |
552 } | |
553 | |
90059
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
554 /* 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
|
555 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
|
556 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
|
557 /* 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
|
558 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
|
559 static int encode_terminal_dst_size; |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
560 |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
561 /* 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
|
562 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
|
563 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
|
564 |
58701
24c51e9d8586
(encode_terminal_code): Don't make it "static".
Kenichi Handa <handa@m17n.org>
parents:
58638
diff
changeset
|
565 unsigned char * |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
566 encode_terminal_code (src, src_len, coding) |
25002 | 567 struct glyph *src; |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
568 int src_len; |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
569 struct coding_system *coding; |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
570 { |
66238
d3f5aa0f18c4
(encode_terminal_code): Remove unused var src_start.
Kim F. Storm <storm@cua.dk>
parents:
65795
diff
changeset
|
571 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
|
572 unsigned char *buf; |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
573 int nchars, nbytes, required; |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
574 register int tlen = GLYPH_TABLE_LENGTH; |
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
575 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
|
576 Lisp_Object charset_list; |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
577 |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
578 /* 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
|
579 multibyte-form. But, it may be enlarged on demand if |
90638 | 580 Vglyph_table contains a string or a composite glyph is |
581 encountered. */ | |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
582 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
|
583 if (encode_terminal_src_size < required) |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
584 { |
100276
8f4457a692c5
(encode_terminal_code): Free any previous memory blocks
Chong Yidong <cyd@stupidchicken.com>
parents:
98367
diff
changeset
|
585 if (encode_terminal_src) |
8f4457a692c5
(encode_terminal_code): Free any previous memory blocks
Chong Yidong <cyd@stupidchicken.com>
parents:
98367
diff
changeset
|
586 encode_terminal_src = xrealloc (encode_terminal_src, required); |
8f4457a692c5
(encode_terminal_code): Free any previous memory blocks
Chong Yidong <cyd@stupidchicken.com>
parents:
98367
diff
changeset
|
587 else |
90059
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
588 encode_terminal_src = xmalloc (required); |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
589 encode_terminal_src_size = required; |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
590 } |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
591 |
90059
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
592 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
|
593 |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
594 buf = encode_terminal_src; |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
595 nchars = 0; |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
596 while (src < src_end) |
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
597 { |
90638 | 598 if (src->type == COMPOSITE_GLYPH) |
599 { | |
97830
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
600 struct composition *cmp; |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
601 Lisp_Object gstring; |
90638 | 602 int i; |
603 | |
604 nbytes = buf - encode_terminal_src; | |
97830
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
605 if (src->u.cmp.automatic) |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
606 { |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
607 gstring = composition_gstring_from_id (src->u.cmp.id); |
101964
05ec76bd8aa4
(encode_terminal_code): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
101774
diff
changeset
|
608 required = src->u.cmp.to + 1 - src->u.cmp.from; |
97830
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
609 } |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
610 else |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
611 { |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
612 cmp = composition_table[src->u.cmp.id]; |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
613 required = MAX_MULTIBYTE_LENGTH * cmp->glyph_len; |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
614 } |
90638 | 615 |
616 if (encode_terminal_src_size < nbytes + required) | |
617 { | |
618 encode_terminal_src_size = nbytes + required; | |
619 encode_terminal_src = xrealloc (encode_terminal_src, | |
620 encode_terminal_src_size); | |
621 buf = encode_terminal_src + nbytes; | |
622 } | |
623 | |
97830
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
624 if (src->u.cmp.automatic) |
101964
05ec76bd8aa4
(encode_terminal_code): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
101774
diff
changeset
|
625 for (i = src->u.cmp.from; i <= src->u.cmp.to; i++) |
97830
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
626 { |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
627 Lisp_Object g = LGSTRING_GLYPH (gstring, i); |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
628 int c = LGLYPH_CHAR (g); |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
629 |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
630 if (! char_charset (c, charset_list, NULL)) |
101774
d4f9e4244d5a
(encode_terminal_code): Fix handling of composition.
Kenichi Handa <handa@m17n.org>
parents:
101690
diff
changeset
|
631 c = '?'; |
97830
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
632 buf += CHAR_STRING (c, buf); |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
633 nchars++; |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
634 } |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
635 else |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
636 for (i = 0; i < cmp->glyph_len; i++) |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
637 { |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
638 int c = COMPOSITION_GLYPH (cmp, i); |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
639 |
101774
d4f9e4244d5a
(encode_terminal_code): Fix handling of composition.
Kenichi Handa <handa@m17n.org>
parents:
101690
diff
changeset
|
640 if (c == '\t') |
d4f9e4244d5a
(encode_terminal_code): Fix handling of composition.
Kenichi Handa <handa@m17n.org>
parents:
101690
diff
changeset
|
641 continue; |
d4f9e4244d5a
(encode_terminal_code): Fix handling of composition.
Kenichi Handa <handa@m17n.org>
parents:
101690
diff
changeset
|
642 if (char_charset (c, charset_list, NULL)) |
d4f9e4244d5a
(encode_terminal_code): Fix handling of composition.
Kenichi Handa <handa@m17n.org>
parents:
101690
diff
changeset
|
643 { |
d4f9e4244d5a
(encode_terminal_code): Fix handling of composition.
Kenichi Handa <handa@m17n.org>
parents:
101690
diff
changeset
|
644 if (CHAR_WIDTH (c) == 0 |
d4f9e4244d5a
(encode_terminal_code): Fix handling of composition.
Kenichi Handa <handa@m17n.org>
parents:
101690
diff
changeset
|
645 && i > 0 && COMPOSITION_GLYPH (cmp, i - 1) == '\t') |
d4f9e4244d5a
(encode_terminal_code): Fix handling of composition.
Kenichi Handa <handa@m17n.org>
parents:
101690
diff
changeset
|
646 /* Should be left-padded */ |
d4f9e4244d5a
(encode_terminal_code): Fix handling of composition.
Kenichi Handa <handa@m17n.org>
parents:
101690
diff
changeset
|
647 { |
d4f9e4244d5a
(encode_terminal_code): Fix handling of composition.
Kenichi Handa <handa@m17n.org>
parents:
101690
diff
changeset
|
648 buf += CHAR_STRING (' ', buf); |
d4f9e4244d5a
(encode_terminal_code): Fix handling of composition.
Kenichi Handa <handa@m17n.org>
parents:
101690
diff
changeset
|
649 nchars++; |
d4f9e4244d5a
(encode_terminal_code): Fix handling of composition.
Kenichi Handa <handa@m17n.org>
parents:
101690
diff
changeset
|
650 } |
d4f9e4244d5a
(encode_terminal_code): Fix handling of composition.
Kenichi Handa <handa@m17n.org>
parents:
101690
diff
changeset
|
651 } |
d4f9e4244d5a
(encode_terminal_code): Fix handling of composition.
Kenichi Handa <handa@m17n.org>
parents:
101690
diff
changeset
|
652 else |
d4f9e4244d5a
(encode_terminal_code): Fix handling of composition.
Kenichi Handa <handa@m17n.org>
parents:
101690
diff
changeset
|
653 c = '?'; |
97830
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
654 buf += CHAR_STRING (c, buf); |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
655 nchars++; |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
656 } |
90638 | 657 } |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
658 /* We must skip glyphs to be padded for a wide character. */ |
90638 | 659 else if (! CHAR_GLYPH_PADDING_P (*src)) |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
660 { |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
661 GLYPH g; |
90059
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
662 int c; |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
663 Lisp_Object string; |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
664 |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
665 string = Qnil; |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
666 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
|
667 |
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
668 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
|
669 { |
98367
758774f72111
(encode_terminal_code): Fix a typo in a comment.
Eli Zaretskii <eliz@gnu.org>
parents:
98155
diff
changeset
|
670 /* This glyph doesn't have 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
|
671 c = src->u.ch; |
26871
aaf45e665b14
(encode_terminal_code): Delete codes for a composite
Kenichi Handa <handa@m17n.org>
parents:
26425
diff
changeset
|
672 } |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
673 else |
19035 | 674 { |
26999
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
diff
changeset
|
675 /* 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
|
676 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
|
677 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
|
678 |
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
diff
changeset
|
679 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
|
680 /* 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
|
681 (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
|
682 c = GLYPH_CHAR (g); |
26999
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
diff
changeset
|
683 else |
89563
d193de460ec1
(terminal_encode_buffer, terminal_encode_buf_size): New
Kenichi Handa <handa@m17n.org>
parents:
89483
diff
changeset
|
684 /* 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
|
685 string = tbase[GLYPH_CHAR (g)]; |
19035 | 686 } |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
687 |
89563
d193de460ec1
(terminal_encode_buffer, terminal_encode_buf_size): New
Kenichi Handa <handa@m17n.org>
parents:
89483
diff
changeset
|
688 if (NILP (string)) |
d193de460ec1
(terminal_encode_buffer, terminal_encode_buf_size): New
Kenichi Handa <handa@m17n.org>
parents:
89483
diff
changeset
|
689 { |
90638 | 690 nbytes = buf - encode_terminal_src; |
691 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
|
692 { |
90638 | 693 encode_terminal_src_size = nbytes + MAX_MULTIBYTE_LENGTH; |
694 encode_terminal_src = xrealloc (encode_terminal_src, | |
695 encode_terminal_src_size); | |
696 buf = encode_terminal_src + nbytes; | |
697 } | |
90059
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
698 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
|
699 { |
89566
86c0ff434620
(encode_terminal_code): Don't handle glyph-table. Check
Kenichi Handa <handa@m17n.org>
parents:
89563
diff
changeset
|
700 /* 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
|
701 buf += CHAR_STRING (c, buf); |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
702 nchars++; |
26999
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
diff
changeset
|
703 } |
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
diff
changeset
|
704 else |
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
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 /* C is not encodable. */ |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
707 *buf++ = '?'; |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
708 nchars++; |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
709 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
|
710 { |
90059
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
711 *buf++ = '?'; |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
712 nchars++; |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
713 src++; |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
714 } |
26999
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
diff
changeset
|
715 } |
19035 | 716 } |
89563
d193de460ec1
(terminal_encode_buffer, terminal_encode_buf_size): New
Kenichi Handa <handa@m17n.org>
parents:
89483
diff
changeset
|
717 else |
23338
0a2b76b09162
(encode_terminal_code): Handle raw 8-bit codes correctly.
Kenichi Handa <handa@m17n.org>
parents:
23066
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 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
|
720 |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
721 if (! STRING_MULTIBYTE (string)) |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
722 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
|
723 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
|
724 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
|
725 { |
90059
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
726 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
|
727 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
|
728 encode_terminal_src_size); |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
729 buf = encode_terminal_src + nbytes; |
89563
d193de460ec1
(terminal_encode_buffer, terminal_encode_buf_size): New
Kenichi Handa <handa@m17n.org>
parents:
89483
diff
changeset
|
730 } |
90059
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
731 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
|
732 buf += SBYTES (string); |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
733 nchars += SCHARS (string); |
23338
0a2b76b09162
(encode_terminal_code): Handle raw 8-bit codes correctly.
Kenichi Handa <handa@m17n.org>
parents:
23066
diff
changeset
|
734 } |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
735 } |
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
736 src++; |
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
737 } |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
738 |
90059
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
739 if (nchars == 0) |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
740 { |
90059
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
741 coding->produced = 0; |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
742 return NULL; |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
743 } |
90059
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
744 |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
745 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
|
746 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
|
747 if (encode_terminal_dst_size == 0) |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
748 { |
90059
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
749 encode_terminal_dst_size = encode_terminal_src_size; |
100276
8f4457a692c5
(encode_terminal_code): Free any previous memory blocks
Chong Yidong <cyd@stupidchicken.com>
parents:
98367
diff
changeset
|
750 if (encode_terminal_dst) |
8f4457a692c5
(encode_terminal_code): Free any previous memory blocks
Chong Yidong <cyd@stupidchicken.com>
parents:
98367
diff
changeset
|
751 encode_terminal_dst = xrealloc (encode_terminal_dst, |
8f4457a692c5
(encode_terminal_code): Free any previous memory blocks
Chong Yidong <cyd@stupidchicken.com>
parents:
98367
diff
changeset
|
752 encode_terminal_dst_size); |
8f4457a692c5
(encode_terminal_code): Free any previous memory blocks
Chong Yidong <cyd@stupidchicken.com>
parents:
98367
diff
changeset
|
753 else |
8f4457a692c5
(encode_terminal_code): Free any previous memory blocks
Chong Yidong <cyd@stupidchicken.com>
parents:
98367
diff
changeset
|
754 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
|
755 } |
90059
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
756 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
|
757 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
|
758 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
|
759 /* 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
|
760 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
|
761 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
|
762 |
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
763 return (encode_terminal_dst); |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
764 } |
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
765 |
253 | 766 |
91041 | 767 |
83025
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
768 /* 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
|
769 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
770 static void |
83100
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
771 tty_write_glyphs (struct frame *f, struct glyph *string, int len) |
253 | 772 { |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
773 unsigned char *conversion_buffer; |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
774 struct coding_system *coding; |
253 | 775 |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
776 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
|
777 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
778 tty_turn_off_insert (tty); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
779 tty_hide_cursor (tty); |
253 | 780 |
25002 | 781 /* Don't dare write in last column of bottom line, if Auto-Wrap, |
765 | 782 since that would scroll the whole frame on some terminals. */ |
253 | 783 |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
784 if (AutoWrap (tty) |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
785 && 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
|
786 && (curX (tty) + len) == FRAME_COLS (f)) |
253 | 787 len --; |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
788 if (len <= 0) |
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
789 return; |
253 | 790 |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
791 cmplus (tty, len); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
792 |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
793 /* 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
|
794 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
|
795 because it always return 1 if the member src_multibyte is 1. */ |
83231 | 796 coding = (FRAME_TERMINAL_CODING (f)->common_flags & CODING_REQUIRE_ENCODING_MASK |
797 ? 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
|
798 /* 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
|
799 the tail. */ |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
800 coding->mode &= ~CODING_MODE_LAST_BLOCK; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
801 |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
802 while (len > 0) |
253 | 803 { |
25002 | 804 /* 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
|
805 int face_id = string->face_id; |
25002 | 806 int n; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
807 |
25002 | 808 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
|
809 if (string[n].face_id != face_id) |
25002 | 810 break; |
811 | |
812 /* 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
|
813 tty_highlight_if_desired (tty); |
25002 | 814 turn_on_face (f, face_id); |
815 | |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
816 if (n == len) |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
817 /* This is the last run. */ |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
818 coding->mode |= CODING_MODE_LAST_BLOCK; |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
819 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
|
820 if (coding->produced > 0) |
253 | 821 { |
76627
c53e7d075f1a
Include blockinput.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75348
diff
changeset
|
822 BLOCK_INPUT; |
83231 | 823 fwrite (conversion_buffer, 1, coding->produced, tty->output); |
824 if (ferror (tty->output)) | |
825 clearerr (tty->output); | |
826 if (tty->termscript) | |
827 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
|
828 UNBLOCK_INPUT; |
253 | 829 } |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
830 len -= n; |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
831 string += n; |
25002 | 832 |
833 /* Turn appearance modes off. */ | |
834 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
|
835 tty_turn_off_highlight (tty); |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
836 } |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
837 |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
838 cmcheckmagic (tty); |
253 | 839 } |
840 | |
84981
a35153116cd0
(term_clear_mouse_face, term_mouse_highlight)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84969
diff
changeset
|
841 #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
|
842 |
83622 | 843 static void |
844 tty_write_glyphs_with_face (f, string, len, face_id) | |
845 register struct frame *f; | |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
846 register struct glyph *string; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
847 register int len, face_id; |
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 unsigned char *conversion_buffer; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
850 struct coding_system *coding; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
851 |
83622 | 852 struct tty_display_info *tty = FRAME_TTY (f); |
853 | |
854 tty_turn_off_insert (tty); | |
855 tty_hide_cursor (tty); | |
80979
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 /* 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
|
858 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
|
859 |
83622 | 860 if (AutoWrap (tty) |
861 && curY (tty) + 1 == FRAME_LINES (f) | |
862 && (curX (tty) + len) == FRAME_COLS (f)) | |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
863 len --; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
864 if (len <= 0) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
865 return; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
866 |
83622 | 867 cmplus (tty, len); |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
868 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
869 /* 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
|
870 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
|
871 because it always return 1 if the member src_multibyte is 1. */ |
83622 | 872 coding = (FRAME_TERMINAL_CODING (f)->common_flags & CODING_REQUIRE_ENCODING_MASK |
873 ? 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
|
874 /* 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
|
875 the tail. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
876 coding->mode &= ~CODING_MODE_LAST_BLOCK; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
877 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
878 /* Turn appearance modes of the face. */ |
83622 | 879 tty_highlight_if_desired (tty); |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
880 turn_on_face (f, face_id); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
881 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
882 coding->mode |= CODING_MODE_LAST_BLOCK; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
883 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
|
884 if (coding->produced > 0) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
885 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
886 BLOCK_INPUT; |
83622 | 887 fwrite (conversion_buffer, 1, coding->produced, tty->output); |
888 if (ferror (tty->output)) | |
889 clearerr (tty->output); | |
890 if (tty->termscript) | |
891 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
|
892 UNBLOCK_INPUT; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
893 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
894 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
895 /* Turn appearance modes off. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
896 turn_off_face (f, face_id); |
83622 | 897 tty_turn_off_highlight (tty); |
898 | |
899 cmcheckmagic (tty); | |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
900 } |
84981
a35153116cd0
(term_clear_mouse_face, term_mouse_highlight)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84969
diff
changeset
|
901 #endif |
83622 | 902 |
83025
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
903 /* 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
|
904 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
905 static void |
83100
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
906 tty_insert_glyphs (struct frame *f, struct glyph *start, int len) |
253 | 907 { |
908 char *buf; | |
31829
43566b0aec59
Avoid some more compiler warnings.
Gerd Moellmann <gerd@gnu.org>
parents:
31102
diff
changeset
|
909 struct glyph *glyph = NULL; |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
910 unsigned char *conversion_buffer; |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
911 unsigned char space[1]; |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
912 struct coding_system *coding; |
253 | 913 |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
914 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
|
915 |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
916 if (tty->TS_ins_multi_chars) |
253 | 917 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
918 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
|
919 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
|
920 xfree (buf); |
253 | 921 if (start) |
83100
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
922 write_glyphs (f, start, len); |
253 | 923 return; |
924 } | |
25002 | 925 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
926 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
|
927 cmplus (tty, len); |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
928 |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
929 if (! start) |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
930 space[0] = SPACEGLYPH; |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
931 |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
932 /* 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
|
933 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
|
934 because it always return 1 if the member src_multibyte is 1. */ |
83231 | 935 coding = (FRAME_TERMINAL_CODING (f)->common_flags & CODING_REQUIRE_ENCODING_MASK |
936 ? 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
|
937 /* 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
|
938 the tail. */ |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
939 coding->mode &= ~CODING_MODE_LAST_BLOCK; |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
940 |
17191
36caec9c2e52
(insert_glyphs): Fix a bug which turns up when
Kenichi Handa <handa@m17n.org>
parents:
17180
diff
changeset
|
941 while (len-- > 0) |
253 | 942 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
943 OUTPUT1_IF (tty, tty->TS_ins_char); |
253 | 944 if (!start) |
26999
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
diff
changeset
|
945 { |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
946 conversion_buffer = space; |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
947 coding->produced = 1; |
26999
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
diff
changeset
|
948 } |
253 | 949 else |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
950 { |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
951 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
|
952 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
|
953 glyph = start; |
25002 | 954 ++start; |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
955 /* 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
|
956 occupies more than one column. */ |
25002 | 957 while (len && CHAR_GLYPH_PADDING_P (*start)) |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
958 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
959 OUTPUT1_IF (tty, tty->TS_ins_char); |
17046
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
960 start++, len--; |
84b0e9794a87
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16894
diff
changeset
|
961 } |
26999
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
diff
changeset
|
962 |
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
diff
changeset
|
963 if (len <= 0) |
5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
26902
diff
changeset
|
964 /* This is the last glyph. */ |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
965 coding->mode |= CODING_MODE_LAST_BLOCK; |
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
966 |
83231 | 967 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
|
968 } |
253 | 969 |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
970 if (coding->produced > 0) |
253 | 971 { |
76627
c53e7d075f1a
Include blockinput.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75348
diff
changeset
|
972 BLOCK_INPUT; |
83231 | 973 fwrite (conversion_buffer, 1, coding->produced, tty->output); |
83065
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
974 if (ferror (tty->output)) |
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
975 clearerr (tty->output); |
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
976 if (tty->termscript) |
83231 | 977 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
|
978 UNBLOCK_INPUT; |
253 | 979 } |
980 | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
981 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
|
982 if (start) |
30848
fc80dcfc32cd
(write_glyphs): Also turn off inverse video after turning
Gerd Moellmann <gerd@gnu.org>
parents:
30836
diff
changeset
|
983 { |
fc80dcfc32cd
(write_glyphs): Also turn off inverse video after turning
Gerd Moellmann <gerd@gnu.org>
parents:
30836
diff
changeset
|
984 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
|
985 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
|
986 } |
10439
1fcbeb4410f6
(write_glyphs, insert_glyphs): Call checkmagic.
Karl Heuer <kwzh@gnu.org>
parents:
10332
diff
changeset
|
987 } |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
988 |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
989 cmcheckmagic (tty); |
253 | 990 } |
991 | |
83025
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
992 /* 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
|
993 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
994 static void |
83100
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
995 tty_delete_glyphs (struct frame *f, int n) |
253 | 996 { |
997 char *buf; | |
998 register int i; | |
999 | |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
1000 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
|
1001 |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1002 if (tty->delete_in_insert_mode) |
253 | 1003 { |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
1004 tty_turn_on_insert (tty); |
253 | 1005 } |
1006 else | |
1007 { | |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
1008 tty_turn_off_insert (tty); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1009 OUTPUT_IF (tty, tty->TS_delete_mode); |
253 | 1010 } |
1011 | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1012 if (tty->TS_del_multi_chars) |
253 | 1013 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1014 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
|
1015 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
|
1016 xfree (buf); |
253 | 1017 } |
1018 else | |
1019 for (i = 0; i < n; i++) | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1020 OUTPUT1 (tty, tty->TS_del_char); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1021 if (!tty->delete_in_insert_mode) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1022 OUTPUT_IF (tty, tty->TS_end_delete_mode); |
253 | 1023 } |
1024 | |
83025
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
1025 /* 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
|
1026 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
1027 static void |
83100
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
1028 tty_ins_del_lines (struct frame *f, int vpos, int n) |
253 | 1029 { |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
1030 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
|
1031 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
|
1032 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
|
1033 char *scroll = n > 0 ? tty->TS_rev_scroll : tty->TS_fwd_scroll; |
253 | 1034 |
1035 register int i = n > 0 ? n : -n; | |
1036 register char *buf; | |
1037 | |
1038 /* If the lines below the insertion are being pushed | |
1039 into the end of the window, this is the same as clearing; | |
1040 and we know the lines are already clear, since the matching | |
1041 deletion has already been done. So can ignore this. */ | |
1042 /* If the lines below the deletion are blank lines coming | |
1043 out of the end of the window, don't bother, | |
1044 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
|
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 && vpos + i >= tty->specified_window) |
253 | 1047 return; |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
1048 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
|
1049 && vpos + i >= FRAME_LINES (f)) |
253 | 1050 return; |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
1051 |
253 | 1052 if (multi) |
1053 { | |
83102
a330cf2446ad
Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents:
83100
diff
changeset
|
1054 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
|
1055 tty_background_highlight (tty); |
253 | 1056 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
|
1057 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
|
1058 xfree (buf); |
253 | 1059 } |
1060 else if (single) | |
1061 { | |
83102
a330cf2446ad
Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents:
83100
diff
changeset
|
1062 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
|
1063 tty_background_highlight (tty); |
253 | 1064 while (--i >= 0) |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
1065 OUTPUT (tty, single); |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
1066 if (tty->TF_teleray) |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
1067 curX (tty) = 0; |
253 | 1068 } |
1069 else | |
1070 { | |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
1071 tty_set_scroll_region (f, vpos, tty->specified_window); |
253 | 1072 if (n < 0) |
83102
a330cf2446ad
Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents:
83100
diff
changeset
|
1073 raw_cursor_to (f, tty->specified_window - 1, 0); |
253 | 1074 else |
83102
a330cf2446ad
Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents:
83100
diff
changeset
|
1075 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
|
1076 tty_background_highlight (tty); |
253 | 1077 while (--i >= 0) |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
1078 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
|
1079 tty_set_scroll_region (f, 0, tty->specified_window); |
253 | 1080 } |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
1081 |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
1082 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
|
1083 && 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
|
1084 && n < 0) |
253 | 1085 { |
83100
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
1086 cursor_to (f, FRAME_LINES (f) + n, 0); |
4970ad4995f5
Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
83095
diff
changeset
|
1087 clear_to_end (f); |
253 | 1088 } |
1089 } | |
1090 | |
1091 /* Compute cost of sending "str", in characters, | |
1092 not counting any line-dependent padding. */ | |
1093 | |
1094 int | |
83102
a330cf2446ad
Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents:
83100
diff
changeset
|
1095 string_cost (char *str) |
253 | 1096 { |
1097 cost = 0; | |
1098 if (str) | |
1099 tputs (str, 0, evalcost); | |
1100 return cost; | |
1101 } | |
1102 | |
1103 /* Compute cost of sending "str", in characters, | |
1104 counting any line-dependent padding at one line. */ | |
1105 | |
1106 static int | |
83102
a330cf2446ad
Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents:
83100
diff
changeset
|
1107 string_cost_one_line (char *str) |
253 | 1108 { |
1109 cost = 0; | |
1110 if (str) | |
1111 tputs (str, 1, evalcost); | |
1112 return cost; | |
1113 } | |
1114 | |
1115 /* Compute per line amount of line-dependent padding, | |
1116 in tenths of characters. */ | |
1117 | |
1118 int | |
83102
a330cf2446ad
Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents:
83100
diff
changeset
|
1119 per_line_cost (char *str) |
253 | 1120 { |
1121 cost = 0; | |
1122 if (str) | |
1123 tputs (str, 0, evalcost); | |
1124 cost = - cost; | |
1125 if (str) | |
1126 tputs (str, 10, evalcost); | |
1127 return cost; | |
1128 } | |
1129 | |
1130 #ifndef old | |
1131 /* 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
|
1132 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
|
1133 The length of this vector is based on max_frame_cols. */ |
253 | 1134 |
1135 int *char_ins_del_vector; | |
1136 | |
51212
332134065648
Make (some) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50227
diff
changeset
|
1137 #define char_ins_del_cost(f) (&char_ins_del_vector[FRAME_COLS ((f))]) |
253 | 1138 #endif |
1139 | |
1140 /* ARGSUSED */ | |
1141 static void | |
83102
a330cf2446ad
Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents:
83100
diff
changeset
|
1142 calculate_ins_del_char_costs (struct frame *f) |
253 | 1143 { |
82989
f3845715a5f6
Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
82988
diff
changeset
|
1144 struct tty_display_info *tty = FRAME_TTY (f); |
253 | 1145 int ins_startup_cost, del_startup_cost; |
1146 int ins_cost_per_char, del_cost_per_char; | |
1147 register int i; | |
1148 register int *p; | |
1149 | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1150 if (tty->TS_ins_multi_chars) |
253 | 1151 { |
1152 ins_cost_per_char = 0; | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1153 ins_startup_cost = string_cost_one_line (tty->TS_ins_multi_chars); |
253 | 1154 } |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1155 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
|
1156 || (tty->TS_insert_mode && tty->TS_end_insert_mode)) |
253 | 1157 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1158 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
|
1159 + string_cost (tty->TS_end_insert_mode))) / 100; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1160 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
|
1161 + string_cost_one_line (tty->TS_pad_inserted_char)); |
253 | 1162 } |
1163 else | |
1164 { | |
1165 ins_startup_cost = 9999; | |
1166 ins_cost_per_char = 0; | |
1167 } | |
1168 | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1169 if (tty->TS_del_multi_chars) |
253 | 1170 { |
1171 del_cost_per_char = 0; | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1172 del_startup_cost = string_cost_one_line (tty->TS_del_multi_chars); |
253 | 1173 } |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1174 else if (tty->TS_del_char) |
253 | 1175 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1176 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
|
1177 + string_cost (tty->TS_end_delete_mode)); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1178 if (tty->delete_in_insert_mode) |
253 | 1179 del_startup_cost /= 2; |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1180 del_cost_per_char = string_cost_one_line (tty->TS_del_char); |
253 | 1181 } |
1182 else | |
1183 { | |
1184 del_startup_cost = 9999; | |
1185 del_cost_per_char = 0; | |
1186 } | |
1187 | |
1188 /* Delete costs are at negative offsets */ | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1189 p = &char_ins_del_cost (f)[0]; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1190 for (i = FRAME_COLS (f); --i >= 0;) |
253 | 1191 *--p = (del_startup_cost += del_cost_per_char); |
1192 | |
1193 /* Doing nothing is free */ | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1194 p = &char_ins_del_cost (f)[0]; |
253 | 1195 *p++ = 0; |
1196 | |
1197 /* Insert costs are at positive offsets */ | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1198 for (i = FRAME_COLS (f); --i >= 0;) |
253 | 1199 *p++ = (ins_startup_cost += ins_cost_per_char); |
1200 } | |
1201 | |
21514 | 1202 void |
83102
a330cf2446ad
Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents:
83100
diff
changeset
|
1203 calculate_costs (struct frame *frame) |
253 | 1204 { |
10121
3f9f77a9488d
(calculate_costs): Set FRAME_COST_BAUD_RATE.
Richard M. Stallman <rms@gnu.org>
parents:
9797
diff
changeset
|
1205 FRAME_COST_BAUD_RATE (frame) = baud_rate; |
253 | 1206 |
53226
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
1207 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
|
1208 { |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1209 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
|
1210 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
|
1211 ? 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
|
1212 : 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
|
1213 |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1214 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
|
1215 |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1216 tty->costs_set = 1; |
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 /* 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
|
1219 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
|
1220 used afterwards. |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1221 |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1222 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
|
1223 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
|
1224 |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1225 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
|
1226 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
|
1227 |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1228 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
|
1229 char_ins_del_vector |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1230 = (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
|
1231 (sizeof (int) |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1232 + 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
|
1233 else |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1234 char_ins_del_vector |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1235 = (int *) xmalloc (sizeof (int) |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1236 + 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
|
1237 |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1238 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
|
1239 + 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
|
1240 |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1241 |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1242 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
|
1243 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
|
1244 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
|
1245 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
|
1246 f, f, 1); |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1247 else |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1248 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
|
1249 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
|
1250 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
|
1251 0, 0, 1); |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1252 |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1253 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
|
1254 |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1255 /* 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
|
1256 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
|
1257 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
|
1258 else |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1259 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
|
1260 |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
1261 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
|
1262 } |
253 | 1263 } |
1264 | |
1015
58c373be762c
* term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents:
969
diff
changeset
|
1265 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
|
1266 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
|
1267 }; |
58c373be762c
* term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents:
969
diff
changeset
|
1268 |
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
|
1269 /* 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
|
1270 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
|
1271 (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
|
1272 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
|
1273 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
|
1274 */ |
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 |
25002 | 1276 static struct fkey_table keys[] = |
1277 { | |
42122
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1278 {"kh", "home"}, /* termcap */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1279 {"kl", "left"}, /* termcap */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1280 {"ku", "up"}, /* termcap */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1281 {"kr", "right"}, /* termcap */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1282 {"kd", "down"}, /* termcap */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1283 {"%8", "prior"}, /* terminfo */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1284 {"%5", "next"}, /* terminfo */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1285 {"@7", "end"}, /* terminfo */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1286 {"@1", "begin"}, /* terminfo */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1287 {"*6", "select"}, /* terminfo */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1288 {"%9", "print"}, /* terminfo */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1289 {"@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
|
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 * "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
|
1292 */ |
42122
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1293 {"&8", "undo"}, /* terminfo */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1294 {"%0", "redo"}, /* terminfo */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1295 {"%7", "menu"}, /* terminfo --- actually the `options' key */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1296 {"@0", "find"}, /* terminfo */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1297 {"@2", "cancel"}, /* terminfo */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1298 {"%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
|
1299 /* |
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 * "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
|
1301 */ |
42122
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1302 {"&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
|
1303 /* |
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 * "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
|
1305 */ |
42122
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1306 {"kE", "clearline"}, /* terminfo */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1307 {"kA", "insertline"}, /* terminfo */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1308 {"kL", "deleteline"}, /* terminfo */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1309 {"kI", "insertchar"}, /* terminfo */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1310 {"kD", "deletechar"}, /* terminfo */ |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1311 {"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
|
1312 /* |
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
|
1313 * "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
|
1314 */ |
42122
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1315 {"@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
|
1316 /* |
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
|
1317 * "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
|
1318 * "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
|
1319 * "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
|
1320 * --- 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
|
1321 */ |
42122
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1322 {"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
|
1323 /* |
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
|
1324 * "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
|
1325 */ |
42122
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1326 {"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
|
1327 /* |
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
|
1328 * "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
|
1329 */ |
42122
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1330 {"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
|
1331 /* |
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
|
1332 * "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
|
1333 */ |
42122
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1334 {"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
|
1335 /* |
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
|
1336 * "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
|
1337 */ |
42122
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1338 {"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
|
1339 /* |
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
|
1340 * "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
|
1341 */ |
42122
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1342 {"k1", "f1"}, |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1343 {"k2", "f2"}, |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1344 {"k3", "f3"}, |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1345 {"k4", "f4"}, |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1346 {"k5", "f5"}, |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1347 {"k6", "f6"}, |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1348 {"k7", "f7"}, |
706558f91b28
(keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
40086
diff
changeset
|
1349 {"k8", "f8"}, |
61591
b015e12637bc
(struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59382
diff
changeset
|
1350 {"k9", "f9"}, |
b015e12637bc
(struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59382
diff
changeset
|
1351 |
b015e12637bc
(struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59382
diff
changeset
|
1352 {"&0", "S-cancel"}, /*shifted cancel key*/ |
b015e12637bc
(struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59382
diff
changeset
|
1353 {"&9", "S-begin"}, /*shifted begin key*/ |
b015e12637bc
(struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59382
diff
changeset
|
1354 {"*0", "S-find"}, /*shifted find key*/ |
b015e12637bc
(struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59382
diff
changeset
|
1355 {"*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
|
1356 {"*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
|
1357 {"*7", "S-end"}, /*shifted end key*/ |
b015e12637bc
(struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59382
diff
changeset
|
1358 {"*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
|
1359 {"#1", "S-help"}, /*shifted help key*/ |
b015e12637bc
(struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59382
diff
changeset
|
1360 {"#2", "S-home"}, /*shifted home key*/ |
b015e12637bc
(struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59382
diff
changeset
|
1361 {"#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
|
1362 {"#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
|
1363 {"%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
|
1364 {"%c", "S-next"}, /*shifted next key*/ |
b015e12637bc
(struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59382
diff
changeset
|
1365 {"%e", "S-prior"}, /*shifted previous key*/ |
b015e12637bc
(struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59382
diff
changeset
|
1366 {"%f", "S-print"}, /*shifted print key*/ |
b015e12637bc
(struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59382
diff
changeset
|
1367 {"%g", "S-redo"}, /*shifted redo key*/ |
b015e12637bc
(struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59382
diff
changeset
|
1368 {"%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
|
1369 {"!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
|
1370 }; |
58c373be762c
* term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents:
969
diff
changeset
|
1371 |
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
|
1372 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
|
1373 static KBOARD *term_get_fkeys_kboard; |
6248
0e4319197d29
(term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents:
5933
diff
changeset
|
1374 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
|
1375 |
85106
fd282fb888de
Add new `input-decode-map' keymap and use it for temrinal
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84981
diff
changeset
|
1376 /* 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
|
1377 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
|
1378 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
|
1379 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
1380 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
|
1381 term_get_fkeys (address, kboard) |
533 | 1382 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
|
1383 KBOARD *kboard; |
533 | 1384 { |
6248
0e4319197d29
(term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents:
5933
diff
changeset
|
1385 /* 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
|
1386 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
|
1387 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
|
1388 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
|
1389 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
|
1390 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
|
1391 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
|
1392 |
0e4319197d29
(term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents:
5933
diff
changeset
|
1393 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
|
1394 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
|
1395 term_get_fkeys_kboard = kboard; |
6248
0e4319197d29
(term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents:
5933
diff
changeset
|
1396 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
|
1397 } |
0e4319197d29
(term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents:
5933
diff
changeset
|
1398 |
0e4319197d29
(term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents:
5933
diff
changeset
|
1399 static Lisp_Object |
0e4319197d29
(term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents:
5933
diff
changeset
|
1400 term_get_fkeys_1 () |
0e4319197d29
(term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents:
5933
diff
changeset
|
1401 { |
533 | 1402 int i; |
1403 | |
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
|
1404 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
|
1405 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
|
1406 |
3359
ef29e2a4fc46
(term_get_fkeys): If not initialized, init Vfunction_key_map.
Richard M. Stallman <rms@gnu.org>
parents:
2961
diff
changeset
|
1407 /* 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
|
1408 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
|
1409 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
|
1410 |
533 | 1411 for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++) |
1412 { | |
1413 char *sequence = tgetstr (keys[i].cap, address); | |
1414 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
|
1415 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
|
1416 Fmake_vector (make_number (1), |
0e4319197d29
(term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents:
5933
diff
changeset
|
1417 intern (keys[i].name))); |
533 | 1418 } |
1015
58c373be762c
* term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents:
969
diff
changeset
|
1419 |
58c373be762c
* term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents:
969
diff
changeset
|
1420 /* 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
|
1421 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
|
1422 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
|
1423 "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
|
1424 */ |
58c373be762c
* term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents:
969
diff
changeset
|
1425 { |
58c373be762c
* term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents:
969
diff
changeset
|
1426 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
|
1427 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
|
1428 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
|
1429 |
58c373be762c
* term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents:
969
diff
changeset
|
1430 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
|
1431 { |
43073
c9baf4b00820
(term_get_fkeys_1): If `k0' and `k;' are both specified and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42959
diff
changeset
|
1432 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
|
1433 /* 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
|
1434 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
|
1435 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
|
1436 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
|
1437 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
|
1438 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
|
1439 } |
43073
c9baf4b00820
(term_get_fkeys_1): If `k0' and `k;' are both specified and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42959
diff
changeset
|
1440 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
|
1441 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
|
1442 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
|
1443 } |
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
|
1444 |
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
|
1445 /* 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
|
1446 { |
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
|
1447 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
|
1448 |
3489
5c2b4797aab2
(term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents:
3359
diff
changeset
|
1449 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
|
1450 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
|
1451 { |
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
|
1452 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
|
1453 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
|
1454 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
|
1455 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
|
1456 else |
10481
24756aef26e3
(term_get_fkeys_1): Bug fix for function key above f19.
Richard M. Stallman <rms@gnu.org>
parents:
10439
diff
changeset
|
1457 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
|
1458 |
3489
5c2b4797aab2
(term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents:
3359
diff
changeset
|
1459 { |
5c2b4797aab2
(term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents:
3359
diff
changeset
|
1460 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
|
1461 if (sequence) |
5c2b4797aab2
(term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents:
3359
diff
changeset
|
1462 { |
4543
929e4c850e76
(term_get_fkeys_define_1, term_get_fkeys_define): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
4499
diff
changeset
|
1463 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
|
1464 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
|
1465 Fmake_vector (make_number (1), |
0e4319197d29
(term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents:
5933
diff
changeset
|
1466 intern (fkey))); |
3489
5c2b4797aab2
(term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents:
3359
diff
changeset
|
1467 } |
5c2b4797aab2
(term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents:
3359
diff
changeset
|
1468 } |
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
|
1469 } |
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 } |
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
|
1471 |
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
|
1472 /* |
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
|
1473 * 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
|
1474 */ |
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
|
1475 { |
3489
5c2b4797aab2
(term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents:
3359
diff
changeset
|
1476 #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
|
1477 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
|
1478 { \ |
5c2b4797aab2
(term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents:
3359
diff
changeset
|
1479 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
|
1480 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
|
1481 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
|
1482 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
|
1483 intern (sym))); \ |
3489
5c2b4797aab2
(term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents:
3359
diff
changeset
|
1484 } |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
1485 |
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
|
1486 /* 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
|
1487 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
|
1488 /* 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
|
1489 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
|
1490 /* 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
|
1491 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
|
1492 /* 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
|
1493 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
|
1494 |
f42e5fd15f6f
(term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents:
8898
diff
changeset
|
1495 /* 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
|
1496 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
|
1497 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
|
1498 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
|
1499 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
|
1500 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
|
1501 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
|
1502 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
|
1503 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
|
1504 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
|
1505 CONDITIONAL_REASSIGN ("*6", "kU", "select"); |
2224
49bda4cf498c
Supply second arg for tgetstr() calls.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2179
diff
changeset
|
1506 #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
|
1507 } |
25002 | 1508 |
1509 return Qnil; | |
533 | 1510 } |
1511 | |
1512 | |
25002 | 1513 /*********************************************************************** |
1514 Character Display Information | |
1515 ***********************************************************************/ | |
1516 | |
69637
8b3e0cacc358
Define aliases for append_glyph and produce_stretch_glyph
Kim F. Storm <storm@cua.dk>
parents:
68661
diff
changeset
|
1517 /* 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
|
1518 #ifdef static |
8b3e0cacc358
Define aliases for append_glyph and produce_stretch_glyph
Kim F. Storm <storm@cua.dk>
parents:
68661
diff
changeset
|
1519 #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
|
1520 #define produce_stretch_glyph produce_stretch_glyph_term |
90638 | 1521 #define append_composite_glyph append_composite_glyph_term |
1522 #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
|
1523 #endif |
8b3e0cacc358
Define aliases for append_glyph and produce_stretch_glyph
Kim F. Storm <storm@cua.dk>
parents:
68661
diff
changeset
|
1524 |
25002 | 1525 static void append_glyph P_ ((struct it *)); |
54428
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1526 static void produce_stretch_glyph P_ ((struct it *)); |
90638 | 1527 static void append_composite_glyph P_ ((struct it *)); |
1528 static void produce_composite_glyph P_ ((struct it *)); | |
25002 | 1529 |
1530 /* 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
|
1531 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
|
1532 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
|
1533 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
|
1534 IT->pixel_width > 1. */ |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
1535 |
25002 | 1536 static void |
1537 append_glyph (it) | |
1538 struct it *it; | |
1539 { | |
1540 struct glyph *glyph, *end; | |
1541 int i; | |
1542 | |
1543 xassert (it->glyph_row); | |
1544 glyph = (it->glyph_row->glyphs[it->area] | |
1545 + it->glyph_row->used[it->area]); | |
1546 end = it->glyph_row->glyphs[1 + it->area]; | |
1547 | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
1548 for (i = 0; |
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
1549 i < it->pixel_width && glyph < end; |
25002 | 1550 ++i) |
1551 { | |
1552 glyph->type = CHAR_GLYPH; | |
29462
3306af2e4f3d
(append_glyph): Revert change of 2000-06-06.
Gerd Moellmann <gerd@gnu.org>
parents:
29448
diff
changeset
|
1553 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
|
1554 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
|
1555 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
|
1556 glyph->padding_p = i > 0; |
25002 | 1557 glyph->charpos = CHARPOS (it->position); |
1558 glyph->object = it->object; | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
1559 |
25002 | 1560 ++it->glyph_row->used[it->area]; |
1561 ++glyph; | |
1562 } | |
1563 } | |
1564 | |
1565 | |
44372 | 1566 /* Produce glyphs for the display element described by IT. *IT |
1567 specifies what we want to produce a glyph for (character, image, ...), | |
1568 and where in the glyph matrix we currently are (glyph row and hpos). | |
1569 produce_glyphs fills in output fields of *IT with information such as the | |
1570 pixel width and height of a character, and maybe output actual glyphs at | |
25002 | 1571 the same time if IT->glyph_row is non-null. See the explanation of |
44372 | 1572 struct display_iterator in dispextern.h for an overview. |
1573 | |
1574 produce_glyphs also stores the result of glyph width, ascent | |
1575 etc. computations in *IT. | |
1576 | |
1577 IT->glyph_row may be null, in which case produce_glyphs does not | |
1578 actually fill in the glyphs. This is used in the move_* functions | |
1579 in xdisp.c for text width and height computations. | |
1580 | |
1581 Callers usually don't call produce_glyphs directly; | |
1582 instead they use the macro PRODUCE_GLYPHS. */ | |
25002 | 1583 |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
1584 void |
25002 | 1585 produce_glyphs (it) |
1586 struct it *it; | |
1587 { | |
1588 /* If a hook is installed, let it do the work. */ | |
90638 | 1589 |
1590 /* Nothing but characters are supported on terminal frames. */ | |
25002 | 1591 xassert (it->what == IT_CHARACTER |
26871
aaf45e665b14
(encode_terminal_code): Delete codes for a composite
Kenichi Handa <handa@m17n.org>
parents:
26425
diff
changeset
|
1592 || it->what == IT_COMPOSITION |
25002 | 1593 || it->what == IT_STRETCH); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
1594 |
54428
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1595 if (it->what == IT_STRETCH) |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1596 { |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1597 produce_stretch_glyph (it); |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1598 goto done; |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1599 } |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1600 |
90638 | 1601 if (it->what == IT_COMPOSITION) |
1602 { | |
1603 produce_composite_glyph (it); | |
1604 goto done; | |
1605 } | |
25002 | 1606 |
68661
4e22dd401a52
(append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents:
68651
diff
changeset
|
1607 /* 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
|
1608 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
|
1609 |
25002 | 1610 if (it->c >= 040 && it->c < 0177) |
1611 { | |
1612 it->pixel_width = it->nglyphs = 1; | |
1613 if (it->glyph_row) | |
1614 append_glyph (it); | |
1615 } | |
1616 else if (it->c == '\n') | |
1617 it->pixel_width = it->nglyphs = 0; | |
1618 else if (it->c == '\t') | |
1619 { | |
28685
b4310b6f3b5e
(produce_glyphs): Remove reference to struct it's prompt_width.
Gerd Moellmann <gerd@gnu.org>
parents:
28507
diff
changeset
|
1620 int absolute_x = (it->current_x |
25002 | 1621 + it->continuation_lines_width); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
1622 int next_tab_x |
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
1623 = (((1 + absolute_x + it->tab_width - 1) |
25002 | 1624 / it->tab_width) |
1625 * it->tab_width); | |
1626 int nspaces; | |
1627 | |
1628 /* If part of the TAB has been displayed on the previous line | |
1629 which is continued now, continuation_lines_width will have | |
1630 been incremented already by the part that fitted on the | |
1631 continued line. So, we will get the right number of spaces | |
1632 here. */ | |
1633 nspaces = next_tab_x - absolute_x; | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
1634 |
25002 | 1635 if (it->glyph_row) |
1636 { | |
1637 int n = nspaces; | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
1638 |
68661
4e22dd401a52
(append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents:
68651
diff
changeset
|
1639 it->char_to_display = ' '; |
25002 | 1640 it->pixel_width = it->len = 1; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
1641 |
25002 | 1642 while (n--) |
1643 append_glyph (it); | |
1644 } | |
1645 | |
1646 it->pixel_width = nspaces; | |
1647 it->nglyphs = nspaces; | |
1648 } | |
89566
86c0ff434620
(encode_terminal_code): Don't handle glyph-table. Check
Kenichi Handa <handa@m17n.org>
parents:
89563
diff
changeset
|
1649 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
|
1650 { |
68661
4e22dd401a52
(append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents:
68651
diff
changeset
|
1651 if (unibyte_display_via_language_environment |
90301
1f534e44acca
(produce_glyphs): Sync to HEAD.
Kenichi Handa <handa@m17n.org>
parents:
90294
diff
changeset
|
1652 && (it->c >= 0240)) |
68661
4e22dd401a52
(append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents:
68651
diff
changeset
|
1653 { |
105661
bac26aa40069
Remove leftover table unibyte_to_multibyte_table.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105426
diff
changeset
|
1654 it->char_to_display = BYTE8_TO_CHAR (it->c); |
90301
1f534e44acca
(produce_glyphs): Sync to HEAD.
Kenichi Handa <handa@m17n.org>
parents:
90294
diff
changeset
|
1655 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
|
1656 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
|
1657 if (it->glyph_row) |
4e22dd401a52
(append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents:
68651
diff
changeset
|
1658 append_glyph (it); |
4e22dd401a52
(append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents:
68651
diff
changeset
|
1659 } |
4e22dd401a52
(append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents:
68651
diff
changeset
|
1660 else |
4e22dd401a52
(append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents:
68651
diff
changeset
|
1661 { |
90301
1f534e44acca
(produce_glyphs): Sync to HEAD.
Kenichi Handa <handa@m17n.org>
parents:
90294
diff
changeset
|
1662 /* 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
|
1663 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
|
1664 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
|
1665 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
|
1666 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
|
1667 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
|
1668 if (it->glyph_row) |
4e22dd401a52
(append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents:
68651
diff
changeset
|
1669 append_glyph (it); |
4e22dd401a52
(append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents:
68651
diff
changeset
|
1670 } |
29262
b7059c9f98ac
(produce_glyphs): Don't treat eight-bit-* charsets as multibyte.
Eli Zaretskii <eliz@gnu.org>
parents:
29097
diff
changeset
|
1671 } |
25002 | 1672 else |
1673 { | |
88391
1953d0d56cd7
Include "buffer.h" and "character.h".
Kenichi Handa <handa@m17n.org>
parents:
43073
diff
changeset
|
1674 it->pixel_width = CHAR_WIDTH (it->c); |
25002 | 1675 it->nglyphs = it->pixel_width; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
1676 |
25002 | 1677 if (it->glyph_row) |
1678 append_glyph (it); | |
1679 } | |
1680 | |
54428
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1681 done: |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
1682 /* Advance current_x by the pixel width as a convenience for |
25002 | 1683 the caller. */ |
1684 if (it->area == TEXT_AREA) | |
1685 it->current_x += it->pixel_width; | |
25187
39feb68ed3c7
(produce_glyphs): Set iterator's physical height
Gerd Moellmann <gerd@gnu.org>
parents:
25002
diff
changeset
|
1686 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
|
1687 it->descent = it->max_descent = it->phys_descent = it->max_phys_descent = 1; |
25002 | 1688 } |
1689 | |
1690 | |
54428
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1691 /* 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
|
1692 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
|
1693 `(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
|
1694 being recognized: |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1695 |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1696 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
|
1697 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
|
1698 point number. |
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 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
|
1701 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
|
1702 |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1703 static void |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1704 produce_stretch_glyph (it) |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1705 struct it *it; |
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 /* (space :width WIDTH ...) */ |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1708 Lisp_Object prop, plist; |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1709 int width = 0, align_to = -1; |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1710 int zero_width_ok_p = 0; |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1711 double tem; |
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 /* List should start with `space'. */ |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1714 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
|
1715 plist = XCDR (it->object); |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1716 |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1717 /* Compute the width of the stretch. */ |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1718 if ((prop = Fplist_get (plist, QCwidth), !NILP (prop)) |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1719 && 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
|
1720 { |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1721 /* Absolute width `:width WIDTH' specified and valid. */ |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1722 zero_width_ok_p = 1; |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1723 width = (int)(tem + 0.5); |
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 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
|
1726 && 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
|
1727 { |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1728 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
|
1729 align_to = (align_to < 0 |
54428
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1730 ? 0 |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1731 : 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
|
1732 else if (align_to < 0) |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1733 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
|
1734 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
|
1735 zero_width_ok_p = 1; |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1736 } |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1737 else |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1738 /* Nothing specified -> width defaults to canonical char width. */ |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1739 width = FRAME_COLUMN_WIDTH (it->f); |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1740 |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1741 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
|
1742 width = 1; |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1743 |
102831
1f0beb33697b
* term.c (produce_stretch_glyph): Reduce width of stretch glyphs
Chong Yidong <cyd@stupidchicken.com>
parents:
102744
diff
changeset
|
1744 if (width > 0 && it->line_wrap != TRUNCATE |
1f0beb33697b
* term.c (produce_stretch_glyph): Reduce width of stretch glyphs
Chong Yidong <cyd@stupidchicken.com>
parents:
102744
diff
changeset
|
1745 && it->current_x + width > it->last_visible_x) |
1f0beb33697b
* term.c (produce_stretch_glyph): Reduce width of stretch glyphs
Chong Yidong <cyd@stupidchicken.com>
parents:
102744
diff
changeset
|
1746 width = it->last_visible_x - it->current_x - 1; |
1f0beb33697b
* term.c (produce_stretch_glyph): Reduce width of stretch glyphs
Chong Yidong <cyd@stupidchicken.com>
parents:
102744
diff
changeset
|
1747 |
54428
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1748 if (width > 0 && it->glyph_row) |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1749 { |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1750 Lisp_Object o_object = it->object; |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1751 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
|
1752 int n = width; |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1753 |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1754 if (!STRINGP (object)) |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1755 object = it->w->buffer; |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1756 it->object = object; |
68661
4e22dd401a52
(append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents:
68651
diff
changeset
|
1757 it->char_to_display = ' '; |
54428
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1758 it->pixel_width = it->len = 1; |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1759 while (n--) |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1760 append_glyph (it); |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1761 it->object = o_object; |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1762 } |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1763 it->pixel_width = width; |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1764 it->nglyphs = width; |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1765 } |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1766 |
3a86bc69c0e3
(produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents:
54167
diff
changeset
|
1767 |
90638 | 1768 /* Append glyphs to IT's glyph_row for the composition IT->cmp_id. |
1769 Called from produce_composite_glyph for terminal frames if | |
1770 IT->glyph_row != NULL. IT->face_id contains the character's | |
1771 face. */ | |
1772 | |
1773 static void | |
1774 append_composite_glyph (it) | |
1775 struct it *it; | |
1776 { | |
1777 struct glyph *glyph; | |
1778 | |
1779 xassert (it->glyph_row); | |
1780 glyph = it->glyph_row->glyphs[it->area] + it->glyph_row->used[it->area]; | |
1781 if (glyph < it->glyph_row->glyphs[1 + it->area]) | |
1782 { | |
1783 glyph->type = COMPOSITE_GLYPH; | |
1784 glyph->pixel_width = it->pixel_width; | |
97830
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
1785 glyph->u.cmp.id = it->cmp_it.id; |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
1786 if (it->cmp_it.ch < 0) |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
1787 { |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
1788 glyph->u.cmp.automatic = 0; |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
1789 glyph->u.cmp.id = it->cmp_it.id; |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
1790 } |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
1791 else |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
1792 { |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
1793 glyph->u.cmp.automatic = 1; |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
1794 glyph->u.cmp.id = it->cmp_it.id; |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
1795 glyph->u.cmp.from = it->cmp_it.from; |
101964
05ec76bd8aa4
(encode_terminal_code): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
101774
diff
changeset
|
1796 glyph->u.cmp.to = it->cmp_it.to - 1; |
97830
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
1797 } |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
1798 |
90638 | 1799 glyph->face_id = it->face_id; |
1800 glyph->padding_p = 0; | |
1801 glyph->charpos = CHARPOS (it->position); | |
1802 glyph->object = it->object; | |
1803 | |
1804 ++it->glyph_row->used[it->area]; | |
1805 ++glyph; | |
1806 } | |
1807 } | |
1808 | |
1809 | |
1810 /* Produce a composite glyph for iterator IT. IT->cmp_id is the ID of | |
1811 the composition. We simply produces components of the composition | |
105426
d0a6d64c3cfc
Fix typos in comments.
Juanma Barranquero <lekktu@gmail.com>
parents:
103711
diff
changeset
|
1812 assuming that the terminal has a capability to layout/render it |
d0a6d64c3cfc
Fix typos in comments.
Juanma Barranquero <lekktu@gmail.com>
parents:
103711
diff
changeset
|
1813 correctly. */ |
90638 | 1814 |
1815 static void | |
1816 produce_composite_glyph (it) | |
1817 struct it *it; | |
1818 { | |
1819 int c; | |
1820 | |
97830
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
1821 if (it->cmp_it.ch < 0) |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
1822 { |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
1823 struct composition *cmp = composition_table[it->cmp_it.id]; |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
1824 |
101774
d4f9e4244d5a
(encode_terminal_code): Fix handling of composition.
Kenichi Handa <handa@m17n.org>
parents:
101690
diff
changeset
|
1825 it->pixel_width = cmp->width; |
97830
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
1826 } |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
1827 else |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
1828 { |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
1829 Lisp_Object gstring = composition_gstring_from_id (it->cmp_it.id); |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
1830 |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
1831 it->pixel_width = composition_gstring_width (gstring, it->cmp_it.from, |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
1832 it->cmp_it.to, NULL); |
62a07e57ef40
(encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
97720
diff
changeset
|
1833 } |
90638 | 1834 it->nglyphs = 1; |
1835 if (it->glyph_row) | |
1836 append_composite_glyph (it); | |
1837 } | |
1838 | |
1839 | |
25002 | 1840 /* Get information about special display element WHAT in an |
1841 environment described by IT. WHAT is one of IT_TRUNCATION or | |
1842 IT_CONTINUATION. Maybe produce glyphs for WHAT if IT has a | |
1843 non-null glyph_row member. This function ensures that fields like | |
1844 face_id, c, len of IT are left untouched. */ | |
1845 | |
1846 void | |
1847 produce_special_glyphs (it, what) | |
1848 struct it *it; | |
1849 enum display_element_type what; | |
1850 { | |
1851 struct it temp_it; | |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
1852 Lisp_Object gc; |
63549
bda22724fc82
(produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents:
61591
diff
changeset
|
1853 GLYPH glyph; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
1854 |
25002 | 1855 temp_it = *it; |
1856 temp_it.dp = NULL; | |
1857 temp_it.what = IT_CHARACTER; | |
1858 temp_it.len = 1; | |
28507
b6f06a755c7d
make_number/XINT/XUINT conversions; EQ/== fixes; ==Qnil -> NILP
Ken Raeburn <raeburn@raeburn.org>
parents:
28465
diff
changeset
|
1859 temp_it.object = make_number (0); |
25002 | 1860 bzero (&temp_it.current, sizeof temp_it.current); |
1861 | |
1862 if (what == IT_CONTINUATION) | |
1863 { | |
1864 /* Continuation glyph. */ | |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
1865 SET_GLYPH_FROM_CHAR (glyph, '\\'); |
25002 | 1866 if (it->dp |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
1867 && (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
|
1868 && GLYPH_CODE_CHAR_VALID_P (gc)) |
25002 | 1869 { |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
1870 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
|
1871 spec_glyph_lookup_face (XWINDOW (it->window), &glyph); |
25002 | 1872 } |
1873 } | |
1874 else if (what == IT_TRUNCATION) | |
1875 { | |
1876 /* Truncation glyph. */ | |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
1877 SET_GLYPH_FROM_CHAR (glyph, '$'); |
25002 | 1878 if (it->dp |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
1879 && (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
|
1880 && GLYPH_CODE_CHAR_VALID_P (gc)) |
25002 | 1881 { |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
1882 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
|
1883 spec_glyph_lookup_face (XWINDOW (it->window), &glyph); |
25002 | 1884 } |
1885 } | |
1886 else | |
1887 abort (); | |
63549
bda22724fc82
(produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents:
61591
diff
changeset
|
1888 |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
1889 temp_it.c = GLYPH_CHAR (glyph); |
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
1890 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
|
1891 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
|
1892 |
bda22724fc82
(produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents:
61591
diff
changeset
|
1893 produce_glyphs (&temp_it); |
bda22724fc82
(produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents:
61591
diff
changeset
|
1894 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
|
1895 it->nglyphs = temp_it.pixel_width; |
25002 | 1896 } |
1897 | |
1898 | |
1899 | |
1900 /*********************************************************************** | |
1901 Faces | |
1902 ***********************************************************************/ | |
1903 | |
28465
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
1904 /* 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
|
1905 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
|
1906 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
|
1907 color; the termcap capability `NC' specifies which ones. */ |
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
1908 |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1909 #define MAY_USE_WITH_COLORS_P(tty, ATTR) \ |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1910 (tty->TN_max_colors > 0 \ |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1911 ? (tty->TN_no_color_video & (ATTR)) == 0 \ |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1912 : 1) |
25002 | 1913 |
63549
bda22724fc82
(produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents:
61591
diff
changeset
|
1914 /* 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
|
1915 FACE_ID is a realized face ID number, in the face cache. */ |
25002 | 1916 |
1917 static void | |
1918 turn_on_face (f, face_id) | |
1919 struct frame *f; | |
1920 int face_id; | |
1921 { | |
1922 struct face *face = FACE_FROM_ID (f, face_id); | |
37477
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1923 long fg = face->foreground; |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1924 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
|
1925 struct tty_display_info *tty = FRAME_TTY (f); |
25002 | 1926 |
37477
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1927 /* 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
|
1928 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
|
1929 if (MAY_USE_WITH_COLORS_P (tty, NC_REVERSE)) |
37477
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1930 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1931 if (tty->TN_max_colors > 0) |
37477
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1932 { |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1933 if (fg >= 0 && bg >= 0) |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1934 { |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1935 /* If the terminal supports colors, we can set them |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1936 below without using reverse video. The face's fg |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1937 and bg colors are set as they should appear on |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1938 the screen, i.e. they take the inverse-video'ness |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1939 of the face already into account. */ |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1940 } |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1941 else if (inverse_video) |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1942 { |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1943 if (fg == FACE_TTY_DEFAULT_FG_COLOR |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1944 || 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
|
1945 tty_toggle_highlight (tty); |
37477
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1946 } |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1947 else |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1948 { |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1949 if (fg == FACE_TTY_DEFAULT_BG_COLOR |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1950 || 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
|
1951 tty_toggle_highlight (tty); |
37477
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1952 } |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1953 } |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1954 else |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1955 { |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1956 /* If we can't display colors, use reverse video |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1957 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
|
1958 if (inverse_video) |
b8ff92361366
(turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents:
37477
diff
changeset
|
1959 { |
b8ff92361366
(turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents:
37477
diff
changeset
|
1960 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
|
1961 || 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
|
1962 tty_toggle_highlight (tty); |
37499
b8ff92361366
(turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents:
37477
diff
changeset
|
1963 } |
b8ff92361366
(turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents:
37477
diff
changeset
|
1964 else |
b8ff92361366
(turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents:
37477
diff
changeset
|
1965 { |
b8ff92361366
(turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents:
37477
diff
changeset
|
1966 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
|
1967 || 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
|
1968 tty_toggle_highlight (tty); |
37499
b8ff92361366
(turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents:
37477
diff
changeset
|
1969 } |
37477
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1970 } |
6a7ab4d2c7b3
(toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
35448
diff
changeset
|
1971 } |
25002 | 1972 |
103605
d6ac90c70d24
* term.c (turn_on_face): Allow simultaneously bold and dim
Chong Yidong <cyd@stupidchicken.com>
parents:
103114
diff
changeset
|
1973 if (face->tty_bold_p && MAY_USE_WITH_COLORS_P (tty, NC_BOLD)) |
d6ac90c70d24
* term.c (turn_on_face): Allow simultaneously bold and dim
Chong Yidong <cyd@stupidchicken.com>
parents:
103114
diff
changeset
|
1974 OUTPUT1_IF (tty, tty->TS_enter_bold_mode); |
d6ac90c70d24
* term.c (turn_on_face): Allow simultaneously bold and dim
Chong Yidong <cyd@stupidchicken.com>
parents:
103114
diff
changeset
|
1975 |
d6ac90c70d24
* term.c (turn_on_face): Allow simultaneously bold and dim
Chong Yidong <cyd@stupidchicken.com>
parents:
103114
diff
changeset
|
1976 if (face->tty_dim_p && MAY_USE_WITH_COLORS_P (tty, NC_DIM)) |
d6ac90c70d24
* term.c (turn_on_face): Allow simultaneously bold and dim
Chong Yidong <cyd@stupidchicken.com>
parents:
103114
diff
changeset
|
1977 OUTPUT1_IF (tty, tty->TS_enter_dim_mode); |
25002 | 1978 |
1979 /* Alternate charset and blinking not yet used. */ | |
28465
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
1980 if (face->tty_alt_charset_p |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1981 && 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
|
1982 OUTPUT1_IF (tty, tty->TS_enter_alt_charset_mode); |
25002 | 1983 |
28465
113efc964095
(TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28200
diff
changeset
|
1984 if (face->tty_blinking_p |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1985 && MAY_USE_WITH_COLORS_P (tty, NC_BLINK)) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1986 OUTPUT1_IF (tty, tty->TS_enter_blink_mode); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1987 |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1988 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
|
1989 OUTPUT1_IF (tty, tty->TS_enter_underline_mode); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1990 |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
1991 if (tty->TN_max_colors > 0) |
25002 | 1992 { |
65072
462eb3df5c58
(turn_on_face): Check for TS_set_foreground and
Juri Linkov <juri@jurta.org>
parents:
64773
diff
changeset
|
1993 char *ts, *p; |
462eb3df5c58
(turn_on_face): Check for TS_set_foreground and
Juri Linkov <juri@jurta.org>
parents:
64773
diff
changeset
|
1994 |
83353
532e0a9335a9
Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
1995 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
|
1996 if (fg >= 0 && ts) |
25002 | 1997 { |
83353
532e0a9335a9
Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
1998 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
|
1999 OUTPUT (tty, p); |
25002 | 2000 xfree (p); |
2001 } | |
2002 | |
83353
532e0a9335a9
Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
2003 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
|
2004 if (bg >= 0 && ts) |
25002 | 2005 { |
83353
532e0a9335a9
Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
2006 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
|
2007 OUTPUT (tty, p); |
25002 | 2008 xfree (p); |
2009 } | |
2010 } | |
2011 } | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
2012 |
25002 | 2013 |
2014 /* Turn off appearances of face FACE_ID on tty frame F. */ | |
2015 | |
2016 static void | |
2017 turn_off_face (f, face_id) | |
2018 struct frame *f; | |
2019 int face_id; | |
2020 { | |
2021 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
|
2022 struct tty_display_info *tty = FRAME_TTY (f); |
25002 | 2023 |
2024 xassert (face != NULL); | |
2025 | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2026 if (tty->TS_exit_attribute_mode) |
25002 | 2027 { |
2028 /* Capability "me" will turn off appearance modes double-bright, | |
2029 half-bright, reverse-video, standout, underline. It may or | |
2030 may not turn off alt-char-mode. */ | |
2031 if (face->tty_bold_p | |
2032 || face->tty_dim_p | |
2033 || face->tty_reverse_p | |
2034 || face->tty_alt_charset_p | |
2035 || face->tty_blinking_p | |
2036 || face->tty_underline_p) | |
30848
fc80dcfc32cd
(write_glyphs): Also turn off inverse video after turning
Gerd Moellmann <gerd@gnu.org>
parents:
30836
diff
changeset
|
2037 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2038 OUTPUT1_IF (tty, tty->TS_exit_attribute_mode); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2039 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
|
2040 tty->standout_mode = 0; |
30848
fc80dcfc32cd
(write_glyphs): Also turn off inverse video after turning
Gerd Moellmann <gerd@gnu.org>
parents:
30836
diff
changeset
|
2041 } |
25002 | 2042 |
2043 if (face->tty_alt_charset_p) | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2044 OUTPUT_IF (tty, tty->TS_exit_alt_charset_mode); |
25002 | 2045 } |
2046 else | |
2047 { | |
2048 /* If we don't have "me" we can only have those appearances | |
2049 that have exit sequences defined. */ | |
2050 if (face->tty_alt_charset_p) | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2051 OUTPUT_IF (tty, tty->TS_exit_alt_charset_mode); |
25002 | 2052 |
40086
050b19294988
(TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents:
40081
diff
changeset
|
2053 if (face->tty_underline_p) |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2054 OUTPUT_IF (tty, tty->TS_exit_underline_mode); |
25002 | 2055 } |
2056 | |
2057 /* Switch back to default colors. */ | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2058 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
|
2059 && ((face->foreground != FACE_TTY_DEFAULT_COLOR |
264b83a3a688
Changes for separate unspecified foreground and background colors
Eli Zaretskii <eliz@gnu.org>
parents:
26871
diff
changeset
|
2060 && 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
|
2061 || (face->background != FACE_TTY_DEFAULT_COLOR |
264b83a3a688
Changes for separate unspecified foreground and background colors
Eli Zaretskii <eliz@gnu.org>
parents:
26871
diff
changeset
|
2062 && face->background != FACE_TTY_DEFAULT_BG_COLOR))) |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2063 OUTPUT1_IF (tty, tty->TS_orig_pair); |
25002 | 2064 } |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
2065 |
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
2066 |
45522
1513f6afe56f
(tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents:
44890
diff
changeset
|
2067 /* 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
|
2068 capabilities in CAPS simultaneously, with foreground and background |
1513f6afe56f
(tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents:
44890
diff
changeset
|
2069 colors FG and BG. */ |
1513f6afe56f
(tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents:
44890
diff
changeset
|
2070 |
45548 | 2071 int |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2072 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
|
2073 struct tty_display_info *tty; |
45522
1513f6afe56f
(tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents:
44890
diff
changeset
|
2074 unsigned caps; |
1513f6afe56f
(tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents:
44890
diff
changeset
|
2075 unsigned long fg, bg; |
1513f6afe56f
(tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents:
44890
diff
changeset
|
2076 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2077 #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
|
2078 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
|
2079 return 0; |
1513f6afe56f
(tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents:
44890
diff
changeset
|
2080 |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2081 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
|
2082 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
|
2083 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
|
2084 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
|
2085 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
|
2086 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
|
2087 |
1513f6afe56f
(tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents:
44890
diff
changeset
|
2088 /* We can do it! */ |
1513f6afe56f
(tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents:
44890
diff
changeset
|
2089 return 1; |
1513f6afe56f
(tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents:
44890
diff
changeset
|
2090 } |
1513f6afe56f
(tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents:
44890
diff
changeset
|
2091 |
25002 | 2092 /* Return non-zero if the terminal is capable to display colors. */ |
2093 | |
2094 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
|
2095 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
|
2096 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
|
2097 |
103047
997f1f1cac08
* term.c (Ftty_display_color_p, Ftty_display_color_cells)
Chong Yidong <cyd@stupidchicken.com>
parents:
102831
diff
changeset
|
2098 TERMINAL can be a terminal object, a frame, or nil (meaning the |
997f1f1cac08
* term.c (Ftty_display_color_p, Ftty_display_color_cells)
Chong Yidong <cyd@stupidchicken.com>
parents:
102831
diff
changeset
|
2099 selected frame's terminal). This function always returns nil if |
997f1f1cac08
* term.c (Ftty_display_color_p, Ftty_display_color_cells)
Chong Yidong <cyd@stupidchicken.com>
parents:
102831
diff
changeset
|
2100 TERMINAL does not refer to a text-only terminal. */) |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2101 (terminal) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2102 Lisp_Object terminal; |
25002 | 2103 { |
83512
5d328dadd0f4
Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83502
diff
changeset
|
2104 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
|
2105 if (!t) |
83004
7900111db01c
Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
82995
diff
changeset
|
2106 return Qnil; |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
2107 else |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2108 return t->display_info.tty->TN_max_colors > 0 ? Qt : Qnil; |
25002 | 2109 } |
2110 | |
42954
e514d4931d6f
(Ftty_display_color_cells): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
42808
diff
changeset
|
2111 /* Return the number of supported colors. */ |
e514d4931d6f
(Ftty_display_color_cells): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
42808
diff
changeset
|
2112 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
|
2113 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
|
2114 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
|
2115 |
103047
997f1f1cac08
* term.c (Ftty_display_color_p, Ftty_display_color_cells)
Chong Yidong <cyd@stupidchicken.com>
parents:
102831
diff
changeset
|
2116 TERMINAL can be a terminal object, a frame, or nil (meaning the |
997f1f1cac08
* term.c (Ftty_display_color_p, Ftty_display_color_cells)
Chong Yidong <cyd@stupidchicken.com>
parents:
102831
diff
changeset
|
2117 selected frame's terminal). This function always returns 0 if |
997f1f1cac08
* term.c (Ftty_display_color_p, Ftty_display_color_cells)
Chong Yidong <cyd@stupidchicken.com>
parents:
102831
diff
changeset
|
2118 TERMINAL does not refer to a text-only terminal. */) |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2119 (terminal) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2120 Lisp_Object terminal; |
42954
e514d4931d6f
(Ftty_display_color_cells): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
42808
diff
changeset
|
2121 { |
83512
5d328dadd0f4
Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83502
diff
changeset
|
2122 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
|
2123 if (!t) |
83161
8d62eda26760
Fix byte-compile errors during bootstrap. (Reported by Juraj Kubelka.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83158
diff
changeset
|
2124 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
|
2125 else |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2126 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
|
2127 } |
e514d4931d6f
(Ftty_display_color_cells): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
42808
diff
changeset
|
2128 |
97658 | 2129 #ifndef DOS_NT |
25002 | 2130 |
78566
a23949b99eb1
Tweak previous change (don't init statics).
Glenn Morris <rgm@gnu.org>
parents:
78563
diff
changeset
|
2131 /* 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
|
2132 to work around an HPUX compiler bug (?). See |
78562 | 2133 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
|
2134 static int default_max_colors; |
a23949b99eb1
Tweak previous change (don't init statics).
Glenn Morris <rgm@gnu.org>
parents:
78563
diff
changeset
|
2135 static int default_max_pairs; |
a23949b99eb1
Tweak previous change (don't init statics).
Glenn Morris <rgm@gnu.org>
parents:
78563
diff
changeset
|
2136 static int default_no_color_video; |
a23949b99eb1
Tweak previous change (don't init statics).
Glenn Morris <rgm@gnu.org>
parents:
78563
diff
changeset
|
2137 static char *default_orig_pair; |
a23949b99eb1
Tweak previous change (don't init statics).
Glenn Morris <rgm@gnu.org>
parents:
78563
diff
changeset
|
2138 static char *default_set_foreground; |
a23949b99eb1
Tweak previous change (don't init statics).
Glenn Morris <rgm@gnu.org>
parents:
78563
diff
changeset
|
2139 static char *default_set_background; |
78560
44134c35ea57
Philippe Waroquiers <philippe.waroquiers at eurocontrol.int>
Glenn Morris <rgm@gnu.org>
parents:
78260
diff
changeset
|
2140 |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2141 /* 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
|
2142 terminal. */ |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2143 static void |
82989
f3845715a5f6
Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
82988
diff
changeset
|
2144 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
|
2145 { |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2146 |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2147 if (save) |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2148 { |
95481
4390d64d3328
Make "xfree (NULL)" a no-op; remove useless if-before-xfree.
Jim Meyering <jim@meyering.net>
parents:
94963
diff
changeset
|
2149 xfree (default_orig_pair); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2150 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
|
2151 |
95481
4390d64d3328
Make "xfree (NULL)" a no-op; remove useless if-before-xfree.
Jim Meyering <jim@meyering.net>
parents:
94963
diff
changeset
|
2152 xfree (default_set_foreground); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2153 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
|
2154 : NULL; |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2155 |
95481
4390d64d3328
Make "xfree (NULL)" a no-op; remove useless if-before-xfree.
Jim Meyering <jim@meyering.net>
parents:
94963
diff
changeset
|
2156 xfree (default_set_background); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2157 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
|
2158 : NULL; |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2159 |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2160 default_max_colors = tty->TN_max_colors; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2161 default_max_pairs = tty->TN_max_pairs; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2162 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
|
2163 } |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2164 else |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2165 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2166 tty->TS_orig_pair = default_orig_pair; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2167 tty->TS_set_foreground = default_set_foreground; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2168 tty->TS_set_background = default_set_background; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2169 tty->TN_max_colors = default_max_colors; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2170 tty->TN_max_pairs = default_max_pairs; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2171 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
|
2172 } |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2173 } |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2174 |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2175 /* 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
|
2176 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
|
2177 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
|
2178 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
|
2179 static void |
82989
f3845715a5f6
Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
82988
diff
changeset
|
2180 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
|
2181 { |
52652
31a3a92c1a03
(tty_setup_colors): Treat any negative argument as -1.
Eli Zaretskii <eliz@gnu.org>
parents:
52579
diff
changeset
|
2182 /* 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
|
2183 if (mode < -1) |
31a3a92c1a03
(tty_setup_colors): Treat any negative argument as -1.
Eli Zaretskii <eliz@gnu.org>
parents:
52579
diff
changeset
|
2184 mode = -1; |
31a3a92c1a03
(tty_setup_colors): Treat any negative argument as -1.
Eli Zaretskii <eliz@gnu.org>
parents:
52579
diff
changeset
|
2185 |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2186 switch (mode) |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2187 { |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2188 case -1: /* no colors at all */ |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2189 tty->TN_max_colors = 0; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2190 tty->TN_max_pairs = 0; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2191 tty->TN_no_color_video = 0; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2192 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
|
2193 break; |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2194 case 0: /* default colors, if any */ |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2195 default: |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2196 tty_default_color_capabilities (tty, 0); |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2197 break; |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2198 case 8: /* 8 standard ANSI colors */ |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2199 tty->TS_orig_pair = "\033[0m"; |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2200 #ifdef TERMINFO |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2201 tty->TS_set_foreground = "\033[3%p1%dm"; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2202 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
|
2203 #else |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2204 tty->TS_set_foreground = "\033[3%dm"; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2205 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
|
2206 #endif |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2207 tty->TN_max_colors = 8; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2208 tty->TN_max_pairs = 64; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
2209 tty->TN_no_color_video = 0; |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2210 break; |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2211 } |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2212 } |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2213 |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2214 void |
93883
722fdbc7a012
* xdisp.c (redisplay_internal): Reset tty's color_mode when switching
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92281
diff
changeset
|
2215 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
|
2216 struct tty_display_info *tty; |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2217 struct frame *f; |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2218 { |
93883
722fdbc7a012
* xdisp.c (redisplay_internal): Reset tty's color_mode when switching
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92281
diff
changeset
|
2219 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
|
2220 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
|
2221 int mode; |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2222 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
|
2223 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
|
2224 = 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
|
2225 |
93984
ddcecf318c8a
(set_tty_color_mode): Left over typo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93883
diff
changeset
|
2226 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
|
2227 val = CONSP (tem) ? XCDR (tem) : Qnil; |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2228 |
52579
611336925095
(set_tty_color_mode): Use INTEGERP to test whether a
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
2229 if (INTEGERP (val)) |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2230 color_mode = val; |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2231 else |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2232 { |
93883
722fdbc7a012
* xdisp.c (redisplay_internal): Reset tty's color_mode when switching
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92281
diff
changeset
|
2233 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
|
2234 : 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
|
2235 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
|
2236 } |
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
|
2237 |
93883
722fdbc7a012
* xdisp.c (redisplay_internal): Reset tty's color_mode when switching
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92281
diff
changeset
|
2238 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
|
2239 |
722fdbc7a012
* xdisp.c (redisplay_internal): Reset tty's color_mode when switching
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92281
diff
changeset
|
2240 if (mode != tty->previous_color_mode) |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2241 { |
93883
722fdbc7a012
* xdisp.c (redisplay_internal): Reset tty's color_mode when switching
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92281
diff
changeset
|
2242 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
|
2243 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
|
2244 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
|
2245 /* 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
|
2246 safe_call (1, &funsym); |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2247 } |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2248 } |
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
2249 |
97658 | 2250 #endif /* !DOS_NT */ |
25002 | 2251 |
2252 | |
53226
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
2253 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2254 /* 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
|
2255 |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2256 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
|
2257 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
|
2258 { |
83512
5d328dadd0f4
Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83502
diff
changeset
|
2259 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
|
2260 |
97658 | 2261 if (t && t->type != output_termcap && t->type != output_msdos_raw) |
83512
5d328dadd0f4
Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83502
diff
changeset
|
2262 { |
5d328dadd0f4
Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83502
diff
changeset
|
2263 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
|
2264 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
|
2265 else |
5d328dadd0f4
Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83502
diff
changeset
|
2266 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
|
2267 } |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2268 |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2269 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
|
2270 } |
69ebc75cb461
Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83161
diff
changeset
|
2271 |
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
|
2272 /* 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
|
2273 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
|
2274 |
83342
9216636c02fc
Rename `struct display' to `struct device'. Update function, parameter and variable names accordingly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83341
diff
changeset
|
2275 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
|
2276 |
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
2277 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
|
2278 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2279 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
|
2280 get_named_tty (name) |
53226
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
2281 char *name; |
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
2282 { |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2283 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
|
2284 |
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
|
2285 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
|
2286 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
|
2287 |
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
|
2288 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
|
2289 { |
97720
b2594691f8f2
(get_named_tty): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
97658
diff
changeset
|
2290 if ((t->type == output_termcap || t->type == output_msdos_raw) |
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
|
2291 && !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
|
2292 && 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
|
2293 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
|
2294 } |
53226
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
2295 |
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
2296 return 0; |
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
2297 } |
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
2298 |
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
2299 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2300 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
|
2301 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
|
2302 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
|
2303 |
103047
997f1f1cac08
* term.c (Ftty_display_color_p, Ftty_display_color_cells)
Chong Yidong <cyd@stupidchicken.com>
parents:
102831
diff
changeset
|
2304 TERMINAL can be a terminal object, a frame, or nil (meaning the |
997f1f1cac08
* term.c (Ftty_display_color_p, Ftty_display_color_cells)
Chong Yidong <cyd@stupidchicken.com>
parents:
102831
diff
changeset
|
2305 selected frame's terminal). */) |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2306 (terminal) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2307 Lisp_Object terminal; |
82988
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
2308 { |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2309 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
|
2310 |
97658 | 2311 if (t->type != output_termcap && t->type != output_msdos_raw) |
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
|
2312 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
|
2313 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2314 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
|
2315 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
|
2316 else |
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
2317 return Qnil; |
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
2318 } |
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
2319 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2320 DEFUN ("controlling-tty-p", Fcontrolling_tty_p, Scontrolling_tty_p, 0, 1, 0, |
97658 | 2321 doc: /* Return non-nil if TERMINAL is the controlling tty of the Emacs process. |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2322 |
103047
997f1f1cac08
* term.c (Ftty_display_color_p, Ftty_display_color_cells)
Chong Yidong <cyd@stupidchicken.com>
parents:
102831
diff
changeset
|
2323 TERMINAL can be a terminal object, a frame, or nil (meaning the |
997f1f1cac08
* term.c (Ftty_display_color_p, Ftty_display_color_cells)
Chong Yidong <cyd@stupidchicken.com>
parents:
102831
diff
changeset
|
2324 selected frame's terminal). This function always returns nil if |
997f1f1cac08
* term.c (Ftty_display_color_p, Ftty_display_color_cells)
Chong Yidong <cyd@stupidchicken.com>
parents:
102831
diff
changeset
|
2325 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
|
2326 (terminal) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2327 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
|
2328 { |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2329 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
|
2330 |
97658 | 2331 if ((t->type != output_termcap && t->type != output_msdos_raw) |
2332 || strcmp (t->display_info.tty->name, DEV_TTY) != 0) | |
83173
6b4b299e2cd5
Fix suspend-frame on the controlling tty (reported by Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83168
diff
changeset
|
2333 return Qnil; |
6b4b299e2cd5
Fix suspend-frame on the controlling tty (reported by Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83168
diff
changeset
|
2334 else |
6b4b299e2cd5
Fix suspend-frame on the controlling tty (reported by Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83168
diff
changeset
|
2335 return Qt; |
6b4b299e2cd5
Fix suspend-frame on the controlling tty (reported by Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83168
diff
changeset
|
2336 } |
6b4b299e2cd5
Fix suspend-frame on the controlling tty (reported by Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83168
diff
changeset
|
2337 |
83311
c016d82bf02b
Merged from miles@gnu.org--gnu-2005 (patch 423-434)
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
2338 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
|
2339 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
|
2340 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
|
2341 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
|
2342 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
|
2343 |
103047
997f1f1cac08
* term.c (Ftty_display_color_p, Ftty_display_color_cells)
Chong Yidong <cyd@stupidchicken.com>
parents:
102831
diff
changeset
|
2344 TERMINAL can be a terminal object, a frame or nil (meaning the |
997f1f1cac08
* term.c (Ftty_display_color_p, Ftty_display_color_cells)
Chong Yidong <cyd@stupidchicken.com>
parents:
102831
diff
changeset
|
2345 selected frame's terminal). This function always returns nil if |
997f1f1cac08
* term.c (Ftty_display_color_p, Ftty_display_color_cells)
Chong Yidong <cyd@stupidchicken.com>
parents:
102831
diff
changeset
|
2346 TERMINAL does not refer to a text-only terminal. */) |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2347 (terminal) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2348 Lisp_Object terminal; |
83311
c016d82bf02b
Merged from miles@gnu.org--gnu-2005 (patch 423-434)
Karoly Lorentey <lorentey@elte.hu>
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 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
|
2351 |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2352 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
|
2353 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
|
2354 return Qnil; |
c016d82bf02b
Merged from miles@gnu.org--gnu-2005 (patch 423-434)
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
2355 } |
c016d82bf02b
Merged from miles@gnu.org--gnu-2005 (patch 423-434)
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
2356 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2357 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2358 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2359 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
|
2360 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
|
2361 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2362 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
|
2363 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
|
2364 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
|
2365 not updated. |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2366 |
103047
997f1f1cac08
* term.c (Ftty_display_color_p, Ftty_display_color_cells)
Chong Yidong <cyd@stupidchicken.com>
parents:
102831
diff
changeset
|
2367 TTY may be a terminal object, a frame, or nil for the terminal device |
997f1f1cac08
* term.c (Ftty_display_color_p, Ftty_display_color_cells)
Chong Yidong <cyd@stupidchicken.com>
parents:
102831
diff
changeset
|
2368 of 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
|
2369 |
83891
dab32bc3edc8
* server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83889
diff
changeset
|
2370 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
|
2371 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
|
2372 terminal device. |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2373 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2374 `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
|
2375 suspended. |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2376 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2377 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
|
2378 (tty) |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2379 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
|
2380 { |
83512
5d328dadd0f4
Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83502
diff
changeset
|
2381 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
|
2382 FILE *f; |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
2383 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2384 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
|
2385 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
|
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 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
|
2388 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2389 if (f) |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2390 { |
84769
cbcb89640ef2
* xt-mouse.el (xterm-mouse-mode): Re-enable suspend-tty-functions.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
84768
diff
changeset
|
2391 /* 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
|
2392 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
|
2393 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
|
2394 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
|
2395 { |
cbcb89640ef2
* xt-mouse.el (xterm-mouse-mode): Re-enable suspend-tty-functions.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
84768
diff
changeset
|
2396 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
|
2397 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
|
2398 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
|
2399 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
|
2400 } |
cbcb89640ef2
* xt-mouse.el (xterm-mouse-mode): Re-enable suspend-tty-functions.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
84768
diff
changeset
|
2401 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2402 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
|
2403 |
97658 | 2404 #ifdef subprocesses |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2405 delete_keyboard_wait_descriptor (fileno (f)); |
97658 | 2406 #endif |
2407 | |
2408 #ifndef MSDOS | |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2409 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
|
2410 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
|
2411 fclose (t->display_info.tty->output); |
97658 | 2412 #endif |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
2413 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2414 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
|
2415 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
|
2416 |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2417 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
|
2418 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
|
2419 |
83420
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 |
83521
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
2422 /* 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
|
2423 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
|
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 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2427 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2428 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
|
2429 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
|
2430 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
|
2431 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
|
2432 |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2433 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
|
2434 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
|
2435 |
83891
dab32bc3edc8
* server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83889
diff
changeset
|
2436 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
|
2437 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
|
2438 device. |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2439 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2440 `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
|
2441 suspended. |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2442 |
103047
997f1f1cac08
* term.c (Ftty_display_color_p, Ftty_display_color_cells)
Chong Yidong <cyd@stupidchicken.com>
parents:
102831
diff
changeset
|
2443 TTY may be a terminal object, a frame, or nil (meaning the selected |
997f1f1cac08
* term.c (Ftty_display_color_p, Ftty_display_color_cells)
Chong Yidong <cyd@stupidchicken.com>
parents:
102831
diff
changeset
|
2444 frame's terminal). */) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2445 (tty) |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2446 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
|
2447 { |
83512
5d328dadd0f4
Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83502
diff
changeset
|
2448 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
|
2449 int fd; |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2450 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2451 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
|
2452 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
|
2453 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2454 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
|
2455 { |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2456 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
|
2457 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
|
2458 |
97658 | 2459 #ifdef MSDOS |
2460 t->display_info.tty->output = stdout; | |
2461 t->display_info.tty->input = stdin; | |
2462 #else /* !MSDOS */ | |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2463 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
|
2464 |
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
|
2465 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
|
2466 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
|
2467 |
84779
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
2468 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
|
2469 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
|
2470 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2471 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
|
2472 t->display_info.tty->input = t->display_info.tty->output; |
97658 | 2473 #endif |
2474 | |
2475 #ifdef subprocesses | |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2476 add_keyboard_wait_descriptor (fd); |
97658 | 2477 #endif |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2478 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2479 if (FRAMEP (t->display_info.tty->top_frame)) |
101690
1009d5607716
* dispnew.c (window_change_signal): Don't try to get the size of a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
100951
diff
changeset
|
2480 { |
1009d5607716
* dispnew.c (window_change_signal): Don't try to get the size of a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
100951
diff
changeset
|
2481 struct frame *f = XFRAME (t->display_info.tty->top_frame); |
1009d5607716
* dispnew.c (window_change_signal): Don't try to get the size of a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
100951
diff
changeset
|
2482 int width, height; |
1009d5607716
* dispnew.c (window_change_signal): Don't try to get the size of a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
100951
diff
changeset
|
2483 int old_height = FRAME_COLS (f); |
1009d5607716
* dispnew.c (window_change_signal): Don't try to get the size of a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
100951
diff
changeset
|
2484 int old_width = FRAME_LINES (f); |
1009d5607716
* dispnew.c (window_change_signal): Don't try to get the size of a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
100951
diff
changeset
|
2485 |
1009d5607716
* dispnew.c (window_change_signal): Don't try to get the size of a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
100951
diff
changeset
|
2486 /* Check if terminal/window size has changed while the frame |
1009d5607716
* dispnew.c (window_change_signal): Don't try to get the size of a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
100951
diff
changeset
|
2487 was suspended. */ |
1009d5607716
* dispnew.c (window_change_signal): Don't try to get the size of a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
100951
diff
changeset
|
2488 get_tty_size (fileno (t->display_info.tty->input), &width, &height); |
1009d5607716
* dispnew.c (window_change_signal): Don't try to get the size of a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
100951
diff
changeset
|
2489 if (width != old_width || height != old_height) |
1009d5607716
* dispnew.c (window_change_signal): Don't try to get the size of a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
100951
diff
changeset
|
2490 change_frame_size (f, height, width, 0, 0, 0); |
1009d5607716
* dispnew.c (window_change_signal): Don't try to get the size of a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
100951
diff
changeset
|
2491 FRAME_SET_VISIBLE (XFRAME (t->display_info.tty->top_frame), 1); |
1009d5607716
* dispnew.c (window_change_signal): Don't try to get the size of a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
100951
diff
changeset
|
2492 } |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2493 |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
2494 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
|
2495 |
83891
dab32bc3edc8
* server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83889
diff
changeset
|
2496 /* 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
|
2497 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
|
2498 { |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2499 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
|
2500 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
|
2501 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
|
2502 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
|
2503 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2504 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2505 |
83521
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
2506 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
|
2507 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2508 return Qnil; |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
2509 } |
83311
c016d82bf02b
Merged from miles@gnu.org--gnu-2005 (patch 423-434)
Karoly Lorentey <lorentey@elte.hu>
diff
changeset
|
2510 |
82988
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
2511 |
25002 | 2512 /*********************************************************************** |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2513 Mouse |
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 |
80994
62b6aa7f8c37
Use HAVE_GPM instead of HAVE_GPM_H.
Nick Roberts <nickrob@snap.net.nz>
parents:
80979
diff
changeset
|
2516 #ifdef HAVE_GPM |
81107 | 2517 void |
2518 term_mouse_moveto (int x, int y) | |
81102
a00e7c5f2faa
(mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
81083
diff
changeset
|
2519 { |
81811
c10410a3aa36
Include unistd.h for ttyname, used in handle_one_term_event.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81308
diff
changeset
|
2520 /* TODO: how to set mouse position? |
81102
a00e7c5f2faa
(mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
81083
diff
changeset
|
2521 const char *name; |
a00e7c5f2faa
(mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
81083
diff
changeset
|
2522 int fd; |
a00e7c5f2faa
(mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
81083
diff
changeset
|
2523 name = (const char *) ttyname (0); |
a00e7c5f2faa
(mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
81083
diff
changeset
|
2524 fd = open (name, O_WRONLY); |
81127
d620b28641cd
(term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
81107
diff
changeset
|
2525 SOME_FUNCTION (x, y, fd); |
81102
a00e7c5f2faa
(mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
81083
diff
changeset
|
2526 close (fd); |
a00e7c5f2faa
(mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
81083
diff
changeset
|
2527 last_mouse_x = x; |
81127
d620b28641cd
(term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
81107
diff
changeset
|
2528 last_mouse_y = y; */ |
81102
a00e7c5f2faa
(mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
81083
diff
changeset
|
2529 } |
a00e7c5f2faa
(mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
81083
diff
changeset
|
2530 |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2531 static void |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2532 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
|
2533 { |
84968
85eb2660cbe3
(mouse_face_window): Rename from Qmouse_face_window. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84955
diff
changeset
|
2534 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
|
2535 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
|
2536 int i; |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2537 |
83622 | 2538 struct frame *f = XFRAME (w->frame); |
2539 struct tty_display_info *tty = FRAME_TTY (f); | |
2540 | |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2541 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
|
2542 to do anything. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2543 w->current_matrix != NULL |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2544 /* 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
|
2545 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
|
2546 && 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
|
2547 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2548 /* 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
|
2549 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
|
2550 the highlight region. */ |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
2551 |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2552 /* Save current cursor co-ordinates */ |
83622 | 2553 save_y = curY (tty); |
2554 save_x = curX (tty); | |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2555 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2556 /* 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
|
2557 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
|
2558 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2559 int start_hpos, end_hpos, nglyphs; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2560 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
|
2561 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2562 /* 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
|
2563 if (!row->enabled_p) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2564 continue; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2565 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2566 /* 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
|
2567 if (i == mouse_face_beg_row) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2568 start_hpos = mouse_face_beg_col; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2569 else |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2570 start_hpos = 0; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2571 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2572 if (i == mouse_face_end_row) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2573 end_hpos = mouse_face_end_col; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2574 else |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2575 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2576 end_hpos = row->used[TEXT_AREA]; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2577 if (draw == DRAW_NORMAL_TEXT) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2578 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
|
2579 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2580 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2581 if (end_hpos <= start_hpos) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2582 continue; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2583 /* 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
|
2584 mouse-face. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2585 row->mouse_face_p = draw > 0; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2586 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2587 nglyphs = end_hpos - start_hpos; |
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 if (end_hpos >= row->used[TEXT_AREA]) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2590 nglyphs = row->used[TEXT_AREA] - start_hpos; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2591 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2592 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
|
2593 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
|
2594 + WINDOW_LEFT_EDGE_X (w); |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
2595 |
83622 | 2596 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
|
2597 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2598 if (draw == DRAW_MOUSE_FACE) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2599 { |
83622 | 2600 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
|
2601 nglyphs, mouse_face_face_id); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2602 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2603 else /* draw == DRAW_NORMAL_TEXT */ |
83622 | 2604 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
|
2605 } |
83622 | 2606 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
|
2607 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2608 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2609 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2610 static void |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2611 term_clear_mouse_face () |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2612 { |
84968
85eb2660cbe3
(mouse_face_window): Rename from Qmouse_face_window. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84955
diff
changeset
|
2613 if (!NILP (mouse_face_window)) |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2614 term_show_mouse_face (DRAW_NORMAL_TEXT); |
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 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
|
2617 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
|
2618 mouse_face_window = Qnil; |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2619 } |
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 /* 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
|
2622 *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
|
2623 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
|
2624 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
|
2625 - taken from msdos.c */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2626 static int |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2627 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
|
2628 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2629 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
|
2630 int yb = window_text_bottom_y (w); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2631 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
|
2632 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2633 while (row->y < yb) |
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 if (row->used[TEXT_AREA]) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2636 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
|
2637 else |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2638 line_start_position = 0; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2639 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2640 if (line_start_position > pos) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2641 break; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2642 /* 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
|
2643 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
|
2644 else if (line_start_position == pos |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2645 && pos == BUF_ZV (XBUFFER (w->buffer))) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2646 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2647 maybe_next_line_p = 1; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2648 break; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2649 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2650 else if (line_start_position > 0) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2651 best_row = row; |
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 /* 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
|
2654 never-never land... */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2655 if (row->y + 1 >= yb) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2656 break; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2657 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2658 ++row; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2659 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2660 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2661 /* Find the right column within BEST_ROW. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2662 lastcol = 0; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2663 row = best_row; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2664 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
|
2665 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2666 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
|
2667 int charpos; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2668 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2669 charpos = glyph->charpos; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2670 if (charpos == pos) |
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 *hpos = i; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2673 *vpos = row->y; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2674 return 1; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2675 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2676 else if (charpos > pos) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2677 break; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2678 else if (charpos > 0) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2679 lastcol = i; |
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 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
|
2683 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
|
2684 use the start of the following line. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2685 if (maybe_next_line_p) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2686 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2687 ++row; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2688 lastcol = 0; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2689 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2690 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2691 *vpos = row->y; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2692 *hpos = lastcol + 1; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2693 return 0; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2694 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2695 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2696 static void |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2697 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
|
2698 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2699 enum window_part part; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2700 Lisp_Object window; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2701 struct window *w; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2702 struct buffer *b; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2703 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2704 if (NILP (Vmouse_highlight) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2705 || !f->glyphs_initialized_p) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2706 return; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2707 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2708 /* Which window is that in? */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2709 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
|
2710 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2711 /* Not on a window -> return. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2712 if (!WINDOWP (window)) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2713 return; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2714 |
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 term_clear_mouse_face (); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2717 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2718 w = XWINDOW (window); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2719 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2720 /* 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
|
2721 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
|
2722 b = XBUFFER (w->buffer); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2723 if (part == ON_TEXT |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2724 && EQ (w->window_end_valid, w->buffer) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2725 && XFASTINT (w->last_modified) == BUF_MODIFF (b) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2726 && 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
|
2727 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2728 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
|
2729 struct glyph_row *row; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2730 struct glyph *glyph; |
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 /* Find the glyph under X/Y. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2733 glyph = NULL; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2734 if (y >= 0 && y < nrows) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2735 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2736 row = MATRIX_ROW (w->current_matrix, y); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2737 /* 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
|
2738 not enabled. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2739 for (i = 0; i <= y; i++) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2740 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
|
2741 break; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2742 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
|
2743 && row->displays_text_p |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2744 && x < window_box_width (w, TEXT_AREA)) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2745 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2746 glyph = row->glyphs[TEXT_AREA]; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2747 if (x >= row->used[TEXT_AREA]) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2748 glyph = NULL; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2749 else |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2750 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2751 glyph += x; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2752 if (!BUFFERP (glyph->object)) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2753 glyph = NULL; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2754 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2755 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2756 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2757 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2758 /* 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
|
2759 if (glyph == NULL) |
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 term_clear_mouse_face (); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2762 return; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2763 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2764 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2765 if (!BUFFERP (glyph->object)) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2766 abort (); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2767 pos = glyph->charpos; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2768 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2769 /* Check for mouse-face. */ |
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 extern Lisp_Object Qmouse_face; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2772 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
|
2773 int noverlays, obegv, ozv; |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2774 struct buffer *obuf; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2775 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2776 /* 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
|
2777 if (pos > BUF_Z (b)) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2778 return; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2779 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2780 /* 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
|
2781 overlays_at and compute_char_face. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2782 obuf = current_buffer; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2783 current_buffer = b; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2784 obegv = BEGV; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2785 ozv = ZV; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2786 BEGV = BEG; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2787 ZV = Z; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2788 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2789 /* Is this char mouse-active? */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2790 XSETINT (position, pos); |
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 /* 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
|
2793 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
|
2794 /* Sort overlays into increasing priority order. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2795 noverlays = sort_overlays (overlay_vec, noverlays, w); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2796 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2797 /* 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
|
2798 if (!(EQ (window, mouse_face_window) |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2799 && y >= mouse_face_beg_row |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2800 && y <= mouse_face_end_row |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2801 && (y > mouse_face_beg_row |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2802 || x >= mouse_face_beg_col) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2803 && (y < mouse_face_end_row |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2804 || x < mouse_face_end_col |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2805 || mouse_face_past_end))) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2806 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2807 /* 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
|
2808 term_clear_mouse_face (); |
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 /* 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
|
2811 property. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2812 overlay = Qnil; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2813 for (i = noverlays - 1; i >= 0; --i) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2814 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2815 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
|
2816 if (!NILP (mouse_face)) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2817 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2818 overlay = overlay_vec[i]; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2819 break; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2820 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2821 } |
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 /* 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
|
2824 if (NILP (overlay)) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2825 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
|
2826 w->buffer); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2827 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2828 /* Handle the overlay case. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2829 if (!NILP (overlay)) |
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 /* 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
|
2832 should be active. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2833 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
|
2834 EMACS_INT ignore; |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2835 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2836 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2837 before = Foverlay_start (overlay); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2838 after = Foverlay_end (overlay); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2839 /* Record this as the current active region. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2840 fast_find_position (w, XFASTINT (before), |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2841 &mouse_face_beg_col, |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2842 &mouse_face_beg_row); |
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 mouse_face_past_end |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2845 = !fast_find_position (w, XFASTINT (after), |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2846 &mouse_face_end_col, |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2847 &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
|
2848 mouse_face_window = window; |
80979
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 mouse_face_face_id |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2851 = face_at_buffer_position (w, pos, 0, 0, |
103114
fa8e2c663118
* xfaces.c (face_at_buffer_position): New arg base_face_id.
Chong Yidong <cyd@stupidchicken.com>
parents:
103048
diff
changeset
|
2852 &ignore, pos + 1, 1, -1); |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2853 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2854 /* Display it as active. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2855 term_show_mouse_face (DRAW_MOUSE_FACE); |
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 /* Handle the text property case. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2858 else if (!NILP (mouse_face)) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2859 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2860 /* 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
|
2861 should be active. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2862 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
|
2863 EMACS_INT ignore; |
80979
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 beginning = Fmarker_position (w->start); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2866 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
|
2867 before |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2868 = 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
|
2869 Qmouse_face, |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2870 w->buffer, beginning); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2871 after |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2872 = Fnext_single_property_change (position, Qmouse_face, |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2873 w->buffer, end); |
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 /* Record this as the current active region. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2876 fast_find_position (w, XFASTINT (before), |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2877 &mouse_face_beg_col, |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2878 &mouse_face_beg_row); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2879 mouse_face_past_end |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2880 = !fast_find_position (w, XFASTINT (after), |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2881 &mouse_face_end_col, |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2882 &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
|
2883 mouse_face_window = window; |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2884 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2885 mouse_face_face_id |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2886 = face_at_buffer_position (w, pos, 0, 0, |
103114
fa8e2c663118
* xfaces.c (face_at_buffer_position): New arg base_face_id.
Chong Yidong <cyd@stupidchicken.com>
parents:
103048
diff
changeset
|
2887 &ignore, pos + 1, 1, -1); |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2888 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2889 /* Display it as active. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2890 term_show_mouse_face (DRAW_MOUSE_FACE); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2891 } |
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 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2894 /* Look for a `help-echo' property. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2895 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2896 Lisp_Object help; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2897 extern Lisp_Object Qhelp_echo; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2898 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2899 /* Check overlays first. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2900 help = Qnil; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2901 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
|
2902 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2903 overlay = overlay_vec[i]; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2904 help = Foverlay_get (overlay, Qhelp_echo); |
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 if (!NILP (help)) |
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 help_echo_string = help; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2910 help_echo_window = window; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2911 help_echo_object = overlay; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2912 help_echo_pos = pos; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2913 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2914 /* Try text properties. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2915 else if (NILP (help) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2916 && ((STRINGP (glyph->object) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2917 && glyph->charpos >= 0 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2918 && glyph->charpos < SCHARS (glyph->object)) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2919 || (BUFFERP (glyph->object) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2920 && glyph->charpos >= BEGV |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2921 && glyph->charpos < ZV))) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2922 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2923 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
|
2924 Qhelp_echo, glyph->object); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2925 if (!NILP (help)) |
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 help_echo_string = help; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2928 help_echo_window = window; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2929 help_echo_object = glyph->object; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2930 help_echo_pos = glyph->charpos; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2931 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2932 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2933 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2934 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2935 BEGV = obegv; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2936 ZV = ozv; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2937 current_buffer = obuf; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2938 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2939 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2940 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2941 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2942 static int |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2943 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
|
2944 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2945 /* 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
|
2946 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
|
2947 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2948 frame->mouse_moved = 1; |
81127
d620b28641cd
(term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
81107
diff
changeset
|
2949 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
|
2950 /* Remember which glyph we're now on. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2951 last_mouse_x = event->x; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2952 last_mouse_y = event->y; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2953 return 1; |
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 return 0; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2956 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2957 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2958 /* Return the current position of the mouse. |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2959 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2960 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
|
2961 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
|
2962 garbage. |
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 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
|
2965 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
|
2966 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2967 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
|
2968 |
81127
d620b28641cd
(term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
81107
diff
changeset
|
2969 This clears mouse_moved until the next motion |
81102
a00e7c5f2faa
(mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
81083
diff
changeset
|
2970 event arrives. */ |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2971 static void |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2972 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
|
2973 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
|
2974 Lisp_Object *y, unsigned long *time) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2975 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2976 struct timeval now; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2977 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2978 *fp = SELECTED_FRAME (); |
81102
a00e7c5f2faa
(mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
81083
diff
changeset
|
2979 (*fp)->mouse_moved = 0; |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2980 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2981 *bar_window = Qnil; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2982 *part = 0; |
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 XSETINT (*x, last_mouse_x); |
81102
a00e7c5f2faa
(mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents:
81083
diff
changeset
|
2985 XSETINT (*y, last_mouse_y); |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2986 gettimeofday(&now, 0); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2987 *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
|
2988 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2989 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2990 /* 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
|
2991 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2992 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
|
2993 the mouse. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2994 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2995 static Lisp_Object |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
2996 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
|
2997 struct frame *f) |
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 struct timeval now; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3000 int i, j; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3001 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3002 result->kind = GPM_CLICK_EVENT; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3003 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
|
3004 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3005 if (event->buttons & j) { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3006 result->code = i; /* button number */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3007 break; |
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 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3010 gettimeofday(&now, 0); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3011 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
|
3012 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3013 if (event->type & GPM_UP) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3014 result->modifiers = up_modifier; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3015 else if (event->type & GPM_DOWN) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3016 result->modifiers = down_modifier; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3017 else |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3018 result->modifiers = 0; |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
3019 |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3020 if (event->type & GPM_SINGLE) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3021 result->modifiers |= click_modifier; |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
3022 |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3023 if (event->type & GPM_DOUBLE) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3024 result->modifiers |= double_modifier; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3025 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3026 if (event->type & GPM_TRIPLE) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3027 result->modifiers |= triple_modifier; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3028 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3029 if (event->type & GPM_DRAG) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3030 result->modifiers |= drag_modifier; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3031 |
81127
d620b28641cd
(term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
81107
diff
changeset
|
3032 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
|
3033 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3034 /* 1 << KG_SHIFT */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3035 if (event->modifiers & (1 << 0)) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3036 result->modifiers |= shift_modifier; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3037 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3038 /* 1 << KG_CTRL */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3039 if (event->modifiers & (1 << 2)) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3040 result->modifiers |= ctrl_modifier; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3041 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3042 /* 1 << KG_ALT || KG_ALTGR */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3043 if (event->modifiers & (1 << 3) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3044 || event->modifiers & (1 << 1)) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3045 result->modifiers |= meta_modifier; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3046 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3047 |
81127
d620b28641cd
(term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
81107
diff
changeset
|
3048 XSETINT (result->x, event->x); |
d620b28641cd
(term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
81107
diff
changeset
|
3049 XSETINT (result->y, event->y); |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3050 XSETFRAME (result->frame_or_window, f); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3051 result->arg = Qnil; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3052 return Qnil; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3053 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3054 |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
3055 int |
83622 | 3056 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
|
3057 { |
83622 | 3058 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
|
3059 struct input_event ie; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3060 int do_help = 0; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3061 int count = 0; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3062 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3063 EVENT_INIT (ie); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3064 ie.kind = NO_EVENT; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3065 ie.arg = Qnil; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3066 |
81127
d620b28641cd
(term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
81107
diff
changeset
|
3067 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
|
3068 previous_help_echo_string = help_echo_string; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3069 help_echo_string = Qnil; |
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 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
|
3072 |
81127
d620b28641cd
(term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
81107
diff
changeset
|
3073 if (!term_mouse_movement (f, event)) |
d620b28641cd
(term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
81107
diff
changeset
|
3074 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
|
3075 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3076 /* 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
|
3077 has changed, generate a HELP_EVENT. */ |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3078 if (!NILP (help_echo_string) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3079 || !NILP (previous_help_echo_string)) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3080 do_help = 1; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3081 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3082 goto done; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3083 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3084 else { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3085 f->mouse_moved = 0; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3086 term_mouse_click (&ie, event, f); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3087 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3088 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3089 done: |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3090 if (ie.kind != NO_EVENT) |
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 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
|
3093 count++; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3094 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3095 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3096 if (do_help |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3097 && !(hold_quit && hold_quit->kind != NO_EVENT)) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3098 { |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3099 Lisp_Object frame; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3100 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3101 if (f) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3102 XSETFRAME (frame, f); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3103 else |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3104 frame = Qnil; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3105 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3106 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
|
3107 help_echo_object, help_echo_pos); |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3108 count++; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3109 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3110 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3111 return count; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3112 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3113 |
84968
85eb2660cbe3
(mouse_face_window): Rename from Qmouse_face_window. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84955
diff
changeset
|
3114 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
|
3115 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
|
3116 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
|
3117 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
|
3118 () |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3119 { |
84768
53194ec05789
* termhooks.h (term_gpm): Delete. Use gpm_tty's NULLness instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84692
diff
changeset
|
3120 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
|
3121 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
|
3122 = ((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
|
3123 ? (f)->terminal->display_info.tty : NULL); |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3124 Gpm_Connect connection; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3125 |
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
|
3126 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
|
3127 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
|
3128 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
|
3129 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
|
3130 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
|
3131 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
|
3132 |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3133 connection.eventMask = ~0; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3134 connection.defaultMask = ~GPM_HARD; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3135 connection.maxMod = ~0; |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3136 connection.minMod = 0; |
81127
d620b28641cd
(term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents:
81107
diff
changeset
|
3137 gpm_zerobased = 1; |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3138 |
84768
53194ec05789
* termhooks.h (term_gpm): Delete. Use gpm_tty's NULLness instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84692
diff
changeset
|
3139 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
|
3140 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
|
3141 else |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3142 { |
84768
53194ec05789
* termhooks.h (term_gpm): Delete. Use gpm_tty's NULLness instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84692
diff
changeset
|
3143 gpm_tty = tty; |
84955
dfbee4931a6a
(Fterm_open_connection): Add comment.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84849
diff
changeset
|
3144 /* `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
|
3145 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
|
3146 before calling init_sys_modes. */ |
83622 | 3147 reset_sys_modes (tty); |
3148 init_sys_modes (tty); | |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3149 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
|
3150 return Qnil; |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3151 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3152 } |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3153 |
98155
314662df7c17
* term.c (close_gpm): New fun extracted from Fgpm_mouse_stop.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
97830
diff
changeset
|
3154 void |
102744
d69c45eb83b1
* keyboard.c (tty_read_avail_input): Don't treat a -1 return from
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
101964
diff
changeset
|
3155 close_gpm (int fd) |
98155
314662df7c17
* term.c (close_gpm): New fun extracted from Fgpm_mouse_stop.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
97830
diff
changeset
|
3156 { |
102744
d69c45eb83b1
* keyboard.c (tty_read_avail_input): Don't treat a -1 return from
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
101964
diff
changeset
|
3157 if (fd >= 0) |
d69c45eb83b1
* keyboard.c (tty_read_avail_input): Don't treat a -1 return from
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
101964
diff
changeset
|
3158 delete_gpm_wait_descriptor (fd); |
98155
314662df7c17
* term.c (close_gpm): New fun extracted from Fgpm_mouse_stop.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
97830
diff
changeset
|
3159 while (Gpm_Close()); /* close all the stack */ |
314662df7c17
* term.c (close_gpm): New fun extracted from Fgpm_mouse_stop.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
97830
diff
changeset
|
3160 gpm_tty = NULL; |
314662df7c17
* term.c (close_gpm): New fun extracted from Fgpm_mouse_stop.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
97830
diff
changeset
|
3161 } |
314662df7c17
* term.c (close_gpm): New fun extracted from Fgpm_mouse_stop.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
97830
diff
changeset
|
3162 |
84968
85eb2660cbe3
(mouse_face_window): Rename from Qmouse_face_window. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84955
diff
changeset
|
3163 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
|
3164 0, 0, 0, |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3165 doc: /* Close a connection to Gpm. */) |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3166 () |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3167 { |
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
|
3168 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
|
3169 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
|
3170 = ((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
|
3171 ? (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
|
3172 |
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
|
3173 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
|
3174 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
|
3175 |
102744
d69c45eb83b1
* keyboard.c (tty_read_avail_input): Don't treat a -1 return from
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
101964
diff
changeset
|
3176 close_gpm (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
|
3177 return Qnil; |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3178 } |
80994
62b6aa7f8c37
Use HAVE_GPM instead of HAVE_GPM_H.
Nick Roberts <nickrob@snap.net.nz>
parents:
80979
diff
changeset
|
3179 #endif /* HAVE_GPM */ |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3180 |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3181 |
103617
9342805096db
(create_tty_output) [MSDOS]: #ifdef away.
Eli Zaretskii <eliz@gnu.org>
parents:
103605
diff
changeset
|
3182 #ifndef MSDOS |
25002 | 3183 /*********************************************************************** |
3184 Initialization | |
3185 ***********************************************************************/ | |
3186 | |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3187 /* 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
|
3188 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
|
3189 |
21514 | 3190 void |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3191 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
|
3192 { |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3193 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
|
3194 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3195 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
|
3196 abort (); |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3197 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3198 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
|
3199 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
|
3200 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3201 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
|
3202 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3203 f->output_data.tty = t; |
53226
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
3204 } |
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
3205 |
100367
b6b22701e97c
(tty_free_frame_resources): Renamed from delete_tty_output; all
Chong Yidong <cyd@stupidchicken.com>
parents:
100276
diff
changeset
|
3206 /* Delete frame F's face cache, and its tty-dependent part. */ |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3207 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3208 static void |
100367
b6b22701e97c
(tty_free_frame_resources): Renamed from delete_tty_output; all
Chong Yidong <cyd@stupidchicken.com>
parents:
100276
diff
changeset
|
3209 tty_free_frame_resources (struct frame *f) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3210 { |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3211 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
|
3212 abort (); |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3213 |
100367
b6b22701e97c
(tty_free_frame_resources): Renamed from delete_tty_output; all
Chong Yidong <cyd@stupidchicken.com>
parents:
100276
diff
changeset
|
3214 if (FRAME_FACE_CACHE (f)) |
b6b22701e97c
(tty_free_frame_resources): Renamed from delete_tty_output; all
Chong Yidong <cyd@stupidchicken.com>
parents:
100276
diff
changeset
|
3215 free_frame_faces (f); |
b6b22701e97c
(tty_free_frame_resources): Renamed from delete_tty_output; all
Chong Yidong <cyd@stupidchicken.com>
parents:
100276
diff
changeset
|
3216 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3217 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
|
3218 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3219 |
103617
9342805096db
(create_tty_output) [MSDOS]: #ifdef away.
Eli Zaretskii <eliz@gnu.org>
parents:
103605
diff
changeset
|
3220 #else /* MSDOS */ |
9342805096db
(create_tty_output) [MSDOS]: #ifdef away.
Eli Zaretskii <eliz@gnu.org>
parents:
103605
diff
changeset
|
3221 |
9342805096db
(create_tty_output) [MSDOS]: #ifdef away.
Eli Zaretskii <eliz@gnu.org>
parents:
103605
diff
changeset
|
3222 /* Delete frame F's face cache. */ |
9342805096db
(create_tty_output) [MSDOS]: #ifdef away.
Eli Zaretskii <eliz@gnu.org>
parents:
103605
diff
changeset
|
3223 |
9342805096db
(create_tty_output) [MSDOS]: #ifdef away.
Eli Zaretskii <eliz@gnu.org>
parents:
103605
diff
changeset
|
3224 static void |
9342805096db
(create_tty_output) [MSDOS]: #ifdef away.
Eli Zaretskii <eliz@gnu.org>
parents:
103605
diff
changeset
|
3225 tty_free_frame_resources (struct frame *f) |
9342805096db
(create_tty_output) [MSDOS]: #ifdef away.
Eli Zaretskii <eliz@gnu.org>
parents:
103605
diff
changeset
|
3226 { |
9342805096db
(create_tty_output) [MSDOS]: #ifdef away.
Eli Zaretskii <eliz@gnu.org>
parents:
103605
diff
changeset
|
3227 if (! FRAME_TERMCAP_P (f) && ! FRAME_MSDOS_P (f)) |
9342805096db
(create_tty_output) [MSDOS]: #ifdef away.
Eli Zaretskii <eliz@gnu.org>
parents:
103605
diff
changeset
|
3228 abort (); |
9342805096db
(create_tty_output) [MSDOS]: #ifdef away.
Eli Zaretskii <eliz@gnu.org>
parents:
103605
diff
changeset
|
3229 |
9342805096db
(create_tty_output) [MSDOS]: #ifdef away.
Eli Zaretskii <eliz@gnu.org>
parents:
103605
diff
changeset
|
3230 if (FRAME_FACE_CACHE (f)) |
9342805096db
(create_tty_output) [MSDOS]: #ifdef away.
Eli Zaretskii <eliz@gnu.org>
parents:
103605
diff
changeset
|
3231 free_frame_faces (f); |
9342805096db
(create_tty_output) [MSDOS]: #ifdef away.
Eli Zaretskii <eliz@gnu.org>
parents:
103605
diff
changeset
|
3232 } |
9342805096db
(create_tty_output) [MSDOS]: #ifdef away.
Eli Zaretskii <eliz@gnu.org>
parents:
103605
diff
changeset
|
3233 #endif /* MSDOS */ |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3234 |
84461
7ec30b352b6e
* xterm.c (x_create_terminal): Add comment.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
84359
diff
changeset
|
3235 /* 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
|
3236 |
83521
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3237 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
|
3238 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
|
3239 { |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3240 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
|
3241 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
|
3242 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
|
3243 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
|
3244 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
|
3245 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
|
3246 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
|
3247 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
|
3248 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
|
3249 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
|
3250 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
|
3251 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
|
3252 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
|
3253 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
|
3254 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
|
3255 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
|
3256 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
|
3257 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
|
3258 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
|
3259 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
|
3260 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
|
3261 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
|
3262 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
|
3263 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
|
3264 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
|
3265 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
|
3266 |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3267 /* 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
|
3268 correctly. */ |
100367
b6b22701e97c
(tty_free_frame_resources): Renamed from delete_tty_output; all
Chong Yidong <cyd@stupidchicken.com>
parents:
100276
diff
changeset
|
3269 terminal->delete_frame_hook = &tty_free_frame_resources; |
83521
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3270 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
|
3271 } |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3272 |
84461
7ec30b352b6e
* xterm.c (x_create_terminal): Add comment.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
84359
diff
changeset
|
3273 /* 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
|
3274 |
83521
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3275 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
|
3276 set_tty_hooks (struct terminal *terminal) |
253 | 3277 { |
83521
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3278 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
|
3279 |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3280 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
|
3281 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
|
3282 |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3283 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
|
3284 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
|
3285 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
|
3286 |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3287 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
|
3288 |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3289 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
|
3290 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
|
3291 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
|
3292 |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3293 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
|
3294 |
83521
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3295 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
|
3296 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
|
3297 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
|
3298 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
|
3299 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
|
3300 |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3301 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
|
3302 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
|
3303 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
|
3304 |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3305 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
|
3306 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
|
3307 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
|
3308 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
|
3309 |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3310 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
|
3311 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
|
3312 |
100367
b6b22701e97c
(tty_free_frame_resources): Renamed from delete_tty_output; all
Chong Yidong <cyd@stupidchicken.com>
parents:
100276
diff
changeset
|
3313 terminal->delete_frame_hook = &tty_free_frame_resources; |
83521
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3314 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
|
3315 } |
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3316 |
83086
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
3317 /* 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
|
3318 static void |
83086
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
3319 dissociate_if_controlling_tty (int fd) |
253 | 3320 { |
97658 | 3321 #ifndef DOS_NT |
83086
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
3322 int pgid; |
83154
ae72b7a6c292
Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents:
83147
diff
changeset
|
3323 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
|
3324 if (pgid != -1) |
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
3325 { |
83154
ae72b7a6c292
Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents:
83147
diff
changeset
|
3326 #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
|
3327 setpgrp (); |
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
3328 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
|
3329 #elif defined (CYGWIN) |
b651dc7c54ac
* term.c (dissociate_if_controlling_tty): Call setsid on CYGWIN.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83891
diff
changeset
|
3330 setsid (); |
b651dc7c54ac
* term.c (dissociate_if_controlling_tty): Call setsid on CYGWIN.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83891
diff
changeset
|
3331 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
|
3332 #else |
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
3333 #ifdef TIOCNOTTY /* Try BSD ioctls. */ |
83154
ae72b7a6c292
Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents:
83147
diff
changeset
|
3334 sigblock (sigmask (SIGTTOU)); |
84779
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
3335 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
|
3336 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
|
3337 { |
ae72b7a6c292
Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents:
83147
diff
changeset
|
3338 no_controlling_tty = 1; |
ae72b7a6c292
Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents:
83147
diff
changeset
|
3339 } |
ae72b7a6c292
Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents:
83147
diff
changeset
|
3340 if (fd != -1) |
ae72b7a6c292
Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents:
83147
diff
changeset
|
3341 emacs_close (fd); |
ae72b7a6c292
Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents:
83147
diff
changeset
|
3342 sigunblock (sigmask (SIGTTOU)); |
ae72b7a6c292
Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents:
83147
diff
changeset
|
3343 #else |
ae72b7a6c292
Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents:
83147
diff
changeset
|
3344 /* Unknown system. */ |
ae72b7a6c292
Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents:
83147
diff
changeset
|
3345 croak (); |
ae72b7a6c292
Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents:
83147
diff
changeset
|
3346 #endif /* ! TIOCNOTTY */ |
83158
f948c9fd910c
Fix parse error in term.c (ARISAWA Akihiro).
Karoly Lorentey <lorentey@elte.hu>
parents:
83154
diff
changeset
|
3347 #endif /* ! USG */ |
83086
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
3348 } |
97658 | 3349 #endif /* !DOS_NT */ |
83086
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
3350 } |
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
3351 |
83338
5f293f92f85e
Fix compilation error in src/term.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83332
diff
changeset
|
3352 static void maybe_fatal(); |
5f293f92f85e
Fix compilation error in src/term.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83332
diff
changeset
|
3353 |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3354 /* 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
|
3355 type. |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3356 |
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
|
3357 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
|
3358 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
|
3359 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
|
3360 |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3361 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
|
3362 |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3363 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
|
3364 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3365 struct terminal * |
83341
76e51706154e
Rename term_init to init_tty.
Karoly Lorentey <lorentey@elte.hu>
parents:
83338
diff
changeset
|
3366 init_tty (char *name, char *terminal_type, int must_succeed) |
253 | 3367 { |
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
|
3368 char *area = NULL; |
253 | 3369 char **address = &area; |
52314
529dd59ee898
(term_init): Remove `const' from buffer_size's declaration.
Eli Zaretskii <eliz@gnu.org>
parents:
52294
diff
changeset
|
3370 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
|
3371 register char *p = NULL; |
253 | 3372 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
|
3373 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
|
3374 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
|
3375 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
|
3376 |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3377 if (!terminal_type) |
100276
8f4457a692c5
(encode_terminal_code): Free any previous memory blocks
Chong Yidong <cyd@stupidchicken.com>
parents:
98367
diff
changeset
|
3378 maybe_fatal (must_succeed, 0, |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3379 "Unknown terminal type", |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3380 "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
|
3381 |
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
|
3382 if (name == NULL) |
84779
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
3383 name = DEV_TTY; |
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
3384 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
|
3385 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
|
3386 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3387 /* 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
|
3388 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
|
3389 /* 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
|
3390 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
|
3391 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
|
3392 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
|
3393 if (terminal) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3394 return terminal; |
84779
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
3395 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3396 terminal = create_terminal (); |
97658 | 3397 #ifdef MSDOS |
3398 if (been_here > 0) | |
100276
8f4457a692c5
(encode_terminal_code): Free any previous memory blocks
Chong Yidong <cyd@stupidchicken.com>
parents:
98367
diff
changeset
|
3399 maybe_fatal (1, 0, "Attempt to create another terminal %s", "", |
97658 | 3400 name, ""); |
3401 been_here = 1; | |
3402 tty = &the_only_display_info; | |
3403 #else | |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3404 tty = (struct tty_display_info *) xmalloc (sizeof (struct tty_display_info)); |
97658 | 3405 #endif |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3406 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
|
3407 tty->next = tty_list; |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3408 tty_list = tty; |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3409 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3410 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
|
3411 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
|
3412 tty->terminal = terminal; |
53226
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
3413 |
82991
2b26656ff804
MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82990
diff
changeset
|
3414 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
|
3415 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
|
3416 |
97658 | 3417 #ifndef DOS_NT |
83521
40a5d8a15056
Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83512
diff
changeset
|
3418 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
|
3419 |
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
|
3420 { |
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
|
3421 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
|
3422 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
|
3423 |
b8237c556f0e
Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents:
83027
diff
changeset
|
3424 #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
|
3425 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
|
3426 /* 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
|
3427 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
|
3428 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
|
3429 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
|
3430 else |
83032
b8237c556f0e
Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents:
83027
diff
changeset
|
3431 #else |
83074
34a7a8f40548
Fix background-mode on terminal frames (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83065
diff
changeset
|
3432 /* 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
|
3433 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
|
3434 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
|
3435 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
|
3436 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
|
3437 #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
|
3438 |
100370
c611d83003ce
(init_tty): Move setting the terminal name before the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
100367
diff
changeset
|
3439 tty->name = xstrdup (name); |
c611d83003ce
(init_tty): Move setting the terminal name before the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
100367
diff
changeset
|
3440 terminal->name = xstrdup (name); |
c611d83003ce
(init_tty): Move setting the terminal name before the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
100367
diff
changeset
|
3441 |
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
|
3442 if (fd < 0) |
100276
8f4457a692c5
(encode_terminal_code): Free any previous memory blocks
Chong Yidong <cyd@stupidchicken.com>
parents:
98367
diff
changeset
|
3443 maybe_fatal (must_succeed, terminal, |
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
|
3444 "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
|
3445 "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
|
3446 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
|
3447 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
|
3448 { |
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
|
3449 close (fd); |
100276
8f4457a692c5
(encode_terminal_code): Free any previous memory blocks
Chong Yidong <cyd@stupidchicken.com>
parents:
98367
diff
changeset
|
3450 maybe_fatal (must_succeed, terminal, |
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
|
3451 "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
|
3452 "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
|
3453 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
|
3454 } |
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
|
3455 |
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
|
3456 #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
|
3457 if (!ctty) |
83086
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
3458 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
|
3459 #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
|
3460 |
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
|
3461 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
|
3462 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
|
3463 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
|
3464 } |
84779
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
3465 |
82989
f3845715a5f6
Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
82988
diff
changeset
|
3466 tty->type = xstrdup (terminal_type); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3467 |
82988
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
3468 add_keyboard_wait_descriptor (fileno (tty->input)); |
253 | 3469 |
97658 | 3470 #endif /* !DOS_NT */ |
3471 | |
90059
9b0bfaaaec9c
Sync to the change in HEAD on 2004-11-30.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
3472 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
|
3473 encode_terminal_dst_size = 0; |
58638
67bea14002c3
(encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents:
54428
diff
changeset
|
3474 |
80994
62b6aa7f8c37
Use HAVE_GPM instead of HAVE_GPM_H.
Nick Roberts <nickrob@snap.net.nz>
parents:
80979
diff
changeset
|
3475 #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
|
3476 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
|
3477 mouse_face_window = Qnil; |
80979
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3478 #endif |
3d81d0b44577
(write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents:
76627
diff
changeset
|
3479 |
97658 | 3480 #ifdef DOS_NT |
9797
05d9072c5a38
(term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents:
9658
diff
changeset
|
3481 #ifdef WINDOWSNT |
83883
cbc88cef4fca
(init_tty) [WINDOWSNT]: Pass terminal to
Jason Rumney <jasonr@gnu.org>
parents:
83875
diff
changeset
|
3482 initialize_w32_display (terminal); |
97658 | 3483 #else /* MSDOS */ |
3484 if (strcmp (terminal_type, "internal") == 0) | |
3485 terminal->type = output_msdos_raw; | |
3486 initialize_msdos_display (terminal); | |
3487 #endif /* MSDOS */ | |
3488 tty->output = stdout; | |
3489 tty->input = stdin; | |
83889
2855c55ba18b
(init_tty) [WINDOWSNT]: Add hooks that are not accessible
Jason Rumney <jasonr@gnu.org>
parents:
83883
diff
changeset
|
3490 /* The following two are inaccessible from w32console.c. */ |
100367
b6b22701e97c
(tty_free_frame_resources): Renamed from delete_tty_output; all
Chong Yidong <cyd@stupidchicken.com>
parents:
100276
diff
changeset
|
3491 terminal->delete_frame_hook = &tty_free_frame_resources; |
83889
2855c55ba18b
(init_tty) [WINDOWSNT]: Add hooks that are not accessible
Jason Rumney <jasonr@gnu.org>
parents:
83883
diff
changeset
|
3492 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
|
3493 |
84779
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
3494 tty->name = xstrdup (name); |
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
3495 terminal->name = xstrdup (name); |
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
3496 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
|
3497 |
97658 | 3498 #ifdef subprocesses |
83889
2855c55ba18b
(init_tty) [WINDOWSNT]: Add hooks that are not accessible
Jason Rumney <jasonr@gnu.org>
parents:
83883
diff
changeset
|
3499 add_keyboard_wait_descriptor (0); |
97658 | 3500 #endif |
83889
2855c55ba18b
(init_tty) [WINDOWSNT]: Add hooks that are not accessible
Jason Rumney <jasonr@gnu.org>
parents:
83883
diff
changeset
|
3501 |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3502 Wcm_clear (tty); |
9797
05d9072c5a38
(term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents:
9658
diff
changeset
|
3503 |
97658 | 3504 #ifdef WINDOWSNT |
83582
a6ca8e4443e4
(dissociate_if_controlling_tty) [WINDOWSNT]: Don't define function body.
Jason Rumney <jasonr@gnu.org>
parents:
83560
diff
changeset
|
3505 { |
a6ca8e4443e4
(dissociate_if_controlling_tty) [WINDOWSNT]: Don't define function body.
Jason Rumney <jasonr@gnu.org>
parents:
83560
diff
changeset
|
3506 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
|
3507 |
83889
2855c55ba18b
(init_tty) [WINDOWSNT]: Add hooks that are not accessible
Jason Rumney <jasonr@gnu.org>
parents:
83883
diff
changeset
|
3508 FrameRows (tty) = FRAME_LINES (f); |
2855c55ba18b
(init_tty) [WINDOWSNT]: Add hooks that are not accessible
Jason Rumney <jasonr@gnu.org>
parents:
83883
diff
changeset
|
3509 FrameCols (tty) = FRAME_COLS (f); |
2855c55ba18b
(init_tty) [WINDOWSNT]: Add hooks that are not accessible
Jason Rumney <jasonr@gnu.org>
parents:
83883
diff
changeset
|
3510 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
|
3511 |
2855c55ba18b
(init_tty) [WINDOWSNT]: Add hooks that are not accessible
Jason Rumney <jasonr@gnu.org>
parents:
83883
diff
changeset
|
3512 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
|
3513 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
|
3514 } |
97658 | 3515 #else /* MSDOS */ |
3516 { | |
3517 int height, width; | |
3518 get_tty_size (fileno (tty->input), &width, &height); | |
3519 FrameCols (tty) = width; | |
3520 FrameRows (tty) = height; | |
3521 } | |
3522 #endif /* MSDOS */ | |
83582
a6ca8e4443e4
(dissociate_if_controlling_tty) [WINDOWSNT]: Don't define function body.
Jason Rumney <jasonr@gnu.org>
parents:
83560
diff
changeset
|
3523 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
|
3524 |
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
3525 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
|
3526 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
|
3527 |
9216636c02fc
Rename `struct display' to `struct device'. Update function, parameter and variable names accordingly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83341
diff
changeset
|
3528 /* 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
|
3529 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
|
3530 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
|
3531 terminal->line_ins_del_ok = 0; |
97658 | 3532 #ifdef WINDOWSNT |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3533 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
|
3534 baud_rate = 19200; |
97658 | 3535 #else /* MSDOS */ |
3536 terminal->char_ins_del_ok = 0; | |
3537 init_baud_rate (fileno (tty->input)); | |
3538 #endif /* MSDOS */ | |
9797
05d9072c5a38
(term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents:
9658
diff
changeset
|
3539 |
83582
a6ca8e4443e4
(dissociate_if_controlling_tty) [WINDOWSNT]: Don't define function body.
Jason Rumney <jasonr@gnu.org>
parents:
83560
diff
changeset
|
3540 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
|
3541 |
97658 | 3542 #else /* not DOS_NT */ |
9797
05d9072c5a38
(term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents:
9658
diff
changeset
|
3543 |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3544 Wcm_clear (tty); |
253 | 3545 |
100276
8f4457a692c5
(encode_terminal_code): Free any previous memory blocks
Chong Yidong <cyd@stupidchicken.com>
parents:
98367
diff
changeset
|
3546 tty->termcap_term_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
|
3547 |
83086
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
3548 /* 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
|
3549 terminal. */ |
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
3550 sigblock (sigmask (SIGTTOU)); |
100276
8f4457a692c5
(encode_terminal_code): Free any previous memory blocks
Chong Yidong <cyd@stupidchicken.com>
parents:
98367
diff
changeset
|
3551 status = tgetent (tty->termcap_term_buffer, terminal_type); |
83086
347ce3d5d79c
Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents:
83082
diff
changeset
|
3552 sigunblock (sigmask (SIGTTOU)); |
84779
67e430e38471
(DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents:
84769
diff
changeset
|
3553 |
253 | 3554 if (status < 0) |
10824
894369e950f5
(term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents:
10771
diff
changeset
|
3555 { |
894369e950f5
(term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents:
10771
diff
changeset
|
3556 #ifdef TERMINFO |
100276
8f4457a692c5
(encode_terminal_code): Free any previous memory blocks
Chong Yidong <cyd@stupidchicken.com>
parents:
98367
diff
changeset
|
3557 maybe_fatal (must_succeed, terminal, |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3558 "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
|
3559 "Cannot open terminfo database file"); |
10824
894369e950f5
(term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents:
10771
diff
changeset
|
3560 #else |
100276
8f4457a692c5
(encode_terminal_code): Free any previous memory blocks
Chong Yidong <cyd@stupidchicken.com>
parents:
98367
diff
changeset
|
3561 maybe_fatal (must_succeed, terminal, |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3562 "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
|
3563 "Cannot open termcap database file"); |
10824
894369e950f5
(term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents:
10771
diff
changeset
|
3564 #endif |
894369e950f5
(term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents:
10771
diff
changeset
|
3565 } |
253 | 3566 if (status == 0) |
10824
894369e950f5
(term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents:
10771
diff
changeset
|
3567 { |
894369e950f5
(term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents:
10771
diff
changeset
|
3568 #ifdef TERMINFO |
100276
8f4457a692c5
(encode_terminal_code): Free any previous memory blocks
Chong Yidong <cyd@stupidchicken.com>
parents:
98367
diff
changeset
|
3569 maybe_fatal (must_succeed, terminal, |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3570 "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
|
3571 "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
|
3572 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
|
3573 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
|
3574 `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
|
3575 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
|
3576 terminal_type); |
10824
894369e950f5
(term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents:
10771
diff
changeset
|
3577 #else |
100276
8f4457a692c5
(encode_terminal_code): Free any previous memory blocks
Chong Yidong <cyd@stupidchicken.com>
parents:
98367
diff
changeset
|
3578 maybe_fatal (must_succeed, terminal, |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3579 "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
|
3580 "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
|
3581 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
|
3582 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
|
3583 `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
|
3584 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
|
3585 terminal_type); |
10824
894369e950f5
(term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents:
10771
diff
changeset
|
3586 #endif |
894369e950f5
(term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents:
10771
diff
changeset
|
3587 } |
52265
84e49afb2178
(term_init): Use a buffer of size 4096 for tgetent since
Richard M. Stallman <rms@gnu.org>
parents:
51212
diff
changeset
|
3588 |
52294
d9ae4cdf1ed1
(term_init): Fix previous change
Kenichi Handa <handa@m17n.org>
parents:
52293
diff
changeset
|
3589 #ifndef TERMINFO |
100276
8f4457a692c5
(encode_terminal_code): Free any previous memory blocks
Chong Yidong <cyd@stupidchicken.com>
parents:
98367
diff
changeset
|
3590 if (strlen (tty->termcap_term_buffer) >= buffer_size) |
52265
84e49afb2178
(term_init): Use a buffer of size 4096 for tgetent since
Richard M. Stallman <rms@gnu.org>
parents:
51212
diff
changeset
|
3591 abort (); |
100276
8f4457a692c5
(encode_terminal_code): Free any previous memory blocks
Chong Yidong <cyd@stupidchicken.com>
parents:
98367
diff
changeset
|
3592 buffer_size = strlen (tty->termcap_term_buffer); |
52293
473d34d4814c
(term_init): Fix previous change; don't rely on the
Kenichi Handa <handa@m17n.org>
parents:
52265
diff
changeset
|
3593 #endif |
100276
8f4457a692c5
(encode_terminal_code): Free any previous memory blocks
Chong Yidong <cyd@stupidchicken.com>
parents:
98367
diff
changeset
|
3594 tty->termcap_strings_buffer = area = (char *) xmalloc (buffer_size); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3595 tty->TS_ins_line = tgetstr ("al", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3596 tty->TS_ins_multi_lines = tgetstr ("AL", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3597 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
|
3598 BackTab (tty) = tgetstr ("bt", address); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3599 tty->TS_clr_to_bottom = tgetstr ("cd", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3600 tty->TS_clr_line = tgetstr ("ce", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3601 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
|
3602 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
|
3603 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
|
3604 CR (tty) = tgetstr ("cr", address); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3605 tty->TS_set_scroll_region = tgetstr ("cs", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3606 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
|
3607 RowPosition (tty) = tgetstr ("cv", address); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3608 tty->TS_del_char = tgetstr ("dc", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3609 tty->TS_del_multi_chars = tgetstr ("DC", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3610 tty->TS_del_line = tgetstr ("dl", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3611 tty->TS_del_multi_lines = tgetstr ("DL", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3612 tty->TS_delete_mode = tgetstr ("dm", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3613 tty->TS_end_delete_mode = tgetstr ("ed", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3614 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
|
3615 Home (tty) = tgetstr ("ho", address); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3616 tty->TS_ins_char = tgetstr ("ic", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3617 tty->TS_ins_multi_chars = tgetstr ("IC", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3618 tty->TS_insert_mode = tgetstr ("im", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3619 tty->TS_pad_inserted_char = tgetstr ("ip", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3620 tty->TS_end_keypad_mode = tgetstr ("ke", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3621 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
|
3622 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
|
3623 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
|
3624 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
|
3625 if (!Down (tty)) |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3626 Down (tty) = tgetstr ("nl", address); /* Obsolete name for "do" */ |
253 | 3627 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
|
3628 Left (tty) = "\b"; /* can't possibly be longer! */ |
253 | 3629 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
|
3630 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
|
3631 if (!Left (tty)) |
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3632 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
|
3633 tty->TS_pad_char = tgetstr ("pc", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3634 tty->TS_repeat = tgetstr ("rp", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3635 tty->TS_end_standout_mode = tgetstr ("se", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3636 tty->TS_fwd_scroll = tgetstr ("sf", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3637 tty->TS_standout_mode = tgetstr ("so", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3638 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
|
3639 tty->Wcm->cm_tab = tgetstr ("ta", address); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3640 tty->TS_end_termcap_modes = tgetstr ("te", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3641 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
|
3642 Up (tty) = tgetstr ("up", address); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3643 tty->TS_visible_bell = tgetstr ("vb", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3644 tty->TS_cursor_normal = tgetstr ("ve", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3645 tty->TS_cursor_visible = tgetstr ("vs", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3646 tty->TS_cursor_invisible = tgetstr ("vi", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3647 tty->TS_set_window = tgetstr ("wi", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3648 |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3649 tty->TS_enter_underline_mode = tgetstr ("us", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3650 tty->TS_exit_underline_mode = tgetstr ("ue", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3651 tty->TS_enter_bold_mode = tgetstr ("md", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3652 tty->TS_enter_dim_mode = tgetstr ("mh", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3653 tty->TS_enter_blink_mode = tgetstr ("mb", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3654 tty->TS_enter_reverse_mode = tgetstr ("mr", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3655 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
|
3656 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
|
3657 tty->TS_exit_attribute_mode = tgetstr ("me", address); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
3658 |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3659 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
|
3660 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
|
3661 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
|
3662 MultiRight (tty) = tgetstr ("RI", address); |
253 | 3663 |
26425
08c26156186a
(term_init): If "op" isn't available, don't support color
Gerd Moellmann <gerd@gnu.org>
parents:
25727
diff
changeset
|
3664 /* 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
|
3665 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
|
3666 background. */ |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3667 tty->TS_orig_pair = tgetstr ("op", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3668 if (tty->TS_orig_pair) |
25002 | 3669 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3670 tty->TS_set_foreground = tgetstr ("AF", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3671 tty->TS_set_background = tgetstr ("AB", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3672 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
|
3673 { |
08c26156186a
(term_init): If "op" isn't available, don't support color
Gerd Moellmann <gerd@gnu.org>
parents:
25727
diff
changeset
|
3674 /* SVr4. */ |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3675 tty->TS_set_foreground = tgetstr ("Sf", address); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3676 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
|
3677 } |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
3678 |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3679 tty->TN_max_colors = tgetnum ("Co"); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3680 tty->TN_max_pairs = tgetnum ("pa"); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3681 |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3682 tty->TN_no_color_video = tgetnum ("NC"); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3683 if (tty->TN_no_color_video == -1) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3684 tty->TN_no_color_video = 0; |
25002 | 3685 } |
3686 | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3687 tty_default_color_capabilities (tty, 1); |
42742
73fcf65b58d3
(tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents:
42122
diff
changeset
|
3688 |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3689 MagicWrap (tty) = tgetflag ("xn"); |
11530
a265aaa699e0
(term_init): MagicWrap implies AutoWrap.
Karl Heuer <kwzh@gnu.org>
parents:
11235
diff
changeset
|
3690 /* 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
|
3691 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
|
3692 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
|
3693 terminal->memory_below_frame = tgetflag ("db"); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3694 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
|
3695 terminal->must_write_spaces = tgetflag ("in"); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3696 tty->meta_key = tgetflag ("km") || tgetflag ("MT"); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3697 tty->TF_insmode_motion = tgetflag ("mi"); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3698 tty->TF_standout_motion = tgetflag ("ms"); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3699 tty->TF_underscore = tgetflag ("ul"); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3700 tty->TF_teleray = tgetflag ("xt"); |
253 | 3701 |
97658 | 3702 #endif /* !DOS_NT */ |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3703 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
|
3704 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
|
3705 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
|
3706 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
|
3707 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
|
3708 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
|
3709 /* 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
|
3710 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
|
3711 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
|
3712 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
|
3713 current_kboard = terminal->kboard; |
97658 | 3714 #ifndef DOS_NT |
83619
5da6a46ddbd6
* s/darwin.h (SYSTEM_PURESIZE_EXTRA): Define here.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83616
diff
changeset
|
3715 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
|
3716 |
765 | 3717 /* 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
|
3718 { |
4c74d7f1cfa6
(term_init): Avoid type-mismatch calling get_frame_size.
Richard M. Stallman <rms@gnu.org>
parents:
15974
diff
changeset
|
3719 int height, width; |
83065
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
3720 get_tty_size (fileno (tty->input), &width, &height); |
53341 | 3721 FrameCols (tty) = width; |
3722 FrameRows (tty) = height; | |
16093
4c74d7f1cfa6
(term_init): Avoid type-mismatch calling get_frame_size.
Richard M. Stallman <rms@gnu.org>
parents:
15974
diff
changeset
|
3723 } |
4c74d7f1cfa6
(term_init): Avoid type-mismatch calling get_frame_size.
Richard M. Stallman <rms@gnu.org>
parents:
15974
diff
changeset
|
3724 |
53341 | 3725 if (FrameCols (tty) <= 0) |
3726 FrameCols (tty) = tgetnum ("co"); | |
3727 if (FrameRows (tty) <= 0) | |
3728 FrameRows (tty) = tgetnum ("li"); | |
3729 | |
3730 if (FrameRows (tty) < 3 || FrameCols (tty) < 3) | |
100276
8f4457a692c5
(encode_terminal_code): Free any previous memory blocks
Chong Yidong <cyd@stupidchicken.com>
parents:
98367
diff
changeset
|
3731 maybe_fatal (must_succeed, terminal, |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3732 "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
|
3733 "Screen size %dx%d is too small", |
53341 | 3734 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
|
3735 |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3736 TabWidth (tty) = tgetnum ("tw"); |
253 | 3737 |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3738 if (!tty->TS_bell) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3739 tty->TS_bell = "\07"; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3740 |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3741 if (!tty->TS_fwd_scroll) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3742 tty->TS_fwd_scroll = Down (tty); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3743 |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3744 PC = tty->TS_pad_char ? *tty->TS_pad_char : 0; |
253 | 3745 |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3746 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
|
3747 TabWidth (tty) = 8; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46559
diff
changeset
|
3748 |
253 | 3749 /* Turned off since /etc/termcap seems to have :ta= for most terminals |
3750 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
|
3751 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
|
3752 tty->Wcm->cm_tab = "\t"; |
253 | 3753 */ |
3754 | |
40086
050b19294988
(TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents:
40081
diff
changeset
|
3755 /* 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
|
3756 turn off any that do. */ |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3757 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
|
3758 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3759 tty->TS_standout_mode = 0; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3760 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
|
3761 } |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3762 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
|
3763 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3764 tty->TS_enter_underline_mode = 0; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3765 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
|
3766 } |
050b19294988
(TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents:
40081
diff
changeset
|
3767 |
050b19294988
(TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents:
40081
diff
changeset
|
3768 /* 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
|
3769 if (tty->TS_standout_mode == 0) |
253 | 3770 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3771 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
|
3772 tty->TS_end_standout_mode = tty->TS_exit_underline_mode; |
253 | 3773 } |
3774 | |
5933
560cee2048ed
(term_init): If no `se', use `me';
Richard M. Stallman <rms@gnu.org>
parents:
5648
diff
changeset
|
3775 /* 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
|
3776 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
|
3777 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
|
3778 { |
8612
86065bec6fc9
(term_init): Added missing argument to tgetstr.
Richard M. Stallman <rms@gnu.org>
parents:
8027
diff
changeset
|
3779 char *s = tgetstr ("me", address); |
5933
560cee2048ed
(term_init): If no `se', use `me';
Richard M. Stallman <rms@gnu.org>
parents:
5648
diff
changeset
|
3780 if (s != 0) |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3781 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
|
3782 else |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3783 tty->TS_standout_mode = 0; |
5933
560cee2048ed
(term_init): If no `se', use `me';
Richard M. Stallman <rms@gnu.org>
parents:
5648
diff
changeset
|
3784 } |
560cee2048ed
(term_init): If no `se', use `me';
Richard M. Stallman <rms@gnu.org>
parents:
5648
diff
changeset
|
3785 |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3786 if (tty->TF_teleray) |
253 | 3787 { |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3788 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
|
3789 /* 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
|
3790 tty->TS_standout_mode = 0; |
253 | 3791 /* 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
|
3792 CR (tty) = 0; |
253 | 3793 /* LF can't be trusted either -- can alter hpos */ |
3794 /* 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
|
3795 Down (tty) = 0; |
253 | 3796 } |
3797 | |
3798 /* Special handling for certain terminal types known to need it */ | |
3799 | |
3800 if (!strcmp (terminal_type, "supdup")) | |
3801 { | |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3802 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
|
3803 tty->Wcm->cm_losewrap = 1; |
253 | 3804 } |
3805 if (!strncmp (terminal_type, "c10", 3) | |
3806 || !strcmp (terminal_type, "perq")) | |
3807 { | |
3808 /* Supply a makeshift :wi string. | |
3809 This string is not valid in general since it works only | |
3810 for windows starting at the upper left corner; | |
3811 but that is all Emacs uses. | |
3812 | |
765 | 3813 This string works only if the frame is using |
253 | 3814 the top of the video memory, because addressing is memory-relative. |
3815 So first check the :ti string to see if that is true. | |
3816 | |
3817 It would be simpler if the :wi string could go in the termcap | |
3818 entry, but it can't because it is not fully valid. | |
3819 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
|
3820 if (!tty->TS_set_window) |
253 | 3821 { |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3822 p = tty->TS_termcap_modes; |
253 | 3823 while (*p && strcmp (p, "\033v ")) |
3824 p++; | |
3825 if (*p) | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3826 tty->TS_set_window = "\033v%C %C %C %C "; |
253 | 3827 } |
3828 /* 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
|
3829 terminal->must_write_spaces = 1; |
253 | 3830 /* :ti string typically fails to have \E^G! in it */ |
3831 /* 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
|
3832 strcpy (area, tty->TS_termcap_modes); |
253 | 3833 strcat (area, "\033\007!"); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3834 tty->TS_termcap_modes = area; |
253 | 3835 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
|
3836 p = AbsPosition (tty); |
253 | 3837 /* Change all %+ parameters to %C, to handle |
53226
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
3838 values above 96 correctly for the C100. */ |
253 | 3839 while (*p) |
53226
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
3840 { |
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
3841 if (p[0] == '%' && p[1] == '+') |
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
3842 p[1] = 'C'; |
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
3843 p++; |
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
3844 } |
253 | 3845 } |
3846 | |
53341 | 3847 tty->specified_window = FrameRows (tty); |
253 | 3848 |
53232
22aaf1e5fbe6
Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents:
53229
diff
changeset
|
3849 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
|
3850 { |
100276
8f4457a692c5
(encode_terminal_code): Free any previous memory blocks
Chong Yidong <cyd@stupidchicken.com>
parents:
98367
diff
changeset
|
3851 maybe_fatal (must_succeed, terminal, |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3852 "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
|
3853 # ifdef TERMINFO |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3854 "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
|
3855 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
|
3856 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
|
3857 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
|
3858 `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
|
3859 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
|
3860 # else /* TERMCAP */ |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3861 "Terminal type \"%s\" is not powerful enough to run Emacs.\n\ |
253 | 3862 It lacks the ability to position the cursor.\n\ |
3863 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
|
3864 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
|
3865 `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
|
3866 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
|
3867 # endif /* TERMINFO */ |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3868 terminal_type); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3869 } |
82990
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
3870 |
53341 | 3871 if (FrameRows (tty) <= 0 || FrameCols (tty) <= 0) |
100276
8f4457a692c5
(encode_terminal_code): Free any previous memory blocks
Chong Yidong <cyd@stupidchicken.com>
parents:
98367
diff
changeset
|
3872 maybe_fatal (must_succeed, terminal, |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3873 "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
|
3874 "Could not determine the frame size"); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3875 |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3876 tty->delete_in_insert_mode |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3877 = tty->TS_delete_mode && tty->TS_insert_mode |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3878 && !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
|
3879 |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3880 tty->se_is_so = (tty->TS_standout_mode |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3881 && tty->TS_end_standout_mode |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3882 && !strcmp (tty->TS_standout_mode, tty->TS_end_standout_mode)); |
253 | 3883 |
83065
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
3884 UseTabs (tty) = tabs_safe_p (fileno (tty->input)) && TabWidth (tty) == 8; |
253 | 3885 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3886 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
|
3887 = (tty->Wcm->cm_abs |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3888 && (tty->TS_set_window || tty->TS_set_scroll_region || tty->TS_set_scroll_region_1)); |
253 | 3889 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3890 terminal->line_ins_del_ok |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3891 = (((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
|
3892 && (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
|
3893 || (terminal->scroll_region_ok |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3894 && tty->TS_fwd_scroll && tty->TS_rev_scroll)); |
53226
dd3018b4785b
Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents:
53225
diff
changeset
|
3895 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3896 terminal->char_ins_del_ok |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3897 = ((tty->TS_ins_char || tty->TS_insert_mode |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3898 || 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
|
3899 && (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
|
3900 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3901 terminal->fast_clear_end_of_line = tty->TS_clr_line != 0; |
253 | 3902 |
83065
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
3903 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
|
3904 |
97658 | 3905 #endif /* not DOS_NT */ |
84849
ba20cee1aec0
(init_tty): Call init_sys_modes on WINDOWSNT also.
Jason Rumney <jasonr@gnu.org>
parents:
84779
diff
changeset
|
3906 |
53341 | 3907 /* Init system terminal modes (RAW or CBREAK, etc.). */ |
3908 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
|
3909 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3910 return terminal; |
253 | 3911 } |
3912 | |
83341
76e51706154e
Rename term_init to init_tty.
Karoly Lorentey <lorentey@elte.hu>
parents:
83338
diff
changeset
|
3913 /* Auxiliary error-handling function for init_tty. |
100276
8f4457a692c5
(encode_terminal_code): Free any previous memory blocks
Chong Yidong <cyd@stupidchicken.com>
parents:
98367
diff
changeset
|
3914 Delete TERMINAL, then call error or fatal with str1 or str2, |
8f4457a692c5
(encode_terminal_code): Free any previous memory blocks
Chong Yidong <cyd@stupidchicken.com>
parents:
98367
diff
changeset
|
3915 respectively, according to MUST_SUCCEED. */ |
83025
c66ebcc29777
Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83021
diff
changeset
|
3916 |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3917 static void |
100276
8f4457a692c5
(encode_terminal_code): Free any previous memory blocks
Chong Yidong <cyd@stupidchicken.com>
parents:
98367
diff
changeset
|
3918 maybe_fatal (must_succeed, 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
|
3919 int must_succeed; |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3920 struct terminal *terminal; |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3921 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
|
3922 { |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3923 if (terminal) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3924 delete_tty (terminal); |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
3925 |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3926 if (must_succeed) |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3927 fatal (str2, arg1, arg2); |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3928 else |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3929 error (str1, arg1, arg2); |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3930 |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3931 abort (); |
253 | 3932 } |
3933 | |
21514 | 3934 void |
86288
145903731829
* term.c: Include stdarg.h.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85614
diff
changeset
|
3935 fatal (const char *str, ...) |
253 | 3936 { |
86288
145903731829
* term.c: Include stdarg.h.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85614
diff
changeset
|
3937 va_list ap; |
145903731829
* term.c: Include stdarg.h.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85614
diff
changeset
|
3938 va_start (ap, str); |
253 | 3939 fprintf (stderr, "emacs: "); |
86288
145903731829
* term.c: Include stdarg.h.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85614
diff
changeset
|
3940 vfprintf (stderr, str, ap); |
145903731829
* term.c: Include stdarg.h.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85614
diff
changeset
|
3941 va_end (ap); |
253 | 3942 fflush (stderr); |
3943 exit (1); | |
3944 } | |
6752
f9236145bad7
(system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
6652
diff
changeset
|
3945 |
82988
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
3946 |
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
3947 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3948 /* 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
|
3949 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
3950 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
|
3951 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
|
3952 { |
83004
7900111db01c
Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
82995
diff
changeset
|
3953 struct tty_display_info *tty; |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
3954 |
100666
dab9cf44bf3f
In comments, write delete_frame instead of Fdelete_frame.
Martin Rudalics <rudalics@gmx.at>
parents:
100370
diff
changeset
|
3955 /* Protect against recursive calls. delete_frame in |
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
|
3956 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
|
3957 if (!terminal->name) |
53341 | 3958 return; |
3959 | |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3960 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
|
3961 abort (); |
7900111db01c
Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
82995
diff
changeset
|
3962 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3963 tty = terminal->display_info.tty; |
92281
4bf10a5a835d
(encode_terminal_code, produce_special_glyphs): Likewise.
Kim F. Storm <storm@cua.dk>
parents:
92237
diff
changeset
|
3964 |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3965 if (tty == tty_list) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3966 tty_list = tty->next; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3967 else |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3968 { |
82989
f3845715a5f6
Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
82988
diff
changeset
|
3969 struct tty_display_info *p; |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3970 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
|
3971 ; |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3972 |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3973 if (! p) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3974 /* This should not happen. */ |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3975 abort (); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3976 |
53341 | 3977 p->next = tty->next; |
3978 tty->next = 0; | |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3979 } |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3980 |
83342
9216636c02fc
Rename `struct display' to `struct device'. Update function, parameter and variable names accordingly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83341
diff
changeset
|
3981 /* 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
|
3982 before delete_terminal. */ |
83008
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3983 reset_sys_modes (tty); |
040dd41ed7d0
Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
83004
diff
changeset
|
3984 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
3985 delete_terminal (terminal); |
83004
7900111db01c
Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
82995
diff
changeset
|
3986 |
95481
4390d64d3328
Make "xfree (NULL)" a no-op; remove useless if-before-xfree.
Jim Meyering <jim@meyering.net>
parents:
94963
diff
changeset
|
3987 xfree (tty->name); |
4390d64d3328
Make "xfree (NULL)" a no-op; remove useless if-before-xfree.
Jim Meyering <jim@meyering.net>
parents:
94963
diff
changeset
|
3988 xfree (tty->type); |
82990
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
3989 |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
3990 if (tty->input) |
82988
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
3991 { |
97658 | 3992 #ifdef subprocesses |
82988
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
3993 delete_keyboard_wait_descriptor (fileno (tty->input)); |
97658 | 3994 #endif |
82988
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
3995 if (tty->input != stdin) |
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
3996 fclose (tty->input); |
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
3997 } |
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
3998 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
|
3999 fclose (tty->output); |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
4000 if (tty->termscript) |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
4001 fclose (tty->termscript); |
82990
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
4002 |
95481
4390d64d3328
Make "xfree (NULL)" a no-op; remove useless if-before-xfree.
Jim Meyering <jim@meyering.net>
parents:
94963
diff
changeset
|
4003 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
|
4004 xfree (tty->Wcm); |
103624
3e06f0e66062
Remove useless if-before-xfree tests.
Jim Meyering <jim@meyering.net>
parents:
103617
diff
changeset
|
4005 xfree (tty->termcap_strings_buffer); |
3e06f0e66062
Remove useless if-before-xfree tests.
Jim Meyering <jim@meyering.net>
parents:
103617
diff
changeset
|
4006 xfree (tty->termcap_term_buffer); |
82990
2ecd1f669db9
Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents:
82989
diff
changeset
|
4007 |
82989
f3845715a5f6
Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
82988
diff
changeset
|
4008 bzero (tty, sizeof (struct tty_display_info)); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
4009 xfree (tty); |
63549
bda22724fc82
(produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents:
61591
diff
changeset
|
4010 } |
bda22724fc82
(produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents:
61591
diff
changeset
|
4011 |
83004
7900111db01c
Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
82995
diff
changeset
|
4012 |
7900111db01c
Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
82995
diff
changeset
|
4013 |
82989
f3845715a5f6
Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
82988
diff
changeset
|
4014 /* 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
|
4015 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
|
4016 |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
4017 void |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
83416
diff
changeset
|
4018 mark_ttys (void) |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
4019 { |
82989
f3845715a5f6
Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
82988
diff
changeset
|
4020 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
|
4021 |
82988
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
4022 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
|
4023 mark_object (tty->top_frame); |
53233
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
4024 } |
fe9b37bee5f7
Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
53232
diff
changeset
|
4025 |
83004
7900111db01c
Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
82995
diff
changeset
|
4026 |
7900111db01c
Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents:
82995
diff
changeset
|
4027 |
21514 | 4028 void |
6752
f9236145bad7
(system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
6652
diff
changeset
|
4029 syms_of_term () |
f9236145bad7
(system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
6652
diff
changeset
|
4030 { |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39914
diff
changeset
|
4031 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
|
4032 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
|
4033 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
|
4034 #ifdef TERMINFO |
f9236145bad7
(system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
6652
diff
changeset
|
4035 system_uses_terminfo = 1; |
f9236145bad7
(system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
6652
diff
changeset
|
4036 #else |
f9236145bad7
(system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
6652
diff
changeset
|
4037 system_uses_terminfo = 0; |
f9236145bad7
(system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
6652
diff
changeset
|
4038 #endif |
15974
61249a8fe735
(Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
15094
diff
changeset
|
4039 |
83891
dab32bc3edc8
* server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83889
diff
changeset
|
4040 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
|
4041 doc: /* Functions to be run after suspending a tty. |
103048
b5e8a934cfd1
* term.c (Vsuspend_tty_functions, Vresume_tty_functions): Doc fixes,
Chong Yidong <cyd@stupidchicken.com>
parents:
103047
diff
changeset
|
4042 The functions are run with one argument, the terminal object to be suspended. |
83065
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
4043 See `suspend-tty'. */); |
83891
dab32bc3edc8
* server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83889
diff
changeset
|
4044 Vsuspend_tty_functions = Qnil; |
dab32bc3edc8
* server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83889
diff
changeset
|
4045 |
dab32bc3edc8
* server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83889
diff
changeset
|
4046 |
dab32bc3edc8
* server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83889
diff
changeset
|
4047 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
|
4048 doc: /* Functions to be run after resuming a tty. |
103048
b5e8a934cfd1
* term.c (Vsuspend_tty_functions, Vresume_tty_functions): Doc fixes,
Chong Yidong <cyd@stupidchicken.com>
parents:
103047
diff
changeset
|
4049 The functions are run with one argument, the terminal object that was revived. |
83065
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
4050 See `resume-tty'. */); |
83891
dab32bc3edc8
* server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83889
diff
changeset
|
4051 Vresume_tty_functions = Qnil; |
25002 | 4052 |
67935
52bbc53dbce1
(visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66238
diff
changeset
|
4053 DEFVAR_BOOL ("visible-cursor", &visible_cursor, |
52bbc53dbce1
(visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66238
diff
changeset
|
4054 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
|
4055 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
|
4056 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
|
4057 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
|
4058 visible_cursor = 1; |
52bbc53dbce1
(visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66238
diff
changeset
|
4059 |
25002 | 4060 defsubr (&Stty_display_color_p); |
42954
e514d4931d6f
(Ftty_display_color_cells): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
42808
diff
changeset
|
4061 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
|
4062 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
|
4063 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
|
4064 defsubr (&Scontrolling_tty_p); |
83065
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
4065 defsubr (&Ssuspend_tty); |
a871be7b26a5
Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83050
diff
changeset
|
4066 defsubr (&Sresume_tty); |
80994
62b6aa7f8c37
Use HAVE_GPM instead of HAVE_GPM_H.
Nick Roberts <nickrob@snap.net.nz>
parents:
80979
diff
changeset
|
4067 #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
|
4068 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
|
4069 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
|
4070 |
85eb2660cbe3
(mouse_face_window): Rename from Qmouse_face_window. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84955
diff
changeset
|
4071 staticpro (&mouse_face_window); |
80994
62b6aa7f8c37
Use HAVE_GPM instead of HAVE_GPM_H.
Nick Roberts <nickrob@snap.net.nz>
parents:
80979
diff
changeset
|
4072 #endif /* HAVE_GPM */ |
97021
fb376eec83a9
(syms_of_term): Initialize default_orig_pair, default_set_foreground,
Chong Yidong <cyd@stupidchicken.com>
parents:
96303
diff
changeset
|
4073 |
97658 | 4074 #ifndef DOS_NT |
97021
fb376eec83a9
(syms_of_term): Initialize default_orig_pair, default_set_foreground,
Chong Yidong <cyd@stupidchicken.com>
parents:
96303
diff
changeset
|
4075 default_orig_pair = NULL; |
fb376eec83a9
(syms_of_term): Initialize default_orig_pair, default_set_foreground,
Chong Yidong <cyd@stupidchicken.com>
parents:
96303
diff
changeset
|
4076 default_set_foreground = NULL; |
fb376eec83a9
(syms_of_term): Initialize default_orig_pair, default_set_foreground,
Chong Yidong <cyd@stupidchicken.com>
parents:
96303
diff
changeset
|
4077 default_set_background = NULL; |
97658 | 4078 #endif /* !DOS_NT */ |
100276
8f4457a692c5
(encode_terminal_code): Free any previous memory blocks
Chong Yidong <cyd@stupidchicken.com>
parents:
98367
diff
changeset
|
4079 |
8f4457a692c5
(encode_terminal_code): Free any previous memory blocks
Chong Yidong <cyd@stupidchicken.com>
parents:
98367
diff
changeset
|
4080 encode_terminal_src = NULL; |
8f4457a692c5
(encode_terminal_code): Free any previous memory blocks
Chong Yidong <cyd@stupidchicken.com>
parents:
98367
diff
changeset
|
4081 encode_terminal_dst = NULL; |
6752
f9236145bad7
(system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
6652
diff
changeset
|
4082 } |
25002 | 4083 |
82988
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
4084 |
f82e3a6f5ccb
A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents:
82987
diff
changeset
|
4085 |
52401 | 4086 /* arch-tag: 498e7449-6f2e-45e2-91dd-b7d4ca488193 |
4087 (do not change this comment) */ |