mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-09-30 06:58:38 +00:00
macos: non-native fs keeps track of screen number for change screen comp
Fixes #2370 Comparing NSScreens directly was fragile. It appears that AppKit/Cocoa can return different instances of NSScreen for the same screen for unknown reasons between calls to windowDidChangeScreen. I don't fully understand why this happens. In any case, our comparison was not safe. Instad, we now keep track of of the CGDirectDisplayID for each screen and compare those instead.
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
import Cocoa
|
||||
|
||||
extension NSScreen {
|
||||
/// The unique CoreGraphics display ID for this screen.
|
||||
var displayID: UInt32? {
|
||||
deviceDescription[NSDeviceDescriptionKey("NSScreenNumber")] as? UInt32
|
||||
}
|
||||
|
||||
// Returns true if the given screen has a visible dock. This isn't
|
||||
// point-in-time visible, this is true if the dock is always visible
|
||||
// AND present on this screen.
|
||||
|
Reference in New Issue
Block a user