diff --git a/.changes/fix-inner-size.md b/.changes/fix-inner-size.md new file mode 100644 index 000000000..83d2191bf --- /dev/null +++ b/.changes/fix-inner-size.md @@ -0,0 +1,5 @@ +--- +"tauri-runtime-wry": patch:bug +--- + +Fix window inner size evaluation on macOS. diff --git a/core/tauri-runtime-wry/src/lib.rs b/core/tauri-runtime-wry/src/lib.rs index 65f71768f..d8ec4bbc9 100644 --- a/core/tauri-runtime-wry/src/lib.rs +++ b/core/tauri-runtime-wry/src/lib.rs @@ -436,14 +436,12 @@ impl WindowEventWrapper { // because wry replaces the NSView TaoWindowEvent::Resized(_) => { if let Some(w) = &window.inner { - Self(Some(WindowEvent::Resized( - PhysicalSizeWrapper(inner_size( - w, - &window.webviews, - window.has_children.load(Ordering::Relaxed), - )) - .into(), - ))) + let size = inner_size( + w, + &window.webviews, + window.has_children.load(Ordering::Relaxed), + ); + Self(Some(WindowEvent::Resized(PhysicalSizeWrapper(size).into()))) } else { Self(None) } @@ -3915,7 +3913,7 @@ fn inner_size( webviews: &[WebviewWrapper], has_children: bool, ) -> TaoPhysicalSize { - if has_children && webviews.len() == 1 { + if !has_children { use wry::WebViewExtMacOS; let webview = webviews.first().unwrap(); let view_frame = unsafe { cocoa::appkit::NSView::frame(webview.webview()) }; diff --git a/core/tauri-utils/src/platform/starting_binary.rs b/core/tauri-utils/src/platform/starting_binary.rs index bfcecc60a..226d2f8d0 100644 --- a/core/tauri-utils/src/platform/starting_binary.rs +++ b/core/tauri-utils/src/platform/starting_binary.rs @@ -41,6 +41,8 @@ impl StartingBinary { /// /// Because [`Error`] is not clone-able, it is recreated instead. pub(super) fn cloned(&self) -> Result { + // false positive + #[allow(clippy::useless_asref)] self .0 .as_ref() diff --git a/core/tauri/src/resources/mod.rs b/core/tauri/src/resources/mod.rs index 5023395b4..63dcd6ae5 100644 --- a/core/tauri/src/resources/mod.rs +++ b/core/tauri/src/resources/mod.rs @@ -127,7 +127,7 @@ impl ResourceTable { .index .get(&rid) .and_then(|rc| rc.downcast_arc::()) - .map(Clone::clone) + .cloned() .ok_or_else(|| Error::BadResourceId(rid)) } @@ -137,7 +137,7 @@ impl ResourceTable { self .index .get(&rid) - .map(Clone::clone) + .cloned() .ok_or_else(|| Error::BadResourceId(rid)) }