mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-01 03:02:28 +03:00
fix: center and focus not being allowed in config (#2199)
This commit is contained in:
parent
d0f34a3784
commit
bc2c331dec
7
.changes/fix-window-config-center-focus.md
Normal file
7
.changes/fix-window-config-center-focus.md
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
---
|
||||
"cli.rs": patch
|
||||
"tauri-runtime-wry": patch
|
||||
---
|
||||
|
||||
Fixes `center` and `focus` not being allowed in `tauri.conf.json > tauri > windows` and ignored in `WindowBuilderWrapper`.
|
@ -442,6 +442,10 @@ impl WindowBuilder for WindowBuilderWrapper {
|
||||
window = window.position(x, y);
|
||||
}
|
||||
|
||||
if config.center {
|
||||
window = window.center();
|
||||
}
|
||||
|
||||
if config.focus {
|
||||
window = window.focus();
|
||||
}
|
||||
|
@ -268,6 +268,9 @@ pub struct WindowConfig {
|
||||
/// Disabling it is required to use drag and drop on the frontend on Windows.
|
||||
#[serde(default = "default_file_drop_enabled")]
|
||||
pub file_drop_enabled: bool,
|
||||
/// Whether or not the window starts centered or not.
|
||||
#[serde(default)]
|
||||
pub center: bool,
|
||||
/// The horizontal position of the window's top left corner
|
||||
pub x: Option<f64>,
|
||||
/// The vertical position of the window's top left corner
|
||||
@ -292,6 +295,9 @@ pub struct WindowConfig {
|
||||
/// Whether the window starts as fullscreen or not.
|
||||
#[serde(default)]
|
||||
pub fullscreen: bool,
|
||||
/// Whether the window will be initially hidden or focused.
|
||||
#[serde(default = "default_focus")]
|
||||
pub focus: bool,
|
||||
/// Whether the window is transparent or not.
|
||||
#[serde(default)]
|
||||
pub transparent: bool,
|
||||
@ -312,6 +318,10 @@ pub struct WindowConfig {
|
||||
pub skip_taskbar: bool,
|
||||
}
|
||||
|
||||
fn default_focus() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn default_visible() -> bool {
|
||||
true
|
||||
}
|
||||
|
@ -1099,6 +1099,11 @@
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"center": {
|
||||
"description": "Whether or not the window starts centered or not.",
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"decorations": {
|
||||
"description": "Whether the window should have borders and bars.",
|
||||
"default": true,
|
||||
@ -1109,6 +1114,11 @@
|
||||
"default": true,
|
||||
"type": "boolean"
|
||||
},
|
||||
"focus": {
|
||||
"description": "Whether the window will be initially hidden or focused.",
|
||||
"default": true,
|
||||
"type": "boolean"
|
||||
},
|
||||
"fullscreen": {
|
||||
"description": "Whether the window starts as fullscreen or not.",
|
||||
"default": false,
|
||||
|
Loading…
Reference in New Issue
Block a user