summaryrefslogtreecommitdiffstats
path: root/runtime/src/window.rs
diff options
context:
space:
mode:
authorLibravatar dtzxporter <dtzxporter@users.noreply.github.com>2024-01-19 14:48:14 -0500
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-02-07 09:35:13 +0100
commit7105992228e58566cfacb6a1d6e10ec60fb05ecf (patch)
treed67ac19c57adf9a3282e8050cec407f437b86bff /runtime/src/window.rs
parent6f97b62457d924ef690d736c1aabe658f9c5778b (diff)
downloadiced-7105992228e58566cfacb6a1d6e10ec60fb05ecf.tar.gz
iced-7105992228e58566cfacb6a1d6e10ec60fb05ecf.tar.bz2
iced-7105992228e58566cfacb6a1d6e10ec60fb05ecf.zip
Re-implement against latest iced master. Rename FetchNativeHandle.
Diffstat (limited to 'runtime/src/window.rs')
-rw-r--r--runtime/src/window.rs15
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,