Mercurial > emacs
diff src/process.c @ 111353:f2cb0d643a91
Backport fix for Bug#6571 from trunk. NOTE: May cause merge conflicts.
* src/keyboard.c (input_available_signal): Declare.
(kbd_buffer_nr_stored): New function.
(kbd_buffer_store_event_hold): If kbd_buffer_nr_stored returns
more than KBD_BUFFER_SIZE/2, stop reding input (Bug#6571).
(kbd_buffer_get_event): If input is suspended and kbd_buffer_nr_stored
returns less than KBD_BUFFER_SIZE/4, resume reding input (Bug#6571).
(tty_read_avail_input): If input is on hold, return.
Don't read more that free slots in kbd_buffer (Bug#6571).
* src/process.c (kbd_is_on_hold): New variable.
(hold_keyboard_input, unhold_keyboard_input, kbd_on_hold_p):
New functions.
(wait_reading_process_output): If kbd_on_hold_p returns non-zero,
select on empty input mask.
(init_process): Initialize kbd_is_on_hold to 0.
* src/process.h (hold_keyboard_input, unhold_keyboard_input)
(kbd_on_hold_p): Declare.
| author | Jan D. <jan.h.d@swipnet.se> |
|---|---|
| date | Mon, 01 Nov 2010 12:30:33 +0100 |
| parents | 4d672e9d91bf |
| children | 1d1b5e1c230b |
line wrap: on
line diff
--- a/src/process.c Sun Oct 31 23:55:49 2010 -0700 +++ b/src/process.c Mon Nov 01 12:30:33 2010 +0100 @@ -346,6 +346,9 @@ /* The largest descriptor currently in use for gpm mouse input. */ static int max_gpm_desc; +/* Non-zero if keyboard input is on hold, zero otherwise. */ +static int kbd_is_on_hold; + /* Nonzero means delete a process right away if it exits. */ static int delete_exited_processes; @@ -4795,7 +4798,11 @@ SELECT_TYPE Ctemp; #endif - Atemp = input_wait_mask; + if (kbd_on_hold_p ()) + FD_ZERO (&Atemp); + else + Atemp = input_wait_mask; + IF_NON_BLOCKING_CONNECT (Ctemp = connect_wait_mask); EMACS_SET_SECS_USECS (timeout, 0, 0); @@ -7224,6 +7231,31 @@ return 0; } + +/* Stop reading input from keyboard sources. */ + +void +hold_keyboard_input (void) +{ + kbd_is_on_hold = 1; +} + +/* Resume reading input from keyboard sources. */ + +void +unhold_keyboard_input (void) +{ + kbd_is_on_hold = 0; +} + +/* Return non-zero if keyboard input is on hold, zero otherwise. */ + +int +kbd_on_hold_p (void) +{ + return kbd_is_on_hold; +} + /* Enumeration of and access to system processes a-la ps(1). */ @@ -8039,6 +8071,7 @@ void init_process () { + kbd_is_on_hold = 0; } void
