Fix exit_on_last_window_close for UserWindowEvent::CloseWindow (#5047)
* Fix exit_on_last_window_close for UserWindowEvent::CloseWindow * fix: unify under close_requested --------- Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
1 parent
3fef7a9962
commit
3b9558d8eb
2 files changed
+1
-11
No files matched your search
@@ -302,16 +302,6 @@ impl App {
|
|||||||
_ = self.shared.proxy.send_event(UserWindowEvent::Poll(id));
|
_ = self.shared.proxy.send_event(UserWindowEvent::Poll(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Todo: maybe we should poll the virtualdom asking if it has any final actions to apply before closing the webview
|
|
||||||
///
|
|
||||||
/// Technically you can handle this with the use_window_event hook
|
|
||||||
pub fn handle_close_msg(&mut self, id: WindowId) {
|
|
||||||
self.webviews.remove(&id);
|
|
||||||
if self.webviews.is_empty() {
|
|
||||||
self.control_flow = ControlFlow::Exit
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn handle_query_msg(&mut self, msg: IpcMessage, id: WindowId) {
|
pub fn handle_query_msg(&mut self, msg: IpcMessage, id: WindowId) {
|
||||||
let Ok(result) = serde_json::from_value::<QueryResult>(msg.params()) else {
|
let Ok(result) = serde_json::from_value::<QueryResult>(msg.params()) else {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ pub fn launch_virtual_dom_blocking(virtual_dom: VirtualDom, mut desktop_config:
|
|||||||
Event::UserEvent(event) => match event {
|
Event::UserEvent(event) => match event {
|
||||||
UserWindowEvent::Poll(id) => app.poll_vdom(id),
|
UserWindowEvent::Poll(id) => app.poll_vdom(id),
|
||||||
UserWindowEvent::NewWindow => app.handle_new_window(),
|
UserWindowEvent::NewWindow => app.handle_new_window(),
|
||||||
UserWindowEvent::CloseWindow(id) => app.handle_close_msg(id),
|
UserWindowEvent::CloseWindow(id) => app.handle_close_requested(id),
|
||||||
UserWindowEvent::Shutdown => app.control_flow = tao::event_loop::ControlFlow::Exit,
|
UserWindowEvent::Shutdown => app.control_flow = tao::event_loop::ControlFlow::Exit,
|
||||||
|
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||||
|
|||||||
Reference in new issue
Block a user