Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to get window/view reference with NSAPI on Mac OS X 10.6 [Snow Leopard]

4 views
Skip to first unread message

Doug Hill

unread,
Jul 17, 2009, 11:43:16 AM7/17/09
to
Let me rephrase the subject line. What I mean to ask is this:

If NPDrawingModelQuickDraw and NPEventModelCarbon are not
available :-) how does one get a reference to the window or NSView
that a plugin is contained in?

With the Carbon event model, the "window" field of the NPWindow passed
via SetWindow contains a WindowRef which is sufficient to draw and
attach Drag Manager handlers.

However, after reading the docs and looking at the Moz. code, if the
event model is NPEventModelCocoa the "window" field is always NULL.
This seems to be because that drawing now takes places via the new
Cocoa "draw" event which provides the CGContextRef. However, this
seems to ignore the need to access the window for things other than
drawing.

Please, plugin gurus, tell me how I can get access to the appropriate
Cocoa objects.

Thanks for any help you can provide.

-doug

ps. It seems that none of the sample code currently out there handles
the case where QD and Carbon are not available. Most still use the
Carbon event model.

pps. I have the same issue with a NSAPI plugin running under WebKit/
Safari. However, in this case I can cheat and use the instance->ndata
which is actually the NSView* I need. I understand this is likely to
break so if there's a WebKit developer reading this I'd like to pose
the same question to you guys. Using the WebKit API is trivial to
get what I need but that's not cross-browser and I need to avoid two
plugins at all cost.


0 new messages