annotate src/event-tty.c @ 126:1370575f1259 xemacs-20-1p1

Import from CVS: tag xemacs-20-1p1
author cvs
date Mon, 13 Aug 2007 09:27:39 +0200
parents 376386a54a3c
children 3d6bfa290dbd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 /* The event_stream interface for tty's.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 Copyright (C) 1995 Sun Microsystems, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 Copyright (C) 1995 Ben Wing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 under the terms of the GNU General Public License as published by the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 Free Software Foundation; either version 2, or (at your option) any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 along with XEmacs; see the file COPYING. If not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 Boston, MA 02111-1307, USA. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 /* Synched up with: Not in FSF. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 #include <config.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 #include "lisp.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 #include "blocktype.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 #include "device.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 #include "console-tty.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 #include "events.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 #include "frame.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 #include "process.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 #include "sysproc.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 #include "syswait.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 #include "systime.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 /* Mask of bits indicating the descriptors that we wait for input on */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 extern SELECT_TYPE input_wait_mask, non_fake_input_wait_mask;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 extern SELECT_TYPE process_only_mask, tty_only_mask;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 extern Lisp_Object Qdelete_device;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 static struct event_stream *tty_event_stream;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 /************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 /* timeout events */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 /************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 /* The pending timers are stored in an ordered list, where the first timer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 on the list is the first one to fire. Times recorded here are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 absolute. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 static struct low_level_timeout *tty_timer_queue;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 emacs_tty_add_timeout (EMACS_TIME thyme)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 return add_low_level_timeout (&tty_timer_queue, thyme);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 emacs_tty_remove_timeout (int id)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 remove_low_level_timeout (&tty_timer_queue, id);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 tty_timeout_to_emacs_event (struct Lisp_Event *emacs_event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 emacs_event->event_type = timeout_event;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 /* timeout events have nil as channel */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 emacs_event->timestamp = 0; /* #### */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 emacs_event->event.timeout.interval_id =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 pop_low_level_timeout (&tty_timer_queue, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 emacs_tty_event_pending_p (int user_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 if (!user_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 EMACS_TIME sometime;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 /* see if there's a pending timeout. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 EMACS_GET_TIME (sometime);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 if (tty_timer_queue &&
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 EMACS_TIME_EQUAL_OR_GREATER (sometime, tty_timer_queue->time))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 return 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 return poll_fds_for_input (user_p ? tty_only_mask :
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 non_fake_input_wait_mask);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 static struct console *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 find_console_from_fd (int fd)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 Lisp_Object concons;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 CONSOLE_LOOP (concons)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 struct console *c;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 c = XCONSOLE (XCAR (concons));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 if (CONSOLE_TTY_P (c) && CONSOLE_TTY_DATA (c)->infd == fd)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 return c;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 emacs_tty_next_event (struct Lisp_Event *emacs_event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 while (1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 int ndesc;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 int i;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 SELECT_TYPE temp_mask = input_wait_mask;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 EMACS_TIME time_to_block;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 EMACS_SELECT_TIME select_time_to_block, *pointer_to_this;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 if (!get_low_level_timeout_interval (tty_timer_queue, &time_to_block))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 /* no timer events; block indefinitely */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 pointer_to_this = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 EMACS_TIME_TO_SELECT_TIME (time_to_block, select_time_to_block);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 pointer_to_this = &select_time_to_block;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 ndesc = select (MAXDESC, &temp_mask, 0, 0, pointer_to_this);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 if (ndesc > 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 /* Look for a TTY event */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 for (i = 0; i < MAXDESC; i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 /* To avoid race conditions (among other things, an infinite
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 loop when called from Fdiscard_input()), we must return
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 user events ahead of process events. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 if (FD_ISSET (i, &temp_mask) && FD_ISSET (i, &tty_only_mask))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 struct console *c = find_console_from_fd (i);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 assert (c);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 if (read_event_from_tty_or_stream_desc (emacs_event, c, i))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 /* Look for a process event */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 for (i = 0; i < MAXDESC; i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 if (FD_ISSET (i, &temp_mask) && FD_ISSET (i, &process_only_mask))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 Lisp_Object process;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 struct Lisp_Process *p =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 get_process_from_input_descriptor (i);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 assert (p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 XSETPROCESS (process, p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 emacs_event->event_type = process_event;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 /* process events have nil as channel */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 emacs_event->timestamp = 0; /* #### */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 emacs_event->event.process.process = process;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 /* We might get here when a fake event came through a signal. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 /* Return a dummy event, so that a cycle of the command loop will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 occur. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 drain_signal_event_pipe ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 emacs_event->event_type = eval_event;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 /* eval events have nil as channel */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 emacs_event->event.eval.function = Qidentity;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 emacs_event->event.eval.object = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 else if (ndesc == 0) /* timeout fired */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 tty_timeout_to_emacs_event (emacs_event);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 emacs_tty_handle_magic_event (struct Lisp_Event *emacs_event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 /* Nothing to do currently */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 emacs_tty_select_process (struct Lisp_Process *process)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 event_stream_unixoid_select_process (process);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 emacs_tty_unselect_process (struct Lisp_Process *process)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 event_stream_unixoid_unselect_process (process);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 emacs_tty_select_console (struct console *con)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 event_stream_unixoid_select_console (con);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 emacs_tty_unselect_console (struct console *con)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 event_stream_unixoid_unselect_console (con);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 emacs_tty_quit_p (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 /* Nothing to do currently because QUIT is handled through SIGINT.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 This could change. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 /************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 /* initialization */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 /************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 vars_of_event_tty (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 tty_event_stream =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 (struct event_stream *) xmalloc (sizeof (struct event_stream));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 tty_event_stream->event_pending_p = emacs_tty_event_pending_p;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 tty_event_stream->next_event_cb = emacs_tty_next_event;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 tty_event_stream->handle_magic_event_cb = emacs_tty_handle_magic_event;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 tty_event_stream->add_timeout_cb = emacs_tty_add_timeout;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 tty_event_stream->remove_timeout_cb = emacs_tty_remove_timeout;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 tty_event_stream->select_console_cb = emacs_tty_select_console;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 tty_event_stream->unselect_console_cb = emacs_tty_unselect_console;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 tty_event_stream->select_process_cb = emacs_tty_select_process;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 tty_event_stream->unselect_process_cb = emacs_tty_unselect_process;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 tty_event_stream->quit_p_cb = emacs_tty_quit_p;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 init_event_tty_late (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 event_stream = tty_event_stream;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 }