[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r109300: Fix bug #12082 with input of
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r109300: Fix bug #12082 with input of Meta-non-ASCII-characters on MS-Windows. |
Date: |
Mon, 30 Jul 2012 20:07:33 +0300 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 109300
fixes bug: http://debbugs.gnu.org/12082
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Mon 2012-07-30 20:07:33 +0300
message:
Fix bug #12082 with input of Meta-non-ASCII-characters on MS-Windows.
src/w32fns.c (w32_wnd_proc): Pass w32_keyboard_codepage to
w32_kbd_patch_key as the 2nd arg.
src/w32term.c <w32_keyboard_codepage>: Renamed from
keyboard_codepage and now external. All users changed.
src/w32term.h: Add declaration of w32_keyboard_codepage.
src/w32inevt.c (w32_kbd_patch_key): Accept an additional argument --
the codepage to translate keys to Unicode. If this argument is
-1, use the value returned by GetConsoleCP. All callers changed.
modified:
src/ChangeLog
src/w32fns.c
src/w32inevt.c
src/w32term.c
src/w32term.h
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2012-07-30 16:20:35 +0000
+++ b/src/ChangeLog 2012-07-30 17:07:33 +0000
@@ -1,3 +1,17 @@
+2012-07-30 Eli Zaretskii <address@hidden>
+
+ * w32fns.c (w32_wnd_proc): Pass w32_keyboard_codepage to
+ w32_kbd_patch_key as the 2nd arg. (Bug#12082)
+
+ * w32term.c <w32_keyboard_codepage>: Renamed from
+ keyboard_codepage and now external. All users changed.
+
+ * w32term.h: Add declaration of w32_keyboard_codepage.
+
+ * w32inevt.c (w32_kbd_patch_key): Accept an additional argument --
+ the codepage to translate keys to Unicode. If this argument is
+ -1, use the value returned by GetConsoleCP. All callers changed.
+
2012-07-30 Paul Eggert <address@hidden>
Update .PHONY listings in makefiles.
=== modified file 'src/w32fns.c'
--- a/src/w32fns.c 2012-07-29 08:18:29 +0000
+++ b/src/w32fns.c 2012-07-30 17:07:33 +0000
@@ -2882,7 +2882,7 @@
key.uChar.AsciiChar = 0;
key.dwControlKeyState = modifiers;
- add = w32_kbd_patch_key (&key);
+ add = w32_kbd_patch_key (&key, w32_keyboard_codepage);
/* 0 means an unrecognized keycode, negative means
dead key. Ignore both. */
while (--add >= 0)
@@ -2892,7 +2892,7 @@
(hwnd, WM_CHAR,
(unsigned char) key.uChar.AsciiChar, lParam,
w32_get_key_modifiers (wParam, lParam));
- w32_kbd_patch_key (&key);
+ w32_kbd_patch_key (&key, w32_keyboard_codepage);
}
return 0;
}
=== modified file 'src/w32inevt.c'
--- a/src/w32inevt.c 2012-07-29 08:18:29 +0000
+++ b/src/w32inevt.c 2012-07-30 17:07:33 +0000
@@ -185,9 +185,11 @@
}
#endif
-/* The return code indicates key code size. */
+/* The return code indicates key code size. cpID is the codepage to
+ use for translation to Unicode; -1 means use the current console
+ input codepage. */
int
-w32_kbd_patch_key (KEY_EVENT_RECORD *event)
+w32_kbd_patch_key (KEY_EVENT_RECORD *event, int cpId)
{
unsigned int key_code = event->wVirtualKeyCode;
unsigned int mods = event->dwControlKeyState;
@@ -243,7 +245,11 @@
keystate, buf, 128, 0);
if (isdead > 0)
{
- int cpId = GetConsoleCP ();
+ /* When we are called from the GUI message processing code,
+ we are passed the current keyboard codepage, a positive
+ number, to use below. */
+ if (cpId == -1)
+ cpId = GetConsoleCP ();
event->uChar.UnicodeChar = buf[isdead - 1];
isdead = WideCharToMultiByte (cpId, 0, buf, isdead,
@@ -442,7 +448,7 @@
base character (ie. translating the base key plus shift
modifier). */
else if (event->uChar.AsciiChar == 0)
- w32_kbd_patch_key (event);
+ w32_kbd_patch_key (event, -1);
}
if (event->uChar.AsciiChar == 0)
=== modified file 'src/w32term.c'
--- a/src/w32term.c 2012-07-29 08:18:29 +0000
+++ b/src/w32term.c 2012-07-30 17:07:33 +0000
@@ -155,6 +155,9 @@
int last_scroll_bar_drag_pos;
+/* Keyboard code page - may be changed by language-change events. */
+int w32_keyboard_codepage;
+
/* Mouse movement. */
/* Where the mouse was last time we reported a mouse event. */
@@ -188,9 +191,6 @@
static int input_signal_count;
#endif
-/* Keyboard code page - may be changed by language-change events. */
-static int keyboard_codepage;
-
static void x_update_window_end (struct window *, int, int);
static void w32_handle_tool_bar_click (struct frame *,
struct input_event *);
@@ -4235,14 +4235,14 @@
/* lParam contains the input language ID in its low 16 bits.
Use it to update our record of the keyboard codepage. */
- keyboard_codepage = codepage_for_locale ((LCID)(msg.msg.lParam
- & 0xffff));
+ w32_keyboard_codepage = codepage_for_locale ((LCID)(msg.msg.lParam
+ & 0xffff));
if (f)
{
inev.kind = LANGUAGE_CHANGE_EVENT;
XSETFRAME (inev.frame_or_window, f);
- inev.code = keyboard_codepage;
+ inev.code = w32_keyboard_codepage;
inev.modifiers = msg.msg.lParam & 0xffff;
}
break;
@@ -4308,7 +4308,7 @@
{
dbcs[0] = dbcs_lead;
dbcs_lead = 0;
- if (!MultiByteToWideChar (keyboard_codepage, 0,
+ if (!MultiByteToWideChar (w32_keyboard_codepage, 0,
dbcs, 2, &code, 1))
{
/* Garbage */
@@ -4318,7 +4318,7 @@
break;
}
}
- else if (IsDBCSLeadByteEx (keyboard_codepage,
+ else if (IsDBCSLeadByteEx (w32_keyboard_codepage,
(BYTE) msg.msg.wParam))
{
dbcs_lead = (char) msg.msg.wParam;
@@ -4327,7 +4327,7 @@
}
else
{
- if (!MultiByteToWideChar (keyboard_codepage, 0,
+ if (!MultiByteToWideChar (w32_keyboard_codepage, 0,
&dbcs[1], 1, &code, 1))
{
/* What to do with garbage? */
@@ -6426,7 +6426,8 @@
{
DWORD input_locale_id = (DWORD) GetKeyboardLayout (0);
- keyboard_codepage = codepage_for_locale ((LCID) (input_locale_id &
0xffff));
+ w32_keyboard_codepage =
+ codepage_for_locale ((LCID) (input_locale_id & 0xffff));
}
/* Create the window thread - it will terminate itself when the app
=== modified file 'src/w32term.h'
--- a/src/w32term.h 2012-07-29 08:18:29 +0000
+++ b/src/w32term.h 2012-07-30 17:07:33 +0000
@@ -667,6 +667,9 @@
#define RIGHT_WIN_PRESSED 0x4000
#define APPS_PRESSED 0x2000
+/* The current ANSI input codepage for GUI sessions. */
+extern int w32_keyboard_codepage;
+
/* When compiling on Windows 9x/ME and NT 3.x, the following are not defined
(even though they are supported on 98 and ME. */
#ifndef WM_MOUSELEAVE
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r109300: Fix bug #12082 with input of Meta-non-ASCII-characters on MS-Windows.,
Eli Zaretskii <=