|
View:
New views
7 Messages
—
Rating Filter:
Alert me
|
|
|
Embeding a NSView/HICocoaViewHi, 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! Thank you,
KaKaRoTo
------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Tcl-mac mailing list tcl-mac@... https://lists.sourceforge.net/lists/listinfo/tcl-mac |
|
|
Re: Embeding a NSView/HICocoaViewOn 7/28/09 2:18 PM, Youness Alaoui wrote:
> Hi, > 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! > Thank you, > KaKaRoTo > KaKaRoTo, Were you aware that Daniel Steffen has backported Tk 8.5 to Cocoa? It's hosted here: http://github.com/das/tcltk/tree/de-carbon-8-5 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. --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Tcl-mac mailing list tcl-mac@... https://lists.sourceforge.net/lists/listinfo/tcl-mac |
|
|
Re: Embeding a NSView/HICocoaViewOn Tue, Jul 28, 2009 at 6:13 PM, Kevin Walzer <kw@...> wrote:
Hi Kevin, 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) etc... 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! :) KaKaRoTo
------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Tcl-mac mailing list tcl-mac@... https://lists.sourceforge.net/lists/listinfo/tcl-mac |
|
|
Re: Embeding a NSView/HICocoaViewStill noone with an answer for me ? How can I embed a window (NSview/HICocoaView) inside a frame from TkAqua ? please... ? On Tue, Jul 28, 2009 at 6:48 PM, Youness Alaoui <kakaroto@...> wrote:
------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Tcl-mac mailing list tcl-mac@... https://lists.sourceforge.net/lists/listinfo/tcl-mac |
|
|
Re: Embeding a NSView/HICocoaViewOn 2009-07-30, at 12:48:35, Youness Alaoui wrote:
> Still noone with an answer for me ? How can I embed a window (NSview/ > HICocoaView) inside a frame from TkAqua ? > please... ? I don't know much about TkAqua but guess that you're probably going to have to create a separate Carbon or Cocoa application with the LSUIElement set in its Info.plist so as to give the illusion that the window containing the NSView belongs to your app. A HICocoaView/NSView is going to require Objective-C AppKit and I think that will be difficult to mix in with the Tk runtime. You can communicate to your Tk app by using CFUserNotifications or AppleEvents (perhaps by receiving them in an extension). The best example I can think of to introduce you to what kinds of things are required to keep Cocoa things at arms length from Carbon is to be found in /Developer/Examples/WebKit/CarbonWeb. You will see that it translates Cocoa actions to Carbon events and these are sent back to the Carbon runtime. Carbon Events can be wrapped in AppleEvents to communicate with your Tk app or you could bypass the Carbon Event wrapper and use custom AppleEvents directly. A Cocoa application can be made minimally scriptable very easily and this should be enough to communicate from Tk to it. I believe that AppleEvents will be faster than CFUserNotifications for this purpose because they are targeted directly at an application whereas notifications are broadcast all over the place (hoping that someone has subscribed to them). Philip Aker echo astwta@...@nl | tr a-z@. p-za-o.@ Democracy: Two wolves and a sheep voting on lunch. ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Tcl-mac mailing list tcl-mac@... https://lists.sourceforge.net/lists/listinfo/tcl-mac |
|
|
Re: Embeding a NSView/HICocoaViewHi, Just an update here.. I looked through Tk's code as well as tclCarbon's extension which seems to need the WindowRef for ProcessHICommand, and it does this : Tk_Window tkwin = Tk_NameToWindow(interp,toplevel,Tk_MainWindow(interp)); WindowRef window = GetWindowFromPort( ((TkWindowPrivate*)Tk_WindowId(tkwin))->grafPtr); with TkWindowPrivate defined locally as : typedef struct TkWindowPrivate { Tk_Window *winPtr; CGrafPtr grafPtr; } TkWindowPrivate; so it gets the CGrafPtr and uses GetWindowFromPort to get a WindowRef.. from there, I suppose I have enough info to do what I need... I've seen that I could do something like this :
HIViewRef view; status = HIViewFindByID(HIViewGetRoot(windowRef), kContainerControlID, &view); and then I'd get the HIViewRef of my window, which I can just create a HICocoaView with that view and it should work...
However, I just realized that HICocoaView is only available in Mac OS X 10.5, so I can't use that, since we want to keep support for 10.4... Using Tk Cocoa is the same problem since we need 10.4 support...
I've posted this info in case someone else needs to know and can stumble on it in the ML archives... KaKaRoTo
On Thu, Jul 30, 2009 at 3:48 PM, Youness Alaoui <kakaroto@...> wrote:
------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Tcl-mac mailing list tcl-mac@... https://lists.sourceforge.net/lists/listinfo/tcl-mac |
|
|
Re: Embeding a NSView/HICocoaViewOn Fri, Jul 31, 2009 at 10:13 AM, Philip Aker <philip.aker@...> wrote:
Hi, Thanks Philip for the answer, but.. unfortunately, I can't do that.. this has to stay in the same process because it's a Tcl extension that uses gstreamer and it can't be detached... I also don't like the idea of having an external application communicate with aMSN...
Now what I'll try to do is to create a standalone NSWindow to hold my NSView and leave the window standalone instead of being embeded inside a frame in my UI... it's the only solution I have at this point...
My problem remains with mixing the Cocoa event loop with Tk's event loop... :( KaKaRoTo
------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Tcl-mac mailing list tcl-mac@... https://lists.sourceforge.net/lists/listinfo/tcl-mac |
| Free embeddable forum powered by Nabble | Forum Help |