Use NSScreen to fetch primary display

According to Chromium source, `NSScreen::screens` should always get us
one display.

We made this change because we ran into panics caused by the previous
`unwrap()` when `CGGetActiveDisplayList` might return an empty list.
This commit is contained in:
Thorsten Ball 2024-01-16 14:23:10 +01:00
parent 03bfe3ef80
commit f938bae0a2
2 changed files with 23 additions and 2 deletions

View file

@ -484,7 +484,7 @@ impl MacWindow {
let display = options
.display_id
.and_then(|display_id| MacDisplay::all().find(|display| display.id() == display_id))
.and_then(MacDisplay::find_by_id)
.unwrap_or_else(MacDisplay::primary);
let mut target_screen = nil;