diff options
Diffstat (limited to 'runtime/src/window.rs')
-rw-r--r-- | runtime/src/window.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/runtime/src/window.rs b/runtime/src/window.rs index 2136d64d..cf47347a 100644 --- a/runtime/src/window.rs +++ b/runtime/src/window.rs @@ -15,6 +15,8 @@ use crate::core::{Point, Size}; use crate::futures::event; use crate::futures::Subscription; +use raw_window_handle::WindowHandle; + /// Subscribes to the frames of the window of the running application. /// /// The resulting [`Subscription`] will produce items at a rate equal to the @@ -170,6 +172,19 @@ pub fn change_icon<Message>(id: Id, icon: Icon) -> Command<Message> { Command::single(command::Action::Window(Action::ChangeIcon(id, icon))) } +/// Requests access to the native window handle for the window with the given id. +/// +/// Note that if the window closes before this call is processed the callback will not be run. +pub fn fetch_native_handle<Message>( + id: Id, + f: impl FnOnce(&WindowHandle<'_>) -> Message + 'static, +) -> Command<Message> { + Command::single(command::Action::Window(Action::FetchNativeHandle( + id, + Box::new(f), + ))) +} + /// Captures a [`Screenshot`] from the window. pub fn screenshot<Message>( id: Id, |