diff options
| author | Miles Bader | 2007-12-16 04:31:49 +0000 |
|---|---|---|
| committer | Miles Bader | 2007-12-16 04:31:49 +0000 |
| commit | 47854a55680b5809811caf72f66ecbe8289c2855 (patch) | |
| tree | b980b3347185be466df5cef9ef3eaf0959ce170a /src | |
| parent | bbbe940b6d5834189ea6d48d70a2e8f113cf53e9 (diff) | |
| parent | a2586785fb5d84e457a4489cfbc3d6d604c1d410 (diff) | |
| download | emacs-47854a55680b5809811caf72f66ecbe8289c2855.tar.gz emacs-47854a55680b5809811caf72f66ecbe8289c2855.zip | |
Merge from emacs--rel--22
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-956
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 11 | ||||
| -rw-r--r-- | src/w32fns.c | 8 | ||||
| -rw-r--r-- | src/w32term.c | 94 |
3 files changed, 107 insertions, 6 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index ea8c01bef59..d5edca82fe9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | 2007-12-14 Jason Rumney <jasonr@gnu.org> | ||
| 2 | |||
| 3 | * w32term.c (w32_read_socket): Use MULTIBYTE_CHAR_KEYSTROKE_EVENT | ||
| 4 | for characters above 127. | ||
| 5 | |||
| 6 | 2007-12-13 Jason Rumney <jasonr@gnu.org> | ||
| 7 | |||
| 8 | * w32fns.c (w32_wnd_proc, Fw32_reconstruct_hot_key): Range check | ||
| 9 | before dereferencing array. | ||
| 10 | (lookup_vk_code): Remove zero comparison. | ||
| 11 | |||
| 1 | 2007-12-14 Michael Albinus <michael.albinus@gmx.de> | 12 | 2007-12-14 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 13 | ||
| 3 | * dbusbind.c (xd_retrieve_value, xd_retrieve_arg) | 14 | * dbusbind.c (xd_retrieve_value, xd_retrieve_arg) |
diff --git a/src/w32fns.c b/src/w32fns.c index 491ccedeb13..0c5bd1e4cc3 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -2957,7 +2957,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam) | |||
| 2957 | they don't produce WM_CHAR messages). This ensures that | 2957 | they don't produce WM_CHAR messages). This ensures that |
| 2958 | indicator lights are toggled promptly on Windows 9x, for | 2958 | indicator lights are toggled promptly on Windows 9x, for |
| 2959 | example. */ | 2959 | example. */ |
| 2960 | if (lispy_function_keys[wParam] != 0) | 2960 | if (wParam < 256 && lispy_function_keys[wParam]) |
| 2961 | { | 2961 | { |
| 2962 | windows_translate = 1; | 2962 | windows_translate = 1; |
| 2963 | goto translate; | 2963 | goto translate; |
| @@ -3079,7 +3079,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam) | |||
| 3079 | break; | 3079 | break; |
| 3080 | default: | 3080 | default: |
| 3081 | /* If not defined as a function key, change it to a WM_CHAR message. */ | 3081 | /* If not defined as a function key, change it to a WM_CHAR message. */ |
| 3082 | if (lispy_function_keys[wParam] == 0) | 3082 | if (wParam > 255 || !lispy_function_keys[wParam]) |
| 3083 | { | 3083 | { |
| 3084 | DWORD modifiers = construct_console_modifiers (); | 3084 | DWORD modifiers = construct_console_modifiers (); |
| 3085 | 3085 | ||
| @@ -8159,7 +8159,7 @@ lookup_vk_code (char *key) | |||
| 8159 | int i; | 8159 | int i; |
| 8160 | 8160 | ||
| 8161 | for (i = 0; i < 256; i++) | 8161 | for (i = 0; i < 256; i++) |
| 8162 | if (lispy_function_keys[i] != 0 | 8162 | if (lispy_function_keys[i] |
| 8163 | && strcmp (lispy_function_keys[i], key) == 0) | 8163 | && strcmp (lispy_function_keys[i], key) == 0) |
| 8164 | return i; | 8164 | return i; |
| 8165 | 8165 | ||
| @@ -8337,7 +8337,7 @@ usage: (w32-reconstruct-hot-key ID) */) | |||
| 8337 | vk_code = HOTKEY_VK_CODE (hotkeyid); | 8337 | vk_code = HOTKEY_VK_CODE (hotkeyid); |
| 8338 | w32_modifiers = HOTKEY_MODIFIERS (hotkeyid); | 8338 | w32_modifiers = HOTKEY_MODIFIERS (hotkeyid); |
| 8339 | 8339 | ||
| 8340 | if (lispy_function_keys[vk_code]) | 8340 | if (vk_code < 256 && lispy_function_keys[vk_code]) |
| 8341 | key = intern (lispy_function_keys[vk_code]); | 8341 | key = intern (lispy_function_keys[vk_code]); |
| 8342 | else | 8342 | else |
| 8343 | key = make_number (vk_code); | 8343 | key = make_number (vk_code); |
diff --git a/src/w32term.c b/src/w32term.c index 4f4701b5f23..2c22399bc1b 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -4170,6 +4170,8 @@ x_scroll_bar_clear (f) | |||
| 4170 | static int temp_index; | 4170 | static int temp_index; |
| 4171 | static short temp_buffer[100]; | 4171 | static short temp_buffer[100]; |
| 4172 | 4172 | ||
| 4173 | /* Temporarily store lead byte of DBCS input sequences. */ | ||
| 4174 | static char dbcs_lead = 0; | ||
| 4173 | 4175 | ||
| 4174 | /* Read events coming from the W32 shell. | 4176 | /* Read events coming from the W32 shell. |
| 4175 | This routine is called by the SIGIO handler. | 4177 | This routine is called by the SIGIO handler. |
| @@ -4329,8 +4331,96 @@ w32_read_socket (sd, expected, hold_quit) | |||
| 4329 | if (temp_index == sizeof temp_buffer / sizeof (short)) | 4331 | if (temp_index == sizeof temp_buffer / sizeof (short)) |
| 4330 | temp_index = 0; | 4332 | temp_index = 0; |
| 4331 | temp_buffer[temp_index++] = msg.msg.wParam; | 4333 | temp_buffer[temp_index++] = msg.msg.wParam; |
| 4332 | inev.kind = ASCII_KEYSTROKE_EVENT; | 4334 | |
| 4333 | inev.code = msg.msg.wParam; | 4335 | if (msg.msg.wParam < 128 && !dbcs_lead) |
| 4336 | { | ||
| 4337 | inev.kind = ASCII_KEYSTROKE_EVENT; | ||
| 4338 | inev.code = msg.msg.wParam; | ||
| 4339 | } | ||
| 4340 | else if (msg.msg.wParam < 256) | ||
| 4341 | { | ||
| 4342 | wchar_t code; | ||
| 4343 | |||
| 4344 | inev.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT; | ||
| 4345 | |||
| 4346 | if (IsDBCSLeadByteEx(CP_ACP, (BYTE) msg.msg.wParam)) | ||
| 4347 | { | ||
| 4348 | dbcs_lead = (char) msg.msg.wParam; | ||
| 4349 | inev.kind = NO_EVENT; | ||
| 4350 | break; | ||
| 4351 | } | ||
| 4352 | else if (dbcs_lead) | ||
| 4353 | { | ||
| 4354 | char dbcs[2]; | ||
| 4355 | dbcs[0] = dbcs_lead; | ||
| 4356 | dbcs[1] = (char) msg.msg.wParam; | ||
| 4357 | dbcs_lead = 0; | ||
| 4358 | if (!MultiByteToWideChar(CP_ACP, 0, dbcs, 2, &code, 1)) | ||
| 4359 | { | ||
| 4360 | /* Garbage */ | ||
| 4361 | DebPrint (("Invalid DBCS sequence: %d %d\n", | ||
| 4362 | dbcs[0], dbcs[1])); | ||
| 4363 | inev.kind = NO_EVENT; | ||
| 4364 | break; | ||
| 4365 | } | ||
| 4366 | } | ||
| 4367 | else | ||
| 4368 | { | ||
| 4369 | char single_byte = (char) msg.msg.wParam; | ||
| 4370 | if (!MultiByteToWideChar(CP_ACP, 0, &single_byte, 1, | ||
| 4371 | &code, 1)) | ||
| 4372 | { | ||
| 4373 | /* What to do with garbage? */ | ||
| 4374 | DebPrint (("Invalid character: %d\n", single_byte)); | ||
| 4375 | inev.kind = NO_EVENT; | ||
| 4376 | break; | ||
| 4377 | } | ||
| 4378 | } | ||
| 4379 | |||
| 4380 | /* Now process unicode input as per xterm.c */ | ||
| 4381 | if (code < 0x80) | ||
| 4382 | { | ||
| 4383 | inev.kind = ASCII_KEYSTROKE_EVENT; | ||
| 4384 | inev.code = code; | ||
| 4385 | } | ||
| 4386 | else if (code < 0xA0) | ||
| 4387 | inev.code = MAKE_CHAR (CHARSET_8_BIT_CONTROL, code, 0); | ||
| 4388 | else if (code < 0x100) | ||
| 4389 | inev.code = MAKE_CHAR (charset_latin_iso8859_1, code, 0); | ||
| 4390 | else | ||
| 4391 | { | ||
| 4392 | int c1, c2; | ||
| 4393 | int charset_id; | ||
| 4394 | |||
| 4395 | if (code < 0x2500) | ||
| 4396 | { | ||
| 4397 | charset_id = charset_mule_unicode_0100_24ff; | ||
| 4398 | code -= 0x100; | ||
| 4399 | } | ||
| 4400 | else if (code < 0xE000) | ||
| 4401 | { | ||
| 4402 | charset_id = charset_mule_unicode_2500_33ff; | ||
| 4403 | code -= 0x2500; | ||
| 4404 | } | ||
| 4405 | else | ||
| 4406 | { | ||
| 4407 | charset_id = charset_mule_unicode_e000_ffff; | ||
| 4408 | code -= 0xE000; | ||
| 4409 | } | ||
| 4410 | |||
| 4411 | c1 = (code / 96) + 32; | ||
| 4412 | c2 = (code % 96) + 32; | ||
| 4413 | inev.code = MAKE_CHAR (charset_id, c1, c2); | ||
| 4414 | } | ||
| 4415 | } | ||
| 4416 | else | ||
| 4417 | { | ||
| 4418 | /* Windows shouldn't generate WM_CHAR events above 0xFF | ||
| 4419 | in non-Unicode message handlers. */ | ||
| 4420 | DebPrint (("Non-byte WM_CHAR: %d\n", msg.msg.wParam)); | ||
| 4421 | inev.kind = NO_EVENT; | ||
| 4422 | break; | ||
| 4423 | } | ||
| 4334 | inev.modifiers = msg.dwModifiers; | 4424 | inev.modifiers = msg.dwModifiers; |
| 4335 | XSETFRAME (inev.frame_or_window, f); | 4425 | XSETFRAME (inev.frame_or_window, f); |
| 4336 | inev.timestamp = msg.msg.time; | 4426 | inev.timestamp = msg.msg.time; |