From 401857eda39c57bd59a1e3a1dee57fd6420eeab5 Mon Sep 17 00:00:00 2001 From: Ilya Zakharevich Date: Thu, 21 Apr 2016 19:08:16 +0300 Subject: 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) --- src/w32fns.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'src') 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, SHORT r = VkKeyScanW (*b), bitmap = 0x1FF; FPRINTF_WM_CHARS((stderr, "VkKeyScanW %#06x %#04x\n", (int)r, - wParam)); + wParam)); if ((r & 0xFF) == wParam) bitmap = r>>8; /* *b is reachable via simple interface */ + else + { + /* VkKeyScanW() (essentially) returns the FIRST key with + the specified character; so here the pressed key is the + SECONDARY key producing the character. + + Essentially, we have no information about the "role" of + modifiers on this key: which contribute into the + produced character (so "are consumed"), and which are + "extra" (must attache to bindable events). + + The default above would consume ALL modifiers, so the + character is reported "as is". However, on many layouts + the ordering of the keys (in the layout table) is not + thought out well, so the "secondary" keys are often those + which the users would prefer to use with Alt-CHAR. + (Moreover - with e.g. Czech-QWERTY - the ASCII + punctuation is accessible from two equally [nu]preferable + AltGr-keys.) + + SO: Heuristic: if the reported char is ASCII, AND Meta + modifier is a candidate, behave as if Meta is present + (fallback to the legacy branch; bug#23251). + + (This would break layouts + - delivering ASCII characters + - on SECONDARY keys + - with not Shift/AltGr-like modifier combinations. + All 3 conditions together must be pretty exotic + cases - and a workaround exists: use "primary" keys!) */ + if (*b < 0x80 + && (wmsg.dwModifiers + & (alt_modifier | meta_modifier + | super_modifier | hyper_modifier))) + return 0; + } if (*type_CtrlAlt == 'a') /* Simple Alt seen */ { if ((bitmap & ~1) == 0) /* 1: KBDSHIFT */ -- cgit v1.3 From 2b31a0c21e51d39a82572a32d2d31b5a2aa174a3 Mon Sep 17 00:00:00 2001 From: Martin Rudalics Date: Fri, 22 Apr 2016 11:56:03 +0200 Subject: In x_set_window_size restore do_pending_window_change calls * src/xterm.c (x_set_window_size): * src/w32term.c (x_set_window_size): Restore do_pending_window_change calls after their stupid removal on 2015-08-31. --- src/w32term.c | 2 ++ src/xterm.c | 2 ++ 2 files changed, 4 insertions(+) (limited to 'src') diff --git a/src/w32term.c b/src/w32term.c index 62ad4eb086b..51743f8f94d 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -6231,6 +6231,8 @@ x_set_window_size (struct frame *f, bool change_gravity, } unblock_input (); + + do_pending_window_change (false); } /* Mouse warping. */ diff --git a/src/xterm.c b/src/xterm.c index ba9bf50de31..2f8e0775909 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -10746,6 +10746,8 @@ x_set_window_size (struct frame *f, bool change_gravity, cancel_mouse_face (f); unblock_input (); + + do_pending_window_change (false); } /* Move the mouse to position pixel PIX_X, PIX_Y relative to frame F. */ -- cgit v1.3