Data Fields

int32_t(* RequestInputEvents )(PP_Instance instance, uint32_t event_classes)
int32_t(* RequestFilteringInputEvents )(PP_Instance instance, uint32_t event_classes)
void(* ClearInputEventRequest )(PP_Instance instance, uint32_t event_classes)
PP_Bool(* IsInputEvent )(PP_Resource resource)
PP_InputEvent_Type(* GetType )(PP_Resource event)
PP_TimeTicks(* GetTimeStamp )(PP_Resource event)
uint32_t(* GetModifiers )(PP_Resource event)

Detailed Description

The PPB_InputEvent interface contains pointers to several functions related to generic input events on the browser.


Field Documentation

void(* PPB_InputEvent::ClearInputEventRequest)(PP_Instance instance, uint32_t event_classes)

ClearInputEventRequest() requests that input events corresponding to the given input classes no longer be delivered to the instance.

By default, no input events are delivered. If you have previously requested input events via RequestInputEvents() or RequestFilteringInputEvents(), this function will unregister handling for the given instance. This will allow greater browser performance for those events.

Note that you may still get some input events after clearing the flag if they were dispatched before the request was cleared. For example, if there are 3 mouse move events waiting to be delivered, and you clear the mouse event class during the processing of the first one, you'll still receive the next two. You just won't get more events generated.

Parameters:
instanceThe PP_Instance of the instance requesting to no longer receive the given events.
event_classesA combination of flags from PP_InputEvent_Class that identify the classes of events the instance is no longer interested in.

GetModifiers() returns a bitfield indicating which modifiers were down at the time of the event.

This is a combination of the flags in the PP_InputEvent_Modifier enum.

Parameters:
[in]resourceA PP_Resource corresponding to an input event.
Returns:
The modifiers associated with the event, or 0 if the given resource is not a valid event resource.

GetTimeStamp() Returns the time that the event was generated.

This will be before the current time since processing and dispatching the event has some overhead. Use this value to compare the times the user generated two events without being sensitive to variable processing time.

Parameters:
[in]resourceA PP_Resource corresponding to the event.
Returns:
The return value is in time ticks, which is a monotonically increasing clock not related to the wall clock time. It will not change if the user changes their clock or daylight savings time starts, so can be reliably used to compare events. This means, however, that you can't correlate event times to a particular time of day on the system clock.

GetType() returns the type of input event for the given input event resource.

Parameters:
[in]resourceA PP_Resource corresponding to an input event.
Returns:
A PP_InputEvent_Type if its a valid input event or PP_INPUTEVENT_TYPE_UNDEFINED if the resource is invalid.

IsInputEvent() returns true if the given resource is a valid input event resource.

Parameters:
[in]resourceA PP_Resource corresponding to a generic resource.
Returns:
PP_TRUE if the given resource is a valid input event resource.
int32_t(* PPB_InputEvent::RequestFilteringInputEvents)(PP_Instance instance, uint32_t event_classes)

RequestFilteringInputEvents() requests that input events corresponding to the given input events are delivered to the instance for filtering.

By default, no input events are delivered. In most cases you would register to receive events by calling RequestInputEvents(). In some cases, however, you may wish to filter events such that they can be bubbled up to the default handlers. In this case, register for those classes of events using this function instead of RequestInputEvents().

Filtering input events requires significantly more overhead than just delivering them to the instance. As such, you should only request filtering in those cases where it's absolutely necessary. The reason is that it requires the browser to stop and block for the instance to handle the input event, rather than sending the input event asynchronously. This can have significant overhead.

Example:

Returns:
PP_OK if the operation succeeded, PP_ERROR_BADARGUMENT if instance is invalid, or PP_ERROR_NOTSUPPORTED if one of the event class bits were illegal. In the case of an invalid bit, all valid bits will be applied and only the illegal bits will be ignored.
int32_t(* PPB_InputEvent::RequestInputEvents)(PP_Instance instance, uint32_t event_classes)

RequestInputEvent() requests that input events corresponding to the given input events are delivered to the instance.

It's recommended that you use RequestFilteringInputEvents() for keyboard events instead of this function so that you don't interfere with normal browser accelerators.

By default, no input events are delivered. Call this function with the classes of events you are interested in to have them be delivered to the instance. Calling this function will override any previous setting for each specified class of input events (for example, if you previously called RequestFilteringInputEvents(), this function will set those events to non-filtering mode).

Input events may have high overhead, so you should only request input events that your plugin will actually handle. For example, the browser may do optimizations for scroll or touch events that can be processed substantially faster if it knows there are no non-default receivers for that message. Requesting that such messages be delivered, even if they are processed very quickly, may have a noticeable effect on the performance of the page.

Note that synthetic mouse events will be generated from touch events if (and only if) you do not request touch events.

When requesting input events through this function, the events will be delivered and not bubbled to the default handlers.

Example:

Parameters:
instanceThe PP_Instance of the instance requesting the given events.
event_classesA combination of flags from PP_InputEvent_Class that identifies the classes of events the instance is requesting. The flags are combined by logically ORing their values.
Returns:
PP_OK if the operation succeeded, PP_ERROR_BADARGUMENT if instance is invalid, or PP_ERROR_NOTSUPPORTED if one of the event class bits were illegal. In the case of an invalid bit, all valid bits will be applied and only the illegal bits will be ignored. The most common cause of a PP_ERROR_NOTSUPPORTED return value is requesting keyboard events, these must use RequestFilteringInputEvents().

The documentation for this struct was generated from the following file:
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.