How can a window be visible but not in the onscreen list?

I'm looking at a case where a handler for NSWindowDidBecomeMain gets the NSWindow* from the notification object and verifies that window.isVisible == YES, window.windowNumber > 0 and window.screen != nil. However, window.windowNumber is missing from the array [NSWindow windowNumbersWithOptions: NSWindowNumberListAllSpaces] and from CGWindowListCopyWindowInfo( kCGWindowListOptionOnScreenOnly, kCGNullWindowID ), how can that be?

The window number is in the array returned by CGWindowListCopyWindowInfo( kCGWindowListOptionAll, kCGNullWindowID ).

I'm seeing this issue in macOS 15, maybe 14, but not 13.

Answered by DTS Engineer in 812206022

Looking at the documentation for window numbers it does not specify a case where these would be missing. Ostensibly, I might expect that behavior if you specify 0 for the NSWindowNumberListOptions because of the comment in the overview on this page, but in your code you're using a non-zero value. Maybe there's something else going on here.

Our engineering teams need to investigate this issue, as resolution may involve changes to Apple's software. I'd greatly appreciate it if you could open a bug report, include a small Xcode project and some directions that can be used to reproduce the problem, and post the FB number here once you do.

Bug Reporting: How and Why? has tips on creating your bug report.

Looking at the documentation for window numbers it does not specify a case where these would be missing. Ostensibly, I might expect that behavior if you specify 0 for the NSWindowNumberListOptions because of the comment in the overview on this page, but in your code you're using a non-zero value. Maybe there's something else going on here.

Our engineering teams need to investigate this issue, as resolution may involve changes to Apple's software. I'd greatly appreciate it if you could open a bug report, include a small Xcode project and some directions that can be used to reproduce the problem, and post the FB number here once you do.

Bug Reporting: How and Why? has tips on creating your bug report.

Bug report submitted, FB15657061

How can a window be visible but not in the onscreen list?
 
 
Q