Skip to content

Commit ea0cd53

Browse files
robbert-vdhmicahrj
andauthored
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 <micah@photophore.systems>
1 parent 65d9704 commit ea0cd53

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/win/window.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -509,17 +509,14 @@ impl WindowState {
509509
self.handler.borrow_mut()
510510
}
511511

512-
/// Handle a deferred task as described in [`Self::deferred_tasks
512+
/// Handle a deferred task as described in [`Self::deferred_tasks`].
513513
pub(self) fn handle_deferred_task(&self, task: WindowTask) {
514514
match task {
515515
WindowTask::Resize(size) => {
516-
let window_info = {
517-
let mut window_info = self.window_info.borrow_mut();
518-
let scaling = window_info.scale();
519-
*window_info = WindowInfo::from_logical_size(size, scaling);
520-
521-
*window_info
522-
};
516+
// `self.window_info` will be modified in response to the `WM_SIZE` event that
517+
// follows the `SetWindowPos()` call
518+
let scaling = self.window_info.borrow().scale();
519+
let window_info = WindowInfo::from_logical_size(size, scaling);
523520

524521
// If the window is a standalone window then the size needs to include the window
525522
// decorations

0 commit comments

Comments
 (0)