| OLD | NEW |
| 1 .. _view_focus_input_events: | 1 .. _view_focus_input_events: |
| 2 | 2 |
| 3 :template: standard_nacl_api | 3 :template: standard_nacl_api |
| 4 | 4 |
| 5 #################################### | 5 #################################### |
| 6 View Change, Focus, and Input Events | 6 View Change, Focus, and Input Events |
| 7 #################################### | 7 #################################### |
| 8 | 8 |
| 9 .. contents:: | 9 .. contents:: |
| 10 :local: | 10 :local: |
| 11 :backlinks: none | 11 :backlinks: none |
| 12 :depth: 2 | 12 :depth: 2 |
| 13 | 13 |
| 14 This chapter describes view change, focus, and input event handling for a | 14 This chapter describes view change, focus, and input event handling for a |
| 15 Native Client module. The chapter assumes you are familiar with the | 15 Native Client module. The chapter assumes you are familiar with the |
| 16 material presented in the :doc:`Technical Overview <../../overview>`. | 16 material presented in the :doc:`Technical Overview <../../overview>`. |
| 17 | 17 |
| 18 There are two examples used in this chapter to illustrate basic | 18 There are two examples used in this chapter to illustrate basic |
| 19 programming techniques. The ``input_events`` example is used to | 19 programming techniques. The ``input_events`` example is used to |
| 20 illustrate how your module can react to keyboard and mouse input | 20 illustrate how your module can react to keyboard and mouse input |
| 21 event. The ``mouse_lock`` example is used to illustrate how your module | 21 event. The ``mouse_lock`` example is used to illustrate how your module |
| 22 can react to view change events. You can find these examples in the | 22 can react to view change events. You can find these examples in the |
| 23 ``/examples/api/input_events`` and ``/examples/api/mouse_lock`` | 23 ``/pepper_<version>/examples/api/input_event`` and |
| 24 directories in the Native Client SDK. There is also the | 24 ``/pepper_<version>/examples/api/mouse_lock`` directories in the Native Client |
| 25 ppapi_simple library that can be used to to implement most of the | 25 SDK. There is also the ppapi_simple library that can be used to to implement |
| 26 boiler plate. The ``pi_generator`` example in | 26 most of the boiler plate. The ``pi_generator`` example in |
| 27 ``/examples/demo/pi_generator`` uses ppapi_simple to manage view | 27 ``/pepper_<version>/examples/demo/pi_generator`` uses ppapi_simple to manage |
| 28 change events and 2D graphics. | 28 view change events and 2D graphics. |
| 29 | 29 |
| 30 | 30 |
| 31 Overview | 31 Overview |
| 32 ======== | 32 ======== |
| 33 | 33 |
| 34 When a user interacts with the web page using a keyboard, mouse or some other | 34 When a user interacts with the web page using a keyboard, mouse or some other |
| 35 input device, the browser generates input events. In a traditional web | 35 input device, the browser generates input events. In a traditional web |
| 36 application, these input events are passed to and handled in JavaScript, | 36 application, these input events are passed to and handled in JavaScript, |
| 37 typically through event listeners and event handlers. In a Native Client | 37 typically through event listeners and event handlers. In a Native Client |
| 38 application, user interaction with an instance of a module (e.g., clicking | 38 application, user interaction with an instance of a module (e.g., clicking |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 | 325 |
| 326 Threading and blocking | 326 Threading and blocking |
| 327 ---------------------- | 327 ---------------------- |
| 328 | 328 |
| 329 ``HandleInputEvent()`` in this example runs on the main module thread. | 329 ``HandleInputEvent()`` in this example runs on the main module thread. |
| 330 However, the bulk of the work happens on a separate worker thread (see | 330 However, the bulk of the work happens on a separate worker thread (see |
| 331 ``ProcessEventOnWorkerThread``). ``HandleInputEvent()`` puts events in | 331 ``ProcessEventOnWorkerThread``). ``HandleInputEvent()`` puts events in |
| 332 the ``event_queue_`` and the worker thread takes events from the | 332 the ``event_queue_`` and the worker thread takes events from the |
| 333 ``event_queue_``. This processing happens independently of the main | 333 ``event_queue_``. This processing happens independently of the main |
| 334 thread, so as not to slow down the browser. | 334 thread, so as not to slow down the browser. |
| OLD | NEW |