Mercurial > hg > xemacs-beta
comparison src/event-unixoid.c @ 398:74fd4e045ea6 r21-2-29
Import from CVS: tag r21-2-29
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:13:30 +0200 |
parents | 6719134a07c2 |
children | 2f8bb876ab1d |
comparison
equal
deleted
inserted
replaced
397:f4aeb21a5bad | 398:74fd4e045ea6 |
---|---|
39 #include "sysdep.h" | 39 #include "sysdep.h" |
40 #include "sysfile.h" | 40 #include "sysfile.h" |
41 #include "sysproc.h" /* select stuff */ | 41 #include "sysproc.h" /* select stuff */ |
42 #include "systime.h" | 42 #include "systime.h" |
43 | 43 |
44 #ifdef HAVE_GPM | |
45 #include "gpmevent.h" | |
46 #endif | |
47 | |
48 /* Mask of bits indicating the descriptors that we wait for input on. | 44 /* Mask of bits indicating the descriptors that we wait for input on. |
49 These work as follows: | 45 These work as follows: |
50 | 46 |
51 input_wait_mask == mask of all file descriptors we select() on, | 47 input_wait_mask == mask of all file descriptors we select() on, |
52 including TTY/stream console descriptors, | 48 including TTY/stream console descriptors, |
73 int signal_event_pipe_initialized; | 69 int signal_event_pipe_initialized; |
74 | 70 |
75 int fake_event_occurred; | 71 int fake_event_occurred; |
76 | 72 |
77 int | 73 int |
78 read_event_from_tty_or_stream_desc (struct Lisp_Event *event, | 74 read_event_from_tty_or_stream_desc (Lisp_Event *event, |
79 struct console *con, int fd) | 75 struct console *con, int fd) |
80 { | 76 { |
81 unsigned char ch; | 77 unsigned char ch; |
82 int nread; | 78 int nread; |
83 Lisp_Object console; | 79 Lisp_Object console; |
84 | 80 |
85 XSETCONSOLE (console, con); | 81 XSETCONSOLE (console, con); |
86 | |
87 #ifdef HAVE_GPM | |
88 if (fd == CONSOLE_TTY_MOUSE_FD (con)) { | |
89 return handle_gpm_read (event,con,fd); | |
90 } | |
91 #endif | |
92 | 82 |
93 nread = read (fd, &ch, 1); | 83 nread = read (fd, &ch, 1); |
94 if (nread <= 0) | 84 if (nread <= 0) |
95 { | 85 { |
96 /* deleting the console might not be safe right now ... */ | 86 /* deleting the console might not be safe right now ... */ |
182 FD_CLR (infd, &tty_only_mask); | 172 FD_CLR (infd, &tty_only_mask); |
183 return infd; | 173 return infd; |
184 } | 174 } |
185 | 175 |
186 static int | 176 static int |
187 get_process_infd (struct Lisp_Process *p) | 177 get_process_infd (Lisp_Process *p) |
188 { | 178 { |
189 Lisp_Object instr, outstr; | 179 Lisp_Object instr, outstr; |
190 get_process_streams (p, &instr, &outstr); | 180 get_process_streams (p, &instr, &outstr); |
191 assert (!NILP (instr)); | 181 assert (!NILP (instr)); |
192 return filedesc_stream_fd (XLSTREAM (instr)); | 182 return filedesc_stream_fd (XLSTREAM (instr)); |
193 } | 183 } |
194 | 184 |
195 int | 185 int |
196 event_stream_unixoid_select_process (struct Lisp_Process *proc) | 186 event_stream_unixoid_select_process (Lisp_Process *proc) |
197 { | 187 { |
198 int infd = get_process_infd (proc); | 188 int infd = get_process_infd (proc); |
199 | 189 |
200 FD_SET (infd, &input_wait_mask); | 190 FD_SET (infd, &input_wait_mask); |
201 FD_SET (infd, &non_fake_input_wait_mask); | 191 FD_SET (infd, &non_fake_input_wait_mask); |
202 FD_SET (infd, &process_only_mask); | 192 FD_SET (infd, &process_only_mask); |
203 return infd; | 193 return infd; |
204 } | 194 } |
205 | 195 |
206 int | 196 int |
207 event_stream_unixoid_unselect_process (struct Lisp_Process *proc) | 197 event_stream_unixoid_unselect_process (Lisp_Process *proc) |
208 { | 198 { |
209 int infd = get_process_infd (proc); | 199 int infd = get_process_infd (proc); |
210 | 200 |
211 FD_CLR (infd, &input_wait_mask); | 201 FD_CLR (infd, &input_wait_mask); |
212 FD_CLR (infd, &non_fake_input_wait_mask); | 202 FD_CLR (infd, &non_fake_input_wait_mask); |