From d6454b5d0ca4c3812d1614805de1094638153df1 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 22 Feb 2024 09:19:51 +0100 Subject: Rename `fetch_location` to `fetch_position` --- winit/src/application.rs | 23 ++++++++++++----------- winit/src/multi_window.rs | 29 +++++++++++++++-------------- 2 files changed, 27 insertions(+), 25 deletions(-) (limited to 'winit/src') diff --git a/winit/src/application.rs b/winit/src/application.rs index c86d1619..8d0d7456 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -767,19 +767,14 @@ pub fn run_command( window::Action::Minimize(_id, minimized) => { window.set_minimized(minimized); } - window::Action::Move(_id, position) => { - window.set_outer_position(winit::dpi::LogicalPosition { - x: position.x, - y: position.y, - }); - } - window::Action::FetchLocation(_id, callback) => { + window::Action::FetchPosition(_id, callback) => { let position = window .inner_position() - .map(|p| { - let pos = - p.to_logical::(window.scale_factor()); - crate::core::Point::new(pos.x, pos.y) + .map(|position| { + let position = position + .to_logical::(window.scale_factor()); + + crate::core::Point::new(position.x, position.y) }) .ok(); @@ -787,6 +782,12 @@ pub fn run_command( .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, + y: position.y, + }); + } window::Action::ChangeMode(_id, mode) => { window.set_visible(conversion::visible(mode)); window.set_fullscreen(conversion::fullscreen( diff --git a/winit/src/multi_window.rs b/winit/src/multi_window.rs index 3b00200b..c9056c9f 100644 --- a/winit/src/multi_window.rs +++ b/winit/src/multi_window.rs @@ -993,26 +993,17 @@ fn run_command( window.raw.set_minimized(minimized); } } - window::Action::Move(id, position) => { - if let Some(window) = window_manager.get_mut(id) { - window.raw.set_outer_position( - winit::dpi::LogicalPosition { - x: position.x, - y: position.y, - }, - ); - } - } - window::Action::FetchLocation(id, callback) => { + window::Action::FetchPosition(id, callback) => { if let Some(window) = window_manager.get_mut(id) { let position = window .raw .inner_position() - .map(|p| { - let pos = p.to_logical::( + .map(|position| { + let position = position.to_logical::( window.raw.scale_factor(), ); - crate::core::Point::new(pos.x, pos.y) + + crate::core::Point::new(position.x, position.y) }) .ok(); @@ -1021,6 +1012,16 @@ fn run_command( .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( + winit::dpi::LogicalPosition { + x: position.x, + y: position.y, + }, + ); + } + } window::Action::ChangeMode(id, mode) => { if let Some(window) = window_manager.get_mut(id) { window.raw.set_visible(conversion::visible(mode)); -- cgit