Remove Option from HiDpiFactorChanged in favor of a bare PhysicalSize (#1346)

* Remove Option from HiDpiFactorChanged in favor of a bare PhysicalSize

* Fix macos and ios builds
This commit is contained in:
Osspial 2020-01-03 00:28:41 -05:00
parent 777d9edeaa
commit 55166da437
6 changed files with 40 additions and 41 deletions

View file

@ -861,8 +861,8 @@ fn handle_hidpi_proxy(
hidpi_factor: f64,
window_id: id,
) {
let size = suggested_size.to_physical(hidpi_factor);
let new_inner_size = &mut Some(size);
let mut size = suggested_size.to_physical(hidpi_factor);
let new_inner_size = &mut size;
let event = Event::WindowEvent {
window_id: RootWindowId(window_id.into()),
event: WindowEvent::HiDpiFactorChanged {
@ -872,13 +872,12 @@ fn handle_hidpi_proxy(
};
event_handler.handle_nonuser_event(event, &mut control_flow);
let (view, screen_frame) = get_view_and_screen_frame(window_id);
if let Some(physical_size) = new_inner_size {
let logical_size = physical_size.to_logical(hidpi_factor);
let size = CGSize::new(logical_size);
let new_frame: CGRect = CGRect::new(screen_frame.origin, size);
unsafe {
let () = msg_send![view, setFrame: new_frame];
}
let physical_size = *new_inner_size;
let logical_size = physical_size.to_logical(hidpi_factor);
let size = CGSize::new(logical_size);
let new_frame: CGRect = CGRect::new(screen_frame.origin, size);
unsafe {
let () = msg_send![view, setFrame: new_frame];
}
}