comparison src/events.h @ 398:74fd4e045ea6 r21-2-29

Import from CVS: tag r21-2-29
author cvs
date Mon, 13 Aug 2007 11:13:30 +0200
parents 064ab7fed2e0
children 2f8bb876ab1d
comparison
equal deleted inserted replaced
397:f4aeb21a5bad 398:74fd4e045ea6
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */ 21 Boston, MA 02111-1307, USA. */
22 22
23 /* Synched up with: Not in FSF. */ 23 /* Synched up with: Not in FSF. */
24 24
25 #ifndef _XEMACS_EVENTS_H_ 25 #ifndef INCLUDED_events_h_
26 #define _XEMACS_EVENTS_H_ 26 #define INCLUDED_events_h_
27 27
28 #include "systime.h" 28 #include "systime.h"
29 29
30 /* There is one object called an event_stream. This object contains 30 /* There is one object called an event_stream. This object contains
31 callback functions for doing the window-system-dependent operations 31 callback functions for doing the window-system-dependent operations
38 38
39 If it is desired to have XEmacs able to open frames on the displays of 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 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 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 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. 43 event_streams are for dumb-ttys, and for X11 plus dumb-ttys,
44 and for mswindows.
44 45
45 To implement this for one window system is relatively simple. 46 To implement this for one window system is relatively simple.
46 To implement this for multiple window systems is trickier and may 47 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 not be possible in all situations, but it's been done for X and TTY.
48 49
273 implementation does not care about that implementation. 274 implementation does not care about that implementation.
274 275
275 The Create stream pair function is passed two void* values, which identify 276 The Create stream pair function is passed two void* values, which identify
276 process-dependent 'handles'. The process implementation uses these handles 277 process-dependent 'handles'. The process implementation uses these handles
277 to communicate with child processes. The function must be prepared to receive 278 to communicate with child processes. The function must be prepared to receive
278 handle types of any process implementation. Since there only one process 279 handle types of any process implementation. Since only one process
279 implementation exists in a particular XEmacs configuration, preprocessing 280 implementation exists in a particular XEmacs configuration, preprocessing
280 is a mean of compiling in the support for the code which deals with particular 281 is a means of compiling in the support for the code which deals with particular
281 handle types. 282 handle types.
282 283
283 For example, a unixoid type loop, which relies on file descriptors, may be 284 For example, a unixoid type loop, which relies on file descriptors, may be
284 asked to create a pair of streams by a unix-style process implementation. 285 asked to create a pair of streams by a unix-style process implementation.
285 In this case, the handles passed are unix file descriptors, and the code 286 In this case, the handles passed are unix file descriptors, and the code
314 /* typedef unsigned int USID; in lisp.h */ 315 /* typedef unsigned int USID; in lisp.h */
315 #define USID_ERROR ((USID)-1) 316 #define USID_ERROR ((USID)-1)
316 #define USID_DONTHASH ((USID)0) 317 #define USID_DONTHASH ((USID)0)
317 318
318 319
319 struct Lisp_Event;
320 struct Lisp_Process;
321
322 struct event_stream 320 struct event_stream
323 { 321 {
324 int (*event_pending_p) (int); 322 int (*event_pending_p) (int);
325 void (*next_event_cb) (struct Lisp_Event *); 323 void (*next_event_cb) (Lisp_Event *);
326 void (*handle_magic_event_cb) (struct Lisp_Event *); 324 void (*handle_magic_event_cb) (Lisp_Event *);
327 int (*add_timeout_cb) (EMACS_TIME); 325 int (*add_timeout_cb) (EMACS_TIME);
328 void (*remove_timeout_cb) (int); 326 void (*remove_timeout_cb) (int);
329 void (*select_console_cb) (struct console *); 327 void (*select_console_cb) (struct console *);
330 void (*unselect_console_cb) (struct console *); 328 void (*unselect_console_cb) (struct console *);
331 void (*select_process_cb) (struct Lisp_Process *); 329 void (*select_process_cb) (Lisp_Process *);
332 void (*unselect_process_cb) (struct Lisp_Process *); 330 void (*unselect_process_cb) (Lisp_Process *);
333 void (*quit_p_cb) (void); 331 void (*quit_p_cb) (void);
334 USID (*create_stream_pair_cb) (void* /* inhandle*/, void* /*outhandle*/ , 332 USID (*create_stream_pair_cb) (void* /* inhandle*/, void* /*outhandle*/ ,
335 Lisp_Object* /* instream */, 333 Lisp_Object* /* instream */,
336 Lisp_Object* /* outstream */, 334 Lisp_Object* /* outstream */,
337 int /* flags */); 335 int /* flags */);
432 #endif 430 #endif
433 #ifdef HAVE_MS_WINDOWS 431 #ifdef HAVE_MS_WINDOWS
434 int underlying_mswindows_event; 432 int underlying_mswindows_event;
435 #endif 433 #endif
436 }; 434 };
435
436 struct Lisp_Timeout
437 {
438 struct lcrecord_header header;
439 int id; /* Id we use to identify the timeout over its lifetime */
440 int interval_id; /* Id for this particular interval; this may
441 be different each time the timeout is
442 signalled.*/
443 Lisp_Object function, object; /* Function and object associated
444 with timeout. */
445 EMACS_TIME next_signal_time; /* Absolute time when the timeout
446 is next going to be signalled. */
447 unsigned int resignal_msecs; /* How far after the next timeout
448 should the one after that
449 occur? */
450 };
451 typedef struct Lisp_Timeout Lisp_Timeout;
452
453 DECLARE_LRECORD (timeout, Lisp_Timeout);
454 #define XTIMEOUT(x) XRECORD (x, timeout, Lisp_Timeout)
455 #define XSETTIMEOUT(x, p) XSETRECORD (x, p, timeout)
456 #define TIMEOUTP(x) RECORDP (x, timeout)
457 #define CHECK_TIMEOUT(x) CHECK_RECORD (x, timeout)
458 #define CONCHECK_TIMEOUT(x) CONCHECK_RECORD (x, timeout)
437 459
438 struct Lisp_Event 460 struct Lisp_Event
439 { 461 {
440 /* header->next (aka XEVENT_NEXT ()) is used as follows: 462 /* header->next (aka XEVENT_NEXT ()) is used as follows:
441 - For dead events, this is the next dead one. 463 - For dead events, this is the next dead one.
460 union magic_data magic; 482 union magic_data magic;
461 struct magic_eval_data magic_eval; 483 struct magic_eval_data magic_eval;
462 } event; 484 } event;
463 }; 485 };
464 486
465 DECLARE_LRECORD (event, struct Lisp_Event); 487 DECLARE_LRECORD (event, Lisp_Event);
466 #define XEVENT(x) XRECORD (x, event, struct Lisp_Event) 488 #define XEVENT(x) XRECORD (x, event, Lisp_Event)
467 #define XSETEVENT(x, p) XSETRECORD (x, p, event) 489 #define XSETEVENT(x, p) XSETRECORD (x, p, event)
468 #define EVENTP(x) RECORDP (x, event) 490 #define EVENTP(x) RECORDP (x, event)
469 #define GC_EVENTP(x) GC_RECORDP (x, event)
470 #define CHECK_EVENT(x) CHECK_RECORD (x, event) 491 #define CHECK_EVENT(x) CHECK_RECORD (x, event)
471 #define CONCHECK_EVENT(x) CONCHECK_RECORD (x, event) 492 #define CONCHECK_EVENT(x) CONCHECK_RECORD (x, event)
472 493
473 DECLARE_LRECORD (command_builder, struct command_builder); 494 DECLARE_LRECORD (command_builder, struct command_builder);
474 495
519 #ifdef emacs 540 #ifdef emacs
520 /* Maybe this should be trickier */ 541 /* Maybe this should be trickier */
521 #define KEYSYM(x) (intern (x)) 542 #define KEYSYM(x) (intern (x))
522 543
523 /* from events.c */ 544 /* from events.c */
524 void format_event_object (char *buf, struct Lisp_Event *e, int brief); 545 void format_event_object (char *buf, Lisp_Event *e, int brief);
525 void character_to_event (Emchar c, struct Lisp_Event *event, 546 void character_to_event (Emchar c, Lisp_Event *event,
526 struct console *con, 547 struct console *con,
527 int use_console_meta_flag, 548 int use_console_meta_flag,
528 int do_backspace_mapping); 549 int do_backspace_mapping);
529 void zero_event (struct Lisp_Event *e); 550 void zero_event (Lisp_Event *e);
530 void deallocate_event_chain (Lisp_Object event); 551 void deallocate_event_chain (Lisp_Object event);
531 Lisp_Object event_chain_tail (Lisp_Object event); 552 Lisp_Object event_chain_tail (Lisp_Object event);
532 void enqueue_event (Lisp_Object event, Lisp_Object *head, Lisp_Object *tail); 553 void enqueue_event (Lisp_Object event, Lisp_Object *head, Lisp_Object *tail);
533 Lisp_Object dequeue_event (Lisp_Object *head, Lisp_Object *tail); 554 Lisp_Object dequeue_event (Lisp_Object *head, Lisp_Object *tail);
534 void enqueue_event_chain (Lisp_Object event_chain, Lisp_Object *head, 555 void enqueue_event_chain (Lisp_Object event_chain, Lisp_Object *head,
541 Lisp_Object event_chain_nth (Lisp_Object event_chain, int n); 562 Lisp_Object event_chain_nth (Lisp_Object event_chain, int n);
542 Lisp_Object copy_event_chain (Lisp_Object event_chain); 563 Lisp_Object copy_event_chain (Lisp_Object event_chain);
543 /* True if this is a non-internal event 564 /* True if this is a non-internal event
544 (keyboard press, menu, scrollbar, mouse button) */ 565 (keyboard press, menu, scrollbar, mouse button) */
545 int command_event_p (Lisp_Object event); 566 int command_event_p (Lisp_Object event);
567 void define_self_inserting_symbol (Lisp_Object, Lisp_Object);
568 Emchar event_to_character (Lisp_Event *, int, int, int);
546 struct console *event_console_or_selected (Lisp_Object event); 569 struct console *event_console_or_selected (Lisp_Object event);
547 570
548 /* from event-stream.c */ 571 /* from event-stream.c */
549 Lisp_Object allocate_command_builder (Lisp_Object console); 572 Lisp_Object allocate_command_builder (Lisp_Object console);
550 void enqueue_magic_eval_event (void (*fun) (Lisp_Object), Lisp_Object object); 573 void enqueue_magic_eval_event (void (*fun) (Lisp_Object), Lisp_Object object);
551 void event_stream_next_event (struct Lisp_Event *event); 574 void event_stream_next_event (Lisp_Event *event);
552 void event_stream_handle_magic_event (struct Lisp_Event *event); 575 void event_stream_handle_magic_event (Lisp_Event *event);
553 void event_stream_select_console (struct console *con); 576 void event_stream_select_console (struct console *con);
554 void event_stream_unselect_console (struct console *con); 577 void event_stream_unselect_console (struct console *con);
555 void event_stream_select_process (struct Lisp_Process *proc); 578 void event_stream_select_process (Lisp_Process *proc);
556 void event_stream_unselect_process (struct Lisp_Process *proc); 579 void event_stream_unselect_process (Lisp_Process *proc);
557 USID event_stream_create_stream_pair (void* inhandle, void* outhandle, 580 USID event_stream_create_stream_pair (void* inhandle, void* outhandle,
558 Lisp_Object* instream, Lisp_Object* outstream, int flags); 581 Lisp_Object* instream, Lisp_Object* outstream, int flags);
559 USID event_stream_delete_stream_pair (Lisp_Object instream, Lisp_Object outstream); 582 USID event_stream_delete_stream_pair (Lisp_Object instream, Lisp_Object outstream);
560 void event_stream_quit_p (void); 583 void event_stream_quit_p (void);
561 584
614 637
615 extern int fake_event_occurred; 638 extern int fake_event_occurred;
616 639
617 int event_stream_unixoid_select_console (struct console *con); 640 int event_stream_unixoid_select_console (struct console *con);
618 int event_stream_unixoid_unselect_console (struct console *con); 641 int event_stream_unixoid_unselect_console (struct console *con);
619 int event_stream_unixoid_select_process (struct Lisp_Process *proc); 642 int event_stream_unixoid_select_process (Lisp_Process *proc);
620 int event_stream_unixoid_unselect_process (struct Lisp_Process *proc); 643 int event_stream_unixoid_unselect_process (Lisp_Process *proc);
621 int read_event_from_tty_or_stream_desc (struct Lisp_Event *event, 644 int read_event_from_tty_or_stream_desc (Lisp_Event *event,
622 struct console *con, int fd); 645 struct console *con, int fd);
623 USID event_stream_unixoid_create_stream_pair (void* inhandle, void* outhandle, 646 USID event_stream_unixoid_create_stream_pair (void* inhandle, void* outhandle,
624 Lisp_Object* instream, 647 Lisp_Object* instream,
625 Lisp_Object* outstream, 648 Lisp_Object* outstream,
626 int flags); 649 int flags);
636 first console is tty, even if HAVE_X_WINDOWS is defined */ 659 first console is tty, even if HAVE_X_WINDOWS is defined */
637 /* #define DEBUG_TTY_EVENT_STREAM */ 660 /* #define DEBUG_TTY_EVENT_STREAM */
638 661
639 #endif /* emacs */ 662 #endif /* emacs */
640 663
641 #endif /* _XEMACS_EVENTS_H_ */ 664 #endif /* INCLUDED_events_h_ */