diff options
Diffstat (limited to 'winit/src')
-rw-r--r-- | winit/src/application.rs | 14 | ||||
-rw-r--r-- | winit/src/multi_window.rs | 18 |
2 files changed, 32 insertions, 0 deletions
diff --git a/winit/src/application.rs b/winit/src/application.rs index 1fd51d82..c86d1619 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -773,6 +773,20 @@ pub fn run_command<A, C, E>( y: position.y, }); } + window::Action::FetchLocation(_id, callback) => { + let position = window + .inner_position() + .map(|p| { + let pos = + p.to_logical::<f32>(window.scale_factor()); + crate::core::Point::new(pos.x, pos.y) + }) + .ok(); + + proxy + .send_event(callback(position)) + .expect("Send message to event loop"); + } 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 c63dd433..3b00200b 100644 --- a/winit/src/multi_window.rs +++ b/winit/src/multi_window.rs @@ -1003,6 +1003,24 @@ fn run_command<A, C, E>( ); } } + window::Action::FetchLocation(id, callback) => { + if let Some(window) = window_manager.get_mut(id) { + let position = window + .raw + .inner_position() + .map(|p| { + let pos = p.to_logical::<f32>( + window.raw.scale_factor(), + ); + crate::core::Point::new(pos.x, pos.y) + }) + .ok(); + + proxy + .send_event(callback(position)) + .expect("Send message to event loop"); + } + } window::Action::ChangeMode(id, mode) => { if let Some(window) = window_manager.get_mut(id) { window.raw.set_visible(conversion::visible(mode)); |