On Tue, Jul 28, 2009 at 6:13 PM, Kevin Walzer <firstname.lastname@example.org>
On 7/28/09 2:18 PM, Youness Alaoui wrote:
I'm new to this list.. I'm now the new mac maintainer for the aMSN
software (unfortunately, I'm taking Tom Hennigan's place as he can't
work on amsn right now)... so... I just bought a Macbook this week and
I've started learning about all this mac world stuff...
Anyways, so here's my issue :
I'm working on the audio/video conferencing feature of aMSN and we're
using gstreamer for all our processing. Gstreamer has a osxvideosink
element which acts as a sink for our video. However, that element sends
us a NSView (through a signal on the gstreamer bus) that we need to
embed in our application...
Now I know that NSView is Cocoa and TkAqua is Carbon (and I know, it's
been ported to Cocoa, but we support/ship 8.5 with aMSN), but I've found
out that we can embed a Cocoa view into a Carbon application using the
HICocoaView... now my question is :
How can I create a HICocoaView and how can I embed it inside a Tk frame ?
I know about [winfo id $w] but the man page says "On the Macintosh the
value has no meaning outside Tk." so, how am I supposed to create a
HICocoaView and have it embed inside a Tk window ? Is there some C API I
can call to get what I need ?
I have complete zero knowledge of how the Carbon/Cocoa APIs work, so i'm
gonna be learning this, so if you have any tips to give at the same time
with regards to this, I would be greatful!
Were you aware that Daniel Steffen has backported Tk 8.5 to Cocoa? It's hosted here:
This is an unofficial branch that won't go into the mainstream of Tk (that's for 8.6), but I'm developing my own apps against this branch. I've successfully built 64-bit versions of all the Tk extensions that I use (including TkCximage :-)), and I can take advantage of the new Cocoa-specific features.
I'm sure trying to figure out how to embed an NSView directly into Tk-Cocoa would be far simpler than trying to add the HICocoaView stuff to the mix.
The drawback, of course, is that even Tk-Cocoa 8.5 only supports Leopard...so if you want to continue Tiger support, you will have to go the Carbon route.
Yes, I am aware of the Tk 8.5 backport and I'm also waiting to get some free time to read this : http://www.codebykevin.com/blosxom.cgi/2009/07/19
and I've noted from your email that you said "It hasn't been a seamless transition" (someone forwarded that email to me since I wasn't registered to tcl-mac yet) so i've decided to hold the cocoa transition for now...
But anyways, we do plan on keeping Tiger support (as well as 10.3.9 for now) so we'll be going the Carbon route.. But as far as I know, it wouldn't make much difference to create a NSView or to create a HICocoaView, it's all the same, the important part is being able to access the UI Views from Tk... right now the window id is useless but I need some way to do something like this :
TkWindow * win= Tk_GetWindow(".whatever");
HIView *view = Tk_WindowToHIView(win)
that's the real show stopper right now.. in windows you can get a HWND that you can use, and on X, you get the real X identifier, on Mac it's harder... :(
So, if someone could point me in the right direction.. I'll have to dig into the Tk code to look into this but since i'm a complete newbie at the Carbon API, and I'm not so used to the Tk internals, if someone already knows the answer, I'd be grateful if they shared their knowledge!
By the way, you use TkCximage? I didn't know it was used by anyone outside aMSN, nice to know! :)
Code by Kevin