1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-27 02:25:28 +03:00

Probably improve compatibility for AltGr inside VNC on Windows

I didn't recreate precisely the situation in the issue, but I
tried pressing both `AltGr 8` and `CTRL ALT 8` with a DEU
layout active and both now result in `[` being emitted.

refs: #392
This commit is contained in:
Wez Furlong 2020-12-24 16:23:12 -08:00
parent c66e8f5c5e
commit 79c945a893
2 changed files with 10 additions and 1 deletions

View File

@ -32,6 +32,7 @@ brief notes about them may accumulate here.
* macOS: Fixed an issue where hovering over the split between panes could result in wezterm becoming unresponsive [#391](https://github.com/wez/wezterm/issues/391) * macOS: Fixed an issue where hovering over the split between panes could result in wezterm becoming unresponsive [#391](https://github.com/wez/wezterm/issues/391)
* Closing windows will now prompt for confirmation before proceeding with the close. Added `window_close_confirmation` to control this; valid values are `AlwaysPrompt` and `NeverPrompt`. [#280](https://github.com/wez/wezterm/issues/280) * Closing windows will now prompt for confirmation before proceeding with the close. Added `window_close_confirmation` to control this; valid values are `AlwaysPrompt` and `NeverPrompt`. [#280](https://github.com/wez/wezterm/issues/280)
* Tidied up logging. Previously ERROR level logging was used to make sure that informational things showed up in the stderr stream. Now we use INFO level logging for this to avoid alarming the user. You can set `WEZTERM_LOG=trace` in the environment to get more verbose logging for troubleshooting purposes. * Tidied up logging. Previously ERROR level logging was used to make sure that informational things showed up in the stderr stream. Now we use INFO level logging for this to avoid alarming the user. You can set `WEZTERM_LOG=trace` in the environment to get more verbose logging for troubleshooting purposes.
* Windows: fix an issue where VNC-server-emulated AltGr was not treated as AltGr [#392](https://github.com/wez/wezterm/issues/392)
### 20201101-103216-403d002d ### 20201101-103216-403d002d

View File

@ -1497,7 +1497,7 @@ unsafe fn key(hwnd: HWND, msg: UINT, wparam: WPARAM, lparam: LPARAM) -> Option<L
} }
if inner.keyboard_info.has_alt_gr() if inner.keyboard_info.has_alt_gr()
&& (keys[VK_RMENU as usize] & 0x80 != 0) && ((keys[VK_RMENU as usize] & 0x80 != 0) || (keys[VK_MENU as usize] & 0x80 != 0))
&& (keys[VK_CONTROL as usize] & 0x80 != 0) && (keys[VK_CONTROL as usize] & 0x80 != 0)
{ {
// AltGr is pressed; while AltGr is on the RHS of the keyboard // AltGr is pressed; while AltGr is on the RHS of the keyboard
@ -1508,6 +1508,14 @@ unsafe fn key(hwnd: HWND, msg: UINT, wparam: WPARAM, lparam: LPARAM) -> Option<L
// We set RIGHT_ALT as a hint to ourselves that AltGr is in // We set RIGHT_ALT as a hint to ourselves that AltGr is in
// use (we use regular ALT otherwise) so that our dead key // use (we use regular ALT otherwise) so that our dead key
// resolution can do the right thing. // resolution can do the right thing.
//
// When running inside a VNC session, VNC emulates the AltGr keypresses
// by sending plain VK_MENU (rather than RMENU) + VK_CONTROL.
// For compatibility with that we also treat MENU+CONTROL as equivalent
// to RMENU+CONTROL even though it is technically a lossy transformation.
// We only do that when the keyboard layout has AltGr so that we don't
// screw things up for other keyboard layouts.
// See issue #392 for some more context.
modifiers |= Modifiers::RIGHT_ALT; modifiers |= Modifiers::RIGHT_ALT;
} else { } else {
if keys[VK_CONTROL as usize] & 0x80 != 0 { if keys[VK_CONTROL as usize] & 0x80 != 0 {