Window number too large

I'm trying to get information about my status items window. I get the window number using this call: statusItem.button?.window?.windowNumber With that number I try to determine if it visible or not.

On macOS 15, this works fine, however on macOS Tahoe the window number is bigger than UInt32 or its type alias CGWindowID, causing a crash of my app (when converting from Int to UInt32). Somehow the window numbers were always in the 32-bit space.

I can only guess about the reasons for increase of the window number beyond the UInt32 bounds. I don't know how the windows are numbered, but something may not be going as expected here.

Anyone knows if this may be due to running in a virtual machine?

Where did you get that windowNumber is UInt32 ?

Doc states:

var windowNumber: Int { get }

On 32-bit platforms, Int is the same size as Int32, and on 64-bit platforms, Int is the same size as Int64.

But never a UInt32.

Why do you need converting from Int to UInt32 ?

Window number too large
 
 
Q