NPAPI:ExtendedXEventModel: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
 
Line 40: Line 40:
     void *event;
     void *event;
   } NPExtendedXEvent;
   } NPExtendedXEvent;
The events that the browser actually sends will depend on the associated drawing model. For example, if a plugin were to select NPEventModelExtendedX and not  NPDrawingModelDrawImage, then the plugin would simply receive the same events as in NPEventModelX but wrapped in the NPEventModelExtendedX structure and of type NPXEventTypeXEvent.

Latest revision as of 19:03, 27 April 2010

Status

Under consideration.

Contributors

  • Last modified: April 27, 2010
  • Authors: Oleg Romashin (Nokia), Josh Aas (Mozilla)
  • Contributors:

Overview

The default X event model simply sends a native X event as the argument to NPP_HandleEvent. The extended X event model sends a struct with an event type and an event pointer to allow for events that are not native X events.

NPEventModelX

As NPEventModelExtendedX will be the first alternative to the default X event model, we'll designate the original model:

  • NPEventModelX (NPEventModel = 2)
  • NPNVsupportsXEventsBool (NPNVariable = 3002)

NPEventModelExtendedX

For documentation on negotiating drawing models, see NPAPI:Models. The event model variables for extended X events are:

  • NPEventModelExtendedX (NPEventModel = 3)
  • NPNVsupportsExtendedXEventsBool (NPNVariable = 3003)

Event Structure

 typedef enum {
   NPXEventTypeXEvent = 0, /* event is native X event */
   NPXEventTypeDrawImage = 1 /* used with NPDrawingModelDrawImage */
   /* this can be extended */
 } NPXEventType;
 
 typedef struct _NPExtendedXEvent
 {
   NPXEventType type;
   void *event;
 } NPExtendedXEvent;

The events that the browser actually sends will depend on the associated drawing model. For example, if a plugin were to select NPEventModelExtendedX and not NPDrawingModelDrawImage, then the plugin would simply receive the same events as in NPEventModelX but wrapped in the NPEventModelExtendedX structure and of type NPXEventTypeXEvent.