diff options
author | 2019-11-24 12:27:39 +0100 | |
---|---|---|
committer | 2019-11-24 12:27:39 +0100 | |
commit | bbeb03504ab2a5ef20b7b639f21b9bfc8d0dfd16 (patch) | |
tree | 035261727af0078885ae207d0cc1296de3702810 /winit/src | |
parent | 5629716120f2635406707792a6967bcd7d3e0ff3 (diff) | |
download | iced-bbeb03504ab2a5ef20b7b639f21b9bfc8d0dfd16.tar.gz iced-bbeb03504ab2a5ef20b7b639f21b9bfc8d0dfd16.tar.bz2 iced-bbeb03504ab2a5ef20b7b639f21b9bfc8d0dfd16.zip |
Stop emitting private use characters on macOS
Diffstat (limited to 'winit/src')
-rw-r--r-- | winit/src/application.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/winit/src/application.rs b/winit/src/application.rs index 4a5fd66b..ec1444f6 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -286,7 +286,9 @@ pub trait Application: Sized { )); } }, - WindowEvent::ReceivedCharacter(c) => { + WindowEvent::ReceivedCharacter(c) + if !is_private_use_character(c) => + { events.push(Event::Keyboard( keyboard::Event::CharacterReceived(c), )); @@ -379,3 +381,14 @@ fn spawn<Message: Send>( thread_pool.spawn_ok(future); } } + +// As defined in: http://www.unicode.org/faq/private_use.html +// TODO: Remove once https://github.com/rust-windowing/winit/pull/1254 lands +fn is_private_use_character(c: char) -> bool { + match c { + '\u{E000}'..='\u{F8FF}' + | '\u{F0000}'..='\u{FFFFD}' + | '\u{100000}'..='\u{10FFFD}' => true, + _ => false, + } +} |