fix(tauri-runtime-wry): window inner size regression on macOS, closes #9236 (#9276)

* fix(tauri-runtime-wry): window inner size regression on macOS, closes #9236

* lint
This commit is contained in:
Lucas Fernandes Nogueira 2024-03-26 11:38:57 -03:00 committed by GitHub
parent 7898b601d1
commit e7cd973123
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 16 additions and 11 deletions

View File

@ -0,0 +1,5 @@
---
"tauri-runtime-wry": patch:bug
---
Fix window inner size evaluation on macOS.

View File

@ -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<u32> {
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()) };

View File

@ -41,6 +41,8 @@ impl StartingBinary {
///
/// Because [`Error`] is not clone-able, it is recreated instead.
pub(super) fn cloned(&self) -> Result<PathBuf> {
// false positive
#[allow(clippy::useless_asref)]
self
.0
.as_ref()

View File

@ -127,7 +127,7 @@ impl ResourceTable {
.index
.get(&rid)
.and_then(|rc| rc.downcast_arc::<T>())
.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))
}