iced/patches/iced_winit.patch
2025-05-15 01:55:02 +02:00

55 lines
2.1 KiB
Diff

--- iced-o/winit/src/conversion.rs 2025-04-23 13:38:47.125962653 +0200
+++ iced/winit/src/conversion.rs 2025-04-23 13:42:51.660061924 +0200
@@ -203,13 +203,19 @@
WindowEvent::KeyboardInput { is_synthetic, .. } if is_synthetic => None,
WindowEvent::KeyboardInput { event, .. } => Some(Event::Keyboard({
let key = {
- #[cfg(not(target_arch = "wasm32"))]
+ #[cfg(not(any(
+ target_arch = "wasm32",
+ target_os = "android",
+ )))]
{
use winit::platform::modifier_supplement::KeyEventExtModifierSupplement;
event.key_without_modifiers()
}
- #[cfg(target_arch = "wasm32")]
+ #[cfg(any(
+ target_arch = "wasm32",
+ target_os = "android",
+ ))]
{
// TODO: Fix inconsistent API on Wasm
event.logical_key.clone()
@@ -217,7 +223,10 @@
};
let text = {
- #[cfg(not(target_arch = "wasm32"))]
+ #[cfg(not(any(
+ target_arch = "wasm32",
+ target_os = "android",
+ )))]
{
use crate::core::SmolStr;
use winit::platform::modifier_supplement::KeyEventExtModifierSupplement;
@@ -225,6 +234,18 @@
event.text_with_all_modifiers().map(SmolStr::new)
}
+ #[cfg(target_os = "android")]
+ {
+ if event.text.is_some() {
+ event.text
+ } else {
+ match &key {
+ winit::keyboard::Key::Character(c) => Some(c.clone()),
+ _ => None,
+ }
+ }
+ }
+
#[cfg(target_arch = "wasm32")]
{
// TODO: Fix inconsistent API on Wasm