Skip to content

Commit

Permalink
Manage AltGr on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Geobert committed Oct 27, 2024
1 parent b056370 commit e616200
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/event/sys/windows/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,20 @@ fn handle_surrogate(surrogate_buffer: &mut Option<u16>, 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;
}

Expand Down

0 comments on commit e616200

Please sign in to comment.