mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-28 11:29:25 +00:00
Recalculate Metal layer's drawable size when window's scale factor changes
This commit is contained in:
parent
f82dda9981
commit
6f49f4a9cf
1 changed files with 9 additions and 1 deletions
|
@ -758,7 +758,15 @@ extern "C" fn view_did_change_backing_properties(this: &Object, _: Sel) {
|
|||
let mut window_state_borrow = window_state.as_ref().borrow_mut();
|
||||
|
||||
unsafe {
|
||||
let _: () = msg_send![window_state_borrow.layer, setContentsScale: window_state_borrow.scale_factor() as f64];
|
||||
let scale_factor = window_state_borrow.scale_factor() as f64;
|
||||
let size = window_state_borrow.size();
|
||||
let drawable_size: NSSize = NSSize {
|
||||
width: size.x() as f64 * scale_factor,
|
||||
height: size.y() as f64 * scale_factor,
|
||||
};
|
||||
|
||||
let _: () = msg_send![window_state_borrow.layer, setContentsScale: scale_factor];
|
||||
let _: () = msg_send![window_state_borrow.layer, setDrawableSize: drawable_size];
|
||||
}
|
||||
|
||||
if let Some(mut callback) = window_state_borrow.resize_callback.take() {
|
||||
|
|
Loading…
Reference in a new issue