From a25dfa9179f16b22f340c553be312961e5a04098 Mon Sep 17 00:00:00 2001 From: Tw93 Date: Sat, 21 Dec 2024 21:07:06 +0800 Subject: [PATCH] :bug: debug windows close --- src-tauri/src/lib.rs | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index d8e8bb3..9217469 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -100,24 +100,24 @@ pub fn run_app() { Ok(()) }) - .on_window_event(|window, event| { - #[cfg(target_os = "macos")] - if let tauri::WindowEvent::CloseRequested { api, .. } = event { - { - let window_handle = window.clone(); - tauri::async_runtime::spawn(async move { - if window_handle.is_fullscreen().unwrap_or(false) { - window_handle.set_fullscreen(false).unwrap(); - // Give a small delay to ensure the full-screen exit operation is completed. - tokio::time::sleep(Duration::from_millis(900)).await; - } - window_handle.minimize().unwrap(); - window_handle.hide().unwrap(); - }); - api.prevent_close(); - } - } - }) + // .on_window_event(|window, event| { + // #[cfg(target_os = "macos")] + // if let tauri::WindowEvent::CloseRequested { api, .. } = event { + // { + // let window_handle = window.clone(); + // tauri::async_runtime::spawn(async move { + // if window_handle.is_fullscreen().unwrap_or(false) { + // window_handle.set_fullscreen(false).unwrap(); + // // Give a small delay to ensure the full-screen exit operation is completed. + // tokio::time::sleep(Duration::from_millis(900)).await; + // } + // window_handle.minimize().unwrap(); + // window_handle.hide().unwrap(); + // }); + // api.prevent_close(); + // } + // } + // }) .run(tauri::generate_context!()) .expect("error while running tauri application"); }