Skip to content

Commit

Permalink
desktop: Support key codes for non-ASCII characters
Browse files Browse the repository at this point in the history
Flash Player maps non-ASCII input characters to key codes
equal to their respective Unicode code points.
  • Loading branch information
kjarosh authored and torokati44 committed Oct 16, 2024
1 parent ba191b3 commit 8241b3e
Showing 1 changed file with 3 additions and 7 deletions.
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

0 comments on commit 8241b3e

Please sign in to comment.