From 7105992228e58566cfacb6a1d6e10ec60fb05ecf Mon Sep 17 00:00:00 2001 From: dtzxporter Date: Fri, 19 Jan 2024 14:48:14 -0500 Subject: Re-implement against latest iced master. Rename FetchNativeHandle. --- runtime/src/window.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'runtime/src/window.rs') 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(id: Id, icon: Icon) -> Command { 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( + id: Id, + f: impl FnOnce(&WindowHandle<'_>) -> Message + 'static, +) -> Command { + Command::single(command::Action::Window(Action::FetchNativeHandle( + id, + Box::new(f), + ))) +} + /// Captures a [`Screenshot`] from the window. pub fn screenshot( id: Id, -- cgit