diff options
| author | Eli Zaretskii | 2015-07-31 12:14:07 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2015-07-31 12:14:07 +0300 |
| commit | e3d9ee522fce388db67f1f12007660fd3f0ef001 (patch) | |
| tree | 252451830eebff1641b3845fb78a8d1817caac14 /src | |
| parent | 123c82e8307ca386ba7f161dc725e3953dffc5c0 (diff) | |
| download | emacs-e3d9ee522fce388db67f1f12007660fd3f0ef001.tar.gz emacs-e3d9ee522fce388db67f1f12007660fd3f0ef001.zip | |
Allow to use the old key processing code on MS-Windows
* src/w32fns.c (syms_of_w32fns) <w32-use-fallback-wm-chars-method>:
New variable.
(w32_wnd_proc): Use it to invoke the old code that processed
character keys, as fallback, when this variable is non-nil. Fix
typos in comments. (Bug#19994)
Diffstat (limited to 'src')
| -rw-r--r-- | src/w32fns.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/w32fns.c b/src/w32fns.c index fecdf7cb72d..34e2720864c 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -2858,7 +2858,7 @@ get_wm_chars (HWND aWnd, int *buf, int buflen, int ignore_ctrl, int ctrl, | |||
| 2858 | || msg.message == WM_UNICHAR)) | 2858 | || msg.message == WM_UNICHAR)) |
| 2859 | { | 2859 | { |
| 2860 | /* We extract character payload, but in this call we handle only the | 2860 | /* We extract character payload, but in this call we handle only the |
| 2861 | characters which comes BEFORE the next keyup/keydown message. */ | 2861 | characters which come BEFORE the next keyup/keydown message. */ |
| 2862 | int dead; | 2862 | int dead; |
| 2863 | 2863 | ||
| 2864 | GetMessageW(&msg, aWnd, msg.message, msg.message); | 2864 | GetMessageW(&msg, aWnd, msg.message, msg.message); |
| @@ -2962,7 +2962,7 @@ deliver_wm_chars (int do_translate, HWND hwnd, UINT msg, UINT wParam, | |||
| 2962 | The "usual" message pump calls TranslateMessage() for EVERY event. | 2962 | The "usual" message pump calls TranslateMessage() for EVERY event. |
| 2963 | Emacs calls TranslateMessage() very selectively (is it needed for doing | 2963 | Emacs calls TranslateMessage() very selectively (is it needed for doing |
| 2964 | some tricky stuff with Win95??? With newer Windows, selectiveness is, | 2964 | some tricky stuff with Win95??? With newer Windows, selectiveness is, |
| 2965 | most probably, not needed - and harms a lot). | 2965 | most probably, not needed -- and harms a lot). |
| 2966 | 2966 | ||
| 2967 | So, with the usual message pump, the following call to TranslateMessage() | 2967 | So, with the usual message pump, the following call to TranslateMessage() |
| 2968 | is not needed (and is going to be VERY harmful). With Emacs' message | 2968 | is not needed (and is going to be VERY harmful). With Emacs' message |
| @@ -3058,7 +3058,7 @@ deliver_wm_chars (int do_translate, HWND hwnd, UINT msg, UINT wParam, | |||
| 3058 | 3058 | ||
| 3059 | Moreover: "traditional" layouts do not define distinct modifier-masks | 3059 | Moreover: "traditional" layouts do not define distinct modifier-masks |
| 3060 | for VK_LMENU and VK_RMENU (same for VK_L/RCONTROL). Instead, they | 3060 | for VK_LMENU and VK_RMENU (same for VK_L/RCONTROL). Instead, they |
| 3061 | rely on the KLLF_ALTGR bit to make the behaviour of VK_LMENU and | 3061 | rely on the KLLF_ALTGR bit to make the behavior of VK_LMENU and |
| 3062 | VK_RMENU distinct. As a corollary, for such layouts, the produced | 3062 | VK_RMENU distinct. As a corollary, for such layouts, the produced |
| 3063 | character is the same for AltGr-* (=rAlt-*) and Ctrl-Alt-* (in any | 3063 | character is the same for AltGr-* (=rAlt-*) and Ctrl-Alt-* (in any |
| 3064 | combination of handedness). For description of masks, see | 3064 | combination of handedness). For description of masks, see |
| @@ -3153,7 +3153,7 @@ deliver_wm_chars (int do_translate, HWND hwnd, UINT msg, UINT wParam, | |||
| 3153 | /* In "traditional" layouts, Alt without Ctrl does not | 3153 | /* In "traditional" layouts, Alt without Ctrl does not |
| 3154 | change the delivered character. This detects this | 3154 | change the delivered character. This detects this |
| 3155 | situation; it is safe to report this as Alt-something | 3155 | situation; it is safe to report this as Alt-something |
| 3156 | - as opposed to delivering the reported character | 3156 | -- as opposed to delivering the reported character |
| 3157 | without modifiers. */ | 3157 | without modifiers. */ |
| 3158 | if (legacy_alt_meta | 3158 | if (legacy_alt_meta |
| 3159 | && *b > 0x7f && ('A' <= wParam && wParam <= 'Z')) | 3159 | && *b > 0x7f && ('A' <= wParam && wParam <= 'Z')) |
| @@ -3421,6 +3421,8 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) | |||
| 3421 | /* Synchronize modifiers with current keystroke. */ | 3421 | /* Synchronize modifiers with current keystroke. */ |
| 3422 | sync_modifiers (); | 3422 | sync_modifiers (); |
| 3423 | record_keydown (wParam, lParam); | 3423 | record_keydown (wParam, lParam); |
| 3424 | if (w32_use_fallback_wm_chars_method) | ||
| 3425 | wParam = map_keypad_keys (wParam, (lParam & 0x1000000L) != 0); | ||
| 3424 | 3426 | ||
| 3425 | windows_translate = 0; | 3427 | windows_translate = 0; |
| 3426 | 3428 | ||
| @@ -3530,7 +3532,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) | |||
| 3530 | wParam = VK_NUMLOCK; | 3532 | wParam = VK_NUMLOCK; |
| 3531 | break; | 3533 | break; |
| 3532 | default: | 3534 | default: |
| 3533 | if (w32_unicode_gui) | 3535 | if (w32_unicode_gui && !w32_use_fallback_wm_chars_method) |
| 3534 | { | 3536 | { |
| 3535 | /* If this event generates characters or deadkeys, do | 3537 | /* If this event generates characters or deadkeys, do |
| 3536 | not interpret it as a "raw combination of modifiers | 3538 | not interpret it as a "raw combination of modifiers |
| @@ -3557,7 +3559,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) | |||
| 3557 | 3559 | ||
| 3558 | However, the keypress feeders would most probably | 3560 | However, the keypress feeders would most probably |
| 3559 | expect the "standard" message pump, when | 3561 | expect the "standard" message pump, when |
| 3560 | TranslateMessage() is called on EVERY KeyDown/Keyup | 3562 | TranslateMessage() is called on EVERY KeyDown/KeyUp |
| 3561 | event. So they may feed us Down-Ctrl Down-FAKE | 3563 | event. So they may feed us Down-Ctrl Down-FAKE |
| 3562 | Char-o and expect us to recognize it as Ctrl-o. | 3564 | Char-o and expect us to recognize it as Ctrl-o. |
| 3563 | Using 0 as the first argument would interfere with | 3565 | Using 0 as the first argument would interfere with |
| @@ -3566,7 +3568,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) | |||
| 3566 | #endif | 3568 | #endif |
| 3567 | /* Processing the generated WM_CHAR messages *WHILE* we | 3569 | /* Processing the generated WM_CHAR messages *WHILE* we |
| 3568 | handle KEYDOWN/UP event is the best choice, since | 3570 | handle KEYDOWN/UP event is the best choice, since |
| 3569 | withoug any fuss, we know all 3 of: scancode, virtual | 3571 | without any fuss, we know all 3 of: scancode, virtual |
| 3570 | keycode, and expansion. (Additionally, one knows | 3572 | keycode, and expansion. (Additionally, one knows |
| 3571 | boundaries of expansion of different keypresses.) */ | 3573 | boundaries of expansion of different keypresses.) */ |
| 3572 | res = deliver_wm_chars (1, hwnd, msg, wParam, lParam, 1); | 3574 | res = deliver_wm_chars (1, hwnd, msg, wParam, lParam, 1); |
| @@ -9147,6 +9149,15 @@ Set this to nil to get the old behavior for repainting; this should | |||
| 9147 | only be necessary if the default setting causes problems. */); | 9149 | only be necessary if the default setting causes problems. */); |
| 9148 | w32_strict_painting = 1; | 9150 | w32_strict_painting = 1; |
| 9149 | 9151 | ||
| 9152 | DEFVAR_BOOL ("w32-use-fallback-wm-chars-method" | ||
| 9153 | w32_use_fallback_wm_chars_method, | ||
| 9154 | doc: /* Non-nil means use old method of processing character keys. | ||
| 9155 | This is intended only for debugging of the new processing method. | ||
| 9156 | Default is nil. | ||
| 9157 | |||
| 9158 | This variable has effect only on NT family of systems, not on Windows 9X. */); | ||
| 9159 | w32_use_fallback_wm_chars_method = 0; | ||
| 9160 | |||
| 9150 | #if 0 /* TODO: Port to W32 */ | 9161 | #if 0 /* TODO: Port to W32 */ |
| 9151 | defsubr (&Sx_change_window_property); | 9162 | defsubr (&Sx_change_window_property); |
| 9152 | defsubr (&Sx_delete_window_property); | 9163 | defsubr (&Sx_delete_window_property); |