Mercurial > emacs
comparison src/xterm.c @ 84546:18b43a3dce6c
(handle_one_xevent): Skip decoding if nbytes is zero.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Fri, 14 Sep 2007 04:11:26 +0000 |
parents | 7ec30b352b6e |
children | 4236d6c01713 |
comparison
equal
deleted
inserted
replaced
84545:4abcc15327e8 | 84546:18b43a3dce6c |
---|---|
6536 /* The input is converted to events, thus we can't | 6536 /* The input is converted to events, thus we can't |
6537 handle composition. Anyway, there's no XIM that | 6537 handle composition. Anyway, there's no XIM that |
6538 gives us composition information. */ | 6538 gives us composition information. */ |
6539 coding.composing = COMPOSITION_DISABLED; | 6539 coding.composing = COMPOSITION_DISABLED; |
6540 | 6540 |
6541 for (i = 0; i < nbytes; i++) | 6541 if (nbytes > 0) |
6542 { | 6542 { |
6543 STORE_KEYSYM_FOR_DEBUG (copy_bufptr[i]); | 6543 /* Decode the input data. */ |
6544 } | 6544 int require; |
6545 | 6545 unsigned char *p; |
6546 { | 6546 |
6547 /* Decode the input data. */ | 6547 for (i = 0; i < nbytes; i++) |
6548 int require; | 6548 { |
6549 unsigned char *p; | 6549 STORE_KEYSYM_FOR_DEBUG (copy_bufptr[i]); |
6550 | 6550 } |
6551 require = decoding_buffer_size (&coding, nbytes); | 6551 |
6552 p = (unsigned char *) alloca (require); | 6552 require = decoding_buffer_size (&coding, nbytes); |
6553 coding.mode |= CODING_MODE_LAST_BLOCK; | 6553 p = (unsigned char *) alloca (require); |
6554 /* We explicitly disable composition handling because | 6554 coding.mode |= CODING_MODE_LAST_BLOCK; |
6555 key data should not contain any composition sequence. */ | 6555 /* We explicitly disable composition handling because |
6556 coding.composing = COMPOSITION_DISABLED; | 6556 key data should not contain any composition sequence. */ |
6557 decode_coding (&coding, copy_bufptr, p, nbytes, require); | 6557 coding.composing = COMPOSITION_DISABLED; |
6558 nbytes = coding.produced; | 6558 decode_coding (&coding, copy_bufptr, p, nbytes, require); |
6559 nchars = coding.produced_char; | 6559 nbytes = coding.produced; |
6560 copy_bufptr = p; | 6560 nchars = coding.produced_char; |
6561 } | 6561 copy_bufptr = p; |
6562 | 6562 |
6563 /* Convert the input data to a sequence of | 6563 /* Convert the input data to a sequence of |
6564 character events. */ | 6564 character events. */ |
6565 for (i = 0; i < nbytes; i += len) | 6565 for (i = 0; i < nbytes; i += len) |
6566 { | 6566 { |
6567 if (nchars == nbytes) | 6567 if (nchars == nbytes) |
6568 c = copy_bufptr[i], len = 1; | 6568 c = copy_bufptr[i], len = 1; |
6569 else | 6569 else |
6570 c = STRING_CHAR_AND_LENGTH (copy_bufptr + i, | 6570 c = STRING_CHAR_AND_LENGTH (copy_bufptr + i, |
6571 nbytes - i, len); | 6571 nbytes - i, len); |
6572 inev.ie.kind = (SINGLE_BYTE_CHAR_P (c) | 6572 inev.ie.kind = (SINGLE_BYTE_CHAR_P (c) |
6573 ? ASCII_KEYSTROKE_EVENT | 6573 ? ASCII_KEYSTROKE_EVENT |
6574 : MULTIBYTE_CHAR_KEYSTROKE_EVENT); | 6574 : MULTIBYTE_CHAR_KEYSTROKE_EVENT); |
6575 inev.ie.code = c; | 6575 inev.ie.code = c; |
6576 kbd_buffer_store_event_hold (&inev.ie, hold_quit); | 6576 kbd_buffer_store_event_hold (&inev.ie, hold_quit); |
6577 } | |
6577 } | 6578 } |
6578 | 6579 |
6579 /* Previous code updated count by nchars rather than nbytes, | 6580 /* Previous code updated count by nchars rather than nbytes, |
6580 but that seems bogus to me. ++kfs */ | 6581 but that seems bogus to me. ++kfs */ |
6581 count += nbytes; | 6582 count += nbytes; |