Pass WindowHandle by value to window::run_with_handle
This commit is contained in:
parent
7e7af91e6f
commit
718fe5b7de
4 changed files with 4 additions and 4 deletions
|
|
@ -197,7 +197,7 @@ pub fn change_icon<Message>(id: Id, icon: Icon) -> Command<Message> {
|
|||
/// Note that if the window closes before this call is processed the callback will not be run.
|
||||
pub fn run_with_handle<Message>(
|
||||
id: Id,
|
||||
f: impl FnOnce(&WindowHandle<'_>) -> Message + 'static,
|
||||
f: impl FnOnce(WindowHandle<'_>) -> Message + 'static,
|
||||
) -> Command<Message> {
|
||||
Command::single(command::Action::Window(Action::RunWithHandle(
|
||||
id,
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ pub enum Action<T> {
|
|||
/// said, it's usually in the same ballpark as on Windows.
|
||||
ChangeIcon(Id, Icon),
|
||||
/// Runs the closure with the native window handle of the window with the given [`Id`].
|
||||
RunWithHandle(Id, Box<dyn FnOnce(&WindowHandle<'_>) -> T + 'static>),
|
||||
RunWithHandle(Id, Box<dyn FnOnce(WindowHandle<'_>) -> T + 'static>),
|
||||
/// Screenshot the viewport of the window.
|
||||
Screenshot(Id, Box<dyn FnOnce(Screenshot) -> T + 'static>),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1050,7 +1050,7 @@ pub fn run_command<A, C, E>(
|
|||
use window::raw_window_handle::HasWindowHandle;
|
||||
|
||||
if let Ok(handle) = window.window_handle() {
|
||||
proxy.send(tag(&handle));
|
||||
proxy.send(tag(handle));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1223,7 +1223,7 @@ fn run_command<A, C, E>(
|
|||
.get_mut(id)
|
||||
.and_then(|window| window.raw.window_handle().ok())
|
||||
{
|
||||
proxy.send(tag(&handle));
|
||||
proxy.send(tag(handle));
|
||||
}
|
||||
}
|
||||
window::Action::Screenshot(id, tag) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue