Mercurial > hg > xemacs-beta
comparison src/events.h @ 412:697ef44129c6 r21-2-14
Import from CVS: tag r21-2-14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:20:41 +0200 |
parents | 2f8bb876ab1d |
children | 11054d720c21 |
comparison
equal
deleted
inserted
replaced
411:12e008d41344 | 412:697ef44129c6 |
---|---|
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 INCLUDED_events_h_ | 25 #ifndef _XEMACS_EVENTS_H_ |
26 #define INCLUDED_events_h_ | 26 #define _XEMACS_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. | |
45 | 44 |
46 To implement this for one window system is relatively simple. | 45 To implement this for one window system is relatively simple. |
47 To implement this for multiple window systems is trickier and may | 46 To implement this for multiple window systems is trickier and may |
48 not be possible in all situations, but it's been done for X and TTY. | 47 not be possible in all situations, but it's been done for X and TTY. |
49 | 48 |
274 implementation does not care about that implementation. | 273 implementation does not care about that implementation. |
275 | 274 |
276 The Create stream pair function is passed two void* values, which identify | 275 The Create stream pair function is passed two void* values, which identify |
277 process-dependent 'handles'. The process implementation uses these handles | 276 process-dependent 'handles'. The process implementation uses these handles |
278 to communicate with child processes. The function must be prepared to receive | 277 to communicate with child processes. The function must be prepared to receive |
279 handle types of any process implementation. Since only one process | 278 handle types of any process implementation. Since there only one process |
280 implementation exists in a particular XEmacs configuration, preprocessing | 279 implementation exists in a particular XEmacs configuration, preprocessing |
281 is a means of compiling in the support for the code which deals with particular | 280 is a mean of compiling in the support for the code which deals with particular |
282 handle types. | 281 handle types. |
283 | 282 |
284 For example, a unixoid type loop, which relies on file descriptors, may be | 283 For example, a unixoid type loop, which relies on file descriptors, may be |
285 asked to create a pair of streams by a unix-style process implementation. | 284 asked to create a pair of streams by a unix-style process implementation. |
286 In this case, the handles passed are unix file descriptors, and the code | 285 In this case, the handles passed are unix file descriptors, and the code |
315 /* typedef unsigned int USID; in lisp.h */ | 314 /* typedef unsigned int USID; in lisp.h */ |
316 #define USID_ERROR ((USID)-1) | 315 #define USID_ERROR ((USID)-1) |
317 #define USID_DONTHASH ((USID)0) | 316 #define USID_DONTHASH ((USID)0) |
318 | 317 |
319 | 318 |
319 struct Lisp_Event; | |
320 struct Lisp_Process; | |
321 | |
320 struct event_stream | 322 struct event_stream |
321 { | 323 { |
322 int (*event_pending_p) (int); | 324 int (*event_pending_p) (int); |
323 void (*next_event_cb) (Lisp_Event *); | 325 void (*next_event_cb) (struct Lisp_Event *); |
324 void (*handle_magic_event_cb) (Lisp_Event *); | 326 void (*handle_magic_event_cb) (struct Lisp_Event *); |
325 int (*add_timeout_cb) (EMACS_TIME); | 327 int (*add_timeout_cb) (EMACS_TIME); |
326 void (*remove_timeout_cb) (int); | 328 void (*remove_timeout_cb) (int); |
327 void (*select_console_cb) (struct console *); | 329 void (*select_console_cb) (struct console *); |
328 void (*unselect_console_cb) (struct console *); | 330 void (*unselect_console_cb) (struct console *); |
329 void (*select_process_cb) (Lisp_Process *); | 331 void (*select_process_cb) (struct Lisp_Process *); |
330 void (*unselect_process_cb) (Lisp_Process *); | 332 void (*unselect_process_cb) (struct Lisp_Process *); |
331 void (*quit_p_cb) (void); | 333 void (*quit_p_cb) (void); |
332 void (*force_event_pending) (struct frame* f); | |
333 USID (*create_stream_pair_cb) (void* /* inhandle*/, void* /*outhandle*/ , | 334 USID (*create_stream_pair_cb) (void* /* inhandle*/, void* /*outhandle*/ , |
334 Lisp_Object* /* instream */, | 335 Lisp_Object* /* instream */, |
335 Lisp_Object* /* outstream */, | 336 Lisp_Object* /* outstream */, |
336 int /* flags */); | 337 int /* flags */); |
337 USID (*delete_stream_pair_cb) (Lisp_Object /* instream */, | 338 USID (*delete_stream_pair_cb) (Lisp_Object /* instream */, |
365 | 366 |
366 | 367 |
367 struct key_data | 368 struct key_data |
368 { | 369 { |
369 Lisp_Object keysym; | 370 Lisp_Object keysym; |
370 int modifiers; | 371 unsigned char modifiers; |
371 }; | 372 }; |
372 | 373 |
373 struct button_data | 374 struct button_data |
374 { | 375 { |
375 int button; | 376 int button; |
376 int modifiers; | 377 unsigned char modifiers; |
377 int x, y; | 378 int x, y; |
378 }; | 379 }; |
379 | 380 |
380 struct motion_data | 381 struct motion_data |
381 { | 382 { |
382 int x, y; | 383 int x, y; |
383 int modifiers; | 384 unsigned char modifiers; |
384 }; | 385 }; |
385 | 386 |
386 struct process_data | 387 struct process_data |
387 { | 388 { |
388 Lisp_Object process; | 389 Lisp_Object process; |
405 struct misc_user_data | 406 struct misc_user_data |
406 { | 407 { |
407 Lisp_Object function; | 408 Lisp_Object function; |
408 Lisp_Object object; | 409 Lisp_Object object; |
409 int button; | 410 int button; |
410 int modifiers; | 411 unsigned char modifiers; |
411 int x, y; | 412 int x, y; |
412 }; | 413 }; |
413 | 414 |
414 struct magic_eval_data | 415 struct magic_eval_data |
415 { | 416 { |
431 #endif | 432 #endif |
432 #ifdef HAVE_MS_WINDOWS | 433 #ifdef HAVE_MS_WINDOWS |
433 int underlying_mswindows_event; | 434 int underlying_mswindows_event; |
434 #endif | 435 #endif |
435 }; | 436 }; |
436 | |
437 struct Lisp_Timeout | |
438 { | |
439 struct lcrecord_header header; | |
440 int id; /* Id we use to identify the timeout over its lifetime */ | |
441 int interval_id; /* Id for this particular interval; this may | |
442 be different each time the timeout is | |
443 signalled.*/ | |
444 Lisp_Object function, object; /* Function and object associated | |
445 with timeout. */ | |
446 EMACS_TIME next_signal_time; /* Absolute time when the timeout | |
447 is next going to be signalled. */ | |
448 unsigned int resignal_msecs; /* How far after the next timeout | |
449 should the one after that | |
450 occur? */ | |
451 }; | |
452 typedef struct Lisp_Timeout Lisp_Timeout; | |
453 | |
454 DECLARE_LRECORD (timeout, Lisp_Timeout); | |
455 #define XTIMEOUT(x) XRECORD (x, timeout, Lisp_Timeout) | |
456 #define XSETTIMEOUT(x, p) XSETRECORD (x, p, timeout) | |
457 #define TIMEOUTP(x) RECORDP (x, timeout) | |
458 #define CHECK_TIMEOUT(x) CHECK_RECORD (x, timeout) | |
459 #define CONCHECK_TIMEOUT(x) CONCHECK_RECORD (x, timeout) | |
460 | 437 |
461 struct Lisp_Event | 438 struct Lisp_Event |
462 { | 439 { |
463 /* header->next (aka XEVENT_NEXT ()) is used as follows: | 440 /* header->next (aka XEVENT_NEXT ()) is used as follows: |
464 - For dead events, this is the next dead one. | 441 - For dead events, this is the next dead one. |
483 union magic_data magic; | 460 union magic_data magic; |
484 struct magic_eval_data magic_eval; | 461 struct magic_eval_data magic_eval; |
485 } event; | 462 } event; |
486 }; | 463 }; |
487 | 464 |
488 DECLARE_LRECORD (event, Lisp_Event); | 465 DECLARE_LRECORD (event, struct Lisp_Event); |
489 #define XEVENT(x) XRECORD (x, event, Lisp_Event) | 466 #define XEVENT(x) XRECORD (x, event, struct Lisp_Event) |
490 #define XSETEVENT(x, p) XSETRECORD (x, p, event) | 467 #define XSETEVENT(x, p) XSETRECORD (x, p, event) |
491 #define EVENTP(x) RECORDP (x, event) | 468 #define EVENTP(x) RECORDP (x, event) |
469 #define GC_EVENTP(x) GC_RECORDP (x, event) | |
492 #define CHECK_EVENT(x) CHECK_RECORD (x, event) | 470 #define CHECK_EVENT(x) CHECK_RECORD (x, event) |
493 #define CONCHECK_EVENT(x) CONCHECK_RECORD (x, event) | 471 #define CONCHECK_EVENT(x) CONCHECK_RECORD (x, event) |
494 | 472 |
495 DECLARE_LRECORD (command_builder, struct command_builder); | 473 DECLARE_LRECORD (command_builder, struct command_builder); |
496 | 474 |
531 | 509 |
532 extern Lisp_Object QKbackspace, QKdelete, QKescape, QKlinefeed, QKreturn; | 510 extern Lisp_Object QKbackspace, QKdelete, QKescape, QKlinefeed, QKreturn; |
533 extern Lisp_Object QKspace, QKtab, Qmouse_event_p, Vcharacter_set_property; | 511 extern Lisp_Object QKspace, QKtab, Qmouse_event_p, Vcharacter_set_property; |
534 extern Lisp_Object Qcancel_mode_internal; | 512 extern Lisp_Object Qcancel_mode_internal; |
535 | 513 |
536 /* Note: under X Windows, XEMACS_MOD_ALT is generated by the Alt key if there are | 514 /* Note: under X Windows, MOD_ALT is generated by the Alt key if there are |
537 both Alt and Meta keys. If there are no Meta keys, then Alt generates | 515 both Alt and Meta keys. If there are no Meta keys, then Alt generates |
538 XEMACS_MOD_META instead. | 516 MOD_META instead. |
539 */ | 517 */ |
540 | 518 |
541 #ifdef emacs | 519 #ifdef emacs |
542 /* Maybe this should be trickier */ | 520 /* Maybe this should be trickier */ |
543 #define KEYSYM(x) (intern (x)) | 521 #define KEYSYM(x) (intern (x)) |
544 | 522 |
545 /* from events.c */ | 523 /* from events.c */ |
546 void format_event_object (char *buf, Lisp_Event *e, int brief); | 524 void format_event_object (char *buf, struct Lisp_Event *e, int brief); |
547 void character_to_event (Emchar c, Lisp_Event *event, | 525 void character_to_event (Emchar c, struct Lisp_Event *event, |
548 struct console *con, | 526 struct console *con, |
549 int use_console_meta_flag, | 527 int use_console_meta_flag, |
550 int do_backspace_mapping); | 528 int do_backspace_mapping); |
551 void zero_event (Lisp_Event *e); | 529 void zero_event (struct Lisp_Event *e); |
552 void deallocate_event_chain (Lisp_Object event); | 530 void deallocate_event_chain (Lisp_Object event); |
553 Lisp_Object event_chain_tail (Lisp_Object event); | 531 Lisp_Object event_chain_tail (Lisp_Object event); |
554 void enqueue_event (Lisp_Object event, Lisp_Object *head, Lisp_Object *tail); | 532 void enqueue_event (Lisp_Object event, Lisp_Object *head, Lisp_Object *tail); |
555 Lisp_Object dequeue_event (Lisp_Object *head, Lisp_Object *tail); | 533 Lisp_Object dequeue_event (Lisp_Object *head, Lisp_Object *tail); |
556 void enqueue_event_chain (Lisp_Object event_chain, Lisp_Object *head, | 534 void enqueue_event_chain (Lisp_Object event_chain, Lisp_Object *head, |
563 Lisp_Object event_chain_nth (Lisp_Object event_chain, int n); | 541 Lisp_Object event_chain_nth (Lisp_Object event_chain, int n); |
564 Lisp_Object copy_event_chain (Lisp_Object event_chain); | 542 Lisp_Object copy_event_chain (Lisp_Object event_chain); |
565 /* True if this is a non-internal event | 543 /* True if this is a non-internal event |
566 (keyboard press, menu, scrollbar, mouse button) */ | 544 (keyboard press, menu, scrollbar, mouse button) */ |
567 int command_event_p (Lisp_Object event); | 545 int command_event_p (Lisp_Object event); |
568 void define_self_inserting_symbol (Lisp_Object, Lisp_Object); | |
569 Emchar event_to_character (Lisp_Event *, int, int, int); | |
570 struct console *event_console_or_selected (Lisp_Object event); | 546 struct console *event_console_or_selected (Lisp_Object event); |
571 | 547 |
572 /* from event-stream.c */ | 548 /* from event-stream.c */ |
573 Lisp_Object allocate_command_builder (Lisp_Object console); | 549 Lisp_Object allocate_command_builder (Lisp_Object console); |
574 void enqueue_magic_eval_event (void (*fun) (Lisp_Object), Lisp_Object object); | 550 void enqueue_magic_eval_event (void (*fun) (Lisp_Object), Lisp_Object object); |
575 void event_stream_next_event (Lisp_Event *event); | 551 void event_stream_next_event (struct Lisp_Event *event); |
576 void event_stream_handle_magic_event (Lisp_Event *event); | 552 void event_stream_handle_magic_event (struct Lisp_Event *event); |
577 void event_stream_select_console (struct console *con); | 553 void event_stream_select_console (struct console *con); |
578 void event_stream_unselect_console (struct console *con); | 554 void event_stream_unselect_console (struct console *con); |
579 void event_stream_select_process (Lisp_Process *proc); | 555 void event_stream_select_process (struct Lisp_Process *proc); |
580 void event_stream_unselect_process (Lisp_Process *proc); | 556 void event_stream_unselect_process (struct Lisp_Process *proc); |
581 USID event_stream_create_stream_pair (void* inhandle, void* outhandle, | 557 USID event_stream_create_stream_pair (void* inhandle, void* outhandle, |
582 Lisp_Object* instream, Lisp_Object* outstream, int flags); | 558 Lisp_Object* instream, Lisp_Object* outstream, int flags); |
583 USID event_stream_delete_stream_pair (Lisp_Object instream, Lisp_Object outstream); | 559 USID event_stream_delete_stream_pair (Lisp_Object instream, Lisp_Object outstream); |
584 void event_stream_quit_p (void); | 560 void event_stream_quit_p (void); |
585 | 561 |
638 | 614 |
639 extern int fake_event_occurred; | 615 extern int fake_event_occurred; |
640 | 616 |
641 int event_stream_unixoid_select_console (struct console *con); | 617 int event_stream_unixoid_select_console (struct console *con); |
642 int event_stream_unixoid_unselect_console (struct console *con); | 618 int event_stream_unixoid_unselect_console (struct console *con); |
643 int event_stream_unixoid_select_process (Lisp_Process *proc); | 619 int event_stream_unixoid_select_process (struct Lisp_Process *proc); |
644 int event_stream_unixoid_unselect_process (Lisp_Process *proc); | 620 int event_stream_unixoid_unselect_process (struct Lisp_Process *proc); |
645 int read_event_from_tty_or_stream_desc (Lisp_Event *event, | 621 int read_event_from_tty_or_stream_desc (struct Lisp_Event *event, |
646 struct console *con, int fd); | 622 struct console *con, int fd); |
647 USID event_stream_unixoid_create_stream_pair (void* inhandle, void* outhandle, | 623 USID event_stream_unixoid_create_stream_pair (void* inhandle, void* outhandle, |
648 Lisp_Object* instream, | 624 Lisp_Object* instream, |
649 Lisp_Object* outstream, | 625 Lisp_Object* outstream, |
650 int flags); | 626 int flags); |
660 first console is tty, even if HAVE_X_WINDOWS is defined */ | 636 first console is tty, even if HAVE_X_WINDOWS is defined */ |
661 /* #define DEBUG_TTY_EVENT_STREAM */ | 637 /* #define DEBUG_TTY_EVENT_STREAM */ |
662 | 638 |
663 #endif /* emacs */ | 639 #endif /* emacs */ |
664 | 640 |
665 /* #### a hack, until accelerator shit is cleaned up */ | 641 #endif /* _XEMACS_EVENTS_H_ */ |
666 | |
667 /* This structure is what we use to encapsulate the state of a command sequence | |
668 being composed; key events are executed by adding themselves to the command | |
669 builder; if the command builder is then complete (does not still represent | |
670 a prefix key sequence) it executes the corresponding command. | |
671 */ | |
672 struct command_builder | |
673 { | |
674 struct lcrecord_header header; | |
675 Lisp_Object console; /* back pointer to the console this command | |
676 builder is for */ | |
677 /* Qnil, or a Lisp_Event representing the first event read | |
678 * after the last command completed. Threaded. */ | |
679 /* #### NYI */ | |
680 Lisp_Object prefix_events; | |
681 /* Qnil, or a Lisp_Event representing event in the current | |
682 * keymap-lookup sequence. Subsequent events are threaded via | |
683 * the event's next slot */ | |
684 Lisp_Object current_events; | |
685 /* Last elt of above */ | |
686 Lisp_Object most_current_event; | |
687 /* Last elt before function map code took over. What this means is: | |
688 All prefixes up to (but not including) this event have non-nil | |
689 bindings, but the prefix including this event has a nil binding. | |
690 Any events in the chain after this one were read solely because | |
691 we're part of a possible function key. If we end up with | |
692 something that's not part of a possible function key, we have to | |
693 unread all of those events. */ | |
694 Lisp_Object last_non_munged_event; | |
695 /* One set of values for function-key-map, one for key-translation-map */ | |
696 struct munging_key_translation | |
697 { | |
698 /* First event that can begin a possible function key sequence | |
699 (to be translated according to function-key-map). Normally | |
700 this is the first event in the chain. However, once we've | |
701 translated a sequence through function-key-map, this will point | |
702 to the first event after the translated sequence: we don't ever | |
703 want to translate any events twice through function-key-map, or | |
704 things could get really screwed up (e.g. if the user created a | |
705 translation loop). If this is nil, then the next-read event is | |
706 the first that can begin a function key sequence. */ | |
707 Lisp_Object first_mungeable_event; | |
708 } munge_me[2]; | |
709 | |
710 Bufbyte *echo_buf; | |
711 Bytecount echo_buf_length; /* size of echo_buf */ | |
712 Bytecount echo_buf_index; /* index into echo_buf | |
713 * -1 before doing echoing for new cmd */ | |
714 /* Self-insert-command is magic in that it doesn't always push an undo- | |
715 boundary: up to 20 consecutive self-inserts can happen before an undo- | |
716 boundary is pushed. This variable is that counter. | |
717 */ | |
718 int self_insert_countdown; | |
719 }; | |
720 | |
721 #endif /* INCLUDED_events_h_ */ |