diff options
author | 2024-02-07 10:40:06 +0100 | |
---|---|---|
committer | 2024-02-07 10:40:06 +0100 | |
commit | d3619b5f69e3688a9ea76b56a072e01f3ca9d9ab (patch) | |
tree | e25f711dfa6fff214d19a7d1c358f0928f2a538e /winit | |
parent | 6f97b62457d924ef690d736c1aabe658f9c5778b (diff) | |
parent | 2a3778daa349043f5b69a1b264feb5f00d3dd772 (diff) | |
download | iced-d3619b5f69e3688a9ea76b56a072e01f3ca9d9ab.tar.gz iced-d3619b5f69e3688a9ea76b56a072e01f3ca9d9ab.tar.bz2 iced-d3619b5f69e3688a9ea76b56a072e01f3ca9d9ab.zip |
Merge pull request #2200 from dtzxporter/run-window-callback
Provide native window access, via "fetch_native_handle" method on window.
Diffstat (limited to '')
-rw-r--r-- | winit/src/application.rs | 10 | ||||
-rw-r--r-- | winit/src/multi_window.rs | 16 |
2 files changed, 24 insertions, 2 deletions
diff --git a/winit/src/application.rs b/winit/src/application.rs index 24c98d46..6a176834 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -783,6 +783,16 @@ pub fn run_command<A, C, E>( .send_event(tag(window.id().into())) .expect("Send message to event loop"); } + window::Action::RunWithHandle(_id, tag) => { + use window::raw_window_handle::HasWindowHandle; + + if let Ok(handle) = window.window_handle() { + proxy + .send_event(tag(&handle)) + .expect("Send message to event loop"); + } + } + window::Action::Screenshot(_id, tag) => { let bytes = compositor.screenshot( renderer, diff --git a/winit/src/multi_window.rs b/winit/src/multi_window.rs index 662adf5b..23b2f3c4 100644 --- a/winit/src/multi_window.rs +++ b/winit/src/multi_window.rs @@ -998,7 +998,7 @@ fn run_command<A, C, E>( proxy .send_event(tag(mode)) - .expect("Event loop doesn't exist."); + .expect("Send message to event loop"); } } window::Action::ToggleMaximize(id) => { @@ -1034,7 +1034,19 @@ fn run_command<A, C, E>( if let Some(window) = window_manager.get_mut(id) { proxy .send_event(tag(window.raw.id().into())) - .expect("Event loop doesn't exist."); + .expect("Send message to event loop"); + } + } + window::Action::RunWithHandle(id, tag) => { + use window::raw_window_handle::HasWindowHandle; + + if let Some(handle) = window_manager + .get_mut(id) + .and_then(|window| window.raw.window_handle().ok()) + { + proxy + .send_event(tag(&handle)) + .expect("Send message to event loop"); } } window::Action::Screenshot(id, tag) => { |