diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index da672378..1ff6798d 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -4,28 +4,17 @@ use std::error::Error; use polyfrost_launcher::auth; -use tauri::{App, Manager}; +use tauri::App; fn main() { tauri::Builder::default() .plugin(tauri_plugin_shell::init()) .plugin(auth::init()) .setup(setup) - .on_window_event(window_handler) .run(tauri::generate_context!()) .expect("error while running tauri application"); } -fn window_handler(window: &tauri::Window, event: &tauri::WindowEvent) { - match event { - tauri::WindowEvent::CloseRequested { api, .. } => { - api.prevent_close(); - let _ = window.emit("handle_window_close_request", ()); - } - _ => {} - } -} - fn setup(_: &mut App) -> Result<(), Box> { Ok(()) } diff --git a/src/ui/components/native/WindowFrame.tsx b/src/ui/components/native/WindowFrame.tsx index e6b3d065..fa81cede 100644 --- a/src/ui/components/native/WindowFrame.tsx +++ b/src/ui/components/native/WindowFrame.tsx @@ -27,7 +27,8 @@ function WindowFrame() { const minimize = () => Window.getCurrent().minimize(); const quit = () => Window.getCurrent().destroy(); - Window.getCurrent().listen('handle_window_close_request', () => { + Window.getCurrent().onCloseRequested((event) => { + event.preventDefault(); setModalVisible(true); });