89
edits
| Line 177: | Line 177: | ||
Plugins should receive all their events from NPP_HandleEvent. We believe that standardizing the event types and payloads based on, for example, DOM events, would be sufficient to provide browser and OS independent events. If not, the goal can be accomplished by possibly extending the set of event types or data on the event structures to convey more information. | Plugins should receive all their events from NPP_HandleEvent. We believe that standardizing the event types and payloads based on, for example, DOM events, would be sufficient to provide browser and OS independent events. If not, the goal can be accomplished by possibly extending the set of event types or data on the event structures to convey more information. | ||
=== Event Data Structures === | |||
<pre> | |||
struct KeyEvent { | |||
uint32_t normalizedKeyCode; | |||
uint32_t platformKeyCode; | |||
wchar text[4]; | |||
wchar unmodifiedText[4]; | |||
uint8_t keyIdentifier[20]; | |||
uint32_t isSystemKey; | |||
}; | |||
struct MouseEvent { | |||
uint32_t button; | |||
int32_t x; | |||
int32_t y; | |||
int32_t windowX; | |||
int32_t windowY; | |||
int32_t globalX; | |||
int32_t globalY; | |||
int32_t clickCount; | |||
}; | |||
struct MouseWheelEvent { | |||
float deltaX; | |||
float deltaY; | |||
float wheelTicksX; | |||
float wheelTicksY; | |||
uint32_t scrollByPage; | |||
}; | |||
struct PaintEvent { | |||
// See above for graphics events. | |||
}; | |||
struct NPEvent { | |||
uint32_t type; | |||
uint32_t modifiers; | |||
double timeStampSeconds; | |||
union { | |||
KeyEvent key; | |||
MouseEvent mouse; | |||
MouseWheelEvent wheel; | |||
PaintEvent paint; | |||
}; | |||
}; | |||
</pre> | |||
== Plugin Registration == | == Plugin Registration == | ||
edits