diff --git a/Cargo.lock b/Cargo.lock index d01d1f766..0149641e7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1319,7 +1319,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c" dependencies = [ "lazy_static", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -1972,7 +1972,7 @@ dependencies = [ "libc", "option-ext", "redox_users 0.5.0", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -5839,7 +5839,7 @@ dependencies = [ "aes-gcm", "aes-kw", "argon2", - "base64 0.21.7", + "base64 0.22.1", "bitfield", "block-padding", "blowfish", @@ -8849,9 +8849,9 @@ dependencies = [ [[package]] name = "tauri-plugin-log" -version = "2.7.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61c1438bc7662acd16d508c919b3c087efd63669a4c75625dff829b1c75975ec" +checksum = "d5709c792b8630290b5d9811a1f8fe983dd925fc87c7fc7f4923616458cd00b6" dependencies = [ "android_logger", "byte-unit", @@ -10344,7 +10344,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -10976,7 +10976,7 @@ checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" [[package]] name = "wry" -version = "0.53.5" +version = "0.53.4" dependencies = [ "base64 0.22.1", "block2 0.6.0", diff --git a/crates/tauri-cli/config.schema.json b/crates/tauri-cli/config.schema.json index f884489b7..3deb2e340 100644 --- a/crates/tauri-cli/config.schema.json +++ b/crates/tauri-cli/config.schema.json @@ -280,13 +280,19 @@ "width": { "description": "The window width.", "default": 800.0, - "type": "number", + "type": [ + "number", + "null" + ], "format": "double" }, "height": { "description": "The window height.", "default": 600.0, - "type": "number", + "type": [ + "number", + "null" + ], "format": "double" }, "minWidth": { diff --git a/crates/tauri-runtime-wry/src/lib.rs b/crates/tauri-runtime-wry/src/lib.rs index 7532208e9..70f0a0a7b 100644 --- a/crates/tauri-runtime-wry/src/lib.rs +++ b/crates/tauri-runtime-wry/src/lib.rs @@ -890,9 +890,12 @@ impl WindowBuilder for WindowBuilderWrapper { } } + if let (Some(width), Some(height)) = (config.width, config.height) { + window = window.inner_size(width, height); + } + window = window .title(config.title.to_string()) - .inner_size(config.width, config.height) .focused(config.focus) .focusable(config.focusable) .visible(config.visible) diff --git a/crates/tauri-schema-generator/schemas/config.schema.json b/crates/tauri-schema-generator/schemas/config.schema.json index f884489b7..3deb2e340 100644 --- a/crates/tauri-schema-generator/schemas/config.schema.json +++ b/crates/tauri-schema-generator/schemas/config.schema.json @@ -280,13 +280,19 @@ "width": { "description": "The window width.", "default": 800.0, - "type": "number", + "type": [ + "number", + "null" + ], "format": "double" }, "height": { "description": "The window height.", "default": 600.0, - "type": "number", + "type": [ + "number", + "null" + ], "format": "double" }, "minWidth": { diff --git a/crates/tauri-utils/src/config.rs b/crates/tauri-utils/src/config.rs index 30b2377b7..477da33af 100644 --- a/crates/tauri-utils/src/config.rs +++ b/crates/tauri-utils/src/config.rs @@ -1694,10 +1694,10 @@ pub struct WindowConfig { pub y: Option, /// The window width. #[serde(default = "default_width")] - pub width: f64, + pub width: Option, /// The window height. #[serde(default = "default_height")] - pub height: f64, + pub height: Option, /// The min window width. #[serde(alias = "min-width")] pub min_width: Option, @@ -2083,12 +2083,20 @@ fn default_window_label() -> String { "main".to_string() } -fn default_width() -> f64 { - 800f64 +fn default_width() -> Option { + if cfg!(any(target_os = "ios", target_os = "android")) { + None + } else { + Some(800.) + } } -fn default_height() -> f64 { - 600f64 +fn default_height() -> Option { + if cfg!(any(target_os = "ios", target_os = "android")) { + None + } else { + Some(600.) + } } fn default_title() -> String { @@ -3563,8 +3571,8 @@ mod build { let center = self.center; let x = opt_lit(self.x.as_ref()); let y = opt_lit(self.y.as_ref()); - let width = self.width; - let height = self.height; + let width = opt_lit(self.width.as_ref()); + let height = opt_lit(self.height.as_ref()); let min_width = opt_lit(self.min_width.as_ref()); let min_height = opt_lit(self.min_height.as_ref()); let max_width = opt_lit(self.max_width.as_ref()); diff --git a/crates/tauri/src/webview/plugin.rs b/crates/tauri/src/webview/plugin.rs index c4d14c7d4..dce13e4c3 100644 --- a/crates/tauri/src/webview/plugin.rs +++ b/crates/tauri/src/webview/plugin.rs @@ -150,8 +150,8 @@ mod desktop_commands { let x = options.x.context("missing parameter `options.x`")?; let y = options.y.context("missing parameter `options.y`")?; - let width = options.width; - let height = options.height; + let width = options.width.unwrap_or(800.); + let height = options.height.unwrap_or(600.); let builder = crate::webview::WebviewBuilder::from_config(&options);