blob: 97d5fcaef019d67774452e6dc07da6d30fb0474f [file] [log] [blame]
{{+bindTo:partials.standard_nacl_api}}
<h1>PPB_InputEvent Struct Reference</h1>
<div id="doxygen-ref">
{{- dummy div to appease doxygen -}}
<div>
<!-- Generated by Doxygen 1.7.6.1 -->
</div>
<!--header-->
<div class="contents">
<!-- doxytag: class="PPB_InputEvent" --><h2>
Data Fields</h2><table class="memberdecls">
<tr><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___input_event__1__0.html#a369d79730ad84d0b8dee9127c114086e">RequestInputEvents</a> )(<a class="el" href="group___typedefs.html#ga89b662403e6a687bb914b80114c0d19d">PP_Instance</a> instance, uint32_t event_classes)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___input_event__1__0.html#a42dcc8edf80141680e919258f3066069">RequestFilteringInputEvents</a> )(<a class="el" href="group___typedefs.html#ga89b662403e6a687bb914b80114c0d19d">PP_Instance</a> instance, uint32_t event_classes)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___input_event__1__0.html#aec4b0db6ac3dca03f4d3a1c034f84a5a">ClearInputEventRequest</a> )(<a class="el" href="group___typedefs.html#ga89b662403e6a687bb914b80114c0d19d">PP_Instance</a> instance, uint32_t event_classes)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___input_event__1__0.html#a292409d067d969ee6357af350f6fb544">IsInputEvent</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> resource)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___enums.html#gaca7296cfec99fcb6646b7144d1d6a0c5">PP_InputEvent_Type</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___input_event__1__0.html#a1d83a144ef7cb784a34caabc81786538">GetType</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> event)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___typedefs.html#ga71cb1042cdeb38d7881b121f3b09ce94">PP_TimeTicks</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___input_event__1__0.html#a9bf9a261e8161a3a6ec4093ba6f737b2">GetTimeStamp</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> event)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___input_event__1__0.html#a31311048765ee5af6dd3fb62ae014372">GetModifiers</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> event)</td></tr>
</table>
<hr /><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>The <code>PPB_InputEvent</code> interface contains pointers to several functions related to generic input events on the browser. </p>
</div><hr /><h2>Field Documentation</h2>
<a class="anchor" id="aec4b0db6ac3dca03f4d3a1c034f84a5a"></a><!-- doxytag: member="PPB_InputEvent::ClearInputEventRequest" ref="aec4b0db6ac3dca03f4d3a1c034f84a5a" args=")(PP_Instance instance, uint32_t event_classes)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void(* <a class="el" href="struct_p_p_b___input_event__1__0.html#aec4b0db6ac3dca03f4d3a1c034f84a5a">PPB_InputEvent::ClearInputEventRequest</a>)(<a class="el" href="group___typedefs.html#ga89b662403e6a687bb914b80114c0d19d">PP_Instance</a> instance, uint32_t event_classes)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___input_event__1__0.html#aec4b0db6ac3dca03f4d3a1c034f84a5a" title="ClearInputEventRequest() requests that input events corresponding to the given input classes no longe...">ClearInputEventRequest()</a> requests that input events corresponding to the given input classes no longer be delivered to the instance. </p>
<p>By default, no input events are delivered. If you have previously requested input events via <a class="el" href="struct_p_p_b___input_event__1__0.html#a369d79730ad84d0b8dee9127c114086e" title="RequestInputEvent() requests that input events corresponding to the given input events are delivered ...">RequestInputEvents()</a> or <a class="el" href="struct_p_p_b___input_event__1__0.html#a42dcc8edf80141680e919258f3066069" title="RequestFilteringInputEvents() requests that input events corresponding to the given input events are ...">RequestFilteringInputEvents()</a>, this function will unregister handling for the given instance. This will allow greater browser performance for those events.</p>
<p>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.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">instance</td><td>The <code>PP_Instance</code> of the instance requesting to no longer receive the given events.</td></tr>
<tr><td class="paramname">event_classes</td><td>A combination of flags from <code>PP_InputEvent_Class</code> that identify the classes of events the instance is no longer interested in. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a31311048765ee5af6dd3fb62ae014372"></a><!-- doxytag: member="PPB_InputEvent::GetModifiers" ref="a31311048765ee5af6dd3fb62ae014372" args=")(PP_Resource event)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint32_t(* <a class="el" href="struct_p_p_b___input_event__1__0.html#a31311048765ee5af6dd3fb62ae014372">PPB_InputEvent::GetModifiers</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> event)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___input_event__1__0.html#a31311048765ee5af6dd3fb62ae014372" title="GetModifiers() returns a bitfield indicating which modifiers were down at the time of the event...">GetModifiers()</a> returns a bitfield indicating which modifiers were down at the time of the event. </p>
<p>This is a combination of the flags in the <code>PP_InputEvent_Modifier</code> enum.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">resource</td><td>A <code>PP_Resource</code> corresponding to an input event.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>The modifiers associated with the event, or 0 if the given resource is not a valid event resource. </dd></dl>
</div>
</div>
<a class="anchor" id="a9bf9a261e8161a3a6ec4093ba6f737b2"></a><!-- doxytag: member="PPB_InputEvent::GetTimeStamp" ref="a9bf9a261e8161a3a6ec4093ba6f737b2" args=")(PP_Resource event)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group___typedefs.html#ga71cb1042cdeb38d7881b121f3b09ce94">PP_TimeTicks</a>(* <a class="el" href="struct_p_p_b___input_event__1__0.html#a9bf9a261e8161a3a6ec4093ba6f737b2">PPB_InputEvent::GetTimeStamp</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> event)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___input_event__1__0.html#a9bf9a261e8161a3a6ec4093ba6f737b2" title="GetTimeStamp() Returns the time that the event was generated.">GetTimeStamp()</a> Returns the time that the event was generated. </p>
<p>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.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">resource</td><td>A <code>PP_Resource</code> corresponding to the event.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>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. </dd></dl>
</div>
</div>
<a class="anchor" id="a1d83a144ef7cb784a34caabc81786538"></a><!-- doxytag: member="PPB_InputEvent::GetType" ref="a1d83a144ef7cb784a34caabc81786538" args=")(PP_Resource event)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group___enums.html#gaca7296cfec99fcb6646b7144d1d6a0c5">PP_InputEvent_Type</a>(* <a class="el" href="struct_p_p_b___input_event__1__0.html#a1d83a144ef7cb784a34caabc81786538">PPB_InputEvent::GetType</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> event)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___input_event__1__0.html#a1d83a144ef7cb784a34caabc81786538" title="GetType() returns the type of input event for the given input event resource.">GetType()</a> returns the type of input event for the given input event resource. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">resource</td><td>A <code>PP_Resource</code> corresponding to an input event.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>A <code>PP_InputEvent_Type</code> if its a valid input event or <code>PP_INPUTEVENT_TYPE_UNDEFINED</code> if the resource is invalid. </dd></dl>
</div>
</div>
<a class="anchor" id="a292409d067d969ee6357af350f6fb544"></a><!-- doxytag: member="PPB_InputEvent::IsInputEvent" ref="a292409d067d969ee6357af350f6fb544" args=")(PP_Resource resource)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(* <a class="el" href="struct_p_p_b___input_event__1__0.html#a292409d067d969ee6357af350f6fb544">PPB_InputEvent::IsInputEvent</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> resource)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___input_event__1__0.html#a292409d067d969ee6357af350f6fb544" title="IsInputEvent() returns true if the given resource is a valid input event resource.">IsInputEvent()</a> returns true if the given resource is a valid input event resource. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">resource</td><td>A <code>PP_Resource</code> corresponding to a generic resource.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd><code>PP_TRUE</code> if the given resource is a valid input event resource. </dd></dl>
</div>
</div>
<a class="anchor" id="a42dcc8edf80141680e919258f3066069"></a><!-- doxytag: member="PPB_InputEvent::RequestFilteringInputEvents" ref="a42dcc8edf80141680e919258f3066069" args=")(PP_Instance instance, uint32_t event_classes)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* <a class="el" href="struct_p_p_b___input_event__1__0.html#a42dcc8edf80141680e919258f3066069">PPB_InputEvent::RequestFilteringInputEvents</a>)(<a class="el" href="group___typedefs.html#ga89b662403e6a687bb914b80114c0d19d">PP_Instance</a> instance, uint32_t event_classes)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___input_event__1__0.html#a42dcc8edf80141680e919258f3066069" title="RequestFilteringInputEvents() requests that input events corresponding to the given input events are ...">RequestFilteringInputEvents()</a> requests that input events corresponding to the given input events are delivered to the instance for filtering. </p>
<p>By default, no input events are delivered. In most cases you would register to receive events by calling <a class="el" href="struct_p_p_b___input_event__1__0.html#a369d79730ad84d0b8dee9127c114086e" title="RequestInputEvent() requests that input events corresponding to the given input events are delivered ...">RequestInputEvents()</a>. 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 <a class="el" href="struct_p_p_b___input_event__1__0.html#a369d79730ad84d0b8dee9127c114086e" title="RequestInputEvent() requests that input events corresponding to the given input events are delivered ...">RequestInputEvents()</a>.</p>
<p>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.</p>
<p><b>Example:</b> </p>
<div class="fragment"><pre class="fragment"> <a class="code" href="struct_p_p_b___input_event__1__0.html#a369d79730ad84d0b8dee9127c114086e" title="RequestInputEvent() requests that input events corresponding to the given input events are delivered ...">RequestInputEvents</a>(instance, <a class="code" href="group___enums.html#ggafe68e3c1031daa4a6496845ff47649cda79ccc5180eb39c52ab3207f0c876dd52" title="Request mouse input events.">PP_INPUTEVENT_CLASS_MOUSE</a>);
<a class="code" href="struct_p_p_b___input_event__1__0.html#a42dcc8edf80141680e919258f3066069" title="RequestFilteringInputEvents() requests that input events corresponding to the given input events are ...">RequestFilteringInputEvents</a>(instance,
<a class="code" href="group___enums.html#ggafe68e3c1031daa4a6496845ff47649cda59d6686dbce1f0dc092cb88a451bb3a6" title="Identifies scroll wheel input event.">PP_INPUTEVENT_CLASS_WHEEL</a> | <a class="code" href="group___enums.html#ggafe68e3c1031daa4a6496845ff47649cda2c3341eacc3a459713ce334b9af0cda8" title="Requests keyboard events.">PP_INPUTEVENT_CLASS_KEYBOARD</a>);
</pre></div><dl class="return"><dt><b>Returns:</b></dt><dd><code>PP_OK</code> if the operation succeeded, <code>PP_ERROR_BADARGUMENT</code> if instance is invalid, or <code>PP_ERROR_NOTSUPPORTED</code> 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. </dd></dl>
</div>
</div>
<a class="anchor" id="a369d79730ad84d0b8dee9127c114086e"></a><!-- doxytag: member="PPB_InputEvent::RequestInputEvents" ref="a369d79730ad84d0b8dee9127c114086e" args=")(PP_Instance instance, uint32_t event_classes)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* <a class="el" href="struct_p_p_b___input_event__1__0.html#a369d79730ad84d0b8dee9127c114086e">PPB_InputEvent::RequestInputEvents</a>)(<a class="el" href="group___typedefs.html#ga89b662403e6a687bb914b80114c0d19d">PP_Instance</a> instance, uint32_t event_classes)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>RequestInputEvent() requests that input events corresponding to the given input events are delivered to the instance. </p>
<p>It's recommended that you use <a class="el" href="struct_p_p_b___input_event__1__0.html#a42dcc8edf80141680e919258f3066069" title="RequestFilteringInputEvents() requests that input events corresponding to the given input events are ...">RequestFilteringInputEvents()</a> for keyboard events instead of this function so that you don't interfere with normal browser accelerators.</p>
<p>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 <a class="el" href="struct_p_p_b___input_event__1__0.html#a42dcc8edf80141680e919258f3066069" title="RequestFilteringInputEvents() requests that input events corresponding to the given input events are ...">RequestFilteringInputEvents()</a>, this function will set those events to non-filtering mode).</p>
<p>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.</p>
<p>Note that synthetic mouse events will be generated from touch events if (and only if) you do not request touch events.</p>
<p>When requesting input events through this function, the events will be delivered and <em>not</em> bubbled to the default handlers.</p>
<p><b>Example:</b> </p>
<div class="fragment"><pre class="fragment"> <a class="code" href="struct_p_p_b___input_event__1__0.html#a369d79730ad84d0b8dee9127c114086e" title="RequestInputEvent() requests that input events corresponding to the given input events are delivered ...">RequestInputEvents</a>(instance, <a class="code" href="group___enums.html#ggafe68e3c1031daa4a6496845ff47649cda79ccc5180eb39c52ab3207f0c876dd52" title="Request mouse input events.">PP_INPUTEVENT_CLASS_MOUSE</a>);
<a class="code" href="struct_p_p_b___input_event__1__0.html#a42dcc8edf80141680e919258f3066069" title="RequestFilteringInputEvents() requests that input events corresponding to the given input events are ...">RequestFilteringInputEvents</a>(instance,
<a class="code" href="group___enums.html#ggafe68e3c1031daa4a6496845ff47649cda59d6686dbce1f0dc092cb88a451bb3a6" title="Identifies scroll wheel input event.">PP_INPUTEVENT_CLASS_WHEEL</a> | <a class="code" href="group___enums.html#ggafe68e3c1031daa4a6496845ff47649cda2c3341eacc3a459713ce334b9af0cda8" title="Requests keyboard events.">PP_INPUTEVENT_CLASS_KEYBOARD</a>);
</pre></div><dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">instance</td><td>The <code>PP_Instance</code> of the instance requesting the given events.</td></tr>
<tr><td class="paramname">event_classes</td><td>A combination of flags from <code>PP_InputEvent_Class</code> that identifies the classes of events the instance is requesting. The flags are combined by logically ORing their values.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd><code>PP_OK</code> if the operation succeeded, <code>PP_ERROR_BADARGUMENT</code> if instance is invalid, or <code>PP_ERROR_NOTSUPPORTED</code> 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 <code>PP_ERROR_NOTSUPPORTED</code> return value is requesting keyboard events, these must use <a class="el" href="struct_p_p_b___input_event__1__0.html#a42dcc8edf80141680e919258f3066069" title="RequestFilteringInputEvents() requests that input events corresponding to the given input events are ...">RequestFilteringInputEvents()</a>. </dd></dl>
</div>
</div>
<hr />The documentation for this struct was generated from the following file:<ul>
<li><a class="el" href="ppb__input__event_8h.html">ppb_input_event.h</a></li>
</ul>
</div><!-- contents -->
</div>
{{/partials.standard_nacl_api}}