Skip to content

Commit

Permalink
Fix resizing on Windows not triggering an event (#166)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
robbert-vdh and micahrj authored Mar 26, 2024
1 parent 65d9704 commit ea0cd53
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/win/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ea0cd53

Please sign in to comment.