Re-implement against latest iced master. Rename FetchNativeHandle.

This commit is contained in:
dtzxporter 2024-01-19 14:48:14 -05:00 committed by Héctor Ramón Jiménez
parent 6f97b62457
commit 7105992228
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
5 changed files with 47 additions and 0 deletions

View file

@ -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,