comparison src/keyboard.c @ 90068:eac554634bfa

Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-79 Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-735 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-747 Update from CVS
author Miles Bader <miles@gnu.org>
date Sat, 25 Dec 2004 02:00:25 +0000
parents fb79180b618d 867a7d5055b2
children cb67264d6096
comparison
equal deleted inserted replaced
90067:b481c5870e10 90068:eac554634bfa
3041 int count = SPECPDL_INDEX (); 3041 int count = SPECPDL_INDEX ();
3042 3042
3043 /* Save the echo status. */ 3043 /* Save the echo status. */
3044 int saved_immediate_echo = current_kboard->immediate_echo; 3044 int saved_immediate_echo = current_kboard->immediate_echo;
3045 struct kboard *saved_ok_to_echo = ok_to_echo_at_next_pause; 3045 struct kboard *saved_ok_to_echo = ok_to_echo_at_next_pause;
3046 Lisp_Object saved_echo_string = current_kboard->echo_string;
3046 int saved_echo_after_prompt = current_kboard->echo_after_prompt; 3047 int saved_echo_after_prompt = current_kboard->echo_after_prompt;
3047 3048
3048 #if 0 3049 #if 0
3049 if (before_command_restore_flag) 3050 if (before_command_restore_flag)
3050 { 3051 {
3095 if (key_count > 0) 3096 if (key_count > 0)
3096 this_command_keys = keys; 3097 this_command_keys = keys;
3097 3098
3098 cancel_echoing (); 3099 cancel_echoing ();
3099 ok_to_echo_at_next_pause = saved_ok_to_echo; 3100 ok_to_echo_at_next_pause = saved_ok_to_echo;
3101 current_kboard->echo_string = saved_echo_string;
3100 current_kboard->echo_after_prompt = saved_echo_after_prompt; 3102 current_kboard->echo_after_prompt = saved_echo_after_prompt;
3101 if (saved_immediate_echo) 3103 if (saved_immediate_echo)
3102 echo_now (); 3104 echo_now ();
3103 3105
3104 UNGCPRO; 3106 UNGCPRO;
3577 else 3579 else
3578 return FRAME_KBOARD (XFRAME (frame)); 3580 return FRAME_KBOARD (XFRAME (frame));
3579 } 3581 }
3580 #endif 3582 #endif
3581 3583
3584
3585 Lisp_Object Vthrow_on_input;
3586
3582 /* Store an event obtained at interrupt level into kbd_buffer, fifo */ 3587 /* Store an event obtained at interrupt level into kbd_buffer, fifo */
3583 3588
3584 void 3589 void
3585 kbd_buffer_store_event (event) 3590 kbd_buffer_store_event (event)
3586 register struct input_event *event; 3591 register struct input_event *event;
3701 Discard the event if it would fill the last slot. */ 3706 Discard the event if it would fill the last slot. */
3702 if (kbd_fetch_ptr - 1 != kbd_store_ptr) 3707 if (kbd_fetch_ptr - 1 != kbd_store_ptr)
3703 { 3708 {
3704 *kbd_store_ptr = *event; 3709 *kbd_store_ptr = *event;
3705 ++kbd_store_ptr; 3710 ++kbd_store_ptr;
3711 }
3712
3713 /* If we're inside while-no-input, and this event qualifies
3714 as input, set quit-flag to cause an interrupt. */
3715 if (!NILP (Vthrow_on_input)
3716 && event->kind != FOCUS_IN_EVENT
3717 && event->kind != HELP_EVENT
3718 && event->kind != DEICONIFY_EVENT)
3719 {
3720 Vquit_flag = Vthrow_on_input;
3721 /* If we're inside a function that wants immediate quits,
3722 do it now. */
3723 if (immediate_quit && NILP (Vinhibit_quit))
3724 {
3725 immediate_quit = 0;
3726 sigfree ();
3727 QUIT;
3728 }
3706 } 3729 }
3707 } 3730 }
3708 3731
3709 3732
3710 /* Put an input event back in the head of the event queue. */ 3733 /* Put an input event back in the head of the event queue. */
6815 6838
6816 #ifdef BSD4_1 6839 #ifdef BSD4_1
6817 sigisheld (SIGIO); 6840 sigisheld (SIGIO);
6818 #endif 6841 #endif
6819 6842
6820 if (input_available_clear_time)
6821 EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0);
6822
6823 #ifdef SYNC_INPUT 6843 #ifdef SYNC_INPUT
6824 interrupt_input_pending = 1; 6844 interrupt_input_pending = 1;
6825 #else 6845 #else
6826 6846 SIGNAL_THREAD_CHECK (signo);
6827 # if !defined (SYSTEM_MALLOC) && defined (HAVE_GTK_AND_PTHREAD) 6847 #endif
6828 extern pthread_t main_thread; 6848
6829 if (pthread_self () != main_thread) 6849 if (input_available_clear_time)
6830 { 6850 EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0);
6831 /* POSIX says any thread can receive the signal. On GNU/Linux that is 6851
6832 not true, but for other systems (FreeBSD at least) it is. So direct 6852 #ifndef SYNC_INPUT
6833 the signal to the correct thread and block it from this thread. */
6834 sigset_t new_mask;
6835
6836 sigemptyset (&new_mask);
6837 sigaddset (&new_mask, SIGIO);
6838 pthread_sigmask (SIG_BLOCK, &new_mask, 0);
6839 pthread_kill (main_thread, SIGIO);
6840 return;
6841 }
6842 # endif /* HAVE_GTK_AND_PTHREAD */
6843
6844 handle_async_input (); 6853 handle_async_input ();
6845 #endif 6854 #endif
6846 6855
6847 #ifdef BSD4_1 6856 #ifdef BSD4_1
6848 sigfree (); 6857 sigfree ();
10253 signal (SIGINT, interrupt_signal); 10262 signal (SIGINT, interrupt_signal);
10254 signal (SIGQUIT, interrupt_signal); 10263 signal (SIGQUIT, interrupt_signal);
10255 } 10264 }
10256 #endif /* USG */ 10265 #endif /* USG */
10257 10266
10267 SIGNAL_THREAD_CHECK (signalnum);
10258 cancel_echoing (); 10268 cancel_echoing ();
10259 10269
10260 if (!NILP (Vquit_flag) 10270 if (!NILP (Vquit_flag)
10261 && (FRAME_TERMCAP_P (sf) || FRAME_MSDOS_P (sf))) 10271 && (FRAME_TERMCAP_P (sf) || FRAME_MSDOS_P (sf)))
10262 { 10272 {
11373 11383
11374 DEFVAR_LISP ("minibuffer-message-timeout", &Vminibuffer_message_timeout, 11384 DEFVAR_LISP ("minibuffer-message-timeout", &Vminibuffer_message_timeout,
11375 doc: /* *How long to display an echo-area message when the minibuffer is active. 11385 doc: /* *How long to display an echo-area message when the minibuffer is active.
11376 If the value is not a number, such messages don't time out. */); 11386 If the value is not a number, such messages don't time out. */);
11377 Vminibuffer_message_timeout = make_number (2); 11387 Vminibuffer_message_timeout = make_number (2);
11388
11389 DEFVAR_LISP ("throw-on-input", &Vthrow_on_input,
11390 doc: /* If non-nil, any keyboard input throws to this symbol.
11391 The value of that variable is passed to `quit-flag' and later causes a
11392 peculiar kind of quitting. */);
11393 Vthrow_on_input = Qnil;
11378 } 11394 }
11379 11395
11380 void 11396 void
11381 keys_of_keyboard () 11397 keys_of_keyboard ()
11382 { 11398 {