diff options
-rw-r--r-- | native/src/window/action.rs | 4 | ||||
-rw-r--r-- | winit/src/application.rs | 5 |
2 files changed, 9 insertions, 0 deletions
diff --git a/native/src/window/action.rs b/native/src/window/action.rs index c6361449..ce36d129 100644 --- a/native/src/window/action.rs +++ b/native/src/window/action.rs @@ -76,6 +76,8 @@ pub enum Action<T> { /// /// - **Web / Wayland:** Unsupported. ChangeAlwaysOnTop(bool), + /// Fetch an identifier unique to the window. + FetchId(Box<dyn FnOnce(u64) -> T + 'static>), } impl<T> Action<T> { @@ -105,6 +107,7 @@ impl<T> Action<T> { Self::ChangeAlwaysOnTop(on_top) => { Action::ChangeAlwaysOnTop(on_top) } + Self::FetchId(o) => Action::FetchId(Box::new(move |s| f(o(s)))), } } } @@ -138,6 +141,7 @@ impl<T> fmt::Debug for Action<T> { Self::ChangeAlwaysOnTop(on_top) => { write!(f, "Action::AlwaysOnTop({on_top})") } + Self::FetchId(_) => write!(f, "Action::FetchId"), } } } 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<A, E>( 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) => { |