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

Side by Side Diff: ppapi/c/pp_input_event.h

Issue 7241024: Mostly minor changes such as adding <code></code> around elements, a little rewriting, and a few ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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 | Annotate | Revision Log
OLDNEW
1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be 2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file. 3 * found in the LICENSE file.
4 */ 4 */
5 #ifndef PPAPI_C_PP_INPUT_EVENT_H_ 5 #ifndef PPAPI_C_PP_INPUT_EVENT_H_
6 #define PPAPI_C_PP_INPUT_EVENT_H_ 6 #define PPAPI_C_PP_INPUT_EVENT_H_
7 7
8 /** 8 /**
9 * @file 9 * @file
10 * This file defines the API used to handle mouse and keyboard input events. 10 * This file defines the API used to handle mouse and keyboard input events.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 /** 87 /**
88 * @} 88 * @}
89 */ 89 */
90 90
91 /** 91 /**
92 * @addtogroup Structs 92 * @addtogroup Structs
93 * @{ 93 * @{
94 */ 94 */
95 95
96 /** 96 /**
97 * The PP_InputEvent_Key struct represents a key up or key down event. 97 * The <code>PP_InputEvent_Key</code> struct represents a key up or key down
98 * event.
98 * 99 *
99 * Key up and key down events correspond to physical keys on the keyboard. The 100 * Key up and key down events correspond to physical keys on the keyboard. The
100 * actual character that the user typed (if any) will be delivered in a 101 * actual character that the user typed (if any) will be delivered in a
101 * "character" event. 102 * "character" event.
102 * 103 *
103 * If the user loses focus on the module while a key is down, a key up 104 * If the user loses focus on the module while a key is down, a key up
104 * event might not occur. For example, if the module has focus and the user 105 * event might not occur. For example, if the module has focus and the user
105 * presses and holds the shift key, the module will see a "shift down" message. 106 * presses and holds the shift key, the module will see a "shift down" message.
106 * Then if the user clicks elsewhere on the web page, the module's focus will 107 * Then if the user clicks elsewhere on the web page, the module's focus will
107 * be lost and no more input events will be delivered. 108 * be lost and no more input events will be delivered.
108 * 109 *
109 * If your module depends on receiving key up events, it should also handle 110 * If your module depends on receiving key up events, it should also handle
110 * "lost focus" as the equivalent of "all keys up." 111 * "lost focus" as the equivalent of "all keys up."
111 */ 112 */
112 struct PP_InputEvent_Key { 113 struct PP_InputEvent_Key {
113 /** This value is a bit field combination of the EVENT_MODIFIER flags. */ 114 /** This value is a bit field combination of the EVENT_MODIFIER flags. */
114 uint32_t modifier; 115 uint32_t modifier;
115 116
116 /** 117 /**
117 * |key_code| reflects the DOM KeyboardEvent |keyCode| field. 118 * This value reflects the DOM KeyboardEvent <code>keyCode</code> field.
118 * Chrome populates this with the Windows-style Virtual Key code of the key. 119 * Chrome populates this with the Windows-style Virtual Key code of the key.
119 */ 120 */
120 121
121 uint32_t key_code; 122 uint32_t key_code;
122 }; 123 };
123 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent_Key, 8); 124 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent_Key, 8);
124 /** 125 /**
125 * @} 126 * @}
126 */ 127 */
127 128
128 /** 129 /**
129 * @addtogroup Structs 130 * @addtogroup Structs
130 * @{ 131 * @{
131 */ 132 */
132 133
133 /** 134 /**
134 * The PP_InputEvent_Character struct represents a typed character event. 135 * The <code>PP_InputEvent_Character</code> struct represents a typed character
136 * event.
135 * 137 *
136 * Normally, the program will receive a key down event, followed by a character 138 * Normally, the program will receive a key down event, followed by a character
137 * event, followed by a key up event. The character event will have any 139 * event, followed by a key up event. The character event will have any
138 * modifier keys applied. Obvious examples are symbols, where Shift-5 gives you 140 * modifier keys applied. Obvious examples are symbols, where Shift-5 gives you
139 * a '%'. The key down and up events will give you the scan code for the "5" 141 * a '%'. The key down and up events will give you the scan code for the "5"
140 * key, and the character event will give you the '%' character. 142 * key, and the character event will give you the '%' character.
141 * 143 *
142 * You may not get a character event for all key down events if the key doesn't 144 * You may not get a character event for all key down events if the key doesn't
143 * generate a character. Likewise, you may actually get multiple character 145 * generate a character. Likewise, you may actually get multiple character
144 * events in a row. For example, some locales have an accent key that modifies 146 * events in a row. For example, some locales have an accent key that modifies
145 * the next character typed. You might get this stream of events: accent down, 147 * the next character typed. You might get this stream of events: accent down,
146 * accent up (it didn't generate a character), letter key down, letter with 148 * accent up (it didn't generate a character), letter key down, letter with
147 * accent character event (it was modified by the previous accent key), letter 149 * accent character event (it was modified by the previous accent key), letter
148 * key up. If the letter can't be combined with the accent, like an umlaut and 150 * key up. If the letter can't be combined with the accent, like an umlaut and
149 * an 'R', the system might send unlaut down, umlaut up, 'R' key down, umlaut 151 * an 'R', the system might send unlaut down, umlaut up, 'R' key down, umlaut
150 * character (can't combine it with 'R', so just send the raw unlaut so it 152 * character (can't combine it with 'R', so just send the raw unlaut so it
151 * isn't lost"), 'R' character event, 'R' key up. 153 * isn't lost"), 'R' character event, 'R' key up.
152 */ 154 */
153 struct PP_InputEvent_Character { 155 struct PP_InputEvent_Character {
154 /** A combination of the EVENT_MODIFIER flags. */ 156 /** A combination of the <code>PP_InputEvent_Modifier</code> flags. */
155 uint32_t modifier; 157 uint32_t modifier;
156 158
157 /** 159 /**
158 * This value represents the typed character as a single null-terminated UTF-8 160 * This value represents the typed character as a single null-terminated UTF-8
159 * character. Any unused bytes will be filled with null bytes. Since the 161 * character. Any unused bytes will be filled with null bytes. Since the
160 * maximum UTF-8 character is 4 bytes, there will always be at least one null 162 * maximum UTF-8 character is 4 bytes, there will always be at least one null
161 * at the end so you can treat this as a null-termianted UTF-8 string. 163 * at the end so you can treat this as a null-termianted UTF-8 string.
162 */ 164 */
163 char text[5]; 165 char text[5];
164 }; 166 };
165 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent_Character, 12); 167 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent_Character, 12);
166 /** 168 /**
167 * @} 169 * @}
168 */ 170 */
169 171
170 /** 172 /**
171 * @addtogroup Structs 173 * @addtogroup Structs
172 * @{ 174 * @{
173 */ 175 */
174 176
175 /** 177 /**
176 * The PP_InputEvent_Mouse struct represents all mouse events except 178 * The <code>PP_InputEvent_Mouse</code> struct represents all mouse events
177 * mouse wheel events. 179 * except mouse wheel events.
178 */ 180 */
179 struct PP_InputEvent_Mouse { 181 struct PP_InputEvent_Mouse {
180 /** This value is a bit field combination of the EVENT_MODIFIER flags. */ 182 /**
183 * This value is a bit field combination of the
184 * <code>PP_InputEvent_Modifier</code> flags.
185 */
181 uint32_t modifier; 186 uint32_t modifier;
182 187
183 /** 188 /**
184 * This value represents the button that changed for mouse down or up events. 189 * This value represents the button that changed for mouse down or up events.
185 * This value will be PP_EVENT_MOUSEBUTTON_NONE for mouse move, enter, and 190 * This value will be <code>PP_EVENT_MOUSEBUTTON_NONE</code> for mouse move,
186 * leave events. 191 * enter, and leave events.
187 */ 192 */
188 PP_InputEvent_MouseButton button; 193 PP_InputEvent_MouseButton button;
189 194
190 /** 195 /**
191 * This values represents the x coordinate of the mouse when the event 196 * This values represents the x coordinate of the mouse when the event
192 * occurred. 197 * occurred.
193 * 198 *
194 * In most, but not all, cases these coordinates will just be integers. 199 * In most, but not all, cases these coordinates will just be integers.
195 * For example, the plugin element might be arbitrarily scaled or transformed 200 * For example, the plugin element might be arbitrarily scaled or transformed
196 * in the DOM, and translating a mouse event into the coordinate space of the 201 * in the DOM, and translating a mouse event into the coordinate space of the
(...skipping 18 matching lines...) Expand all
215 /** 220 /**
216 * @} 221 * @}
217 */ 222 */
218 223
219 /** 224 /**
220 * @addtogroup Structs 225 * @addtogroup Structs
221 * @{ 226 * @{
222 */ 227 */
223 228
224 /** 229 /**
225 * The PP_InputEvent_Wheel struct represents all mouse wheel events. 230 * The <code>PP_InputEvent_Wheel</code> struct represents all mouse wheel
231 * events.
226 */ 232 */
227 struct PP_InputEvent_Wheel { 233 struct PP_InputEvent_Wheel {
228 /** This value represents a combination of the EVENT_MODIFIER flags. */ 234 /**
235 * This value represents a combination of the <code>EVENT_MODIFIER</code>
236 * flags.
237 */
229 uint32_t modifier; 238 uint32_t modifier;
230 239
231 /** 240 /**
232 * Indicates the amount vertically and horizontally the user has requested 241 * Indicates the amount vertically and horizontally the user has requested
233 * to scroll by with their mouse wheel. A scroll down or to the right (where 242 * to scroll by with their mouse wheel. A scroll down or to the right (where
234 * the content moves up or left) is represented as positive values, and 243 * the content moves up or left) is represented as positive values, and
235 * a scroll up or to the left (where the content moves down or right) is 244 * a scroll up or to the left (where the content moves down or right) is
236 * represented as negative values. 245 * represented as negative values.
237 * 246 *
238 * The units are either in pixels (when scroll_by_page is false) or pages 247 * The units are either in pixels (when scroll_by_page is false) or pages
(...skipping 12 matching lines...) Expand all
251 */ 260 */
252 float delta_x; 261 float delta_x;
253 262
254 /** This value represents */ 263 /** This value represents */
255 float delta_y; 264 float delta_y;
256 265
257 /** 266 /**
258 * The number of "clicks" of the scroll wheel that have produced the 267 * The number of "clicks" of the scroll wheel that have produced the
259 * event. The value may have system-specific acceleration applied to it, 268 * event. The value may have system-specific acceleration applied to it,
260 * depending on the device. The positive and negative meanings are the same 269 * depending on the device. The positive and negative meanings are the same
261 * as for |delta|. 270 * as for <code>delta_x</code> and <code>delta_y</code>.
262 * 271 *
263 * If you are scrolling, you probably want to use the delta values above. 272 * If you are scrolling, you probably want to use the delta values above.
264 * These tick events can be useful if you aren't doing actual scrolling and 273 * These tick events can be useful if you aren't doing actual scrolling and
265 * don't want or pixel values. An example may be cycling between different 274 * don't want or pixel values. An example may be cycling between different
266 * items in a game. 275 * items in a game.
267 * 276 *
268 * You may receive fractional values for the wheel ticks if the mouse wheel 277 * You may receive fractional values for the wheel ticks if the mouse wheel
269 * is high resolution or doesn't have "clicks". If your program wants 278 * is high resolution or doesn't have "clicks". If your program wants
270 * discrete events (as in the "picking items" example) you should accumulate 279 * discrete events (as in the "picking items" example) you should accumulate
271 * fractional click values from multiple messages until the total value 280 * fractional click values from multiple messages until the total value
272 * reaches positive or negative one. This should represent a similar amount 281 * reaches positive or negative one. This should represent a similar amount
273 * of scrolling as for a mouse that has a discrete mouse wheel. 282 * of scrolling as for a mouse that has a discrete mouse wheel.
274 */ 283 */
275 float wheel_ticks_x; 284 float wheel_ticks_x;
276 285
277 /** This value represents */ 286 /** This value represents */
278 float wheel_ticks_y; 287 float wheel_ticks_y;
279 288
280 /** 289 /**
281 * Indicates if the scroll delta_x/delta_y indicates pages or lines to 290 * Indicates if the scroll <code>delta_x</code>/<code>delta_y</code>
282 * scroll by. When true, the user is requesting to scroll by pages. 291 * indicates pages or lines to scroll by. When true, the user is requesting
292 * to scroll by pages.
283 */ 293 */
284 PP_Bool scroll_by_page; 294 PP_Bool scroll_by_page;
285 }; 295 };
286 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent_Wheel, 24); 296 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent_Wheel, 24);
287 /** 297 /**
288 * @} 298 * @}
289 */ 299 */
290 300
291 /** 301 /**
292 * 302 *
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 */ 337 */
328 char padding[64]; 338 char padding[64];
329 } u; 339 } u;
330 }; 340 };
331 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent, 80); 341 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent, 80);
332 /** 342 /**
333 * @} 343 * @}
334 */ 344 */
335 345
336 #endif /* PPAPI_C_PP_INPUT_EVENT_H_ */ 346 #endif /* PPAPI_C_PP_INPUT_EVENT_H_ */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698