| OLD | NEW |
| 1 {{+bindTo:partials.standard_nacl_api}} | 1 {{+bindTo:partials.standard_nacl_api}} |
| 2 | 2 |
| 3 <section id="view-change-focus-and-input-events"> | 3 <section id="view-change-focus-and-input-events"> |
| 4 <h1 id="view-change-focus-and-input-events">View Change, Focus, and Input Events
</h1> | 4 <h1 id="view-change-focus-and-input-events">View Change, Focus, and Input Events
</h1> |
| 5 <div class="contents local" id="contents" style="display: none"> | 5 <div class="contents local" id="contents" style="display: none"> |
| 6 <ul class="small-gap"> | 6 <ul class="small-gap"> |
| 7 <li><a class="reference internal" href="#overview" id="id2">Overview</a></li> | 7 <li><a class="reference internal" href="#overview" id="id2">Overview</a></li> |
| 8 <li><p class="first"><a class="reference internal" href="#handling-browser-event
s" id="id3">Handling browser events</a></p> | 8 <li><p class="first"><a class="reference internal" href="#handling-browser-event
s" id="id3">Handling browser events</a></p> |
| 9 <ul class="small-gap"> | 9 <ul class="small-gap"> |
| 10 <li><a class="reference internal" href="#didchangeview" id="id4">DidChangeView()
</a></li> | 10 <li><a class="reference internal" href="#didchangeview" id="id4">DidChangeView()
</a></li> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 </ul> | 21 </ul> |
| 22 | 22 |
| 23 </div><p>This chapter describes view change, focus, and input event handling for
a | 23 </div><p>This chapter describes view change, focus, and input event handling for
a |
| 24 Native Client module. The chapter assumes you are familiar with the | 24 Native Client module. The chapter assumes you are familiar with the |
| 25 material presented in the <a class="reference internal" href="/native-client/ove
rview.html"><em>Technical Overview</em></a>.</p> | 25 material presented in the <a class="reference internal" href="/native-client/ove
rview.html"><em>Technical Overview</em></a>.</p> |
| 26 <p>There are two examples used in this chapter to illustrate basic | 26 <p>There are two examples used in this chapter to illustrate basic |
| 27 programming techniques. The <code>input_events</code> example is used to | 27 programming techniques. The <code>input_events</code> example is used to |
| 28 illustrate how your module can react to keyboard and mouse input | 28 illustrate how your module can react to keyboard and mouse input |
| 29 event. The <code>mouse_lock</code> example is used to illustrate how your modul
e | 29 event. The <code>mouse_lock</code> example is used to illustrate how your modul
e |
| 30 can react to view change events. You can find these examples in the | 30 can react to view change events. You can find these examples in the |
| 31 <code>/examples/api/input_events</code> and <code>/examples/api/mouse_lock</code
> | 31 <code>/pepper_<version>/examples/api/input_event</code> and |
| 32 directories in the Native Client SDK. There is also the | 32 <code>/pepper_<version>/examples/api/mouse_lock</code> directories in the
Native Client |
| 33 ppapi_simple library that can be used to to implement most of the | 33 SDK. There is also the ppapi_simple library that can be used to to implement |
| 34 boiler plate. The <code>pi_generator</code> example in | 34 most of the boiler plate. The <code>pi_generator</code> example in |
| 35 <code>/examples/demo/pi_generator</code> uses ppapi_simple to manage view | 35 <code>/pepper_<version>/examples/demo/pi_generator</code> uses ppapi_simpl
e to manage |
| 36 change events and 2D graphics.</p> | 36 view change events and 2D graphics.</p> |
| 37 <h2 id="overview">Overview</h2> | 37 <h2 id="overview">Overview</h2> |
| 38 <p>When a user interacts with the web page using a keyboard, mouse or some other | 38 <p>When a user interacts with the web page using a keyboard, mouse or some other |
| 39 input device, the browser generates input events. In a traditional web | 39 input device, the browser generates input events. In a traditional web |
| 40 application, these input events are passed to and handled in JavaScript, | 40 application, these input events are passed to and handled in JavaScript, |
| 41 typically through event listeners and event handlers. In a Native Client | 41 typically through event listeners and event handlers. In a Native Client |
| 42 application, user interaction with an instance of a module (e.g., clicking | 42 application, user interaction with an instance of a module (e.g., clicking |
| 43 inside the rectangle managed by a module) also generates input events, which | 43 inside the rectangle managed by a module) also generates input events, which |
| 44 are passed to the module. The browser also passes view change and focus events | 44 are passed to the module. The browser also passes view change and focus events |
| 45 that affect a module’s instance to the module. Native Client modules can | 45 that affect a module’s instance to the module. Native Client modules can |
| 46 override certain functions in the <a class="reference external" href="/native-cl
ient/pepper_stable/cpp/classpp_1_1_instance">pp::Instance</a> class to handle in
put | 46 override certain functions in the <a class="reference external" href="/native-cl
ient/pepper_stable/cpp/classpp_1_1_instance">pp::Instance</a> class to handle in
put |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 <h3 id="threading-and-blocking">Threading and blocking</h3> | 326 <h3 id="threading-and-blocking">Threading and blocking</h3> |
| 327 <p><code>HandleInputEvent()</code> in this example runs on the main module threa
d. | 327 <p><code>HandleInputEvent()</code> in this example runs on the main module threa
d. |
| 328 However, the bulk of the work happens on a separate worker thread (see | 328 However, the bulk of the work happens on a separate worker thread (see |
| 329 <code>ProcessEventOnWorkerThread</code>). <code>HandleInputEvent()</code> puts e
vents in | 329 <code>ProcessEventOnWorkerThread</code>). <code>HandleInputEvent()</code> puts e
vents in |
| 330 the <code>event_queue_</code> and the worker thread takes events from the | 330 the <code>event_queue_</code> and the worker thread takes events from the |
| 331 <code>event_queue_</code>. This processing happens independently of the main | 331 <code>event_queue_</code>. This processing happens independently of the main |
| 332 thread, so as not to slow down the browser.</p> | 332 thread, so as not to slow down the browser.</p> |
| 333 </section> | 333 </section> |
| 334 | 334 |
| 335 {{/partials.standard_nacl_api}} | 335 {{/partials.standard_nacl_api}} |
| OLD | NEW |