From c1f41a49b167ffa5e900fa34486487f3e0d62778 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Thu, 22 Feb 2024 09:48:45 +0100 Subject: [PATCH] Revert "Merge pull request #2280 from n1ght-hunter/add-action-fetch-location" This reverts commit a27267b8fbd7cfc1033c1ca9aff9a57ae57f0030, reversing changes made to ce4eef64cdde5f3e5809c963a1d84c933d27e7ae. --- runtime/src/window.rs | 11 ----------- runtime/src/window/action.rs | 8 -------- winit/src/application.rs | 17 +---------------- winit/src/multi_window.rs | 21 +-------------------- 4 files changed, 2 insertions(+), 55 deletions(-) diff --git a/runtime/src/window.rs b/runtime/src/window.rs index 24171e3ee2..04bcfcd8b3 100644 --- a/runtime/src/window.rs +++ b/runtime/src/window.rs @@ -101,17 +101,6 @@ pub fn minimize(id: Id, minimized: bool) -> Command { Command::single(command::Action::Window(Action::Minimize(id, minimized))) } -/// Fetches the current window position in logical coordinates. -pub fn fetch_position( - id: Id, - f: impl FnOnce(Option) -> Message + 'static, -) -> Command { - Command::single(command::Action::Window(Action::FetchPosition( - id, - Box::new(f), - ))) -} - /// Moves the window to the given logical coordinates. pub fn move_to(id: Id, position: Point) -> Command { Command::single(command::Action::Window(Action::Move(id, position))) diff --git a/runtime/src/window/action.rs b/runtime/src/window/action.rs index e44ff5a688..9bfc2b6203 100644 --- a/runtime/src/window/action.rs +++ b/runtime/src/window/action.rs @@ -38,8 +38,6 @@ pub enum Action { FetchMinimized(Id, Box) -> T + 'static>), /// Set the window to minimized or back Minimize(Id, bool), - /// Fetch the current logical coordinates of the window. - FetchPosition(Id, Box) -> T + 'static>), /// Move the window to the given logical coordinates. /// /// Unsupported on Wayland. @@ -136,9 +134,6 @@ impl Action { Action::FetchMinimized(id, Box::new(move |s| f(o(s)))) } Self::Minimize(id, minimized) => Action::Minimize(id, minimized), - Self::FetchPosition(id, o) => { - Action::FetchPosition(id, Box::new(move |s| f(o(s)))) - } Self::Move(id, position) => Action::Move(id, position), Self::ChangeMode(id, mode) => Action::ChangeMode(id, mode), Self::FetchMode(id, o) => { @@ -191,9 +186,6 @@ impl fmt::Debug for Action { Self::Minimize(id, minimized) => { write!(f, "Action::Minimize({id:?}, {minimized}") } - Self::FetchPosition(id, _) => { - write!(f, "Action::FetchPosition({id:?})") - } Self::Move(id, position) => { write!(f, "Action::Move({id:?}, {position})") } diff --git a/winit/src/application.rs b/winit/src/application.rs index 5956c2342a..5ae01fa8ae 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -10,7 +10,7 @@ use crate::core::renderer; use crate::core::time::Instant; use crate::core::widget::operation; use crate::core::window; -use crate::core::{Event, Point, Size}; +use crate::core::{Event, Size}; use crate::futures::futures; use crate::futures::{Executor, Runtime, Subscription}; use crate::graphics::compositor::{self, Compositor}; @@ -756,21 +756,6 @@ pub fn run_command( window::Action::Minimize(_id, minimized) => { window.set_minimized(minimized); } - window::Action::FetchPosition(_id, callback) => { - let position = window - .inner_position() - .map(|position| { - let position = position - .to_logical::(window.scale_factor()); - - Point::new(position.x, position.y) - }) - .ok(); - - proxy - .send_event(callback(position)) - .expect("Send message to event loop"); - } window::Action::Move(_id, position) => { window.set_outer_position(winit::dpi::LogicalPosition { x: position.x, diff --git a/winit/src/multi_window.rs b/winit/src/multi_window.rs index 68f429ee94..b52e0fd817 100644 --- a/winit/src/multi_window.rs +++ b/winit/src/multi_window.rs @@ -10,7 +10,7 @@ use crate::core::mouse; use crate::core::renderer; use crate::core::widget::operation; use crate::core::window; -use crate::core::{Point, Size}; +use crate::core::Size; use crate::futures::futures::channel::mpsc; use crate::futures::futures::{task, Future, StreamExt}; use crate::futures::{Executor, Runtime, Subscription}; @@ -977,25 +977,6 @@ fn run_command( window.raw.set_minimized(minimized); } } - window::Action::FetchPosition(id, callback) => { - if let Some(window) = window_manager.get_mut(id) { - let position = window - .raw - .inner_position() - .map(|position| { - let position = position.to_logical::( - window.raw.scale_factor(), - ); - - Point::new(position.x, position.y) - }) - .ok(); - - proxy - .send_event(callback(position)) - .expect("Send message to event loop"); - } - } window::Action::Move(id, position) => { if let Some(window) = window_manager.get_mut(id) { window.raw.set_outer_position(