diff --git a/winit/src/conversion.rs b/winit/src/conversion.rs index ef789296e2..8772b2102e 100644 --- a/winit/src/conversion.rs +++ b/winit/src/conversion.rs @@ -2,6 +2,9 @@ //! //! [`winit`]: https://github.com/rust-windowing/winit //! [`iced_runtime`]: https://github.com/iced-rs/iced/tree/0.10/runtime +use iced_graphics::core::SmolStr; +use winit::platform::modifier_supplement::KeyEventExtModifierSupplement; + use crate::core::keyboard; use crate::core::mouse; use crate::core::touch; @@ -195,17 +198,16 @@ pub fn window_event( })) } }, - WindowEvent::KeyboardInput { - event: - winit::event::KeyEvent { - logical_key, - state, - text, - location, - .. - }, - .. - } => Some(Event::Keyboard({ + WindowEvent::KeyboardInput { event, .. } => Some(Event::Keyboard({ + let text_with_modifiers = event + .text_with_all_modifiers() + .map(SmolStr::new); + let winit::event::KeyEvent { + logical_key, + state, + location, + .. + } = event; let key = key(logical_key); let modifiers = self::modifiers(modifiers); @@ -228,7 +230,7 @@ pub fn window_event( key, modifiers, location, - text, + text: text_with_modifiers, } } winit::event::ElementState::Released => {