From ea0cd5367dab8e7fe4584bf2a8c32e70e9117447 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Tue, 26 Mar 2024 17:05:24 +0100 Subject: [PATCH] Fix resizing on Windows not triggering an event (#166) Resizing should trigger a baseview resize event, but because we already set the new size here the `WM_SIZE` event was ignored. Co-authored-by: Micah Johnston --- src/win/window.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/win/window.rs b/src/win/window.rs index b0b72cb..8e1ad40 100644 --- a/src/win/window.rs +++ b/src/win/window.rs @@ -509,17 +509,14 @@ impl WindowState { self.handler.borrow_mut() } - /// Handle a deferred task as described in [`Self::deferred_tasks + /// Handle a deferred task as described in [`Self::deferred_tasks`]. pub(self) fn handle_deferred_task(&self, task: WindowTask) { match task { WindowTask::Resize(size) => { - let window_info = { - let mut window_info = self.window_info.borrow_mut(); - let scaling = window_info.scale(); - *window_info = WindowInfo::from_logical_size(size, scaling); - - *window_info - }; + // `self.window_info` will be modified in response to the `WM_SIZE` event that + // follows the `SetWindowPos()` call + let scaling = self.window_info.borrow().scale(); + let window_info = WindowInfo::from_logical_size(size, scaling); // If the window is a standalone window then the size needs to include the window // decorations