From 2d43d62a8e61514ade27ae63fa33c1dee2de6744 Mon Sep 17 00:00:00 2001 From: Amr Bashir Date: Thu, 9 May 2024 20:04:27 +0300 Subject: [PATCH] fix(windows): use physical size when resizing to parent (#1254) --- .changes/windows-resize-to-parent-logical.md | 5 +++++ src/webview2/mod.rs | 5 +---- 2 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 .changes/windows-resize-to-parent-logical.md diff --git a/.changes/windows-resize-to-parent-logical.md b/.changes/windows-resize-to-parent-logical.md new file mode 100644 index 000000000..1a0b4dfb1 --- /dev/null +++ b/.changes/windows-resize-to-parent-logical.md @@ -0,0 +1,5 @@ +--- +"wry": "patch" +--- + +On Windows, fix webview having a bigger size than the actual window size after creation and until the window is resized. diff --git a/src/webview2/mod.rs b/src/webview2/mod.rs index 5cf0e43ab..fffe36401 100644 --- a/src/webview2/mod.rs +++ b/src/webview2/mod.rs @@ -1268,10 +1268,7 @@ impl InnerWebView { let width = rect.right - rect.left; let height = rect.bottom - rect.top; - self.set_bounds(Rect { - size: dpi::Size::Logical((width, height).into()), - ..Default::default() - }) + self.set_bounds_inner((width, height).into(), (0, 0).into()) } pub fn set_visible(&self, visible: bool) -> Result<()> {