Mercurial > hg > xemacs-beta
comparison src/events.h @ 440:8de8e3f6228a r21-2-28
Import from CVS: tag r21-2-28
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:33:38 +0200 |
parents | 3a7e78e1142d |
children | abe6d1db359e |
comparison
equal
deleted
inserted
replaced
439:357dd071b03c | 440:8de8e3f6228a |
---|---|
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 */); |
448 is next going to be signalled. */ | 446 is next going to be signalled. */ |
449 unsigned int resignal_msecs; /* How far after the next timeout | 447 unsigned int resignal_msecs; /* How far after the next timeout |
450 should the one after that | 448 should the one after that |
451 occur? */ | 449 occur? */ |
452 }; | 450 }; |
453 | 451 typedef struct Lisp_Timeout Lisp_Timeout; |
454 DECLARE_LRECORD (timeout, struct Lisp_Timeout); | 452 |
455 #define XTIMEOUT(x) XRECORD (x, timeout, struct Lisp_Timeout) | 453 DECLARE_LRECORD (timeout, Lisp_Timeout); |
454 #define XTIMEOUT(x) XRECORD (x, timeout, Lisp_Timeout) | |
456 #define XSETTIMEOUT(x, p) XSETRECORD (x, p, timeout) | 455 #define XSETTIMEOUT(x, p) XSETRECORD (x, p, timeout) |
457 #define TIMEOUTP(x) RECORDP (x, timeout) | 456 #define TIMEOUTP(x) RECORDP (x, timeout) |
458 #define CHECK_TIMEOUT(x) CHECK_RECORD (x, timeout) | 457 #define CHECK_TIMEOUT(x) CHECK_RECORD (x, timeout) |
459 #define CONCHECK_TIMEOUT(x) CONCHECK_RECORD (x, timeout) | 458 #define CONCHECK_TIMEOUT(x) CONCHECK_RECORD (x, timeout) |
460 | 459 |
483 union magic_data magic; | 482 union magic_data magic; |
484 struct magic_eval_data magic_eval; | 483 struct magic_eval_data magic_eval; |
485 } event; | 484 } event; |
486 }; | 485 }; |
487 | 486 |
488 DECLARE_LRECORD (event, struct Lisp_Event); | 487 DECLARE_LRECORD (event, Lisp_Event); |
489 #define XEVENT(x) XRECORD (x, event, struct Lisp_Event) | 488 #define XEVENT(x) XRECORD (x, event, Lisp_Event) |
490 #define XSETEVENT(x, p) XSETRECORD (x, p, event) | 489 #define XSETEVENT(x, p) XSETRECORD (x, p, event) |
491 #define EVENTP(x) RECORDP (x, event) | 490 #define EVENTP(x) RECORDP (x, event) |
492 #define CHECK_EVENT(x) CHECK_RECORD (x, event) | 491 #define CHECK_EVENT(x) CHECK_RECORD (x, event) |
493 #define CONCHECK_EVENT(x) CONCHECK_RECORD (x, event) | 492 #define CONCHECK_EVENT(x) CONCHECK_RECORD (x, event) |
494 | 493 |
541 #ifdef emacs | 540 #ifdef emacs |
542 /* Maybe this should be trickier */ | 541 /* Maybe this should be trickier */ |
543 #define KEYSYM(x) (intern (x)) | 542 #define KEYSYM(x) (intern (x)) |
544 | 543 |
545 /* from events.c */ | 544 /* from events.c */ |
546 void format_event_object (char *buf, struct Lisp_Event *e, int brief); | 545 void format_event_object (char *buf, Lisp_Event *e, int brief); |
547 void character_to_event (Emchar c, struct Lisp_Event *event, | 546 void character_to_event (Emchar c, Lisp_Event *event, |
548 struct console *con, | 547 struct console *con, |
549 int use_console_meta_flag, | 548 int use_console_meta_flag, |
550 int do_backspace_mapping); | 549 int do_backspace_mapping); |
551 void zero_event (struct Lisp_Event *e); | 550 void zero_event (Lisp_Event *e); |
552 void deallocate_event_chain (Lisp_Object event); | 551 void deallocate_event_chain (Lisp_Object event); |
553 Lisp_Object event_chain_tail (Lisp_Object event); | 552 Lisp_Object event_chain_tail (Lisp_Object event); |
554 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); |
555 Lisp_Object dequeue_event (Lisp_Object *head, Lisp_Object *tail); | 554 Lisp_Object dequeue_event (Lisp_Object *head, Lisp_Object *tail); |
556 void enqueue_event_chain (Lisp_Object event_chain, Lisp_Object *head, | 555 void enqueue_event_chain (Lisp_Object event_chain, Lisp_Object *head, |
563 Lisp_Object event_chain_nth (Lisp_Object event_chain, int n); | 562 Lisp_Object event_chain_nth (Lisp_Object event_chain, int n); |
564 Lisp_Object copy_event_chain (Lisp_Object event_chain); | 563 Lisp_Object copy_event_chain (Lisp_Object event_chain); |
565 /* True if this is a non-internal event | 564 /* True if this is a non-internal event |
566 (keyboard press, menu, scrollbar, mouse button) */ | 565 (keyboard press, menu, scrollbar, mouse button) */ |
567 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); | |
568 struct console *event_console_or_selected (Lisp_Object event); | 569 struct console *event_console_or_selected (Lisp_Object event); |
569 | 570 |
570 /* from event-stream.c */ | 571 /* from event-stream.c */ |
571 Lisp_Object allocate_command_builder (Lisp_Object console); | 572 Lisp_Object allocate_command_builder (Lisp_Object console); |
572 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); |
573 void event_stream_next_event (struct Lisp_Event *event); | 574 void event_stream_next_event (Lisp_Event *event); |
574 void event_stream_handle_magic_event (struct Lisp_Event *event); | 575 void event_stream_handle_magic_event (Lisp_Event *event); |
575 void event_stream_select_console (struct console *con); | 576 void event_stream_select_console (struct console *con); |
576 void event_stream_unselect_console (struct console *con); | 577 void event_stream_unselect_console (struct console *con); |
577 void event_stream_select_process (struct Lisp_Process *proc); | 578 void event_stream_select_process (Lisp_Process *proc); |
578 void event_stream_unselect_process (struct Lisp_Process *proc); | 579 void event_stream_unselect_process (Lisp_Process *proc); |
579 USID event_stream_create_stream_pair (void* inhandle, void* outhandle, | 580 USID event_stream_create_stream_pair (void* inhandle, void* outhandle, |
580 Lisp_Object* instream, Lisp_Object* outstream, int flags); | 581 Lisp_Object* instream, Lisp_Object* outstream, int flags); |
581 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); |
582 void event_stream_quit_p (void); | 583 void event_stream_quit_p (void); |
583 | 584 |
636 | 637 |
637 extern int fake_event_occurred; | 638 extern int fake_event_occurred; |
638 | 639 |
639 int event_stream_unixoid_select_console (struct console *con); | 640 int event_stream_unixoid_select_console (struct console *con); |
640 int event_stream_unixoid_unselect_console (struct console *con); | 641 int event_stream_unixoid_unselect_console (struct console *con); |
641 int event_stream_unixoid_select_process (struct Lisp_Process *proc); | 642 int event_stream_unixoid_select_process (Lisp_Process *proc); |
642 int event_stream_unixoid_unselect_process (struct Lisp_Process *proc); | 643 int event_stream_unixoid_unselect_process (Lisp_Process *proc); |
643 int read_event_from_tty_or_stream_desc (struct Lisp_Event *event, | 644 int read_event_from_tty_or_stream_desc (Lisp_Event *event, |
644 struct console *con, int fd); | 645 struct console *con, int fd); |
645 USID event_stream_unixoid_create_stream_pair (void* inhandle, void* outhandle, | 646 USID event_stream_unixoid_create_stream_pair (void* inhandle, void* outhandle, |
646 Lisp_Object* instream, | 647 Lisp_Object* instream, |
647 Lisp_Object* outstream, | 648 Lisp_Object* outstream, |
648 int flags); | 649 int flags); |
658 first console is tty, even if HAVE_X_WINDOWS is defined */ | 659 first console is tty, even if HAVE_X_WINDOWS is defined */ |
659 /* #define DEBUG_TTY_EVENT_STREAM */ | 660 /* #define DEBUG_TTY_EVENT_STREAM */ |
660 | 661 |
661 #endif /* emacs */ | 662 #endif /* emacs */ |
662 | 663 |
663 #endif /* _XEMACS_EVENTS_H_ */ | 664 #endif /* INCLUDED_events_h_ */ |