Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: native_client_sdk/src/doc/devguide/coding/view-focus-input-events.rst

Issue 511963004: Rearrange tables so that navigation can be added back to certain pages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix items from review. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 .. _view_focus_input_events: 1 .. _view_focus_input_events:
2 2
3 :template: standard_nacl_api
4
5 #################################### 3 ####################################
6 View Change, Focus, and Input Events 4 View Change, Focus, and Input Events
7 #################################### 5 ####################################
8 6
9 .. contents:: 7 .. contents::
10 :local: 8 :local:
11 :backlinks: none 9 :backlinks: none
12 :depth: 2 10 :depth: 2
13 11
14 This section describes view change, focus, and input event handling for a 12 This section describes view change, focus, and input event handling for a
(...skipping 21 matching lines...) Expand all
36 application, these input events are passed to and handled in JavaScript, 34 application, these input events are passed to and handled in JavaScript,
37 typically through event listeners and event handlers. In a Native Client 35 typically through event listeners and event handlers. In a Native Client
38 application, user interaction with an instance of a module (e.g., clicking 36 application, user interaction with an instance of a module (e.g., clicking
39 inside the rectangle managed by a module) also generates input events, which 37 inside the rectangle managed by a module) also generates input events, which
40 are passed to the module. The browser also passes view change and focus events 38 are passed to the module. The browser also passes view change and focus events
41 that affect a module's instance to the module. Native Client modules can 39 that affect a module's instance to the module. Native Client modules can
42 override certain functions in the `pp::Instance 40 override certain functions in the `pp::Instance
43 </native-client/pepper_stable/cpp/classpp_1_1_instance>`_ class to handle input 41 </native-client/pepper_stable/cpp/classpp_1_1_instance>`_ class to handle input
44 and browser events. These functions are listed in the table below: 42 and browser events. These functions are listed in the table below:
45 43
46 44 +-------------------------------------+----------------------------------------+
47 ====================== =============================== ==================== 45 | Function | Use |
48 Function Event Use 46 +=====================================+========================================+
49 ====================== =============================== ==================== 47 |``DidChangeView`` |An implementation of this function might|
50 ``DidChangeView`` Called when the position, An implementation 48 | Called when the position, size, or |check the size of the module instance's |
51 size, or clip rectangle of this function 49 | clip rectangle of the module's |rectangle has changed and reallocate the|
52 of the module's instance in might check the size 50 | instance in the browser has |graphcs context when a different size is|
53 the browser has changed. of the module 51 | changed. This event also occurs |received. |
54 This event also occurs instance's rectangle 52 | when the browser window is resized | |
55 when browser window is has changed and 53 | or the mouse wheel is scrolled. | |
56 resized or mouse wheel reallocate the 54 +-------------------------------------+----------------------------------------+
57 is scrolled. graphics context 55 |``DidChangeFocus`` |An implementation of this function might|
58 when a different 56 | Called when the module's instance |start or stop an animation or a blinking|
59 size is received. 57 | in the browser has gone in or out |cursor. |
60 58 | of focus (usually by clicking | |
61 ``DidChangeFocus`` Called when the module's An implementation 59 | inside or outside the module | |
62 instance in the browser of this function 60 | instance). Having focus means that | |
63 has gone in or out of might start or stop 61 | keyboard events will be sent to the| |
64 focus (usually by an animation or a 62 | module instance. An instance's | |
65 clicking inside or blinking cursor. 63 | default condition is that it does | |
66 outside the module 64 | not have focus. | |
67 instance). Having focus 65 +-------------------------------------+----------------------------------------+
68 means that keyboard 66 |``HandleDocumentLoad`` |This API is only applicable when you are|
69 events will be sent to 67 | ``pp::Instance::Init()`` for a |writing an extension to enhance the |
70 the module instance. 68 | full-frame module instance that was|abilities of the Chrome web browser. For|
71 An instance's default 69 | instantiated based on the MIME |example, a PDF viewer might implement |
72 condition is that it 70 | type of a DOMWindow navigation. |this function to download and display a |
73 does not have focus. 71 | This situation only applies to |PDF file. |
74 72 | modules that are pre-registered to | |
75 ``HandleDocumentLoad`` Called after This API is only 73 | handle certain MIME types. If you | |
76 ``pp::Instance::Init()`` applicable when you 74 | haven't specifically registered to | |
77 for a full-frame module are writing an 75 | handle a MIME type or aren't | |
78 instance that was extension to enhance 76 | positive this applies to you, your | |
79 instantiated based on the abilities of 77 | implementation of this function can| |
80 the MIME type of a the Chrome web 78 | just return false. | |
81 DOMWindow navigation. browser. For 79 +-------------------------------------+----------------------------------------+
82 This situation only example, a PDF 80 |``HandleInputEvent`` |An implementation of this function |
83 applies to modules that viewer might 81 | Called when a user interacts with |examines the input event type and |
84 are pre-registered to implement this 82 | the module's instance in the |branches accordingly. |
85 handle certain MIME function to download 83 | browser using an input device such | |
86 types. If you haven't and display a PDF 84 | as a mouse or keyboard. You must | |
87 specifically registered file. 85 | register your module to accept | |
88 to handle a MIME type or 86 | input events using | |
89 aren't positive this 87 | ``RequestInputEvents()`` | |
90 applies to you, your 88 | for mouse events and | |
91 implementation of this 89 | ``RequestFilteringInputEvents()`` | |
92 function can just return 90 | for keyboard events prior to | |
93 false. 91 | overriding this function. | |
94 92 +-------------------------------------+----------------------------------------+
95 ``HandleInputEvent`` Called when a user An implementation of
96 interacts with the this function
97 module's instance in the examines the input
98 browser using an input event type and
99 device such as a mouse branches accordingly.
100 or keyboard. You must
101 register your module to
102 accept input events
103 using
104 ``RequestInputEvents()``
105 for mouse events and
106 ``RequestFilteringInputEvents``
107 for keyboard events
108 prior to overriding this
109 function.
110 ====================== =============================== ====================
111 93
112 94
113 These interfaces are found in the `pp::Instance class 95 These interfaces are found in the `pp::Instance class
114 </native-client/pepper_stable/cpp/classpp_1_1_instance>`_. The sections below 96 </native-client/pepper_stable/cpp/classpp_1_1_instance>`_. The sections below
115 provide examples of how to handle these events. 97 provide examples of how to handle these events.
116 98
117 99
118 Handling browser events 100 Handling browser events
119 ======================= 101 =======================
120 102
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 307
326 Threading and blocking 308 Threading and blocking
327 ---------------------- 309 ----------------------
328 310
329 ``HandleInputEvent()`` in this example runs on the main module thread. 311 ``HandleInputEvent()`` in this example runs on the main module thread.
330 However, the bulk of the work happens on a separate worker thread (see 312 However, the bulk of the work happens on a separate worker thread (see
331 ``ProcessEventOnWorkerThread``). ``HandleInputEvent()`` puts events in 313 ``ProcessEventOnWorkerThread``). ``HandleInputEvent()`` puts events in
332 the ``event_queue_`` and the worker thread takes events from the 314 the ``event_queue_`` and the worker thread takes events from the
333 ``event_queue_``. This processing happens independently of the main 315 ``event_queue_``. This processing happens independently of the main
334 thread, so as not to slow down the browser. 316 thread, so as not to slow down the browser.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698