Currently, you would need to create your own nsIWidget and then call its Create method with the WindowRef for your application window. Once you have done that, you pass in your nsIWidget into nsIBaseWindow->InitWindow. However, there is a patch for Mac embedding that will allow you to pass in the WindowRef of the application window into nsIBaseWindow->InitWindow rather than creating an nsIWidget.

You can find the patch here:

http://bugzilla.mozilla.org/show_bug.cgi?id=161623 (see the second attachment for the patch)

However, the patch has been there for quite some time and it may need some manual tweaking to apply it. I'm not sure why this code has not been integrated into Mozilla yet, as passing the application window's native handle into nsIBaseWindow->InitWindow is standard behavior for other platforms, and it's more complicated to have to create an nsIWidget only on Mac.

Kevin

On Thursday, May 29, 2003, at 07:34 AM, Kentucky wrote:

What type of native handle should be passed to the XPCOM call
nsIBaseWindow->InitWindow(?,...) on the Mac?

The PowerPlant PPEmbed sample contains this line in CBrowserShell.cpp

mWebBrowserAsBaseWin->InitWindow(aWidget- >GetNativeData(NS_NATIVE_WIDGET),
nsnull, r.x, r.y, r.width, r.height);


The aWidget is created in 'EnsureTopLevelWidget':
nsCOMPtr<nsIWidget> newWidget(do_CreateInstance(kWindowCID, &rv));
...
rv = newWidget->Create(GetMacWindow(), r, nsnull, nsnull, nsnull,
nsnull, nsnull);

But it's still not clear which kind of handle I could pass on my own
app? Can I use the handle of an existing application window, not
created through do_CreateInstance(kWindowCID, &rv)) ?

Chris





Reply via email to