From 9f687dc47e7639d66488c974d937d216d02f0655 Mon Sep 17 00:00:00 2001 From: Corbanator Date: Sun, 9 Jul 2023 14:01:39 -0600 Subject: [PATCH] fix(windows): fix endless resize events while minimized --- src/native/windows.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/native/windows.rs b/src/native/windows.rs index ef20b2b1..bad7b71a 100644 --- a/src/native/windows.rs +++ b/src/native/windows.rs @@ -773,14 +773,15 @@ impl WindowsDisplay { if GetClientRect(hwnd, &mut rect as *mut _ as _) != 0 { let window_width = ((rect.right - rect.left) as f32 / self.window_scale) as i32; let window_height = ((rect.bottom - rect.top) as f32 / self.window_scale) as i32; - let fb_width = (window_width as f32 * self.content_scale) as i32; - let fb_height = (window_height as f32 * self.content_scale) as i32; + + // prevent a framebuffer size of 0 when window is minimized + let fb_width = ((window_width as f32 * self.content_scale) as i32).max(1); + let fb_height = ((window_height as f32 * self.content_scale) as i32).max(1); if fb_width != self.display_data.screen_width || fb_height != self.display_data.screen_height { - // prevent a framebuffer size of 0 when window is minimized - self.display_data.screen_width = fb_width.max(1); - self.display_data.screen_height = fb_height.max(1); + self.display_data.screen_width = fb_width; + self.display_data.screen_height = fb_height; return true; } } else {