Mercurial > emacs
comparison src/sysdep.c @ 54166:787d9a46cf1a
(BUFFER_SIZE_FACTOR): Remove.
(read_input_waiting): Adapt to new read_socket_hook interface.
Remove allocation and initialization of local input_event buffer,
as read_socket_hook stores events directly in fifo. Allocate and
initialize local hold_quit event to handle postponed quit event
(and store it if set by kbd_buffer_store_event_hold).
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Fri, 27 Feb 2004 23:47:48 +0000 |
parents | d85f8f2e71f7 |
children | 45d805d79d29 b44978264e1d |
comparison
equal
deleted
inserted
replaced
54165:88d1b7a60637 | 54166:787d9a46cf1a |
---|---|
2612 #endif /* not WINDOWSNT */ | 2612 #endif /* not WINDOWSNT */ |
2613 | 2613 |
2614 /* Read keyboard input into the standard buffer, | 2614 /* Read keyboard input into the standard buffer, |
2615 waiting for at least one character. */ | 2615 waiting for at least one character. */ |
2616 | 2616 |
2617 /* Make all keyboard buffers much bigger when using a window system. */ | |
2618 #ifdef HAVE_WINDOW_SYSTEM | |
2619 #define BUFFER_SIZE_FACTOR 16 | |
2620 #else | |
2621 #define BUFFER_SIZE_FACTOR 1 | |
2622 #endif | |
2623 | |
2624 void | 2617 void |
2625 read_input_waiting () | 2618 read_input_waiting () |
2626 { | 2619 { |
2627 int nread, i; | 2620 int nread, i; |
2628 extern int quit_char; | 2621 extern int quit_char; |
2629 | 2622 |
2630 if (read_socket_hook) | 2623 if (read_socket_hook) |
2631 { | 2624 { |
2632 struct input_event buf[256]; | 2625 struct input_event hold_quit; |
2633 for (i = 0; i < 256; i++) | 2626 |
2634 EVENT_INIT (buf[i]); | 2627 EVENT_INIT (hold_quit); |
2635 | 2628 hold_quit.kind = NO_EVENT; |
2629 | |
2636 read_alarm_should_throw = 0; | 2630 read_alarm_should_throw = 0; |
2637 if (! setjmp (read_alarm_throw)) | 2631 if (! setjmp (read_alarm_throw)) |
2638 nread = (*read_socket_hook) (0, buf, 256, 1); | 2632 nread = (*read_socket_hook) (0, 1, &hold_quit); |
2639 else | 2633 else |
2640 nread = -1; | 2634 nread = -1; |
2641 | 2635 |
2642 /* Scan the chars for C-g and store them in kbd_buffer. */ | 2636 if (hold_quit.kind != NO_EVENT) |
2643 for (i = 0; i < nread; i++) | 2637 kbd_buffer_store_event (&hold_quit); |
2644 { | |
2645 kbd_buffer_store_event (&buf[i]); | |
2646 /* Don't look at input that follows a C-g too closely. | |
2647 This reduces lossage due to autorepeat on C-g. */ | |
2648 if (buf[i].kind == ASCII_KEYSTROKE_EVENT | |
2649 && buf[i].code == quit_char) | |
2650 break; | |
2651 } | |
2652 } | 2638 } |
2653 else | 2639 else |
2654 { | 2640 { |
2655 struct input_event e; | 2641 struct input_event e; |
2656 char buf[3]; | 2642 char buf[3]; |