comparison src/events.h @ 380:8626e4521993 r21-2-5

Import from CVS: tag r21-2-5
author cvs
date Mon, 13 Aug 2007 11:07:10 +0200
parents cc15677e0335
children 064ab7fed2e0
comparison
equal deleted inserted replaced
379:76b7d63099ad 380:8626e4521993
113 select_device_cb These callbacks are used by Unixoid event loops 113 select_device_cb These callbacks are used by Unixoid event loops
114 unselect_device_cb (those that use select() and file descriptors and 114 unselect_device_cb (those that use select() and file descriptors and
115 have a separate input fd per device). 115 have a separate input fd per device).
116 116
117 create_stream_pair_cb These callbacks are called by process code to 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 118 delete_stream_pair_cb create and delete a pair of input and output lstreams
119 which are used for subprocess I/O. 119 which are used for subprocess I/O.
120 120
121 quitp_cb A handler function called from the `QUIT' macro which 121 quitp_cb A handler function called from the `QUIT' macro which
122 should check whether the quit character has been 122 should check whether the quit character has been
123 typed. On systems with SIGIO, this will not be called 123 typed. On systems with SIGIO, this will not be called
267 /* 267 /*
268 Stream pairs description 268 Stream pairs description
269 ------------------------ 269 ------------------------
270 270
271 Since there are many possible processes/event loop combinations, the event code 271 Since there are many possible processes/event loop combinations, the event code
272 is responsible for creating an appropriare lstream type. The process 272 is responsible for creating an appropriate lstream type. The process
273 implementation does not care about that implementation. 273 implementation does not care about that implementation.
274 274
275 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
276 process-dependant 'handles'. The process implementation uses these handles 276 process-dependent 'handles'. The process implementation uses these handles
277 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
278 handle types of any process implementation. Since there only one process 278 handle types of any process implementation. Since there only one process
279 implementation exists in a particular XEmacs configuration, preprocessing 279 implementation exists in a particular XEmacs configuration, preprocessing
280 is a mean 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
281 handle types. 281 handle types.
291 291
292 The handle given may have special denying value, in which case the 292 The handle given may have special denying value, in which case the
293 corresponding lstream should not be created. 293 corresponding lstream should not be created.
294 294
295 The return value of the function is a unique stream identifier. It is used 295 The return value of the function is a unique stream identifier. It is used
296 by processes implementation, in its platform-independant part. There is 296 by processes implementation, in its platform-independent part. There is
297 the get_process_from_usid function, which returns process object given its 297 the get_process_from_usid function, which returns process object given its
298 USID. The event stream is responsible for converting its internal handle 298 USID. The event stream is responsible for converting its internal handle
299 type into USID. 299 type into USID.
300 300
301 Example is the TTY event stream. When a file descriptor signals input, the 301 Example is the TTY event stream. When a file descriptor signals input, the
302 event loop must determine process to which the input is destined. Thus, 302 event loop must determine process to which the input is destined. Thus,
303 the imlementation uses process input stream file descriptor as USID, by 303 the implementation uses process input stream file descriptor as USID, by
304 simply casting the fd value to USID type. 304 simply casting the fd value to USID type.
305 305
306 There are two special USID values. One, USID_ERROR, indicates that the stream 306 There are two special USID values. One, USID_ERROR, indicates that the stream
307 pair cannot be created. The second, USID_DONTHASH, indicates that streams are 307 pair cannot be created. The second, USID_DONTHASH, indicates that streams are
308 created, but the event stream does not wish to be able to find the process 308 created, but the event stream does not wish to be able to find the process
309 by its USID. Specifically, if an event stream implementation never calss 309 by its USID. Specifically, if an event stream implementation never calls
310 get_process_from_usid, this value should always be returned, to prevent 310 get_process_from_usid, this value should always be returned, to prevent
311 accumulating useless information on USID to process relationship. 311 accumulating useless information on USID to process relationship.
312 */ 312 */
313 313
314 /* typedef unsigned int USID; in lisp.h */ 314 /* typedef unsigned int USID; in lisp.h */
452 struct key_data key; 452 struct key_data key;
453 struct button_data button; 453 struct button_data button;
454 struct motion_data motion; 454 struct motion_data motion;
455 struct process_data process; 455 struct process_data process;
456 struct timeout_data timeout; 456 struct timeout_data timeout;
457 struct eval_data eval; /* misc_user_event no loger uses this */ 457 struct eval_data eval; /* misc_user_event no longer uses this */
458 struct misc_user_data misc; /* because it needs position information */ 458 struct misc_user_data misc; /* because it needs position information */
459 union magic_data magic; 459 union magic_data magic;
460 struct magic_eval_data magic_eval; 460 struct magic_eval_data magic_eval;
461 } event; 461 } event;
462 }; 462 };
517 517
518 #ifdef emacs 518 #ifdef emacs
519 /* Maybe this should be trickier */ 519 /* Maybe this should be trickier */
520 #define KEYSYM(x) (intern (x)) 520 #define KEYSYM(x) (intern (x))
521 521
522 Lisp_Object allocate_command_builder (Lisp_Object console); 522 /* from events.c */
523
524 void format_event_object (char *buf, struct Lisp_Event *e, int brief); 523 void format_event_object (char *buf, struct Lisp_Event *e, int brief);
525 void character_to_event (Emchar c, struct Lisp_Event *event, 524 void character_to_event (Emchar c, struct Lisp_Event *event,
526 struct console *con, 525 struct console *con,
527 int use_console_meta_flag, 526 int use_console_meta_flag,
528 int do_backspace_mapping); 527 int do_backspace_mapping);
529 void enqueue_magic_eval_event (void (*fun) (Lisp_Object), Lisp_Object object);
530 void zero_event (struct Lisp_Event *e); 528 void zero_event (struct Lisp_Event *e);
531
532 void deallocate_event_chain (Lisp_Object event); 529 void deallocate_event_chain (Lisp_Object event);
533 Lisp_Object event_chain_tail (Lisp_Object event); 530 Lisp_Object event_chain_tail (Lisp_Object event);
534 void enqueue_event (Lisp_Object event, Lisp_Object *head, Lisp_Object *tail); 531 void enqueue_event (Lisp_Object event, Lisp_Object *head, Lisp_Object *tail);
535 Lisp_Object dequeue_event (Lisp_Object *head, Lisp_Object *tail); 532 Lisp_Object dequeue_event (Lisp_Object *head, Lisp_Object *tail);
536 void enqueue_event_chain (Lisp_Object event_chain, Lisp_Object *head, 533 void enqueue_event_chain (Lisp_Object event_chain, Lisp_Object *head,
540 Lisp_Object key_sequence_to_event_chain (Lisp_Object seq); 537 Lisp_Object key_sequence_to_event_chain (Lisp_Object seq);
541 Lisp_Object event_chain_find_previous (Lisp_Object event_chain, 538 Lisp_Object event_chain_find_previous (Lisp_Object event_chain,
542 Lisp_Object event); 539 Lisp_Object event);
543 Lisp_Object event_chain_nth (Lisp_Object event_chain, int n); 540 Lisp_Object event_chain_nth (Lisp_Object event_chain, int n);
544 Lisp_Object copy_event_chain (Lisp_Object event_chain); 541 Lisp_Object copy_event_chain (Lisp_Object event_chain);
545
546 /* True if this is a non-internal event 542 /* True if this is a non-internal event
547 (keyboard press, menu, scrollbar, mouse button) */ 543 (keyboard press, menu, scrollbar, mouse button) */
548 int command_event_p (Lisp_Object event); 544 int command_event_p (Lisp_Object event);
549
550 struct console *event_console_or_selected (Lisp_Object event); 545 struct console *event_console_or_selected (Lisp_Object event);
551 546
547 /* from event-stream.c */
548 Lisp_Object allocate_command_builder (Lisp_Object console);
549 void enqueue_magic_eval_event (void (*fun) (Lisp_Object), Lisp_Object object);
552 void event_stream_next_event (struct Lisp_Event *event); 550 void event_stream_next_event (struct Lisp_Event *event);
553 void event_stream_handle_magic_event (struct Lisp_Event *event); 551 void event_stream_handle_magic_event (struct Lisp_Event *event);
554 void event_stream_select_console (struct console *c); 552 void event_stream_select_console (struct console *con);
555 void event_stream_unselect_console (struct console *c); 553 void event_stream_unselect_console (struct console *con);
556 void event_stream_select_process (struct Lisp_Process *proc); 554 void event_stream_select_process (struct Lisp_Process *proc);
557 void event_stream_unselect_process (struct Lisp_Process *proc); 555 void event_stream_unselect_process (struct Lisp_Process *proc);
558 USID event_stream_create_stream_pair (void* inhandle, void* outhandle, 556 USID event_stream_create_stream_pair (void* inhandle, void* outhandle,
559 Lisp_Object* instream, Lisp_Object* outstream, int flags); 557 Lisp_Object* instream, Lisp_Object* outstream, int flags);
560 USID event_stream_delete_stream_pair (Lisp_Object instream, Lisp_Object outstream); 558 USID event_stream_delete_stream_pair (Lisp_Object instream, Lisp_Object outstream);
581 Lisp_Object object, 579 Lisp_Object object,
582 int async_p); 580 int async_p);
583 void event_stream_disable_wakeup (int id, int async_p); 581 void event_stream_disable_wakeup (int id, int async_p);
584 void event_stream_deal_with_async_timeout (int interval_id); 582 void event_stream_deal_with_async_timeout (int interval_id);
585 583
586 /* from signal.c */
587 int event_stream_add_async_timeout (EMACS_TIME thyme); 584 int event_stream_add_async_timeout (EMACS_TIME thyme);
588 void event_stream_remove_async_timeout (int id); 585 void event_stream_remove_async_timeout (int id);
589 586
590 /* from event-stream.c -- focus sanity */ 587 /* from event-stream.c -- focus sanity */
591 extern int focus_follows_mouse; 588 extern int focus_follows_mouse;
599 596
600 void single_console_state (void); 597 void single_console_state (void);
601 void any_console_state (void); 598 void any_console_state (void);
602 int in_single_console_state (void); 599 int in_single_console_state (void);
603 600
601 extern int emacs_is_blocking;
602
603 extern volatile int sigint_happened;
604
604 #ifdef HAVE_UNIXOID_EVENT_LOOP 605 #ifdef HAVE_UNIXOID_EVENT_LOOP
606 /* from event-unixoid.c */
607
605 /* Ceci n'est pas un pipe. */ 608 /* Ceci n'est pas un pipe. */
606 extern int signal_event_pipe[]; 609 extern int signal_event_pipe[];
607 610
608 void signal_fake_event (void); 611 void signal_fake_event (void);
609 void drain_signal_event_pipe (void); 612 void drain_signal_event_pipe (void);
613 int event_stream_unixoid_select_console (struct console *con); 616 int event_stream_unixoid_select_console (struct console *con);
614 int event_stream_unixoid_unselect_console (struct console *con); 617 int event_stream_unixoid_unselect_console (struct console *con);
615 int event_stream_unixoid_select_process (struct Lisp_Process *proc); 618 int event_stream_unixoid_select_process (struct Lisp_Process *proc);
616 int event_stream_unixoid_unselect_process (struct Lisp_Process *proc); 619 int event_stream_unixoid_unselect_process (struct Lisp_Process *proc);
617 int read_event_from_tty_or_stream_desc (struct Lisp_Event *event, 620 int read_event_from_tty_or_stream_desc (struct Lisp_Event *event,
618 struct console *c, int fd); 621 struct console *con, int fd);
619 USID event_stream_unixoid_create_stream_pair (void* inhandle, void* outhandle, 622 USID event_stream_unixoid_create_stream_pair (void* inhandle, void* outhandle,
620 Lisp_Object* instream, 623 Lisp_Object* instream,
621 Lisp_Object* outstream, 624 Lisp_Object* outstream,
622 int flags); 625 int flags);
623 USID event_stream_unixoid_delete_stream_pair (Lisp_Object instream, 626 USID event_stream_unixoid_delete_stream_pair (Lisp_Object instream,
626 /* Beware: this evil macro evaluates its arg many times */ 629 /* Beware: this evil macro evaluates its arg many times */
627 #define FD_TO_USID(fd) ((fd)==0 ? (USID)999999 : ((fd)<0 ? USID_DONTHASH : (USID)(fd))) 630 #define FD_TO_USID(fd) ((fd)==0 ? (USID)999999 : ((fd)<0 ? USID_DONTHASH : (USID)(fd)))
628 631
629 #endif /* HAVE_UNIXOID_EVENT_LOOP */ 632 #endif /* HAVE_UNIXOID_EVENT_LOOP */
630 633
631 extern int emacs_is_blocking;
632
633 extern volatile int sigint_happened;
634
635 /* Define this if you want the tty event stream to be used when the 634 /* Define this if you want the tty event stream to be used when the
636 first console is tty, even if HAVE_X_WINDOWS is defined */ 635 first console is tty, even if HAVE_X_WINDOWS is defined */
637 /* #define DEBUG_TTY_EVENT_STREAM */ 636 /* #define DEBUG_TTY_EVENT_STREAM */
638 637
639 #endif /* emacs */ 638 #endif /* emacs */