Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

NPP_HandleEvent

« Gecko Plugin API Reference « Plug-in Side Plug-in 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: All platforms.

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
  • Unix/X11: Pointer to a standard Xlib XEvent
For a list of possible events, 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

Document Tags and Contributors

Tags: 
 Contributors to this page: teoli, Karlt, Mgjbot, Kazssym, Pmash
 Last updated by: Karlt,