mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-01-31 00:35:19 +01:00
fix: default WindowConfig::focus to false in Default::default (#14653)
This commit is contained in:
5
.changes/window-config-focus-default-true.md
Normal file
5
.changes/window-config-focus-default-true.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
tauri: patch:bug
|
||||
---
|
||||
|
||||
`WindowConfig::focus` is set to `false` in `WindowConfig::default()`
|
||||
@@ -231,7 +231,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"create": {
|
||||
"description": "Whether Tauri should create this window at app startup or not.\n\n When this is set to `false` you must manually grab the config object via `app.config().app.windows`\n and create it with [`WebviewWindowBuilder::from_config`](https://docs.rs/tauri/2/tauri/webview/struct.WebviewWindowBuilder.html#method.from_config).\n\n ## Example:\n\n ```rust\n tauri::Builder::default()\n .setup(|app| {\n tauri::WebviewWindowBuilder::from_config(app.handle(), app.config().app.windows[0])?.build()?;\n Ok(())\n });\n ```",
|
||||
"description": "Whether Tauri should create this window at app startup or not.\n\n When this is set to `false` you must manually grab the config object via `app.config().app.windows`\n and create it with [`WebviewWindowBuilder::from_config`](https://docs.rs/tauri/2/tauri/webview/struct.WebviewWindowBuilder.html#method.from_config).\n\n ## Example:\n\n ```rust\n tauri::Builder::default()\n .setup(|app| {\n tauri::WebviewWindowBuilder::from_config(app.handle(), &app.config().app.windows[0])?.build()?;\n Ok(())\n });\n ```",
|
||||
"default": true,
|
||||
"type": "boolean"
|
||||
},
|
||||
|
||||
@@ -231,7 +231,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"create": {
|
||||
"description": "Whether Tauri should create this window at app startup or not.\n\n When this is set to `false` you must manually grab the config object via `app.config().app.windows`\n and create it with [`WebviewWindowBuilder::from_config`](https://docs.rs/tauri/2/tauri/webview/struct.WebviewWindowBuilder.html#method.from_config).\n\n ## Example:\n\n ```rust\n tauri::Builder::default()\n .setup(|app| {\n tauri::WebviewWindowBuilder::from_config(app.handle(), app.config().app.windows[0])?.build()?;\n Ok(())\n });\n ```",
|
||||
"description": "Whether Tauri should create this window at app startup or not.\n\n When this is set to `false` you must manually grab the config object via `app.config().app.windows`\n and create it with [`WebviewWindowBuilder::from_config`](https://docs.rs/tauri/2/tauri/webview/struct.WebviewWindowBuilder.html#method.from_config).\n\n ## Example:\n\n ```rust\n tauri::Builder::default()\n .setup(|app| {\n tauri::WebviewWindowBuilder::from_config(app.handle(), &app.config().app.windows[0])?.build()?;\n Ok(())\n });\n ```",
|
||||
"default": true,
|
||||
"type": "boolean"
|
||||
},
|
||||
|
||||
@@ -1653,7 +1653,7 @@ pub struct WindowConfig {
|
||||
/// ```rust
|
||||
/// tauri::Builder::default()
|
||||
/// .setup(|app| {
|
||||
/// tauri::WebviewWindowBuilder::from_config(app.handle(), app.config().app.windows[0])?.build()?;
|
||||
/// tauri::WebviewWindowBuilder::from_config(app.handle(), &app.config().app.windows[0])?.build()?;
|
||||
/// Ok(())
|
||||
/// });
|
||||
/// ```
|
||||
@@ -2006,7 +2006,7 @@ impl Default for WindowConfig {
|
||||
closable: true,
|
||||
title: default_title(),
|
||||
fullscreen: false,
|
||||
focus: false,
|
||||
focus: true,
|
||||
focusable: true,
|
||||
transparent: false,
|
||||
maximized: false,
|
||||
@@ -4384,4 +4384,12 @@ mod test {
|
||||
assert!(object_json.contains("\"cwd\":null") || !object_json.contains("cwd"));
|
||||
assert!(object_json.contains("\"args\":null") || !object_json.contains("args"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn window_config_default_same_as_deserialize() {
|
||||
let config_from_deserialization: WindowConfig = serde_json::from_str("{}").unwrap();
|
||||
let config_from_default: WindowConfig = WindowConfig::default();
|
||||
|
||||
assert_eq!(config_from_deserialization, config_from_default);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user