Dedicated to everyone who loves low-level Window Server (CoreGraphicsPrivate.h, etc.), X11 on Mac, SIMBL and other crazy things :)
There is a simple X11 emulated Mac application (e.g. xterm, xeyes, etc.) with one window. While running, X11 somehow creates its own Quartz window to represent this emulated application, and this window is accessible through Quartz Window Services so that I can get its CSWindowID, title, position, size and owner ID (PID X11.app). But it does not support the Accessibility API, so there is no way to control it (except, perhaps, the main functions of Graph Graphs from the same process).
Now here is the task:
I need to place an additional NSView (or just draw something) in such a window. I mean my own Quartz window, which appeared as a result of X11 emulation of some application. I know that in order to manage windows on a Mac, I have to be in the same process, i.e. X11.app.
I wrote a SIMBL plugin that invaded the X11.app process.
There I can call [NSApp windows], but all the time I get exactly 2 NSWindows that have nothing to do with windows of real applications. They are not even visible on the screen.
However, when I call NSWindowList (), I get everything I need (window identifiers for X11 windows) and even more (window identifiers from other applications).
CSWindowID X11- , [NSApp windowWithWindowNumber:] (Cocoa) HIWindowFromCGWindowID() (Carbon), ! !
, , Safari ...
, :
!