summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2019-11-24 16:35:16 +0100
committerLibravatar GitHub <noreply@github.com>2019-11-24 16:35:16 +0100
commit357f73c2ef9c1cc65374f657e4d406946172d6de (patch)
tree5b6d5efe3e98142d8faa11613752dc86ebdc0c76
parentcfe975938b7b6c91f75ea07efd1b6d6be7bb315e (diff)
parentbbeb03504ab2a5ef20b7b639f21b9bfc8d0dfd16 (diff)
downloadiced-357f73c2ef9c1cc65374f657e4d406946172d6de.tar.gz
iced-357f73c2ef9c1cc65374f657e4d406946172d6de.tar.bz2
iced-357f73c2ef9c1cc65374f657e4d406946172d6de.zip
Merge pull request #67 from hecrj/fix/private-use-characters
Stop emitting private use characters on macOS
Diffstat (limited to '')
-rw-r--r--winit/src/application.rs15
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,
+ }
+}