Skip to content

Commit

Permalink
fix(windows): respect focused: false for webview, closes #7519 (#7722)
Browse files Browse the repository at this point in the history
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
fix(windows): respect `focused: false` for webview, closes #7519
  • Loading branch information
amrbashir and lucasfernog committed Sep 11, 2023
1 parent 0b0bc81 commit 4bf1e85
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .changes/tauri-focused-windows.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'tauri': 'patch:bug'
'tauri-runtime-wry': 'patch:bug'
---

Properly respect the `focused` option when creating the webview.
2 changes: 1 addition & 1 deletion core/tauri-runtime-wry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ exclude = [ "CHANGELOG.md", "/target" ]
readme = "README.md"

[dependencies]
wry = { version = "0.24.1", default-features = false, features = [ "file-drop", "protocol" ] }
wry = { version = "0.24.4", default-features = false, features = [ "file-drop", "protocol" ] }
tauri-runtime = { version = "0.14.0", path = "../tauri-runtime" }
tauri-utils = { version = "1.4.0", path = "../tauri-utils" }
uuid = { version = "1", features = [ "v4" ] }
Expand Down
2 changes: 2 additions & 0 deletions core/tauri-runtime-wry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3154,6 +3154,7 @@ fn create_webview<T: UserEvent>(
} else {
None
};
let focused = window_builder.inner.window.focused;
let window = window_builder.inner.build(event_loop).unwrap();

webview_id_map.insert(window.id(), window_id);
Expand All @@ -3163,6 +3164,7 @@ fn create_webview<T: UserEvent>(
}
let mut webview_builder = WebViewBuilder::new(window)
.map_err(|e| Error::CreateWebview(Box::new(e)))?
.with_focused(focused)
.with_url(&url)
.unwrap() // safe to unwrap because we validate the URL beforehand
.with_transparent(is_window_transparent)
Expand Down
4 changes: 2 additions & 2 deletions examples/api/src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4bf1e85

Please sign in to comment.