diff --git a/masonry/src/event.rs b/masonry/src/event.rs index ec006bb9d..309ad9c0c 100644 --- a/masonry/src/event.rs +++ b/masonry/src/event.rs @@ -10,7 +10,7 @@ use crate::WidgetId; use std::{collections::HashSet, path::PathBuf}; -use winit::event::{Ime, KeyEvent, Modifiers}; +use winit::event::{Force, Ime, KeyEvent, Modifiers}; use winit::keyboard::ModifiersState; // TODO - Occluded(bool) event @@ -95,6 +95,7 @@ pub struct PointerState { pub mods: Modifiers, pub count: u8, pub focus: bool, + pub force: Option, } #[derive(Debug, Clone)] @@ -351,6 +352,7 @@ impl PointerState { mods: Default::default(), count: 0, focus: false, + force: None, } } } diff --git a/masonry/src/event_loop_runner.rs b/masonry/src/event_loop_runner.rs index 57349fb14..04b55ae70 100644 --- a/masonry/src/event_loop_runner.rs +++ b/masonry/src/event_loop_runner.rs @@ -497,12 +497,16 @@ impl MasonryState<'_> { )); } WinitWindowEvent::Touch(winit::event::Touch { - location, phase, .. + location, + phase, + force, + .. }) => { // FIXME: This is naïve and should be refined for actual use. // It will also interact with gesture discrimination. self.pointer_state.physical_position = location; self.pointer_state.position = location.to_logical(window.scale_factor()); + self.pointer_state.force = force; match phase { winit::event::TouchPhase::Started => { self.render_root