0

MacO の NPAPI は、NPWindow 構造の CGrafPtr を提供してくれます。WindowRef が必要です。CGrafPtr から WindowRef を取得する方法はありますか?

ありがとう!

4

1 に答える 1

2

NPAPI only gives you a CGrafPtr if you are using the very, very deprecated QuickDraw drawing model (with Carbon event model). Writing a new plugin using the QuickDraw model would be a terrible idea: Firefox 64-bit doesn't support it, Safari 64-bit doesn't support it, and Chrome doesn't really support it (and soon won't at all). Your plugin wouldn't work for most users.

Instead, you should be using either Core Animation (drawing) + Cocoa (event), or CoreGraphics + Cocoa. In the Cocoa event model there is, deliberately, no way to get a reference to the browser window. Modern browsers almost all run plugins in a separate process, and you can't reference windows across processes.

In short, if you are trying to make a new NPAPI plugin that requires access to the browser window, your design is wrong.

于 2012-05-23T08:41:04.323 に答える