If you say that there's an similar API on Linux for X11, then that's the same methodology across platforms.
BUT there are standardized protocols/APIs for screen sharing including screen sharing of just a window. And you won't get far without using them so also no reason to scan processes.