diff options
author | 2023-02-17 14:10:08 +0100 | |
---|---|---|
committer | 2023-02-17 14:10:08 +0100 | |
commit | c2a5f0592465c5db2d0f95fad345c0c190870654 (patch) | |
tree | 6b91e3eca2fc76a8f8e430f8020ac25abb64f470 /winit/src | |
parent | b9b0a9a1f400483f46ec053247c435ec7739f778 (diff) | |
parent | 2c2421ae5dad9afce1058e67ae8bcabd787fa373 (diff) | |
download | iced-c2a5f0592465c5db2d0f95fad345c0c190870654.tar.gz iced-c2a5f0592465c5db2d0f95fad345c0c190870654.tar.bz2 iced-c2a5f0592465c5db2d0f95fad345c0c190870654.zip |
Merge pull request #1589 from Night-Hunter-NF/FetchWindowId
add action to get window id
Diffstat (limited to 'winit/src')
-rw-r--r-- | winit/src/application.rs | 5 | ||||
-rw-r--r-- | winit/src/window.rs | 9 |
2 files changed, 14 insertions, 0 deletions
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) => { diff --git a/winit/src/window.rs b/winit/src/window.rs index 3d5a765b..961562bd 100644 --- a/winit/src/window.rs +++ b/winit/src/window.rs @@ -95,3 +95,12 @@ pub fn change_always_on_top<Message>(on_top: bool) -> Command<Message> { on_top, ))) } + +/// Fetches an identifier unique to the window. +pub fn fetch_id<Message>( + f: impl FnOnce(u64) -> Message + 'static, +) -> Command<Message> { + Command::single(command::Action::Window(window::Action::FetchId(Box::new( + f, + )))) +} |