aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2012-11-07 23:12:25 +0200
committerEli Zaretskii2012-11-07 23:12:25 +0200
commitdab72075f5caae9f0603b358d58023f4f210d876 (patch)
tree1170acbaff0a42e8d9fa02784e6e4f26621f6240 /src
parentb666f18d4d22b2808488fc785e579e9d5afb6eb5 (diff)
downloademacs-dab72075f5caae9f0603b358d58023f4f210d876.tar.gz
emacs-dab72075f5caae9f0603b358d58023f4f210d876.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog9
-rw-r--r--src/w32fns.c43
2 files changed, 31 insertions, 21 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index c1b42e276c5..04b66ba7cc7 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,10 +1,9 @@
12012-11-07 Eli Zaretskii <eliz@gnu.org> 12012-11-07 Eli Zaretskii <eliz@gnu.org>
2 2
3 * w32fns.c (w32_wnd_proc): Don't directly handle key chords 3 * w32fns.c (modifier_set): Don't report modifiers from toggle key,
4 including modifiers from toggle key, such as Scroll Lock, if the 4 such as Scroll Lock, if the respective keys are treated as
5 respective keys are treated as function keys, not as modifiers. 5 function keys, not as modifiers. This avoids destroying non-ASCII
6 This avoids destroying non-ASCII keyboard input when Scroll Lock 6 keyboard input when Scroll Lock is toggled ON. (Bug#1280)
7 is toggled ON. (Bug#1280)
8 (modifier_set): Do not omit checking the Num Lock key. 7 (modifier_set): Do not omit checking the Num Lock key.
9 8
102012-11-07 Dmitry Antipov <dmantipov@yandex.ru> 92012-11-07 Dmitry Antipov <dmantipov@yandex.ru>
diff --git a/src/w32fns.c b/src/w32fns.c
index dc395551a4a..b5e717f8980 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -2085,8 +2085,28 @@ sync_modifiers (void)
2085static int 2085static int
2086modifier_set (int vkey) 2086modifier_set (int vkey)
2087{ 2087{
2088 if (vkey == VK_CAPITAL || vkey == VK_SCROLL || vkey == VK_NUMLOCK) 2088 if (vkey == VK_CAPITAL)
2089 return (GetKeyState (vkey) & 0x1); 2089 {
2090 if (NILP (Vw32_enable_caps_lock))
2091 return 0;
2092 else
2093 return (GetKeyState (vkey) & 0x1);
2094 }
2095 if (vkey == VK_SCROLL)
2096 {
2097 if (NILP (Vw32_scroll_lock_modifier))
2098 return 0;
2099 else
2100 return (GetKeyState (vkey) & 0x1);
2101 }
2102 if (vkey == VK_NUMLOCK)
2103 {
2104 if (NILP (Vw32_enable_num_lock))
2105 return 0;
2106 else
2107 return (GetKeyState (vkey) & 0x1);
2108 }
2109
2090 if (!modifiers_recorded) 2110 if (!modifiers_recorded)
2091 return (GetKeyState (vkey) & 0x8000); 2111 return (GetKeyState (vkey) & 0x8000);
2092 2112
@@ -2974,21 +2994,12 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
2974 { 2994 {
2975 DWORD modifiers = construct_console_modifiers (); 2995 DWORD modifiers = construct_console_modifiers ();
2976 2996
2977 /* Always let TranslateMessage handle AltGr key chords; 2997 if (!NILP (Vw32_recognize_altgr)
2978 for some reason, ToAscii doesn't always process AltGr 2998 && modifier_set (VK_LCONTROL) && modifier_set (VK_RMENU))
2979 chords correctly. */
2980 if ((!NILP (Vw32_recognize_altgr)
2981 && modifier_set (VK_LCONTROL) && modifier_set (VK_RMENU))
2982 /* If a toggle key is used as a function key, let
2983 TranslateMessage handle keys pressed while the
2984 toggled key is ON. This avoids munging non-ASCII
2985 keys, like interpreting them as ASCII keys below,
2986 when, e.g., Scroll Lock is toggled ON. */
2987 || (NILP (Vw32_scroll_lock_modifier)
2988 && modifier_set (VK_SCROLL))
2989 || (NILP (Vw32_enable_num_lock) && modifier_set (VK_NUMLOCK))
2990 || (NILP (Vw32_enable_caps_lock) && modifier_set (VK_CAPITAL)))
2991 { 2999 {
3000 /* Always let TranslateMessage handle AltGr key chords;
3001 for some reason, ToAscii doesn't always process AltGr
3002 chords correctly. */
2992 windows_translate = 1; 3003 windows_translate = 1;
2993 } 3004 }
2994 else if ((modifiers & (~SHIFT_PRESSED & ~CAPSLOCK_ON)) != 0) 3005 else if ((modifiers & (~SHIFT_PRESSED & ~CAPSLOCK_ON)) != 0)