Commit dab72075 authored by Eli Zaretskii's avatar Eli Zaretskii
Browse files

A (hopefully) better fix for bug #1280.

 src/w32fns.c (modifier_set): Don't report modifiers from toggle key,
 such as Scroll Lock, if the respective keys are treated as
 function keys, not as modifiers.  This avoids destroying non-ASCII
 keyboard input when Scroll Lock is toggled ON.
parent b666f18d
2012-11-07 Eli Zaretskii <eliz@gnu.org> 2012-11-07 Eli Zaretskii <eliz@gnu.org>
   
* w32fns.c (w32_wnd_proc): Don't directly handle key chords * w32fns.c (modifier_set): Don't report modifiers from toggle key,
including modifiers from toggle key, such as Scroll Lock, if the such as Scroll Lock, if the respective keys are treated as
respective keys are treated as function keys, not as modifiers. function keys, not as modifiers. This avoids destroying non-ASCII
This avoids destroying non-ASCII keyboard input when Scroll Lock keyboard input when Scroll Lock is toggled ON. (Bug#1280)
is toggled ON. (Bug#1280)
(modifier_set): Do not omit checking the Num Lock key. (modifier_set): Do not omit checking the Num Lock key.
   
2012-11-07 Dmitry Antipov <dmantipov@yandex.ru> 2012-11-07 Dmitry Antipov <dmantipov@yandex.ru>
......
...@@ -2085,8 +2085,28 @@ sync_modifiers (void) ...@@ -2085,8 +2085,28 @@ sync_modifiers (void)
static int static int
modifier_set (int vkey) modifier_set (int vkey)
{ {
if (vkey == VK_CAPITAL || vkey == VK_SCROLL || vkey == VK_NUMLOCK) if (vkey == VK_CAPITAL)
return (GetKeyState (vkey) & 0x1); {
if (NILP (Vw32_enable_caps_lock))
return 0;
else
return (GetKeyState (vkey) & 0x1);
}
if (vkey == VK_SCROLL)
{
if (NILP (Vw32_scroll_lock_modifier))
return 0;
else
return (GetKeyState (vkey) & 0x1);
}
if (vkey == VK_NUMLOCK)
{
if (NILP (Vw32_enable_num_lock))
return 0;
else
return (GetKeyState (vkey) & 0x1);
}
if (!modifiers_recorded) if (!modifiers_recorded)
return (GetKeyState (vkey) & 0x8000); return (GetKeyState (vkey) & 0x8000);
...@@ -2974,21 +2994,12 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) ...@@ -2974,21 +2994,12 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{ {
DWORD modifiers = construct_console_modifiers (); DWORD modifiers = construct_console_modifiers ();
/* Always let TranslateMessage handle AltGr key chords; if (!NILP (Vw32_recognize_altgr)
for some reason, ToAscii doesn't always process AltGr && modifier_set (VK_LCONTROL) && modifier_set (VK_RMENU))
chords correctly. */
if ((!NILP (Vw32_recognize_altgr)
&& modifier_set (VK_LCONTROL) && modifier_set (VK_RMENU))
/* If a toggle key is used as a function key, let
TranslateMessage handle keys pressed while the
toggled key is ON. This avoids munging non-ASCII
keys, like interpreting them as ASCII keys below,
when, e.g., Scroll Lock is toggled ON. */
|| (NILP (Vw32_scroll_lock_modifier)
&& modifier_set (VK_SCROLL))
|| (NILP (Vw32_enable_num_lock) && modifier_set (VK_NUMLOCK))
|| (NILP (Vw32_enable_caps_lock) && modifier_set (VK_CAPITAL)))
{ {
/* Always let TranslateMessage handle AltGr key chords;
for some reason, ToAscii doesn't always process AltGr
chords correctly. */
windows_translate = 1; windows_translate = 1;
} }
else if ((modifiers & (~SHIFT_PRESSED & ~CAPSLOCK_ON)) != 0) else if ((modifiers & (~SHIFT_PRESSED & ~CAPSLOCK_ON)) != 0)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment