Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

desktop: Support key codes for non-ASCII characters #18255

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions desktop/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,6 @@ pub fn winit_to_ruffle_key_code(event: &KeyEvent) -> Option<KeyCode> {
}

fn alpha_to_ruffle_key_code(char: &str) -> Option<KeyCode> {
if char.len() != 1 {
return None;
}

let char = char.chars().next()?;

if char.is_ascii_alphabetic() {
Expand All @@ -174,9 +170,9 @@ fn alpha_to_ruffle_key_code(char: &str) -> Option<KeyCode> {
}

if !char.is_ascii() {
// TODO Non-ASCII inputs have codes equal to their Unicode codes and yes,
// they overlap with other codes, so that typing '½' and '-' both produce 189.
return None;
// Non-ASCII inputs have codes equal to their Unicode codes and yes,
// they overlap with other codes, so that typing '½' and '-' both produce 189.
return Some(KeyCode::from_code(char as u32));
}

None
Expand Down