diff options
author | 2024-02-26 05:57:10 +0100 | |
---|---|---|
committer | 2024-02-26 05:57:10 +0100 | |
commit | a9733e9906404128ed45e2708e3c1da4bd4f90ce (patch) | |
tree | 2b8ebde664a82c9b63363d812a751aeaf2b38010 /winit/src | |
parent | f67db901ffd5eb0878252c553803695f00bb4e47 (diff) | |
download | iced-a9733e9906404128ed45e2708e3c1da4bd4f90ce.tar.gz iced-a9733e9906404128ed45e2708e3c1da4bd4f90ce.tar.bz2 iced-a9733e9906404128ed45e2708e3c1da4bd4f90ce.zip |
Ignore `text` in `KeyPressed` with private use chars
Apparently, macOS likes to use these for simple keys.
Diffstat (limited to 'winit/src')
-rw-r--r-- | winit/src/conversion.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/winit/src/conversion.rs b/winit/src/conversion.rs index 3d2ba0a4..4ff135e9 100644 --- a/winit/src/conversion.rs +++ b/winit/src/conversion.rs @@ -224,7 +224,7 @@ pub fn window_event( // TODO: Fix inconsistent API on Wasm event.text } - }; + }.filter(|text| !text.as_str().chars().any(is_private_use)); let winit::event::KeyEvent { state, location, .. @@ -839,3 +839,8 @@ pub fn icon(icon: window::Icon) -> Option<winit::window::Icon> { winit::window::Icon::from_rgba(pixels, size.width, size.height).ok() } + +// See: https://en.wikipedia.org/wiki/Private_Use_Areas +fn is_private_use(c: char) -> bool { + c >= '\u{E000}' && c <= '\u{F8FF}' +} |