From b3c2ae663514c1d48e1394a90c11f6102e000120 Mon Sep 17 00:00:00 2001 From: Tw93 Date: Sun, 8 Jan 2023 18:24:31 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E9=83=A8=E5=88=86=E7=BD=91=E7=AB=99?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=E6=9C=89=E9=97=AE=E9=A2=98=EF=BC=8C=E5=85=88?= =?UTF-8?q?=E6=B3=A8=E9=87=8A=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src-tauri/src/main.rs | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 8b76de1..24034ef 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -12,9 +12,9 @@ use wry::{ webview::WebViewBuilder, }; -enum UserEvent { - NewWindow(String), -} +// enum UserEvent { +// NewWindow(String), +// } #[cfg(target_os = "macos")] use wry::application::{ @@ -87,9 +87,9 @@ fn main() -> wry::Result<()> { .. } = get_windows_config().1.unwrap_or_default(); - let event_loop: EventLoop = EventLoop::with_user_event(); - let proxy = event_loop.create_proxy(); - + // let event_loop: EventLoop = EventLoop::with_user_event(); + // let proxy = event_loop.create_proxy(); + let event_loop = EventLoop::new(); let common_window = WindowBuilder::new() .with_title("") .with_resizable(resizable) @@ -151,10 +151,10 @@ fn main() -> wry::Result<()> { .with_devtools(cfg!(feature = "devtools")) .with_initialization_script(include_str!("pake.js")) .with_ipc_handler(handler) - .with_new_window_req_handler(move |uri: String| { - let submitted = proxy.send_event(UserEvent::NewWindow(uri.clone())).is_ok(); - submitted - }) + // .with_new_window_req_handler(move |uri: String| { + // let submitted = proxy.send_event(UserEvent::NewWindow(uri.clone())).is_ok(); + // submitted + // }) .with_back_forward_navigation_gestures(true) .build()? }; @@ -185,10 +185,10 @@ fn main() -> wry::Result<()> { .with_initialization_script(include_str!("pake.js")) .with_ipc_handler(handler) .with_web_context(&mut web_content) - .with_new_window_req_handler(move |uri: String| { - let submitted = proxy.send_event(UserEvent::NewWindow(uri.clone())).is_ok(); - submitted - }) + // .with_new_window_req_handler(move |uri: String| { + // let submitted = proxy.send_event(UserEvent::NewWindow(uri.clone())).is_ok(); + // submitted + // }) .build()? }; #[cfg(feature = "devtools")] @@ -217,11 +217,9 @@ fn main() -> wry::Result<()> { println!("Clicked on {:?}", menu_id); println!("Clicked on {:?}", webview.window().is_visible()); } - Event::UserEvent(UserEvent::NewWindow(uri)) => { - if &uri.to_string() != "about:blank" { - webview.load_url(&uri); - } - } + // Event::UserEvent(UserEvent::NewWindow(uri)) => { + // webbrowser::open(&uri).expect("no browser"); + // } _ => (), } });