@@ -2669,23 +2669,6 @@ fn handle_event_loop<T: UserEvent>(
26692669 event, window_id, ..
26702670 } => {
26712671 if let Some ( window_id) = webview_id_map. get ( & window_id) {
2672- // NOTE(amrbashir): we handle this event here instead of `match` statement below because
2673- // we want to focus the webview as soon as possible, especially on windows.
2674- if event == WryWindowEvent :: Focused ( true ) {
2675- let w = windows
2676- . borrow ( )
2677- . get ( & window_id)
2678- . and_then ( |w| w. inner . clone ( ) ) ;
2679- if let Some ( WindowHandle :: Webview ( webview) ) = w {
2680- // only focus the webview if the window is visible
2681- // somehow tao is sending a Focused(true) event even when the window is invisible,
2682- // which causes a deadlock: https://github.com/tauri-apps/tauri/issues/3534
2683- if webview. window ( ) . is_visible ( ) {
2684- webview. focus ( ) ;
2685- }
2686- }
2687- }
2688-
26892672 {
26902673 let windows_ref = windows. borrow ( ) ;
26912674 if let Some ( window) = windows_ref. get ( & window_id) {
@@ -2980,7 +2963,7 @@ fn create_webview<T: UserEvent>(
29802963 let mut token = EventRegistrationToken :: default ( ) ;
29812964 unsafe {
29822965 controller. add_GotFocus (
2983- FocusChangedEventHandler :: create ( Box :: new ( move |_, _| {
2966+ & FocusChangedEventHandler :: create ( Box :: new ( move |_, _| {
29842967 let _ = proxy_. send_event ( Message :: Webview (
29852968 window_id,
29862969 WebviewMessage :: WebviewEvent ( WebviewEvent :: Focused ( true ) ) ,
@@ -2993,7 +2976,7 @@ fn create_webview<T: UserEvent>(
29932976 . unwrap ( ) ;
29942977 unsafe {
29952978 controller. add_LostFocus (
2996- FocusChangedEventHandler :: create ( Box :: new ( move |_, _| {
2979+ & FocusChangedEventHandler :: create ( Box :: new ( move |_, _| {
29972980 let _ = proxy. send_event ( Message :: Webview (
29982981 window_id,
29992982 WebviewMessage :: WebviewEvent ( WebviewEvent :: Focused ( false ) ) ,
0 commit comments