0
|
1 /* Definitions for the new event model;
|
|
2 created 16-jul-91 by Jamie Zawinski
|
|
3 Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
|
|
4 Copyright (C) 1995, 1996 Ben Wing.
|
|
5
|
|
6 This file is part of XEmacs.
|
|
7
|
|
8 XEmacs is free software; you can redistribute it and/or modify it
|
|
9 under the terms of the GNU General Public License as published by the
|
|
10 Free Software Foundation; either version 2, or (at your option) any
|
|
11 later version.
|
|
12
|
|
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
16 for more details.
|
|
17
|
|
18 You should have received a copy of the GNU General Public License
|
|
19 along with XEmacs; see the file COPYING. If not, write to
|
|
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
21 Boston, MA 02111-1307, USA. */
|
|
22
|
|
23 /* Synched up with: Not in FSF. */
|
|
24
|
|
25 #ifndef _XEMACS_EVENTS_H_
|
|
26 #define _XEMACS_EVENTS_H_
|
|
27
|
|
28 #include "systime.h"
|
|
29
|
2
|
30 /* There is one object called an event_stream. This object contains
|
|
31 callback functions for doing the window-system-dependent operations
|
|
32 that XEmacs requires.
|
0
|
33
|
|
34 If XEmacs is compiled with support for X11 and the X Toolkit, then this
|
|
35 event_stream structure will contain functions that can cope with input
|
|
36 on XEmacs windows on multiple displays, as well as input from dumb tty
|
2
|
37 frames.
|
0
|
38
|
|
39 If it is desired to have XEmacs able to open frames on the displays of
|
|
40 multiple heterogeneous machines, X11 and SunView, or X11 and NeXT, for
|
|
41 example, then it will be necessary to construct an event_stream structure
|
|
42 that can cope with the given types. Currently, the only implemented
|
|
43 event_streams are for dumb-ttys, and for X11 plus dumb-ttys.
|
185
|
44
|
|
45 To implement this for one window system is relatively simple.
|
0
|
46 To implement this for multiple window systems is trickier and may
|
|
47 not be possible in all situations, but it's been done for X and TTY.
|
|
48
|
|
49 Note that these callbacks are *NOT* console methods; that's because
|
|
50 the routines are not specific to a particular console type but must
|
|
51 be able to simultaneously cope with all allowable console types.
|
|
52
|
|
53 The slots of the event_stream structure:
|
|
54
|
2
|
55 next_event_cb A function which fills in an XEmacs_event structure
|
0
|
56 with the next event available. If there is no event
|
|
57 available, then this should block.
|
|
58
|
|
59 IMPORTANT: timer events and especially process
|
|
60 events *must not* be returned if there are
|
|
61 events of other types available; otherwise you
|
|
62 can end up with an infinite loop in Fdiscard_input().
|
|
63
|
|
64 event_pending_cb A function which says whether there are events to be
|
|
65 read. If called with an argument of 0, then this
|
|
66 should say whether calling the next_event_cb will
|
|
67 block. If called with an argument of 1, then this
|
|
68 should say whether there are user-generated events
|
|
69 pending (that is, keypresses or mouse-clicks). This
|
185
|
70 is used for redisplay optimization, among other
|
|
71 things. On dumb ttys, these two results are the
|
0
|
72 same, but under a window system, they are not.
|
|
73
|
|
74 If this function is not sure whether there are events
|
|
75 to be read, it *must* return 0. Otherwise various
|
|
76 undesirable effects will occur, such as redisplay
|
|
77 not occurring until the next event occurs.
|
|
78
|
|
79 handle_magic_event_cb XEmacs calls this with an event structure which
|
|
80 contains window-system dependent information that
|
|
81 XEmacs doesn't need to know about, but which must
|
|
82 happen in order. If the next_event_cb never returns
|
|
83 an event of type "magic", this will never be used.
|
|
84
|
|
85 add_timeout_cb Called with an EMACS_TIME, the absolute time at
|
|
86 which a wakeup event should be generated; and a
|
|
87 void *, which is an arbitrary value that will be
|
|
88 returned in the timeout event. The timeouts
|
|
89 generated by this function should be one-shots:
|
|
90 they fire once and then disappear. This callback
|
|
91 should return an int id-number which uniquely
|
|
92 identifies this wakeup. If an implementation
|
|
93 doesn't have microseconds or millisecond
|
|
94 granularity, it should round up to the closest
|
|
95 value it can deal with.
|
|
96
|
185
|
97 remove_timeout_cb Called with an int, the id number of a wakeup to
|
0
|
98 discard. This id number must have been returned by
|
|
99 the add_timeout_cb. If the given wakeup has
|
|
100 already expired, this should do nothing.
|
|
101
|
|
102 select_process_cb These callbacks tell the underlying implementation to
|
|
103 unselect_process_cb add or remove a file descriptor from the list of fds
|
|
104 which are polled for inferior-process input. When
|
|
105 input becomes available on the given process
|
|
106 connection, an event of type "process" should be
|
|
107 generated.
|
|
108
|
185
|
109 select_console_cb These callbacks tell the underlying implementation
|
0
|
110 unselect_console_cb to add or remove a console from the list of consoles
|
|
111 which are polled for user-input.
|
|
112
|
|
113 select_device_cb These callbacks are used by Unixoid event loops
|
|
114 unselect_device_cb (those that use select() and file descriptors and
|
|
115 have a separate input fd per device).
|
|
116
|
263
|
117 create_stream_pair_cb These callbacks are called by process code to
|
|
118 delete_stream_pair_cb create and delete a pait of input and output lstreams
|
272
|
119 which are used for subprocess I/O.
|
263
|
120
|
0
|
121 quitp_cb A handler function called from the `QUIT' macro which
|
|
122 should check whether the quit character has been
|
|
123 typed. On systems with SIGIO, this will not be called
|
|
124 unless the `sigio_happened' flag is true (it is set
|
|
125 from the SIGIO handler).
|
|
126
|
|
127 XEmacs has its own event structures, which are distinct from the event
|
|
128 structures used by X or any other window system. It is the job of the
|
|
129 event_stream layer to translate to this format.
|
|
130
|
|
131 NOTE: #### All timestamps should be measured as milliseconds since XEmacs
|
|
132 started. Currently many or most events have a 0 as their
|
|
133 timestamp value, and for other timestamps, they are raw server
|
|
134 timestamps. (The X protocol doesn't provide any easy way of
|
|
135 translating between server time and real process time; yuck.)
|
|
136
|
|
137 Every event type has the following structures:
|
|
138
|
|
139 channel Where this event occurred on. This will be
|
|
140 a frame, device, console, or nil, depending on the
|
|
141 event type. It is important that an object of
|
|
142 a more specific type than is actually generated
|
|
143 is not substituted -- e.g. there should not be
|
|
144 a frame inserted when a key-press event occurs,
|
|
145 because events on dead channels are automatically
|
|
146 ignored.
|
|
147
|
|
148 Specifically:
|
|
149
|
|
150 -- for button and mouse-motion events, channel
|
|
151 will be a frame. (The translation to a window
|
|
152 occurs later.)
|
|
153 -- for keyboard events, channel will be a console.
|
|
154 Note that fake keyboard events (generated
|
|
155 by `character-to-event' or something that
|
|
156 calls this, such as macros) need to have
|
|
157 the selected console stored into them when
|
|
158 the event is created. This is so that the
|
|
159 correct console-local variables (e.g. the
|
|
160 command builder) will get affected.
|
|
161 -- for timer, process, magic-eval, and eval events,
|
|
162 channel will be nil.
|
|
163 -- for scrollbar misc-user events, channel
|
|
164 will be a window.
|
|
165 -- for menubar misc-user events, channel
|
|
166 will be a frame.
|
|
167 -- for magic events, channel will be a frame
|
|
168 (usually) or a device.
|
185
|
169
|
0
|
170 timestamp When this event occurred -- if not known, this
|
|
171 is made up.
|
|
172
|
|
173 In addition, the following structures are specific to particular event
|
|
174 types:
|
|
175
|
185
|
176 key_press_event
|
0
|
177 key What keysym this is; an integer or a symbol.
|
|
178 If this is an integer, it will be in the printing
|
|
179 ASCII range: >32 and <127.
|
|
180 modifiers Bucky-bits on that key: control, meta, etc.
|
2
|
181 For many keys, Shift is not a bit; that is implicit
|
0
|
182 in the keyboard layout.
|
|
183
|
|
184 button_press_event
|
|
185 button_release_event
|
|
186 button What button went down or up.
|
|
187 modifiers Bucky-bits on that button: shift, control, meta, etc.
|
|
188 x, y Where it was at the button-state-change (in pixels).
|
|
189
|
|
190 pointer_motion_event
|
|
191 x, y Where it was after it moved (in pixels).
|
|
192 modifiers Bucky-bits down when the motion was detected.
|
|
193 (Possibly not all window systems will provide this?)
|
|
194
|
|
195 process_event
|
|
196 process the XEmacs "process" object in question
|
|
197
|
|
198 timeout_event
|
|
199 interval_id The ID returned when the associated call to
|
|
200 add_timeout_cb() was made
|
|
201 ------ the rest of the fields are filled in by XEmacs -----
|
|
202 id_number The XEmacs timeout ID for this timeout (more
|
|
203 than one timeout event can have the same value
|
|
204 here, since XEmacs timeouts, as opposed to
|
|
205 add_timeout_cb() timeouts, can resignal
|
|
206 themselves)
|
|
207 function An elisp function to call when this timeout is
|
|
208 processed.
|
|
209 object The object passed to that function.
|
|
210
|
|
211 eval_event
|
|
212 function An elisp function to call with this event object.
|
|
213 internal_function An unexported function to call with this event
|
|
214 object. This allows eval events to call internal
|
|
215 functions. For a normal eval event, this field
|
|
216 will always be 0.
|
|
217 object Anything.
|
|
218 This kind of event is used internally; sometimes the
|
|
219 window system interface would like to inform XEmacs of
|
|
220 some user action (such as focusing on another frame)
|
|
221 but needs that to happen synchronously with the other
|
|
222 user input, like keypresses. This is useful when
|
|
223 events are reported through callbacks rather
|
|
224 than in the standard event stream.
|
|
225
|
|
226 misc_user_event
|
|
227 function An elisp function to call with this event object.
|
|
228 internal_function Ignored.
|
|
229 object Anything.
|
282
|
230 button What button went down or up.
|
|
231 modifiers Bucky-bits on that button: shift, control, meta, etc.
|
|
232 x, y Where it was at the button-state-change (in pixels).
|
0
|
233 This is similar to an eval_event, except that it is
|
|
234 generated by user actions: selections in the
|
282
|
235 menubar, scrollbar actions, or drag and drop actions.
|
|
236 It is a "command" event, like key and mouse presses
|
|
237 (and unlike mouse motion, process output, and enter
|
|
238 and leave window hooks). In many ways, eval_events
|
|
239 are not the same as keypresses or misc_user_events.
|
|
240 The button, modifiers, x, and y parts are only used
|
|
241 by the XEmacs Drag'n'Drop system. Don't depend on their
|
|
242 values for other types of misc_user_events.
|
0
|
243
|
|
244 magic_event
|
|
245 No user-serviceable parts within. This is for things
|
|
246 like KeymapNotify and ExposeRegion events and so on
|
|
247 that XEmacs itself doesn't care about, but which it
|
|
248 must do something with for proper interaction with
|
|
249 the window system.
|
|
250
|
|
251 Magic_events are handled somewhat asynchronously, just
|
185
|
252 like subprocess filters. However, occasionally a
|
0
|
253 magic_event needs to be handled synchronously; in that
|
|
254 case, the asynchronous handling of the magic_event will
|
185
|
255 push an eval_event back onto the queue, which will be
|
0
|
256 handled synchronously later. This is one of the
|
|
257 reasons why eval_events exist; I'm not entirely happy
|
|
258 with this aspect of this event model.
|
|
259
|
|
260 magic_eval_event
|
|
261 This is like an eval event but its contents are
|
|
262 not Lisp-accessible. This allows for "internal
|
|
263 eval events" that call non-Lisp-accessible functions.
|
|
264 Externally, a magic_eval_event just appears as
|
|
265 a magic_event; the Lisp programmer need not know
|
|
266 anything more.
|
197
|
267
|
282
|
268 */
|
0
|
269
|
263
|
270 /*
|
|
271 Stream pairs description
|
|
272 ------------------------
|
|
273
|
|
274 Since there are many possible processes/event loop combinations, the event code
|
|
275 is responsible for creating an appropriare lstream type. The process
|
|
276 implementation does not care about that implementation.
|
|
277
|
|
278 The Create stream pair function is passed two void* values, which identify
|
|
279 process-dependant 'handles'. The process implementation uses these handles
|
|
280 to communicate with child processes. The function must be prepared to receive
|
|
281 handle types of any process implementation. Since there only one process
|
|
282 implementation exists in a particular XEmacs configuration, preprocessing
|
|
283 is a mean of compiling in the support for the code which deals with particular
|
|
284 handle types.
|
|
285
|
|
286 For example, a unixoid type loop, which relies on file descriptors, may be
|
|
287 asked to create a pair of streams by a unix-style process implementation.
|
|
288 In this case, the handles passed are unix file descriptors, and the code
|
|
289 may deal with these directly. Although, the same code may be used on Win32
|
|
290 system with X-Windows. In this case, Win32 process implementation passes
|
|
291 handles of type HANDLE, and the create_stream_pair function must call
|
|
292 appropriate function to get file descriptors given HANDLEs, so that these
|
|
293 descriptors may be passed to XtAddInput.
|
|
294
|
|
295 The handle given may have special denying value, in which case the
|
|
296 corresponding lstream should not be created.
|
|
297
|
|
298 The return value of the function is a unique stream identifier. It is used
|
|
299 by processes implementation, in its platform-independant part. There is
|
|
300 the get_process_from_usid function, which returns process object given its
|
|
301 USID. The event stream is responsible for converting its internal handle
|
|
302 type into USID.
|
|
303
|
|
304 Example is the TTY event stream. When a file descriptor signals input, the
|
|
305 event loop must determine process to which the input is destined. Thus,
|
|
306 the imlementation uses process input stream file descriptor as USID, by
|
|
307 simply casting the fd value to USID type.
|
|
308
|
|
309 There are two special USID values. One, USID_ERROR, indicates that the stream
|
|
310 pair cannot be created. The second, USID_DONTHASH, indicates that streams are
|
|
311 created, but the event stream does not wish to be able to find the process
|
|
312 by its USID. Specifically, if an event stream implementation never calss
|
272
|
313 get_process_from_usid, this value should always be returned, to prevent
|
263
|
314 accumulating useless information on USID to process relationship.
|
|
315 */
|
|
316
|
|
317 /* typedef unsigned int USID; in lisp.h */
|
|
318 #define USID_ERROR ((USID)-1)
|
272
|
319 #define USID_DONTHASH ((USID)0)
|
263
|
320
|
0
|
321
|
|
322 struct Lisp_Event;
|
|
323 struct Lisp_Process;
|
|
324
|
|
325 struct event_stream
|
|
326 {
|
|
327 int (*event_pending_p) (int);
|
|
328 void (*next_event_cb) (struct Lisp_Event *);
|
|
329 void (*handle_magic_event_cb) (struct Lisp_Event *);
|
|
330 int (*add_timeout_cb) (EMACS_TIME);
|
|
331 void (*remove_timeout_cb) (int);
|
|
332 void (*select_console_cb) (struct console *);
|
|
333 void (*unselect_console_cb) (struct console *);
|
|
334 void (*select_process_cb) (struct Lisp_Process *);
|
|
335 void (*unselect_process_cb) (struct Lisp_Process *);
|
|
336 void (*quit_p_cb) (void);
|
263
|
337 USID (*create_stream_pair_cb) (void* /* inhandle*/, void* /*outhandle*/ ,
|
|
338 Lisp_Object* /* instream */,
|
|
339 Lisp_Object* /* outstream */,
|
282
|
340 int /* flags */);
|
263
|
341 USID (*delete_stream_pair_cb) (Lisp_Object /* instream */,
|
|
342 Lisp_Object /* outstream */);
|
0
|
343 };
|
|
344
|
282
|
345 /* Flags for create_stream_pair_cb() FLAGS parameter */
|
|
346 #define STREAM_PTY_FLUSHING 0x0001
|
|
347 #define STREAM_NETWORK_CONNECTION 0x0002
|
|
348
|
0
|
349 extern struct event_stream *event_stream;
|
|
350
|
|
351 typedef enum emacs_event_type
|
|
352 {
|
|
353 empty_event,
|
|
354 key_press_event,
|
|
355 button_press_event,
|
|
356 button_release_event,
|
|
357 pointer_motion_event,
|
|
358 process_event,
|
|
359 timeout_event,
|
|
360 magic_event,
|
|
361 magic_eval_event,
|
|
362 eval_event,
|
|
363 misc_user_event,
|
|
364 dead_event
|
|
365 } emacs_event_type;
|
|
366
|
|
367 #define first_event_type empty_event
|
|
368 #define last_event_type dead_event
|
|
369
|
|
370
|
|
371 struct key_data
|
|
372 {
|
|
373 Lisp_Object keysym;
|
|
374 unsigned char modifiers;
|
|
375 };
|
|
376
|
|
377 struct button_data
|
|
378 {
|
|
379 int button;
|
|
380 unsigned char modifiers;
|
|
381 int x, y;
|
|
382 };
|
|
383
|
|
384 struct motion_data
|
|
385 {
|
|
386 int x, y;
|
|
387 unsigned char modifiers;
|
|
388 };
|
|
389
|
|
390 struct process_data
|
|
391 {
|
|
392 Lisp_Object process;
|
|
393 };
|
|
394
|
|
395 struct timeout_data
|
|
396 {
|
|
397 int interval_id;
|
|
398 int id_number;
|
|
399 Lisp_Object function, object;
|
|
400 };
|
|
401
|
|
402 struct eval_data
|
|
403 {
|
|
404 Lisp_Object function;
|
|
405 Lisp_Object object;
|
|
406 };
|
|
407
|
282
|
408 struct misc_user_data
|
|
409 {
|
|
410 Lisp_Object function;
|
|
411 Lisp_Object object;
|
|
412 int button;
|
|
413 unsigned char modifiers;
|
|
414 int x, y;
|
|
415 };
|
|
416
|
0
|
417 struct magic_eval_data
|
|
418 {
|
|
419 void (*internal_function) (Lisp_Object);
|
|
420 Lisp_Object object;
|
|
421 };
|
|
422
|
|
423 #if defined (HAVE_X_WINDOWS) && defined(emacs)
|
|
424 # include <X11/Xlib.h>
|
|
425 #endif
|
|
426
|
|
427 union magic_data
|
|
428 {
|
209
|
429 #ifdef HAVE_TTY
|
|
430 char underlying_tty_event;
|
|
431 #endif
|
0
|
432 #ifdef HAVE_X_WINDOWS
|
209
|
433 XEvent underlying_x_event;
|
|
434 #endif
|
213
|
435 #ifdef HAVE_MS_WINDOWS
|
249
|
436 int underlying_mswindows_event;
|
0
|
437 #endif
|
|
438 };
|
|
439
|
|
440 struct Lisp_Event
|
|
441 {
|
|
442 /* header->next (aka XEVENT_NEXT ()) is used as follows:
|
|
443 - For dead events, this is the next dead one.
|
|
444 - For events on the command_event_queue, the next one on the queue.
|
|
445 - Likewise for events chained in the command builder.
|
|
446 - Otherwise it's Qnil.
|
|
447 */
|
|
448 struct lrecord_header lheader;
|
|
449 Lisp_Object next;
|
|
450 emacs_event_type event_type;
|
|
451 Lisp_Object channel;
|
|
452 unsigned int timestamp;
|
|
453 union
|
|
454 {
|
|
455 struct key_data key;
|
|
456 struct button_data button;
|
|
457 struct motion_data motion;
|
|
458 struct process_data process;
|
|
459 struct timeout_data timeout;
|
282
|
460 struct eval_data eval; /* misc_user_event no loger uses this */
|
|
461 struct misc_user_data misc; /* because it needs position information */
|
0
|
462 union magic_data magic;
|
|
463 struct magic_eval_data magic_eval;
|
|
464 } event;
|
|
465 };
|
|
466
|
|
467 DECLARE_LRECORD (event, struct Lisp_Event);
|
|
468 #define XEVENT(x) XRECORD (x, event, struct Lisp_Event)
|
|
469 #define XSETEVENT(x, p) XSETRECORD (x, p, event)
|
|
470 #define EVENTP(x) RECORDP (x, event)
|
|
471 #define GC_EVENTP(x) GC_RECORDP (x, event)
|
|
472 #define CHECK_EVENT(x) CHECK_RECORD (x, event)
|
|
473 #define CONCHECK_EVENT(x) CONCHECK_RECORD (x, event)
|
|
474
|
|
475 DECLARE_LRECORD (command_builder, struct command_builder);
|
|
476
|
|
477 #define EVENT_CHANNEL(a) ((a)->channel)
|
|
478 #define EVENT_TYPE(a) ((a)->event_type)
|
|
479 #define XEVENT_TYPE(a) (XEVENT (a)->event_type)
|
|
480 #define EVENT_NEXT(a) ((a)->next)
|
|
481 #define XEVENT_NEXT(e) (XEVENT (e)->next)
|
|
482 #define XSET_EVENT_NEXT(e, n) do { (XEVENT (e)->next = (n)); } while (0)
|
|
483
|
|
484 #define EVENT_CHAIN_LOOP(event, chain) \
|
|
485 for (event = chain; !NILP (event); event = XEVENT_NEXT (event))
|
|
486
|
|
487 #define EVENT_LIVE_P(a) (EVENT_TYPE (a) != dead_event)
|
|
488
|
272
|
489 #define CHECK_LIVE_EVENT(x) do { \
|
|
490 CHECK_EVENT (x); \
|
|
491 if (! EVENT_LIVE_P (XEVENT (x))) \
|
|
492 dead_wrong_type_argument (Qevent_live_p, (x)); \
|
|
493 } while (0)
|
|
494 #define CONCHECK_LIVE_EVENT(x) do { \
|
|
495 CONCHECK_EVENT (x); \
|
|
496 if (! EVENT_LIVE_P (XEVENT (x))) \
|
|
497 x = wrong_type_argument (Qevent_live_p, (x)); \
|
|
498 } while (0)
|
0
|
499
|
|
500
|
272
|
501 EXFUN (Fcharacter_to_event, 4);
|
|
502 EXFUN (Fdeallocate_event, 1);
|
|
503 EXFUN (Fevent_glyph_extent, 1);
|
|
504 EXFUN (Fevent_modeline_position, 1);
|
|
505 EXFUN (Fevent_over_modeline_p, 1);
|
|
506 EXFUN (Fevent_over_toolbar_p, 1);
|
|
507 EXFUN (Fevent_point, 1);
|
|
508 EXFUN (Fevent_window, 1);
|
|
509 EXFUN (Fmake_event, 2);
|
|
510
|
|
511 extern Lisp_Object QKbackspace, QKdelete, QKescape, QKlinefeed, QKreturn;
|
|
512 extern Lisp_Object QKspace, QKtab, Qmouse_event_p, Vcharacter_set_property;
|
0
|
513
|
|
514 /* Note: under X Windows, MOD_ALT is generated by the Alt key if there are
|
|
515 both Alt and Meta keys. If there are no Meta keys, then Alt generates
|
|
516 MOD_META instead.
|
|
517 */
|
|
518
|
|
519 #ifdef emacs
|
|
520 /* Maybe this should be trickier */
|
|
521 #define KEYSYM(x) (intern (x))
|
|
522
|
|
523 Lisp_Object allocate_command_builder (Lisp_Object console);
|
|
524
|
|
525 void format_event_object (char *buf, struct Lisp_Event *e, int brief);
|
|
526 void character_to_event (Emchar c, struct Lisp_Event *event,
|
|
527 struct console *con,
|
263
|
528 int use_console_meta_flag,
|
|
529 int do_backspace_mapping);
|
0
|
530 void enqueue_magic_eval_event (void (*fun) (Lisp_Object), Lisp_Object object);
|
|
531 void zero_event (struct Lisp_Event *e);
|
|
532
|
|
533 void deallocate_event_chain (Lisp_Object event);
|
|
534 Lisp_Object event_chain_tail (Lisp_Object event);
|
|
535 void enqueue_event (Lisp_Object event, Lisp_Object *head, Lisp_Object *tail);
|
|
536 Lisp_Object dequeue_event (Lisp_Object *head, Lisp_Object *tail);
|
|
537 void enqueue_event_chain (Lisp_Object event_chain, Lisp_Object *head,
|
|
538 Lisp_Object *tail);
|
|
539 int event_chain_count (Lisp_Object event_chain);
|
|
540 void nth_of_key_sequence_as_event (Lisp_Object seq, int n, Lisp_Object event);
|
|
541 Lisp_Object key_sequence_to_event_chain (Lisp_Object seq);
|
|
542 Lisp_Object event_chain_find_previous (Lisp_Object event_chain,
|
|
543 Lisp_Object event);
|
|
544 Lisp_Object event_chain_nth (Lisp_Object event_chain, int n);
|
|
545 Lisp_Object copy_event_chain (Lisp_Object event_chain);
|
|
546
|
2
|
547 /* True if this is a non-internal event
|
0
|
548 (keyboard press, menu, scrollbar, mouse button) */
|
|
549 int command_event_p (Lisp_Object event);
|
|
550
|
|
551 struct console *event_console_or_selected (Lisp_Object event);
|
|
552
|
|
553 void event_stream_next_event (struct Lisp_Event *event);
|
|
554 void event_stream_handle_magic_event (struct Lisp_Event *event);
|
2
|
555 void event_stream_select_console (struct console *c);
|
0
|
556 void event_stream_unselect_console (struct console *c);
|
2
|
557 void event_stream_select_process (struct Lisp_Process *proc);
|
0
|
558 void event_stream_unselect_process (struct Lisp_Process *proc);
|
263
|
559 USID event_stream_create_stream_pair (void* inhandle, void* outhandle,
|
|
560 Lisp_Object* instream, Lisp_Object* outstream, int flags);
|
|
561 USID event_stream_delete_stream_pair (Lisp_Object instream, Lisp_Object outstream);
|
0
|
562 void event_stream_quit_p (void);
|
|
563
|
|
564 struct low_level_timeout
|
|
565 {
|
|
566 int id;
|
|
567 EMACS_TIME time;
|
|
568 struct low_level_timeout *next;
|
|
569 };
|
|
570
|
|
571 int add_low_level_timeout (struct low_level_timeout **timeout_list,
|
|
572 EMACS_TIME thyme);
|
|
573 void remove_low_level_timeout (struct low_level_timeout **timeout_list,
|
|
574 int id);
|
|
575 int get_low_level_timeout_interval (struct low_level_timeout *
|
|
576 timeout_list, EMACS_TIME *interval);
|
|
577 int pop_low_level_timeout (struct low_level_timeout **timeout_list,
|
|
578 EMACS_TIME *time_out);
|
|
579 int event_stream_generate_wakeup (unsigned int milliseconds,
|
|
580 unsigned int vanilliseconds,
|
|
581 Lisp_Object function,
|
|
582 Lisp_Object object,
|
|
583 int async_p);
|
|
584 void event_stream_disable_wakeup (int id, int async_p);
|
|
585 void event_stream_deal_with_async_timeout (int interval_id);
|
|
586
|
|
587 /* from signal.c */
|
|
588 int event_stream_add_async_timeout (EMACS_TIME thyme);
|
|
589 void event_stream_remove_async_timeout (int id);
|
|
590
|
282
|
591 /* from event-stream.c -- focus sanity */
|
|
592 extern int focus_follows_mouse;
|
|
593 void investigate_frame_change (void);
|
|
594
|
0
|
595 void emacs_handle_focus_change_preliminary (Lisp_Object frame_inp_and_dev);
|
|
596 void emacs_handle_focus_change_final (Lisp_Object frame_inp_and_dev);
|
|
597
|
|
598 Lisp_Object extract_this_command_keys_nth_mouse_event (int n);
|
|
599 Lisp_Object extract_vector_nth_mouse_event (Lisp_Object vector, int n);
|
|
600
|
|
601 void single_console_state (void);
|
|
602 void any_console_state (void);
|
|
603 int in_single_console_state (void);
|
|
604
|
|
605 #ifdef HAVE_UNIXOID_EVENT_LOOP
|
|
606 /* Ceci n'est pas un pipe. */
|
|
607 extern int signal_event_pipe[];
|
|
608
|
|
609 void signal_fake_event (void);
|
|
610 void drain_signal_event_pipe (void);
|
|
611
|
|
612 extern int fake_event_occurred;
|
|
613
|
2
|
614 int event_stream_unixoid_select_console (struct console *con);
|
0
|
615 int event_stream_unixoid_unselect_console (struct console *con);
|
2
|
616 int event_stream_unixoid_select_process (struct Lisp_Process *proc);
|
0
|
617 int event_stream_unixoid_unselect_process (struct Lisp_Process *proc);
|
|
618 int read_event_from_tty_or_stream_desc (struct Lisp_Event *event,
|
|
619 struct console *c, int fd);
|
263
|
620 USID event_stream_unixoid_create_stream_pair (void* inhandle, void* outhandle,
|
|
621 Lisp_Object* instream,
|
|
622 Lisp_Object* outstream,
|
|
623 int flags);
|
|
624 USID event_stream_unixoid_delete_stream_pair (Lisp_Object instream,
|
|
625 Lisp_Object outstream);
|
|
626
|
|
627 /* Beware: this evil macro evaluates its arg many times */
|
|
628 #define FD_TO_USID(fd) ((fd)==0 ? (USID)999999 : ((fd)<0 ? USID_DONTHASH : (USID)(fd)))
|
|
629
|
0
|
630 #endif /* HAVE_UNIXOID_EVENT_LOOP */
|
|
631
|
|
632 extern int emacs_is_blocking;
|
|
633
|
|
634 extern volatile int sigint_happened;
|
|
635
|
|
636 /* Define this if you want the tty event stream to be used when the
|
|
637 first console is tty, even if HAVE_X_WINDOWS is defined */
|
|
638 /* #define DEBUG_TTY_EVENT_STREAM */
|
|
639
|
|
640 #endif /* emacs */
|
|
641
|
|
642 #endif /* _XEMACS_EVENTS_H_ */
|