From e61620022f59adf98508727baec1aaec91bc55a1 Mon Sep 17 00:00:00 2001 From: Geobert Quach Date: Sun, 27 Oct 2024 12:31:44 +0100 Subject: [PATCH] Manage AltGr on Windows Fixes #820 --- src/event/sys/windows/parse.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/event/sys/windows/parse.rs b/src/event/sys/windows/parse.rs index 97677ecf..a54bd8bb 100644 --- a/src/event/sys/windows/parse.rs +++ b/src/event/sys/windows/parse.rs @@ -79,18 +79,20 @@ fn handle_surrogate(surrogate_buffer: &mut Option, new_surrogate: u16) -> O impl From<&ControlKeyState> for KeyModifiers { fn from(state: &ControlKeyState) -> Self { let shift = state.has_state(SHIFT_PRESSED); - let alt = state.has_state(LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED); + let l_alt = state.has_state(LEFT_ALT_PRESSED); + let r_alt = state.has_state(RIGHT_ALT_PRESSED); let control = state.has_state(LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED); + let alt_gr = control && r_alt; let mut modifier = KeyModifiers::empty(); if shift { modifier |= KeyModifiers::SHIFT; } - if control { + if control && !alt_gr { modifier |= KeyModifiers::CONTROL; } - if alt { + if (l_alt || r_alt) && !alt_gr { modifier |= KeyModifiers::ALT; }