diff options
| author | Richard M. Stallman | 1994-04-14 11:59:28 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-04-14 11:59:28 +0000 |
| commit | 587880630da84a74733ba63ebfd7f32b8b6fc453 (patch) | |
| tree | 2bbc251d91b9b0589c2f73d296a5e12687a04b80 /src | |
| parent | 853ccbd574fb398b9e62a6d85db3220f99b3eb3c (diff) | |
| download | emacs-587880630da84a74733ba63ebfd7f32b8b6fc453.tar.gz emacs-587880630da84a74733ba63ebfd7f32b8b6fc453.zip | |
(make_lispy_event): Put mouse event code
into MULTI_FRAME conditional.
(read_avail_input): Separate local var n_to_read
so that reading doesn't clobber that info when it sets nread.
Diffstat (limited to 'src')
| -rw-r--r-- | src/keyboard.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index be60d0f7cf8..7ba9e9ade5c 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -2464,6 +2464,7 @@ make_lispy_event (event) | |||
| 2464 | / sizeof (lispy_function_keys[0]))); | 2464 | / sizeof (lispy_function_keys[0]))); |
| 2465 | break; | 2465 | break; |
| 2466 | 2466 | ||
| 2467 | #ifdef MULTI_FRAME | ||
| 2467 | /* A mouse click. Figure out where it is, decide whether it's | 2468 | /* A mouse click. Figure out where it is, decide whether it's |
| 2468 | a press, click or drag, and build the appropriate structure. */ | 2469 | a press, click or drag, and build the appropriate structure. */ |
| 2469 | case mouse_click: | 2470 | case mouse_click: |
| @@ -2692,6 +2693,7 @@ make_lispy_event (event) | |||
| 2692 | Qnil)); | 2693 | Qnil)); |
| 2693 | } | 2694 | } |
| 2694 | } | 2695 | } |
| 2696 | #endif /* MULTI_FRAME */ | ||
| 2695 | 2697 | ||
| 2696 | /* The 'kind' field of the event is something we don't recognize. */ | 2698 | /* The 'kind' field of the event is something we don't recognize. */ |
| 2697 | default: | 2699 | default: |
| @@ -3301,14 +3303,17 @@ read_avail_input (expected) | |||
| 3301 | the kbd_buffer can really hold. That may prevent loss | 3303 | the kbd_buffer can really hold. That may prevent loss |
| 3302 | of characters on some systems when input is stuffed at us. */ | 3304 | of characters on some systems when input is stuffed at us. */ |
| 3303 | unsigned char cbuf[KBD_BUFFER_SIZE - 1]; | 3305 | unsigned char cbuf[KBD_BUFFER_SIZE - 1]; |
| 3306 | int n_to_read; | ||
| 3304 | 3307 | ||
| 3308 | /* Determine how many characters we should *try* to read. */ | ||
| 3305 | #ifdef MSDOS | 3309 | #ifdef MSDOS |
| 3306 | nread = dos_keysns (); | 3310 | n_to_read = dos_keysns (); |
| 3307 | if (nread == 0) return 0; | 3311 | if (n_to_read == 0) |
| 3312 | return 0; | ||
| 3308 | #else */ not MSDOS */ | 3313 | #else */ not MSDOS */ |
| 3309 | #ifdef FIONREAD | 3314 | #ifdef FIONREAD |
| 3310 | /* Find out how much input is available. */ | 3315 | /* Find out how much input is available. */ |
| 3311 | if (ioctl (0, FIONREAD, &nread) < 0) | 3316 | if (ioctl (0, FIONREAD, &n_to_read) < 0) |
| 3312 | /* Formerly simply reported no input, but that sometimes led to | 3317 | /* Formerly simply reported no input, but that sometimes led to |
| 3313 | a failure of Emacs to terminate. | 3318 | a failure of Emacs to terminate. |
| 3314 | SIGHUP seems appropriate if we can't reach the terminal. */ | 3319 | SIGHUP seems appropriate if we can't reach the terminal. */ |
| @@ -3316,14 +3321,14 @@ read_avail_input (expected) | |||
| 3316 | rather than to the whole process group? | 3321 | rather than to the whole process group? |
| 3317 | Perhaps on systems with FIONREAD Emacs is alone in its group. */ | 3322 | Perhaps on systems with FIONREAD Emacs is alone in its group. */ |
| 3318 | kill (getpid (), SIGHUP); | 3323 | kill (getpid (), SIGHUP); |
| 3319 | if (nread == 0) | 3324 | if (n_to_read == 0) |
| 3320 | return 0; | 3325 | return 0; |
| 3321 | if (nread > sizeof cbuf) | 3326 | if (n_to_read > sizeof cbuf) |
| 3322 | nread = sizeof cbuf; | 3327 | n_to_read = sizeof cbuf; |
| 3323 | #else /* no FIONREAD */ | 3328 | #else /* no FIONREAD */ |
| 3324 | #if defined(USG) || defined(DGUX) | 3329 | #if defined(USG) || defined(DGUX) |
| 3325 | /* Read some input if available, but don't wait. */ | 3330 | /* Read some input if available, but don't wait. */ |
| 3326 | nread = sizeof cbuf; | 3331 | n_to_read = sizeof cbuf; |
| 3327 | fcntl (fileno (stdin), F_SETFL, O_NDELAY); | 3332 | fcntl (fileno (stdin), F_SETFL, O_NDELAY); |
| 3328 | #else | 3333 | #else |
| 3329 | you lose; | 3334 | you lose; |
| @@ -3331,14 +3336,15 @@ read_avail_input (expected) | |||
| 3331 | #endif | 3336 | #endif |
| 3332 | #endif /* not MSDOS */ | 3337 | #endif /* not MSDOS */ |
| 3333 | 3338 | ||
| 3334 | /* Now read; for one reason or another, this will not block. */ | 3339 | /* Now read; for one reason or another, this will not block. |
| 3340 | NREAD is set to the number of chars read. */ | ||
| 3335 | while (1) | 3341 | while (1) |
| 3336 | { | 3342 | { |
| 3337 | #ifdef MSDOS | 3343 | #ifdef MSDOS |
| 3338 | cbuf[0] = dos_keyread(); | 3344 | cbuf[0] = dos_keyread(); |
| 3339 | nread = 1; | 3345 | nread = 1; |
| 3340 | #else | 3346 | #else |
| 3341 | nread = read (fileno (stdin), cbuf, nread); | 3347 | nread = read (fileno (stdin), cbuf, n_to_read); |
| 3342 | #endif | 3348 | #endif |
| 3343 | #ifdef AIX | 3349 | #ifdef AIX |
| 3344 | /* The kernel sometimes fails to deliver SIGHUP for ptys. | 3350 | /* The kernel sometimes fails to deliver SIGHUP for ptys. |
| @@ -3348,9 +3354,7 @@ read_avail_input (expected) | |||
| 3348 | if (nread == 0) | 3354 | if (nread == 0) |
| 3349 | kill (0, SIGHUP); | 3355 | kill (0, SIGHUP); |
| 3350 | #endif | 3356 | #endif |
| 3351 | /* This code is wrong, but at least it gets the right results. | 3357 | /* Retry the read if it was interrupted. */ |
| 3352 | Fix it for 19.23. */ | ||
| 3353 | /* Retry the read if it is interrupted. */ | ||
| 3354 | if (nread >= 0 | 3358 | if (nread >= 0 |
| 3355 | || ! (errno == EAGAIN | 3359 | || ! (errno == EAGAIN |
| 3356 | #ifdef EFAULT | 3360 | #ifdef EFAULT |