diff options
| author | Ilya Zakharevich | 2016-04-21 19:08:16 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2016-04-21 19:08:16 +0300 |
| commit | 401857eda39c57bd59a1e3a1dee57fd6420eeab5 (patch) | |
| tree | e09af90e92b36939787b1f442f96abf1c94b1089 /src | |
| parent | a77cf24ada2f89194c0ac64aae27bcdf7021e697 (diff) | |
| download | emacs-401857eda39c57bd59a1e3a1dee57fd6420eeab5.tar.gz emacs-401857eda39c57bd59a1e3a1dee57fd6420eeab5.zip | |
Fix Alt-modified keys on some European MS-Windows keyboards
* src/w32fns.c (deliver_wm_chars): If the reported character is
ASCII, AND Meta modifier is a candidate, behave as if Meta is
present, i.e. fall back to the legacy code. (Bug#23251)
Diffstat (limited to 'src')
| -rw-r--r-- | src/w32fns.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/src/w32fns.c b/src/w32fns.c index b9002bae770..c57b5a188b2 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -3154,9 +3154,45 @@ deliver_wm_chars (int do_translate, HWND hwnd, UINT msg, UINT wParam, | |||
| 3154 | SHORT r = VkKeyScanW (*b), bitmap = 0x1FF; | 3154 | SHORT r = VkKeyScanW (*b), bitmap = 0x1FF; |
| 3155 | 3155 | ||
| 3156 | FPRINTF_WM_CHARS((stderr, "VkKeyScanW %#06x %#04x\n", (int)r, | 3156 | FPRINTF_WM_CHARS((stderr, "VkKeyScanW %#06x %#04x\n", (int)r, |
| 3157 | wParam)); | 3157 | wParam)); |
| 3158 | if ((r & 0xFF) == wParam) | 3158 | if ((r & 0xFF) == wParam) |
| 3159 | bitmap = r>>8; /* *b is reachable via simple interface */ | 3159 | bitmap = r>>8; /* *b is reachable via simple interface */ |
| 3160 | else | ||
| 3161 | { | ||
| 3162 | /* VkKeyScanW() (essentially) returns the FIRST key with | ||
| 3163 | the specified character; so here the pressed key is the | ||
| 3164 | SECONDARY key producing the character. | ||
| 3165 | |||
| 3166 | Essentially, we have no information about the "role" of | ||
| 3167 | modifiers on this key: which contribute into the | ||
| 3168 | produced character (so "are consumed"), and which are | ||
| 3169 | "extra" (must attache to bindable events). | ||
| 3170 | |||
| 3171 | The default above would consume ALL modifiers, so the | ||
| 3172 | character is reported "as is". However, on many layouts | ||
| 3173 | the ordering of the keys (in the layout table) is not | ||
| 3174 | thought out well, so the "secondary" keys are often those | ||
| 3175 | which the users would prefer to use with Alt-CHAR. | ||
| 3176 | (Moreover - with e.g. Czech-QWERTY - the ASCII | ||
| 3177 | punctuation is accessible from two equally [nu]preferable | ||
| 3178 | AltGr-keys.) | ||
| 3179 | |||
| 3180 | SO: Heuristic: if the reported char is ASCII, AND Meta | ||
| 3181 | modifier is a candidate, behave as if Meta is present | ||
| 3182 | (fallback to the legacy branch; bug#23251). | ||
| 3183 | |||
| 3184 | (This would break layouts | ||
| 3185 | - delivering ASCII characters | ||
| 3186 | - on SECONDARY keys | ||
| 3187 | - with not Shift/AltGr-like modifier combinations. | ||
| 3188 | All 3 conditions together must be pretty exotic | ||
| 3189 | cases - and a workaround exists: use "primary" keys!) */ | ||
| 3190 | if (*b < 0x80 | ||
| 3191 | && (wmsg.dwModifiers | ||
| 3192 | & (alt_modifier | meta_modifier | ||
| 3193 | | super_modifier | hyper_modifier))) | ||
| 3194 | return 0; | ||
| 3195 | } | ||
| 3160 | if (*type_CtrlAlt == 'a') /* Simple Alt seen */ | 3196 | if (*type_CtrlAlt == 'a') /* Simple Alt seen */ |
| 3161 | { | 3197 | { |
| 3162 | if ((bitmap & ~1) == 0) /* 1: KBDSHIFT */ | 3198 | if ((bitmap & ~1) == 0) /* 1: KBDSHIFT */ |