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> |
11 <li><a class="reference internal" href="#didchangefocus" id="id5">DidChangeFocus
()</a></li> | 11 <li><a class="reference internal" href="#didchangefocus" id="id5">DidChangeFocus
()</a></li> |
12 </ul> | 12 </ul> |
13 </li> | 13 </li> |
14 <li><p class="first"><a class="reference internal" href="#handling-input-events"
id="id6">Handling input events</a></p> | 14 <li><p class="first"><a class="reference internal" href="#handling-input-events"
id="id6">Handling input events</a></p> |
15 <ul class="small-gap"> | 15 <ul class="small-gap"> |
16 <li><a class="reference internal" href="#registering-a-module-to-accept-input-ev
ents" id="id7">Registering a module to accept input events</a></li> | 16 <li><a class="reference internal" href="#registering-a-module-to-accept-input-ev
ents" id="id7">Registering a module to accept input events</a></li> |
17 <li><a class="reference internal" href="#determining-and-branching-on-event-type
s" id="id8">Determining and branching on event types</a></li> | 17 <li><a class="reference internal" href="#determining-and-branching-on-event-type
s" id="id8">Determining and branching on event types</a></li> |
18 <li><a class="reference internal" href="#threading-and-blocking" id="id9">Thread
ing and blocking</a></li> | 18 <li><a class="reference internal" href="#threading-and-blocking" id="id9">Thread
ing and blocking</a></li> |
19 </ul> | 19 </ul> |
20 </li> | 20 </li> |
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 section 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 section 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 section 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>/pepper_<version>/examples/api/input_event</code> and | 31 <code>/pepper_<version>/examples/api/input_event</code> and |
32 <code>/pepper_<version>/examples/api/mouse_lock</code> directories in the
Native Client | 32 <code>/pepper_<version>/examples/api/mouse_lock</code> directories in the
Native Client |
33 SDK. There is also the ppapi_simple library that can be used to to implement | 33 SDK. There is also the ppapi_simple library that can be used to to implement |
34 most of the boiler plate. The <code>pi_generator</code> example in | 34 most of the boiler plate. The <code>pi_generator</code> example in |
35 <code>/pepper_<version>/examples/demo/pi_generator</code> uses ppapi_simpl
e to manage | 35 <code>/pepper_<version>/examples/demo/pi_generator</code> uses ppapi_simpl
e to manage |
36 view change events and 2D graphics.</p> | 36 view change events and 2D graphics.</p> |
(...skipping 289 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 |