Skip to content

Commit

Permalink
Resize when size changes on scale change on macOS
Browse files Browse the repository at this point in the history
This fixes an issue where the window glitched due to resize
when the user doesn't actually change the window, but macOS
function to update window size was still called.
  • Loading branch information
BillGoldenWater authored May 23, 2024
1 parent fff6788 commit e108fa2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/changelog/unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,4 @@ changelog entry.
### Fixed

- On macOS, fix panic on exit when dropping windows outside the event loop.
- On macOS, fix window dragging glitches when dragging across a monitor boundary with different scale factor.
8 changes: 5 additions & 3 deletions src/platform_impl/macos/app_delegate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,11 @@ impl ApplicationDelegate {

let physical_size = *new_inner_size.lock().unwrap();
drop(new_inner_size);
let logical_size = physical_size.to_logical(scale_factor);
let size = NSSize::new(logical_size.width, logical_size.height);
window.setContentSize(size);
if physical_size != suggested_size {
let logical_size = physical_size.to_logical(scale_factor);
let size = NSSize::new(logical_size.width, logical_size.height);
window.setContentSize(size);
}

let resized_event = Event::WindowEvent {
window_id: RootWindowId(window.id()),
Expand Down

0 comments on commit e108fa2

Please sign in to comment.