mirror of
https://github.com/wez/wezterm.git
synced 2024-12-23 13:21:38 +03:00
macos: NSScreen::maximumFramesPerSecond is newish
Gate calling it to avoid a runtime failure on eg: Big Sur. refs: https://github.com/wez/wezterm/issues/2440
This commit is contained in:
parent
58eecab4f8
commit
99391e39d2
@ -165,12 +165,19 @@ fn nsscreen_to_screen_info(screen: *mut Object) -> ScreenInfo {
|
||||
frame.size.width as isize,
|
||||
frame.size.height as isize,
|
||||
);
|
||||
let max_fps: NSInteger = unsafe { msg_send!(screen, maximumFramesPerSecond) };
|
||||
let has_max_fps: objc::runtime::BOOL =
|
||||
unsafe { msg_send!(screen, respondsToSelector: sel!(maximumFramesPerSecond)) };
|
||||
let max_fps = if has_max_fps {
|
||||
let max_fps: NSInteger = unsafe { msg_send!(screen, maximumFramesPerSecond) };
|
||||
Some(max_fps as usize)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
ScreenInfo {
|
||||
name,
|
||||
rect,
|
||||
scale: 1.0,
|
||||
max_fps: Some(max_fps as usize),
|
||||
max_fps,
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user