diff --git a/packages/cli/src/build/builder.rs b/packages/cli/src/build/builder.rs index b7a97f539..08f208276 100644 --- a/packages/cli/src/build/builder.rs +++ b/packages/cli/src/build/builder.rs @@ -570,7 +570,7 @@ impl AppBuilder { #[cfg(windows)] { _ = Command::new("taskkill") - .args(["/F", "/PID", &pid.to_string()]) + .args(["/PID", &pid.to_string()]) .spawn(); } diff --git a/packages/desktop/src/app.rs b/packages/desktop/src/app.rs index 361551897..8037fbea8 100644 --- a/packages/desktop/src/app.rs +++ b/packages/desktop/src/app.rs @@ -532,19 +532,25 @@ impl App { let Ok(position) = window.outer_position() else { return; }; + let (x, y) = if cfg!(target_os = "macos") { + let position = position.to_logical::(window.scale_factor()); + (position.x, position.y) + } else { + (position.x, position.y) + }; - let size = window.outer_size(); - - let x = position.x; - let y = position.y; - - // This is to work around a bug in how tao handles inner_size on macOS - // We *want* to use inner_size, but that's currently broken, so we use outer_size instead and then an adjustment - // - // https://github.com/tauri-apps/tao/issues/889 - let adjustment = match window.is_decorated() { - true if cfg!(target_os = "macos") => 56, - _ => 0, + let (width, height) = if cfg!(target_os = "macos") { + let size = window.outer_size(); + let size = size.to_logical::(window.scale_factor()); + // This is to work around a bug in how tao handles inner_size on macOS + // We *want* to use inner_size, but that's currently broken, so we use outer_size instead and then an adjustment + // + // https://github.com/tauri-apps/tao/issues/889 + let adjustment = if window.is_decorated() { 28 } else { 0 }; + (size.width, size.height.saturating_sub(adjustment)) + } else { + let size = window.inner_size(); + (size.width, size.height) }; let Some(monitor_name) = monitor.name() else { @@ -561,8 +567,8 @@ impl App { let state = PreservedWindowState { x, y, - width: size.width.max(200), - height: size.height.saturating_sub(adjustment).max(200), + width: width.max(200), + height: height.max(200), monitor: monitor_name.to_string(), url: Some(url), }; @@ -599,14 +605,24 @@ impl App { // Only set the outer position if it wasn't explicitly set if explicit_window_position.is_none() { - window.set_outer_position(tao::dpi::PhysicalPosition::new( - position.0, position.1, - )); + if cfg!(target_os = "macos") { + window.set_outer_position(tao::dpi::LogicalPosition::new( + position.0, position.1, + )); + } else { + window.set_outer_position(tao::dpi::PhysicalPosition::new( + position.0, position.1, + )); + } } // Only set the inner size if it wasn't explicitly set if explicit_inner_size.is_none() { - window.set_inner_size(tao::dpi::PhysicalSize::new(size.0, size.1)); + if cfg!(target_os = "macos") { + window.set_inner_size(tao::dpi::LogicalSize::new(size.0, size.1)); + } else { + window.set_inner_size(tao::dpi::PhysicalSize::new(size.0, size.1)); + } } // Set the url if it exists