Share NSView between processes
Share NSView between processes
- Subject: Share NSView between processes
- From: Zak Nelson <email@hidden>
- Date: Wed, 19 Sep 2012 19:05:56 -0700
- Acceptlanguage: en, en-US
- Thread-topic: Share NSView between processes
At a high level, I'd like to share an NSView between processes. On Windows, you can share HWNDs across the process boundary, but on mac this doesn't seem possible (http://stackoverflow.com/questions/583202/mac-os-x-can-one-process-render-to-another-processs-window). To get around this, I'm hiding my subprocess' view and using the IOSurface APIs (http://developer.apple.com/library/mac/#documentation/Miscellaneous/Reference/IOSurfaceAPI_header_reference/Reference/reference.html) to get the bitmap back into the parent process.
I've had some success with this approach and it seems performant enough. The problem I'm having now is in sending mouse events to the subprocess' view. Calling [NSApp sendEvent] from the subprocess, the events don't arrive, which I guess is because the application is not in the foreground. I've also tried using CGEventPost which requires the view to be visible and the API moves the mouse, two non-starters. Based on this research it appears impossible to send mouse events to views without key focus.
The next approach I've been considering, which is even more outlandish than my current setup, is to overlay the subprocess' window on top of parent's window. There are a number of edge cases I'm not keen on handling, and that's assuming it's efficient enough to not look terrible.
So at this stage I thought I'd take a step back and seek help. Do my assumptions look valid? Is there perhaps an alternative approach?
Thanks for any help.
Zak
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden