A plugin, which works fine in firefox on windows, is being now ported to safari on Mac. we are using Xcode for development. we want a window in safari browser over which a video can be displayed. I read a code regarding NSwindow being used in NPP_SetWindow function as following:
NPError NPP_SetWindow(NPP instance, NPWindow* npWindow)
{
// Get a Cocoa window reference of the browser window
NP_CGContext* npContext = (NP_CGContext*)npWindow->window;
WindowRef window = npContext->window;
NSWindow* browserWindow = [[[NSWindow alloc] initWithWindowRef:window] autorelease];
// Get a Cocoa reference of my carbon window
// yourCarbonWindow should be replaced with the window handle of the carbon
// window that should be tied to the Safari window.
NSWindow* myWindow = [[[NSWindow alloc] initWithWindowRef:yourCarbonWindow] autorelease];
// Now create a parent child relationship
[browserWindow addChildWindow:myWindow ordered:NSWindowAbove];
}
But the problem is that npWindow->window is not carrying any value. When checked with printf, it shows 0 value, means it was not initialized or NULL.
But in Firefox it was carrying some value. Could someone please tell how to get a NSWindow in Safari or where might be the problem ? And what is this concept of Carbon window?