aboutsummaryrefslogtreecommitdiffstats
path: root/src/keyboard.c
diff options
context:
space:
mode:
authorJoakim Verona2011-12-28 11:34:15 +0100
committerJoakim Verona2011-12-28 11:34:15 +0100
commit2f74c36bf173b5ad01f99e0d1b31b9b8fa5c8f2f (patch)
tree034e65ef002631d0aba8fc1a41e9984fc557e630 /src/keyboard.c
parentbb29f044aa967831cd664c54eba0de0c701436ce (diff)
parentd23ab8e8726ecb7e3554644857b4a58e5f7408f1 (diff)
downloademacs-2f74c36bf173b5ad01f99e0d1b31b9b8fa5c8f2f.tar.gz
emacs-2f74c36bf173b5ad01f99e0d1b31b9b8fa5c8f2f.zip
upstream
Diffstat (limited to 'src/keyboard.c')
-rw-r--r--src/keyboard.c56
1 files changed, 36 insertions, 20 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 656634b8d31..7873dca3a0e 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -467,7 +467,8 @@ static void input_available_signal (int signo);
467static Lisp_Object (Fcommand_execute) (Lisp_Object, Lisp_Object, Lisp_Object, 467static Lisp_Object (Fcommand_execute) (Lisp_Object, Lisp_Object, Lisp_Object,
468 Lisp_Object); 468 Lisp_Object);
469static void handle_interrupt (void); 469static void handle_interrupt (void);
470static void quit_throw_to_read_char (void) NO_RETURN; 470static void quit_throw_to_read_char (int) NO_RETURN;
471static void process_special_events (void);
471static void timer_start_idle (void); 472static void timer_start_idle (void);
472static void timer_stop_idle (void); 473static void timer_stop_idle (void);
473static void timer_resume_idle (void); 474static void timer_resume_idle (void);
@@ -656,7 +657,7 @@ echo_now (void)
656 echo_kboard = current_kboard; 657 echo_kboard = current_kboard;
657 658
658 if (waiting_for_input && !NILP (Vquit_flag)) 659 if (waiting_for_input && !NILP (Vquit_flag))
659 quit_throw_to_read_char (); 660 quit_throw_to_read_char (0);
660} 661}
661 662
662/* Turn off echoing, for the start of a new command. */ 663/* Turn off echoing, for the start of a new command. */
@@ -3820,7 +3821,7 @@ kbd_buffer_get_event (KBOARD **kbp,
3820 /* If the quit flag is set, then read_char will return 3821 /* If the quit flag is set, then read_char will return
3821 quit_char, so that counts as "available input." */ 3822 quit_char, so that counts as "available input." */
3822 if (!NILP (Vquit_flag)) 3823 if (!NILP (Vquit_flag))
3823 quit_throw_to_read_char (); 3824 quit_throw_to_read_char (0);
3824 3825
3825 /* One way or another, wait until input is available; then, if 3826 /* One way or another, wait until input is available; then, if
3826 interrupt handlers have not read it, read it now. */ 3827 interrupt handlers have not read it, read it now. */
@@ -4155,14 +4156,12 @@ kbd_buffer_get_event (KBOARD **kbp,
4155 return (obj); 4156 return (obj);
4156} 4157}
4157 4158
4158/* Process any events that are not user-visible, 4159/* Process any non-user-visible events (currently X selection events),
4159 then return, without reading any user-visible events. */ 4160 without reading any user-visible events. */
4160 4161
4161void 4162static void
4162swallow_events (int do_display) 4163process_special_events (void)
4163{ 4164{
4164 int old_timers_run;
4165
4166 while (kbd_fetch_ptr != kbd_store_ptr) 4165 while (kbd_fetch_ptr != kbd_store_ptr)
4167 { 4166 {
4168 struct input_event *event; 4167 struct input_event *event;
@@ -4197,6 +4196,17 @@ swallow_events (int do_display)
4197 else 4196 else
4198 break; 4197 break;
4199 } 4198 }
4199}
4200
4201/* Process any events that are not user-visible, run timer events that
4202 are ripe, and return, without reading any user-visible events. */
4203
4204void
4205swallow_events (int do_display)
4206{
4207 int old_timers_run;
4208
4209 process_special_events ();
4200 4210
4201 old_timers_run = timers_run; 4211 old_timers_run = timers_run;
4202 get_input_pending (&input_pending, READABLE_EVENTS_DO_TIMERS_NOW); 4212 get_input_pending (&input_pending, READABLE_EVENTS_DO_TIMERS_NOW);
@@ -10538,6 +10548,9 @@ if there is a doubt, the value is t. */)
10538 || !NILP (Vunread_input_method_events)) 10548 || !NILP (Vunread_input_method_events))
10539 return (Qt); 10549 return (Qt);
10540 10550
10551 /* Process non-user-visible events (Bug#10195). */
10552 process_special_events ();
10553
10541 get_input_pending (&input_pending, 10554 get_input_pending (&input_pending,
10542 READABLE_EVENTS_DO_TIMERS_NOW 10555 READABLE_EVENTS_DO_TIMERS_NOW
10543 | READABLE_EVENTS_FILTER_EVENTS); 10556 | READABLE_EVENTS_FILTER_EVENTS);
@@ -10840,7 +10853,7 @@ set_waiting_for_input (struct timeval *time_to_clear)
10840 /* If handle_interrupt was called before and buffered a C-g, 10853 /* If handle_interrupt was called before and buffered a C-g,
10841 make it run again now, to avoid timing error. */ 10854 make it run again now, to avoid timing error. */
10842 if (!NILP (Vquit_flag)) 10855 if (!NILP (Vquit_flag))
10843 quit_throw_to_read_char (); 10856 quit_throw_to_read_char (0);
10844} 10857}
10845 10858
10846void 10859void
@@ -10855,7 +10868,7 @@ clear_waiting_for_input (void)
10855 10868
10856 If we have a frame on the controlling tty, we assume that the 10869 If we have a frame on the controlling tty, we assume that the
10857 SIGINT was generated by C-g, so we call handle_interrupt. 10870 SIGINT was generated by C-g, so we call handle_interrupt.
10858 Otherwise, the handler kills Emacs. */ 10871 Otherwise, tell QUIT to kill Emacs. */
10859 10872
10860static void 10873static void
10861interrupt_signal (int signalnum) /* If we don't have an argument, some */ 10874interrupt_signal (int signalnum) /* If we don't have an argument, some */
@@ -10872,12 +10885,10 @@ interrupt_signal (int signalnum) /* If we don't have an argument, some */
10872 if (!terminal) 10885 if (!terminal)
10873 { 10886 {
10874 /* If there are no frames there, let's pretend that we are a 10887 /* If there are no frames there, let's pretend that we are a
10875 well-behaving UN*X program and quit. We cannot do that while 10888 well-behaving UN*X program and quit. We must not call Lisp
10876 GC is in progress, though. */ 10889 in a signal handler, so tell QUIT to exit when it is
10877 if (!gc_in_progress && !waiting_for_input) 10890 safe. */
10878 Fkill_emacs (Qnil); 10891 Vquit_flag = Qkill_emacs;
10879 else
10880 Vquit_flag = Qt;
10881 } 10892 }
10882 else 10893 else
10883 { 10894 {
@@ -11026,15 +11037,20 @@ handle_interrupt (void)
11026 separate event loop thread like W32. */ 11037 separate event loop thread like W32. */
11027#ifndef HAVE_NS 11038#ifndef HAVE_NS
11028 if (waiting_for_input && !echoing) 11039 if (waiting_for_input && !echoing)
11029 quit_throw_to_read_char (); 11040 quit_throw_to_read_char (1);
11030#endif 11041#endif
11031} 11042}
11032 11043
11033/* Handle a C-g by making read_char return C-g. */ 11044/* Handle a C-g by making read_char return C-g. */
11034 11045
11035static void 11046static void
11036quit_throw_to_read_char (void) 11047quit_throw_to_read_char (int from_signal)
11037{ 11048{
11049 /* When not called from a signal handler it is safe to call
11050 Lisp. */
11051 if (!from_signal && EQ (Vquit_flag, Qkill_emacs))
11052 Fkill_emacs (Qnil);
11053
11038 sigfree (); 11054 sigfree ();
11039 /* Prevent another signal from doing this before we finish. */ 11055 /* Prevent another signal from doing this before we finish. */
11040 clear_waiting_for_input (); 11056 clear_waiting_for_input ();
@@ -12265,7 +12281,7 @@ text in the region before modifying the buffer. The next
12265 DEFVAR_LISP ("debug-on-event", 12281 DEFVAR_LISP ("debug-on-event",
12266 Vdebug_on_event, 12282 Vdebug_on_event,
12267 doc: /* Enter debugger on this event. When Emacs 12283 doc: /* Enter debugger on this event. When Emacs
12268receives the special event specifed by this variable, it will try to 12284receives the special event specified by this variable, it will try to
12269break into the debugger as soon as possible instead of processing the 12285break into the debugger as soon as possible instead of processing the
12270event normally through `special-event-map'. 12286event normally through `special-event-map'.
12271 12287