Skip to content

Commit 4bf1e85

Browse files
fix(windows): respect focused: false for webview, closes #7519 (#7722)
Co-authored-by: Lucas Nogueira <lucas@tauri.studio> fix(windows): respect `focused: false` for webview, closes #7519
1 parent 0b0bc81 commit 4bf1e85

4 files changed

Lines changed: 11 additions & 3 deletions

File tree

.changes/tauri-focused-windows.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'tauri': 'patch:bug'
3+
'tauri-runtime-wry': 'patch:bug'
4+
---
5+
6+
Properly respect the `focused` option when creating the webview.

core/tauri-runtime-wry/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ exclude = [ "CHANGELOG.md", "/target" ]
1313
readme = "README.md"
1414

1515
[dependencies]
16-
wry = { version = "0.24.1", default-features = false, features = [ "file-drop", "protocol" ] }
16+
wry = { version = "0.24.4", default-features = false, features = [ "file-drop", "protocol" ] }
1717
tauri-runtime = { version = "0.14.0", path = "../tauri-runtime" }
1818
tauri-utils = { version = "1.4.0", path = "../tauri-utils" }
1919
uuid = { version = "1", features = [ "v4" ] }

core/tauri-runtime-wry/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3154,6 +3154,7 @@ fn create_webview<T: UserEvent>(
31543154
} else {
31553155
None
31563156
};
3157+
let focused = window_builder.inner.window.focused;
31573158
let window = window_builder.inner.build(event_loop).unwrap();
31583159

31593160
webview_id_map.insert(window.id(), window_id);
@@ -3163,6 +3164,7 @@ fn create_webview<T: UserEvent>(
31633164
}
31643165
let mut webview_builder = WebViewBuilder::new(window)
31653166
.map_err(|e| Error::CreateWebview(Box::new(e)))?
3167+
.with_focused(focused)
31663168
.with_url(&url)
31673169
.unwrap() // safe to unwrap because we validate the URL beforehand
31683170
.with_transparent(is_window_transparent)

examples/api/src-tauri/Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)