NPAPI:ExtendedXEventModel: Difference between revisions
(6 intermediate revisions by the same user not shown) | |||
Line 11: | Line 11: | ||
= Overview = | = Overview = | ||
The default X event model simply sends a native X event as the argument to NPP_HandleEvent. | 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 = | = NPEventModelX = | ||
As | As NPEventModelExtendedX will be the first alternative to the default X event model, we'll designate the original model: | ||
* NPEventModelX (NPEventModel = 2) | * 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: | For documentation on negotiating drawing models, see [[NPAPI:Models]]. The event model variables for extended X events are: | ||
* NPEventModelExtendedX (NPEventModel = 3) | * NPEventModelExtendedX (NPEventModel = 3) | ||
* NPNVsupportsExtendedXEventsBool (NPNVariable = | * NPNVsupportsExtendedXEventsBool (NPNVariable = 3003) | ||
= Event Structure = | = Event Structure = | ||
typedef enum { | typedef enum { | ||
NPXEventTypeXEvent = 0, /* event is native X event */ | |||
NPXEventTypeDrawImage = 1 /* used with NPDrawingModelDrawImage */ | NPXEventTypeDrawImage = 1 /* used with NPDrawingModelDrawImage */ | ||
/* this can be extended */ | |||
} NPXEventType; | } NPXEventType; | ||
Line 38: | 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.