size is now respected on iOS, so default to None

This commit is contained in:
Lucas Nogueira 2025-10-30 08:44:42 -03:00
parent a6020088ba
commit eb51b1329f
No known key found for this signature in database
GPG Key ID: 7C32FCA95C8C95D7
6 changed files with 45 additions and 22 deletions

14
Cargo.lock generated
View File

@ -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",

View File

@ -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": {

View File

@ -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)

View File

@ -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": {

View File

@ -1694,10 +1694,10 @@ pub struct WindowConfig {
pub y: Option<f64>,
/// The window width.
#[serde(default = "default_width")]
pub width: f64,
pub width: Option<f64>,
/// The window height.
#[serde(default = "default_height")]
pub height: f64,
pub height: Option<f64>,
/// The min window width.
#[serde(alias = "min-width")]
pub min_width: Option<f64>,
@ -2083,12 +2083,20 @@ fn default_window_label() -> String {
"main".to_string()
}
fn default_width() -> f64 {
800f64
fn default_width() -> Option<f64> {
if cfg!(any(target_os = "ios", target_os = "android")) {
None
} else {
Some(800.)
}
}
fn default_height() -> f64 {
600f64
fn default_height() -> Option<f64> {
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());

View File

@ -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);