diff options
| author | Eli Zaretskii | 2010-11-09 20:36:21 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2010-11-09 20:36:21 +0200 |
| commit | 86520d8c1737985eb24dabb9de1f90b622e3bbd5 (patch) | |
| tree | 1c944a01a62c4de0f7168833c4138fe290114aa7 /src | |
| parent | 794a4b6d178e5242c693486a6be7fd875820fb45 (diff) | |
| download | emacs-86520d8c1737985eb24dabb9de1f90b622e3bbd5.tar.gz emacs-86520d8c1737985eb24dabb9de1f90b622e3bbd5.zip | |
Fix 2010-05-05T22:14:15Z!lekktu@gmail.com.
keyboard.c (kbd_buffer_nr_stored): Define only ifdef subprocesses.
(kbd_buffer_store_event_hold, kbd_buffer_get_event)
(tty_read_avail_input): Call kbd_buffer_nr_stored only ifdef
subprocesses. Use buffer_free only ifdef subprocesses.
process.c (init_process) [subprocesses]: Init kbd_is_on_hold in
the subprocesses version, not in the non-subprocesses one.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 8 | ||||
| -rw-r--r-- | src/keyboard.c | 10 | ||||
| -rw-r--r-- | src/process.c | 2 |
3 files changed, 19 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 913489ed1f1..7b5959c8db2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,13 @@ | |||
| 1 | 2010-11-09 Eli Zaretskii <eliz@gnu.org> | 1 | 2010-11-09 Eli Zaretskii <eliz@gnu.org> |
| 2 | 2 | ||
| 3 | * keyboard.c (kbd_buffer_nr_stored): Define only ifdef subprocesses. | ||
| 4 | (kbd_buffer_store_event_hold, kbd_buffer_get_event) | ||
| 5 | (tty_read_avail_input): Call kbd_buffer_nr_stored only ifdef | ||
| 6 | subprocesses. Use buffer_free only ifdef subprocesses. | ||
| 7 | |||
| 8 | * process.c (init_process) [subprocesses]: Init kbd_is_on_hold in | ||
| 9 | the subprocesses version, not in the non-subprocesses one. | ||
| 10 | |||
| 3 | * Makefile.in: Don't use ## comment, it breaks the MSDOS build. | 11 | * Makefile.in: Don't use ## comment, it breaks the MSDOS build. |
| 4 | 12 | ||
| 5 | * xfns.c (x_real_positions): Fix declaration-after-statement | 13 | * xfns.c (x_real_positions): Fix declaration-after-statement |
diff --git a/src/keyboard.c b/src/keyboard.c index 311f42fbb3b..b35e4ae84e2 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -3783,6 +3783,7 @@ event_to_kboard (event) | |||
| 3783 | return FRAME_KBOARD (XFRAME (frame)); | 3783 | return FRAME_KBOARD (XFRAME (frame)); |
| 3784 | } | 3784 | } |
| 3785 | 3785 | ||
| 3786 | #ifdef subprocesses | ||
| 3786 | /* Return the number of slots occupied in kbd_buffer. */ | 3787 | /* Return the number of slots occupied in kbd_buffer. */ |
| 3787 | 3788 | ||
| 3788 | static int | 3789 | static int |
| @@ -3795,6 +3796,7 @@ kbd_buffer_nr_stored (void) | |||
| 3795 | : ((kbd_buffer + KBD_BUFFER_SIZE) - kbd_fetch_ptr | 3796 | : ((kbd_buffer + KBD_BUFFER_SIZE) - kbd_fetch_ptr |
| 3796 | + (kbd_store_ptr - kbd_buffer))); | 3797 | + (kbd_store_ptr - kbd_buffer))); |
| 3797 | } | 3798 | } |
| 3799 | #endif /* subprocesses */ | ||
| 3798 | 3800 | ||
| 3799 | Lisp_Object Vthrow_on_input; | 3801 | Lisp_Object Vthrow_on_input; |
| 3800 | 3802 | ||
| @@ -3918,6 +3920,7 @@ kbd_buffer_store_event_hold (event, hold_quit) | |||
| 3918 | { | 3920 | { |
| 3919 | *kbd_store_ptr = *event; | 3921 | *kbd_store_ptr = *event; |
| 3920 | ++kbd_store_ptr; | 3922 | ++kbd_store_ptr; |
| 3923 | #ifdef subprocesses | ||
| 3921 | if (kbd_buffer_nr_stored () > KBD_BUFFER_SIZE/2 && ! kbd_on_hold_p ()) | 3924 | if (kbd_buffer_nr_stored () > KBD_BUFFER_SIZE/2 && ! kbd_on_hold_p ()) |
| 3922 | { | 3925 | { |
| 3923 | /* Don't read keyboard input until we have processed kbd_buffer. | 3926 | /* Don't read keyboard input until we have processed kbd_buffer. |
| @@ -3929,6 +3932,7 @@ kbd_buffer_store_event_hold (event, hold_quit) | |||
| 3929 | #endif | 3932 | #endif |
| 3930 | stop_polling (); | 3933 | stop_polling (); |
| 3931 | } | 3934 | } |
| 3935 | #endif /* subprocesses */ | ||
| 3932 | } | 3936 | } |
| 3933 | 3937 | ||
| 3934 | /* If we're inside while-no-input, and this event qualifies | 3938 | /* If we're inside while-no-input, and this event qualifies |
| @@ -4097,6 +4101,7 @@ kbd_buffer_get_event (kbp, used_mouse_menu, end_time) | |||
| 4097 | register int c; | 4101 | register int c; |
| 4098 | Lisp_Object obj; | 4102 | Lisp_Object obj; |
| 4099 | 4103 | ||
| 4104 | #ifdef subprocesses | ||
| 4100 | if (kbd_on_hold_p () && kbd_buffer_nr_stored () < KBD_BUFFER_SIZE/4) | 4105 | if (kbd_on_hold_p () && kbd_buffer_nr_stored () < KBD_BUFFER_SIZE/4) |
| 4101 | { | 4106 | { |
| 4102 | /* Start reading input again, we have processed enough so we can | 4107 | /* Start reading input again, we have processed enough so we can |
| @@ -4108,6 +4113,7 @@ kbd_buffer_get_event (kbp, used_mouse_menu, end_time) | |||
| 4108 | #endif /* SIGIO */ | 4113 | #endif /* SIGIO */ |
| 4109 | start_polling (); | 4114 | start_polling (); |
| 4110 | } | 4115 | } |
| 4116 | #endif /* subprocesses */ | ||
| 4111 | 4117 | ||
| 4112 | if (noninteractive | 4118 | if (noninteractive |
| 4113 | /* In case we are running as a daemon, only do this before | 4119 | /* In case we are running as a daemon, only do this before |
| @@ -7308,10 +7314,12 @@ tty_read_avail_input (struct terminal *terminal, | |||
| 7308 | int n_to_read, i; | 7314 | int n_to_read, i; |
| 7309 | struct tty_display_info *tty = terminal->display_info.tty; | 7315 | struct tty_display_info *tty = terminal->display_info.tty; |
| 7310 | int nread = 0; | 7316 | int nread = 0; |
| 7317 | #ifdef subprocesses | ||
| 7311 | int buffer_free = KBD_BUFFER_SIZE - kbd_buffer_nr_stored () - 1; | 7318 | int buffer_free = KBD_BUFFER_SIZE - kbd_buffer_nr_stored () - 1; |
| 7312 | 7319 | ||
| 7313 | if (kbd_on_hold_p () || buffer_free <= 0) | 7320 | if (kbd_on_hold_p () || buffer_free <= 0) |
| 7314 | return 0; | 7321 | return 0; |
| 7322 | #endif /* subprocesses */ | ||
| 7315 | 7323 | ||
| 7316 | if (!terminal->name) /* Don't read from a dead terminal. */ | 7324 | if (!terminal->name) /* Don't read from a dead terminal. */ |
| 7317 | return 0; | 7325 | return 0; |
| @@ -7393,9 +7401,11 @@ tty_read_avail_input (struct terminal *terminal, | |||
| 7393 | #endif | 7401 | #endif |
| 7394 | #endif | 7402 | #endif |
| 7395 | 7403 | ||
| 7404 | #ifdef subprocesses | ||
| 7396 | /* Don't read more than we can store. */ | 7405 | /* Don't read more than we can store. */ |
| 7397 | if (n_to_read > buffer_free) | 7406 | if (n_to_read > buffer_free) |
| 7398 | n_to_read = buffer_free; | 7407 | n_to_read = buffer_free; |
| 7408 | #endif /* subprocesses */ | ||
| 7399 | 7409 | ||
| 7400 | /* Now read; for one reason or another, this will not block. | 7410 | /* Now read; for one reason or another, this will not block. |
| 7401 | NREAD is set to the number of chars read. */ | 7411 | NREAD is set to the number of chars read. */ |
diff --git a/src/process.c b/src/process.c index df30adcf0be..384a7acfccd 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -7356,6 +7356,7 @@ init_process () | |||
| 7356 | register int i; | 7356 | register int i; |
| 7357 | 7357 | ||
| 7358 | inhibit_sentinels = 0; | 7358 | inhibit_sentinels = 0; |
| 7359 | kbd_is_on_hold = 0; | ||
| 7359 | 7360 | ||
| 7360 | #ifdef SIGCHLD | 7361 | #ifdef SIGCHLD |
| 7361 | #ifndef CANNOT_DUMP | 7362 | #ifndef CANNOT_DUMP |
| @@ -8093,7 +8094,6 @@ integer or floating point values. | |||
| 8093 | void | 8094 | void |
| 8094 | init_process () | 8095 | init_process () |
| 8095 | { | 8096 | { |
| 8096 | kbd_is_on_hold = 0; | ||
| 8097 | } | 8097 | } |
| 8098 | 8098 | ||
| 8099 | void | 8099 | void |