From 9f75f01ddb7a13a3ab1cffdfa59997cb5b131f72 Mon Sep 17 00:00:00 2001 From: Night_Hunter Date: Sat, 10 Dec 2022 01:54:57 +1300 Subject: add action to get window id --- winit/src/application.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'winit/src') diff --git a/winit/src/application.rs b/winit/src/application.rs index 1f37ffef..3fdec658 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -794,6 +794,11 @@ pub fn run_command( window::Action::ChangeAlwaysOnTop(on_top) => { window.set_always_on_top(on_top); } + window::Action::FetchId(tag) => { + proxy + .send_event(tag(window.id().into())) + .expect("Send message to event loop"); + } }, command::Action::System(action) => match action { system::Action::QueryInformation(_tag) => { -- cgit From 2c2421ae5dad9afce1058e67ae8bcabd787fa373 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 17 Feb 2023 13:47:46 +0100 Subject: Expose `fetch_id` helper in `window` module --- winit/src/window.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'winit/src') diff --git a/winit/src/window.rs b/winit/src/window.rs index 3d5a765b..961562bd 100644 --- a/winit/src/window.rs +++ b/winit/src/window.rs @@ -95,3 +95,12 @@ pub fn change_always_on_top(on_top: bool) -> Command { on_top, ))) } + +/// Fetches an identifier unique to the window. +pub fn fetch_id( + f: impl FnOnce(u64) -> Message + 'static, +) -> Command { + Command::single(command::Action::Window(window::Action::FetchId(Box::new( + f, + )))) +} -- cgit