Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(windows): respect focused: false for webview, closes #7519 #7722

Merged
merged 5 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'
---

On Windows, properly respect `focused: false` when creating the window.
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 = { git = "https://github.com/tauri-apps/wry", branch = "v0.24.1", default-features = false, features = [ "file-drop", "protocol" ] }
lucasfernog marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -1941,7 +1941,7 @@
#[cfg(feature = "clipboard")]
let clipboard_manager = Arc::new(Mutex::new(Clipboard::new()));

let windows = Arc::new(RefCell::new(HashMap::default()));

Check failure on line 1944 in core/tauri-runtime-wry/src/lib.rs

View workflow job for this annotation

GitHub Actions / empty

usage of an `Arc` that is not `Send` or `Sync`

error: usage of an `Arc` that is not `Send` or `Sync` --> core/tauri-runtime-wry/src/lib.rs:1944:19 | 1944 | let windows = Arc::new(RefCell::new(HashMap::default())); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: the trait `Send` is not implemented for `RefCell<HashMap<u64, WindowWrapper>>` = note: the trait `Sync` is not implemented for `RefCell<HashMap<u64, WindowWrapper>>` = note: required for `Arc<RefCell<HashMap<u64, WindowWrapper>>>` to implement `Send` and `Sync` = help: consider using an `Rc` instead or wrapping the inner type with a `Mutex` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#arc_with_non_send_sync = note: `-D clippy::arc-with-non-send-sync` implied by `-D warnings`
let webview_id_map = WebviewIdStore::default();

#[cfg(all(desktop, feature = "system-tray"))]
Expand Down Expand Up @@ -3153,6 +3153,7 @@
} 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 @@ -3162,6 +3163,7 @@
}
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 Expand Up @@ -3289,7 +3291,7 @@
Ok(WindowWrapper {
label,
inner: Some(WindowHandle::Webview {
inner: Arc::new(webview),

Check failure on line 3294 in core/tauri-runtime-wry/src/lib.rs

View workflow job for this annotation

GitHub Actions / empty

usage of an `Arc` that is not `Send` or `Sync`

error: usage of an `Arc` that is not `Send` or `Sync` --> core/tauri-runtime-wry/src/lib.rs:3294:14 | 3294 | inner: Arc::new(webview), | ^^^^^^^^^^^^^^^^^ | = note: the trait `Send` is not implemented for `WebView` = note: the trait `Sync` is not implemented for `WebView` = note: required for `Arc<WebView>` to implement `Send` and `Sync` = help: consider using an `Rc` instead or wrapping the inner type with a `Mutex` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#arc_with_non_send_sync
context_store: web_context_store.clone(),
context_key: if automation_enabled {
None
Expand Down
Loading