Reputation: 1345
I mean all the windows which belong to my application (process). I need to get something like (NSWindow *) for all of them. Notice, some windows were created by third-party plug-ins and are not accessible by [NSApp windows]. Yes, I know, Quartz Window Services can return all the windows by PID. But how can I get NSWindow by CGWindowID then? Thanks!
Upvotes: 1
Views: 3001
Reputation: 1345
Usually NSWindowList()
will give window ids. Also there're Quartz Window Services to help.
NSWindow*
(Cocoa) there's [NSApp windowWithWindowNumber: (NSInteger)windowID]
method.WindowRef
(Carbon) there's HIWindowFromCGWindowID()
function.If both of the above do not work, that means the window was created with CoreGraphics Private API. Its definition is available thanks to reverse engineering.
Concerning X11 windows on Mac, they are created with Xplugin library (by Xquartz) which is closed source and also uses CoreGraphics Private API.
Upvotes: 2
Reputation: 22717
Try NSWindowList
to get window numbers, and then -[NSApplication windowWithWindowNumber:]
to get NSWindows.
Upvotes: 3