diff options
| author | Joakim Verona | 2015-02-01 00:37:46 +0100 |
|---|---|---|
| committer | Joakim Verona | 2015-02-01 00:37:46 +0100 |
| commit | 69815dfe3704f8a8c733843f1fd04546cbb0f4d0 (patch) | |
| tree | cee6910753a51b9a5ee88e2431c9bcad099e8ba8 /src/keyboard.c | |
| parent | 4edad429cafb2f0b1fda028be58367286ab04f1c (diff) | |
| parent | a2c32b0cfc9f6d3410e2832d8ea0d4f1df576d1e (diff) | |
| download | emacs-69815dfe3704f8a8c733843f1fd04546cbb0f4d0.tar.gz emacs-69815dfe3704f8a8c733843f1fd04546cbb0f4d0.zip | |
Merge branch 'master' into xwidget
Diffstat (limited to 'src/keyboard.c')
| -rw-r--r-- | src/keyboard.c | 55 |
1 files changed, 34 insertions, 21 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index a5e1363326c..a9ff77d0473 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -2288,30 +2288,41 @@ read_decoded_event_from_main_queue (struct timespec *end_time, | |||
| 2288 | { /* An encoded byte sequence, let's try to decode it. */ | 2288 | { /* An encoded byte sequence, let's try to decode it. */ |
| 2289 | struct coding_system *coding | 2289 | struct coding_system *coding |
| 2290 | = TERMINAL_KEYBOARD_CODING (terminal); | 2290 | = TERMINAL_KEYBOARD_CODING (terminal); |
| 2291 | unsigned char src[MAX_ENCODED_BYTES]; | 2291 | |
| 2292 | unsigned char dest[MAX_ENCODED_BYTES * MAX_MULTIBYTE_LENGTH]; | 2292 | if (raw_text_coding_system_p (coding)) |
| 2293 | int i; | 2293 | { |
| 2294 | for (i = 0; i < n; i++) | 2294 | int i; |
| 2295 | src[i] = XINT (events[i]); | 2295 | if (meta_key != 2) |
| 2296 | if (meta_key != 2) | 2296 | for (i = 0; i < n; i++) |
| 2297 | for (i = 0; i < n; i++) | 2297 | events[i] = make_number (XINT (events[i]) & ~0x80); |
| 2298 | src[i] &= ~0x80; | ||
| 2299 | coding->destination = dest; | ||
| 2300 | coding->dst_bytes = sizeof dest; | ||
| 2301 | decode_coding_c_string (coding, src, n, Qnil); | ||
| 2302 | eassert (coding->produced_char <= n); | ||
| 2303 | if (coding->produced_char == 0) | ||
| 2304 | { /* The encoded sequence is incomplete. */ | ||
| 2305 | if (n < MAX_ENCODED_BYTES) /* Avoid buffer overflow. */ | ||
| 2306 | continue; /* Read on! */ | ||
| 2307 | } | 2298 | } |
| 2308 | else | 2299 | else |
| 2309 | { | 2300 | { |
| 2310 | const unsigned char *p = coding->destination; | 2301 | unsigned char src[MAX_ENCODED_BYTES]; |
| 2311 | eassert (coding->carryover_bytes == 0); | 2302 | unsigned char dest[MAX_ENCODED_BYTES * MAX_MULTIBYTE_LENGTH]; |
| 2312 | n = 0; | 2303 | int i; |
| 2313 | while (n < coding->produced_char) | 2304 | for (i = 0; i < n; i++) |
| 2314 | events[n++] = make_number (STRING_CHAR_ADVANCE (p)); | 2305 | src[i] = XINT (events[i]); |
| 2306 | if (meta_key != 2) | ||
| 2307 | for (i = 0; i < n; i++) | ||
| 2308 | src[i] &= ~0x80; | ||
| 2309 | coding->destination = dest; | ||
| 2310 | coding->dst_bytes = sizeof dest; | ||
| 2311 | decode_coding_c_string (coding, src, n, Qnil); | ||
| 2312 | eassert (coding->produced_char <= n); | ||
| 2313 | if (coding->produced_char == 0) | ||
| 2314 | { /* The encoded sequence is incomplete. */ | ||
| 2315 | if (n < MAX_ENCODED_BYTES) /* Avoid buffer overflow. */ | ||
| 2316 | continue; /* Read on! */ | ||
| 2317 | } | ||
| 2318 | else | ||
| 2319 | { | ||
| 2320 | const unsigned char *p = coding->destination; | ||
| 2321 | eassert (coding->carryover_bytes == 0); | ||
| 2322 | n = 0; | ||
| 2323 | while (n < coding->produced_char) | ||
| 2324 | events[n++] = make_number (STRING_CHAR_ADVANCE (p)); | ||
| 2325 | } | ||
| 2315 | } | 2326 | } |
| 2316 | } | 2327 | } |
| 2317 | /* Now `events' should hold decoded events. | 2328 | /* Now `events' should hold decoded events. |
| @@ -3639,7 +3650,9 @@ kbd_buffer_store_event_hold (register struct input_event *event, | |||
| 3639 | as input, set quit-flag to cause an interrupt. */ | 3650 | as input, set quit-flag to cause an interrupt. */ |
| 3640 | if (!NILP (Vthrow_on_input) | 3651 | if (!NILP (Vthrow_on_input) |
| 3641 | && event->kind != FOCUS_IN_EVENT | 3652 | && event->kind != FOCUS_IN_EVENT |
| 3653 | && event->kind != FOCUS_OUT_EVENT | ||
| 3642 | && event->kind != HELP_EVENT | 3654 | && event->kind != HELP_EVENT |
| 3655 | && event->kind != ICONIFY_EVENT | ||
| 3643 | && event->kind != DEICONIFY_EVENT) | 3656 | && event->kind != DEICONIFY_EVENT) |
| 3644 | { | 3657 | { |
| 3645 | Vquit_flag = Vthrow_on_input; | 3658 | Vquit_flag = Vthrow_on_input; |