diff options
author | 2021-07-26 12:36:13 -0700 | |
---|---|---|
committer | 2021-07-26 12:36:13 -0700 | |
commit | 81eb3c276d2aa5490173b22318be5fc045270109 (patch) | |
tree | 2177ed7d58a2b80b30f59f1ed470d170b23e37b4 | |
parent | dc0b96ce407283f2ffd9add5ad339f89097555d3 (diff) | |
download | iced-81eb3c276d2aa5490173b22318be5fc045270109.tar.gz iced-81eb3c276d2aa5490173b22318be5fc045270109.tar.bz2 iced-81eb3c276d2aa5490173b22318be5fc045270109.zip |
Add window::Event::Moved
-rw-r--r-- | native/src/window/event.rs | 8 | ||||
-rw-r--r-- | winit/src/conversion.rs | 6 |
2 files changed, 14 insertions, 0 deletions
diff --git a/native/src/window/event.rs b/native/src/window/event.rs index 3aa1ab0b..64f2b8d8 100644 --- a/native/src/window/event.rs +++ b/native/src/window/event.rs @@ -3,6 +3,14 @@ use std::path::PathBuf; /// A window-related event. #[derive(PartialEq, Clone, Debug)] pub enum Event { + /// A window was moved. + Moved { + /// The new logical x location of the window + x: i32, + /// The new logical y location of the window + y: i32, + }, + /// A window was resized. Resized { /// The new width of the window (in units) diff --git a/winit/src/conversion.rs b/winit/src/conversion.rs index b3d05857..e0934f43 100644 --- a/winit/src/conversion.rs +++ b/winit/src/conversion.rs @@ -130,6 +130,12 @@ pub fn window_event( WindowEvent::Touch(touch) => { Some(Event::Touch(touch_event(*touch, scale_factor))) } + WindowEvent::Moved(position) => { + let winit::dpi::LogicalPosition { x, y } = + position.to_logical(scale_factor); + + Some(Event::Window(window::Event::Moved { x, y })) + } _ => None, } } |