mozilla

Revision 183925 of NPP_HandleEvent

  • Revision slug: NPP_HandleEvent
  • Revision title: NPP_HandleEvent
  • Revision id: 183925
  • Created:
  • Creator: Pmash
  • Is current revision? No
  • Comment migration
Tags: 

Revision Content

{{wiki.template('Np-plugin-api')}}

Summary

Delivers a platform-specific window event to the instance.

  • For Windowed Plug-ins: Currently used only on Mac OS.
  • For Windowless Plug-ins: Windows and Mac OS.

Syntax

#include <npapi.h>
 
int16 NPP_HandleEvent(NPP instance, void* event);

Parameters

The function has the following parameters:

instance
Pointer to the current plug-in instance.
event
Platform-specific value representing the event handled by the function. Values:
  • MS Windows: Pointer to NPEvent structure
  • Mac OS: Pointer to a standard Mac OS EventRecord
For a list of possible events for MS Windows and Mac OS, see NPEvent.

Returns

  • If the plug-in handles the event, the function should return true.
  • If the plug-in ignores the event, the function returns false.

Description

The browser calls NPP_HandleEvent to tell the plug-in when events take place in the plug-in's window or drawable area. The plug-in either handles or ignores the event, depending on the value given in the event parameter of this function. For a list of event types the application is responsible for delivering to the plug-in, see the NPEvent structure. MS Windows

The browser gives each windowed plug-in its own native window, often a child window of the browser window, to draw into. The plug-in has complete control over drawing and event handling within that window.

Mac OS

The browser does not give a windowed plug-in a native window, because the Mac OS platform does not support child windows. Instead, the windowed plug-in draws into the graphics port associated with the the browser window, at the offset that the browser specifies. For this reason, NPP_HandleEvent is only way the plug-in can receive events from its host application on Mac OS. When NPP_HandleEvent is called, the current port is set up so that its origin matches the top-left corner of the plug-in. A plug-in does not need to set up the current port for mouse coordinate translation.

See Also

NPEvent

Revision Source

<p>
</p><p>
{{wiki.template('Np-plugin-api')}}
</p>
<h3 name="Summary">Summary</h3>
<p>Delivers a platform-specific window event to the instance.
</p>
<ul><li> For Windowed Plug-ins: Currently used only on Mac OS.
</li><li> For Windowless Plug-ins: Windows and Mac OS.
</li></ul>
<h3 name="Syntax">Syntax</h3>
<pre>#include &lt;npapi.h&gt;
 
int16 NPP_HandleEvent(NPP instance, void* event);
</pre>
<h3 name="Parameters">Parameters</h3>
<p>The function has the following parameters:
</p>
<dl><dt>instance
</dt><dd>Pointer to the current plug-in instance.
</dd></dl>
<dl><dt>event
</dt><dd>Platform-specific value representing the event handled by the function. Values:
<ul><li> MS Windows: Pointer to NPEvent structure
</li><li> Mac OS: Pointer to a standard Mac OS EventRecord
</li></ul>
</dd><dd> For a list of possible events for MS Windows and Mac OS, see <a href="en/NPEvent">NPEvent</a>.
</dd></dl>
<h3 name="Returns">Returns</h3>
<ul><li> If the plug-in handles the event, the function should return true.
</li><li> If the plug-in ignores the event, the function returns false.
</li></ul>
<h3 name="Description">Description</h3>
<p>The browser calls <code>NPP_HandleEvent</code> to tell the plug-in when events take place in the plug-in's window or drawable area. The plug-in either handles or ignores the event, depending on the value given in the event parameter of this function. For a list of event types the application is responsible for delivering to the plug-in, see the <a href="en/NPEvent">NPEvent</a> structure.
MS Windows
</p><p>The browser gives each windowed plug-in its own native window, often a child window of the browser window, to draw into. The plug-in has complete control over drawing and event handling within that window.
</p>
<h4 name="Mac_OS">Mac OS</h4>
<p>The browser does not give a windowed plug-in a native window, because the Mac OS platform does not support child windows. Instead, the windowed plug-in draws into the graphics port associated with the the browser window, at the offset that the browser specifies. For this reason, <code>NPP_HandleEvent</code> is only way the plug-in can receive events from its host application on Mac OS. When <code>NPP_HandleEvent</code> is called, the current port is set up so that its origin matches the top-left corner of the plug-in. A plug-in does not need to set up the current port for mouse coordinate translation. 
</p>
<h3 name="See_Also">See Also</h3>
<p><a href="en/NPEvent">NPEvent</a>
</p>
Revert to this revision