Mercurial > emacs
comparison lib-src/pty.h @ 53229:33c3c7c16e13
lib-src/emacsclient.c: Implemented --here option (open a new Emacs tty). Needs more work.
(here): New variable.
(decode_options): Use it.
(ec_get_tty, ec_set_tty, init_tty, window_change, hang_up_signal): New functions.
(window_change_signal, init_signals, reset_tty, init_pty, copy_from_to): Ditto.
(pty_conversation): Ditto.
(main): Use them.
(master, pty_name, old_tty, tty, old_tty_valid, tty_erase_char): New variables.
(flow_control, meta_key, _sobuf, in_conversation, quit_conversation): Ditto.
lisp/server.el (server-process-filter): Added support for opening a new terminal frame.
dispextern.h (get_frame_size): Renamed to get_tty_size, added tty_output parameter.
dispnew.c (Fredraw_frame): fflush the current terminal instead of stdout.
(direct_output_for_insert, direct_output_forward_char, update_frame_1): Ditto.
(Fding, bitch_at_user): Ditto.
(update_frame_1): Count pending output for current terminal instead of stdout.
(window_change_signal): Resize all terminals.
(change_frame_size): Don't resize all terminals to the same size.
frame.c (Vterminal_frame): Removed.
(syms_of_frame): Removed declaration of Vterminal_frame.
(make_terminal_frame): Set the top frame of the terminal to the new frame.
(Fmake_terminal_frame): Get a new frame size from get_tty_size, don't copy it.
(do_switch_frame): Handle terminal frame visibility.
(next_frame, prev_frame): Skip over frames on different terminals.
frame.h (Vterminal_frame): Removed.
keyboard.c (input_fd): Removed.
(read_avail_input): Removed first argument from read_socket_hook.
Try to read from each available tty, until one succeeds.
(Fsuspend_emacs): Don't suspend if there are multiple terminals.
lisp.h (get_frame_size): Removed superflous declaration.
xterm.c (Xtread_socket): Removed first parameter.
macterm.h (XTread_socket): Ditto.
w32inevt.c (w32_console_read_socket): Ditto.
w32term.c (w32_read_socket): Ditto.
sysdep.c (input_fd): Removed.
(change_input_fd): Removed.
(discard_tty_input): Discard pending input on _all_ input descriptors.
(stuff_char, tabs_safe_p): Use current terminal instead of input_fd.
(init_baud_rate, request_sigio, unrequest_sigio): Ditto.
(init_sys_modes, reset_sys_modes): Ditto.
(narrow_foreground_group, widen_foreground_group): Use stdin.
(init_sys_modes, reset_sys_modes): otty parameter renamed to tty_out.
(get_frame_size): Renamed to get_tty_size, added tty_out parameter.
term.c (read_socket_hook): Removed first parameter.
(clear_end_of_line): Use updating_frame, if possible.
(write_glyphs, insert_glyphs, ins_del_lines): Ditto.
(term_init): Renamed get_frame_size to get_tty_size.
termchar.h (struct tty_output): New entries: top_frame,
previous_terminal_frame.
termhooks.h (read_socket_hook): Removed first parameter.
window.c (init_window_once): Removed reference to Vterminal_frame.
xdisp.c (previous_terminal_frame): Moved to struct tty_output.
(redisplay_internal): Updated to use previous_terminal_frame in tty_output.
Allow for simultaneous refresh of multiple ttys.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-5
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Fri, 26 Dec 2003 04:24:54 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
53228:c5b253fd2504 | 53229:33c3c7c16e13 |
---|---|
1 /* Terminal initialization for emacsclient. | |
2 Copyright (C) 2003 Free Software Foundation, Inc. | |
3 | |
4 This file is part of GNU Emacs. | |
5 | |
6 GNU Emacs is free software; you can redistribute it and/or modify | |
7 it under the terms of the GNU General Public License as published by | |
8 the Free Software Foundation; either version 2, or (at your option) | |
9 any later version. | |
10 | |
11 GNU Emacs is distributed in the hope that it will be useful, | |
12 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 GNU General Public License for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
17 along with GNU Emacs; see the file COPYING. If not, write to | |
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
19 Boston, MA 02111-1307, USA. */ | |
20 | |
21 /* Adapted from systty.h */ | |
22 | |
23 | |
24 #ifdef HAVE_TERMIOS | |
25 #define HAVE_TCATTR | |
26 #endif | |
27 | |
28 | |
29 /* Include the proper files. */ | |
30 #ifdef HAVE_TERMIO | |
31 #ifdef __DGUX | |
32 #include <sys/ioctl.h> | |
33 #endif | |
34 #ifndef NO_TERMIO | |
35 #include <termio.h> | |
36 #endif /* not NO_TERMIO */ | |
37 #ifndef INCLUDED_FCNTL | |
38 #define INCLUDED_FCNTL | |
39 #include <fcntl.h> | |
40 #endif | |
41 #else /* not HAVE_TERMIO */ | |
42 #ifdef HAVE_TERMIOS | |
43 #if defined(_AIX) && defined(_I386) | |
44 #include <termios.h> /* termios.h needs to be before termio.h */ | |
45 #include <termio.h> | |
46 #else /* not (_AIX && _I386) */ | |
47 #ifndef NO_TERMIO | |
48 #include <termio.h> | |
49 #endif | |
50 #include <termios.h> | |
51 #endif /* not (_AIX && _I386) */ | |
52 #define INCLUDED_FCNTL | |
53 #include <fcntl.h> | |
54 #else /* neither HAVE_TERMIO nor HAVE_TERMIOS */ | |
55 #ifndef VMS | |
56 #ifndef DOS_NT | |
57 #include <sgtty.h> | |
58 #endif /* not DOS_NT */ | |
59 #else /* VMS */ | |
60 #include <descrip.h> | |
61 static struct iosb | |
62 { | |
63 short status; | |
64 short offset; | |
65 short termlen; | |
66 short term; | |
67 } input_iosb; | |
68 | |
69 extern int waiting_for_ast; | |
70 extern int stop_input; | |
71 extern int input_ef; | |
72 extern int timer_ef; | |
73 extern int process_ef; | |
74 extern int input_eflist; | |
75 extern int timer_eflist; | |
76 | |
77 static $DESCRIPTOR (input_dsc, "TT"); | |
78 static int terminator_mask[2] = { 0, 0 }; | |
79 | |
80 static struct sensemode { | |
81 short status; | |
82 unsigned char xmit_baud; | |
83 unsigned char rcv_baud; | |
84 unsigned char crfill; | |
85 unsigned char lffill; | |
86 unsigned char parity; | |
87 unsigned char unused; | |
88 char class; | |
89 char type; | |
90 short scr_wid; | |
91 unsigned long tt_char : 24, scr_len : 8; | |
92 unsigned long tt2_char; | |
93 } sensemode_iosb; | |
94 #endif /* VMS */ | |
95 #endif /* not HAVE_TERMIOS */ | |
96 #endif /* not HAVE_TERMIO */ | |
97 | |
98 #ifdef __GNU_LIBRARY__ | |
99 #include <sys/ioctl.h> | |
100 #include <termios.h> | |
101 #endif | |
102 | |
103 #ifdef AIXHFT | |
104 /* Get files for keyboard remapping */ | |
105 #define HFNKEYS 2 | |
106 #include <sys/hft.h> | |
107 #include <sys/devinfo.h> | |
108 #endif | |
109 | |
110 /* Get rid of LLITOUT in 4.1, since it is said to stimulate kernel bugs. */ | |
111 #ifdef BSD4_1 | |
112 #undef LLITOUT | |
113 #define LLITOUT 0 | |
114 #endif /* 4.1 */ | |
115 | |
116 #ifdef NEED_BSDTTY | |
117 #include <sys/bsdtty.h> | |
118 #endif | |
119 | |
120 #if defined (HPUX) && defined (HAVE_PTYS) | |
121 #include <sys/ptyio.h> | |
122 #endif | |
123 | |
124 #ifdef AIX | |
125 #include <sys/pty.h> | |
126 #endif /* AIX */ | |
127 | |
128 #if (defined (POSIX) || defined (NEED_UNISTD_H)) && defined (HAVE_UNISTD_H) | |
129 #include <unistd.h> | |
130 #endif | |
131 | |
132 #ifdef SYSV_PTYS | |
133 #include <sys/types.h> | |
134 #include <sys/tty.h> | |
135 #ifdef titan | |
136 #include <sys/ttyhw.h> | |
137 #include <sys/stream.h> | |
138 #endif | |
139 #ifndef NO_PTY_H | |
140 #include <sys/pty.h> | |
141 #endif | |
142 #endif | |
143 | |
144 /* saka@pfu.fujitsu.co.JP writes: | |
145 FASYNC defined in this file. But, FASYNC don't working. | |
146 so no problem, because unrequest_sigio only need. */ | |
147 #if defined (pfa) | |
148 #include <sys/file.h> | |
149 #endif | |
150 | |
151 | |
152 /* Special cases - inhibiting the use of certain features. */ | |
153 | |
154 #ifdef APOLLO | |
155 #undef TIOCSTART | |
156 #endif | |
157 | |
158 #ifdef XENIX | |
159 #undef TIOCGETC /* Avoid confusing some conditionals that test this. */ | |
160 #endif | |
161 | |
162 #ifdef BROKEN_TIOCGETC | |
163 #undef TIOCGETC /* Avoid confusing some conditionals that test this. */ | |
164 #endif | |
165 | |
166 /* UNIPLUS systems may have FIONREAD. */ | |
167 #ifdef UNIPLUS | |
168 #include <sys.ioctl.h> | |
169 #endif | |
170 | |
171 /* Allow m- file to inhibit use of FIONREAD. */ | |
172 #ifdef BROKEN_FIONREAD | |
173 #undef FIONREAD | |
174 #undef ASYNC | |
175 #endif | |
176 | |
177 /* Interrupt input is not used if there is no FIONREAD. */ | |
178 #ifndef FIONREAD | |
179 #undef SIGIO | |
180 #endif | |
181 | |
182 /* On TERMIOS systems, the tcmumbleattr calls take care of these | |
183 parameters, and it's a bad idea to use them (on AIX, it makes the | |
184 tty hang for a long time). */ | |
185 #if defined (TIOCGLTC) && !defined (HAVE_TERMIOS) | |
186 #define HAVE_LTCHARS | |
187 #endif | |
188 | |
189 #if defined (TIOCGETC) && !defined (HAVE_TERMIOS) | |
190 #define HAVE_TCHARS | |
191 #endif | |
192 | |
193 | |
194 /* Try to establish the correct character to disable terminal functions | |
195 in a system-independent manner. Note that USG (at least) define | |
196 _POSIX_VDISABLE as 0! */ | |
197 | |
198 #ifdef _POSIX_VDISABLE | |
199 #define CDISABLE _POSIX_VDISABLE | |
200 #else /* not _POSIX_VDISABLE */ | |
201 #ifdef CDEL | |
202 #undef CDISABLE | |
203 #define CDISABLE CDEL | |
204 #else /* not CDEL */ | |
205 #define CDISABLE 255 | |
206 #endif /* not CDEL */ | |
207 #endif /* not _POSIX_VDISABLE */ | |
208 | |
209 /* Get the number of characters queued for output. */ | |
210 | |
211 /* EMACS_OUTQSIZE(FD, int *SIZE) stores the number of characters | |
212 queued for output to the terminal FD in *SIZE, if FD is a tty. | |
213 Returns -1 if there was an error (i.e. FD is not a tty), 0 | |
214 otherwise. */ | |
215 #ifdef TIOCOUTQ | |
216 #define EMACS_OUTQSIZE(fd, size) (ioctl ((fd), TIOCOUTQ, (size))) | |
217 #endif | |
218 | |
219 #ifdef HAVE_TERMIO | |
220 #ifdef TCOUTQ | |
221 #undef EMACS_OUTQSIZE | |
222 #define EMACS_OUTQSIZE(fd, size) (ioctl ((fd), TCOUTQ, (size))) | |
223 #endif | |
224 #endif |