OLD | NEW |
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 | 5 |
6 /** | 6 /** |
7 * This file defines the Input Event interfaces. | 7 * This file defines the Input Event interfaces. |
8 */ | 8 */ |
9 | 9 |
10 label Chrome { | 10 label Chrome { |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 PP_INPUTEVENT_CLASS_TOUCH = 1 << 3, | 191 PP_INPUTEVENT_CLASS_TOUCH = 1 << 3, |
192 | 192 |
193 /** | 193 /** |
194 * Identifies IME composition input events. | 194 * Identifies IME composition input events. |
195 * | 195 * |
196 * Request this input event class if you allow on-the-spot IME input. | 196 * Request this input event class if you allow on-the-spot IME input. |
197 */ | 197 */ |
198 PP_INPUTEVENT_CLASS_IME = 1 << 4 | 198 PP_INPUTEVENT_CLASS_IME = 1 << 4 |
199 }; | 199 }; |
200 | 200 |
| 201 /** |
| 202 * The <code>PPB_InputEvent</code> interface contains pointers to several |
| 203 * functions related to generic input events on the browser. |
| 204 */ |
201 [version=1.0, macro="PPB_INPUT_EVENT_INTERFACE"] | 205 [version=1.0, macro="PPB_INPUT_EVENT_INTERFACE"] |
202 interface PPB_InputEvent { | 206 interface PPB_InputEvent { |
203 /** | 207 /** |
204 * Request that input events corresponding to the given input events are | 208 * RequestInputEvent() requests that input events corresponding to the given |
205 * delivered to the instance. | 209 * input events are delivered to the instance. |
206 * | 210 * |
207 * It's recommended that you use RequestFilteringInputEvents() for keyboard | 211 * It's recommended that you use RequestFilteringInputEvents() for keyboard |
208 * events instead of this function so that you don't interfere with normal | 212 * events instead of this function so that you don't interfere with normal |
209 * browser accelerators. | 213 * browser accelerators. |
210 * | 214 * |
211 * By default, no input events are delivered. Call this function with the | 215 * By default, no input events are delivered. Call this function with the |
212 * classes of events you are interested in to have them be delivered to | 216 * classes of events you are interested in to have them be delivered to |
213 * the instance. Calling this function will override any previous setting for | 217 * the instance. Calling this function will override any previous setting for |
214 * each specified class of input events (for example, if you previously | 218 * each specified class of input events (for example, if you previously |
215 * called RequestFilteringInputEvents(), this function will set those events | 219 * called RequestFilteringInputEvents(), this function will set those events |
216 * to non-filtering mode). | 220 * to non-filtering mode). |
217 * | 221 * |
218 * Input events may have high overhead, so you should only request input | 222 * Input events may have high overhead, so you should only request input |
219 * events that your plugin will actually handle. For example, the browser may | 223 * events that your plugin will actually handle. For example, the browser may |
220 * do optimizations for scroll or touch events that can be processed | 224 * do optimizations for scroll or touch events that can be processed |
221 * substantially faster if it knows there are no non-default receivers for | 225 * substantially faster if it knows there are no non-default receivers for |
222 * that message. Requesting that such messages be delivered, even if they are | 226 * that message. Requesting that such messages be delivered, even if they are |
223 * processed very quickly, may have a noticable effect on the performance of | 227 * processed very quickly, may have a noticeable effect on the performance of |
224 * the page. | 228 * the page. |
225 * | 229 * |
226 * When requesting input events through this function, the events will be | 230 * When requesting input events through this function, the events will be |
227 * delivered and <i>not</i> bubbled to the page. This means that even if you | 231 * delivered and <i>not</i> bubbled to the page. This means that even if you |
228 * aren't interested in the message, no other parts of the page will get | 232 * aren't interested in the message, no other parts of the page will get |
229 * a crack at the message. | 233 * a crack at the message. |
230 * | 234 * |
231 * Example: | 235 * <strong>Example:</strong> |
| 236 * <code> |
232 * RequestInputEvents(instance, PP_INPUTEVENT_CLASS_MOUSE); | 237 * RequestInputEvents(instance, PP_INPUTEVENT_CLASS_MOUSE); |
233 * RequestFilteringInputEvents(instance, | 238 * RequestFilteringInputEvents(instance, |
234 * PP_INPUTEVENT_CLASS_WHEEL | PP_INPUTEVENT_CLASS_KEYBOARD); | 239 * PP_INPUTEVENT_CLASS_WHEEL | PP_INPUTEVENT_CLASS_KEYBOARD); |
| 240 * </code> |
235 * | 241 * |
236 * @param instance The <code>PP_Instance</code> of the instance requesting | 242 * @param instance The <code>PP_Instance</code> of the instance requesting |
237 * the given events. | 243 * the given events. |
238 * | 244 * |
239 * @param event_classes A combination of flags from PP_InputEvent_Class that | 245 * @param event_classes A combination of flags from |
240 * identifies the classes of events the instance is requesting. The flags | 246 * <code>PP_InputEvent_Class</code> that identifies the classes of events the |
241 * are combined by logically ORing their values. | 247 * instance is requesting. The flags are combined by logically ORing their |
| 248 * values. |
242 * | 249 * |
243 * @return PP_OK if the operation succeeded, PP_ERROR_BADARGUMENT if instance | 250 * @return <code>PP_OK</code> if the operation succeeded, |
244 * is invalid, or PP_ERROR_NOTSUPPORTED if one of the event class bits were | 251 * <code>PP_ERROR_BADARGUMENT</code> if instance is invalid, or |
| 252 * <code>PP_ERROR_NOTSUPPORTED</code> if one of the event class bits were |
245 * illegal. In the case of an invalid bit, all valid bits will be applied | 253 * illegal. In the case of an invalid bit, all valid bits will be applied |
246 * and only the illegal bits will be ignored. The most common cause of a | 254 * and only the illegal bits will be ignored. The most common cause of a |
247 * PP_ERROR_NOTSUPPORTED return value is requesting keyboard events, these | 255 * <code>PP_ERROR_NOTSUPPORTED</code> return value is requesting keyboard |
248 * must use RequestFilteringInputEvents(). | 256 * events, these must use RequestFilteringInputEvents(). |
249 */ | 257 */ |
250 int32_t RequestInputEvents([in] PP_Instance instance, | 258 int32_t RequestInputEvents([in] PP_Instance instance, |
251 [in] uint32_t event_classes); | 259 [in] uint32_t event_classes); |
252 | 260 |
253 /** | 261 /** |
254 * Request that input events corresponding to the given input events are | 262 * RequestFilteringInputEvents() requests that input events corresponding to |
255 * delivered to the instance for filtering. | 263 * the given input events are delivered to the instance for filtering. |
256 * | 264 * |
257 * By default, no input events are delivered. In most cases you would | 265 * By default, no input events are delivered. In most cases you would |
258 * register to receive events by calling RequestInputEvents(). In some cases, | 266 * register to receive events by calling RequestInputEvents(). In some cases, |
259 * however, you may wish to filter events such that they can be bubbled up | 267 * however, you may wish to filter events such that they can be bubbled up |
260 * to the DOM. In this case, register for those classes of events using | 268 * to the DOM. In this case, register for those classes of events using |
261 * this function instead of RequestInputEvents(). | 269 * this function instead of RequestInputEvents(). |
262 * | 270 * |
263 * Filtering input events requires significantly more overhead than just | 271 * Filtering input events requires significantly more overhead than just |
264 * delivering them to the instance. As such, you should only request | 272 * delivering them to the instance. As such, you should only request |
265 * filtering in those cases where it's absolutely necessary. The reason is | 273 * filtering in those cases where it's absolutely necessary. The reason is |
266 * that it requires the browser to stop and block for the instance to handle | 274 * that it requires the browser to stop and block for the instance to handle |
267 * the input event, rather than sending the input event asynchronously. This | 275 * the input event, rather than sending the input event asynchronously. This |
268 * can have significant overhead. | 276 * can have significant overhead. |
269 * | 277 * |
270 * Example: | 278 * <strong>Example:</strong> |
| 279 * <code> |
271 * RequestInputEvents(instance, PP_INPUTEVENT_CLASS_MOUSE); | 280 * RequestInputEvents(instance, PP_INPUTEVENT_CLASS_MOUSE); |
272 * RequestFilteringInputEvents(instance, | 281 * RequestFilteringInputEvents(instance, |
273 * PP_INPUTEVENT_CLASS_WHEEL | PP_INPUTEVENT_CLASS_KEYBOARD); | 282 * PP_INPUTEVENT_CLASS_WHEEL | PP_INPUTEVENT_CLASS_KEYBOARD); |
| 283 * </code> |
274 * | 284 * |
275 * @return PP_OK if the operation succeeded, PP_ERROR_BADARGUMENT if instance | 285 * @return <code>PP_OK</code> if the operation succeeded, |
276 * is invalid, or PP_ERROR_NOTSUPPORTED if one of the event class bits were | 286 * <code>PP_ERROR_BADARGUMENT</code> if instance is invalid, or |
| 287 * <code>PP_ERROR_NOTSUPPORTED</code> if one of the event class bits were |
277 * illegal. In the case of an invalid bit, all valid bits will be applied | 288 * illegal. In the case of an invalid bit, all valid bits will be applied |
278 * and only the illegal bits will be ignored. | 289 * and only the illegal bits will be ignored. |
279 */ | 290 */ |
280 int32_t RequestFilteringInputEvents([in] PP_Instance instance, | 291 int32_t RequestFilteringInputEvents([in] PP_Instance instance, |
281 [in] uint32_t event_classes); | 292 [in] uint32_t event_classes); |
282 | 293 |
283 /** | 294 /** |
284 * Request that input events corresponding to the given input classes no | 295 * ClearInputEventRequest() requests that input events corresponding to the |
285 * longer be delivered to the instance. | 296 * given input classes no longer be delivered to the instance. |
286 * | 297 * |
287 * By default, no input events are delivered. If you have previously | 298 * By default, no input events are delivered. If you have previously |
288 * requested input events via RequestInputEvents() or | 299 * requested input events via RequestInputEvents() or |
289 * RequestFilteringInputEvents(), this function will unregister handling | 300 * RequestFilteringInputEvents(), this function will unregister handling |
290 * for the given instance. This will allow greater browser performance for | 301 * for the given instance. This will allow greater browser performance for |
291 * those events. | 302 * those events. |
292 * | 303 * |
293 * Note that you may still get some input events after clearing the flag if | 304 * Note that you may still get some input events after clearing the flag if |
294 * they were dispatched before the request was cleared. For example, if | 305 * they were dispatched before the request was cleared. For example, if |
295 * there are 3 mouse move events waiting to be delivered, and you clear the | 306 * there are 3 mouse move events waiting to be delivered, and you clear the |
296 * mouse event class during the processing of the first one, you'll still | 307 * mouse event class during the processing of the first one, you'll still |
297 * receive the next two. You just won't get more events generated. | 308 * receive the next two. You just won't get more events generated. |
298 * | 309 * |
299 * @param instance The <code>PP_Instance</code> of the instance requesting | 310 * @param instance The <code>PP_Instance</code> of the instance requesting |
300 * to no longer receive the given events. | 311 * to no longer receive the given events. |
301 * | 312 * |
302 * @param event_classes A combination of flags from PP_InputEvent_Class that | 313 * @param event_classes A combination of flags from |
303 * identifies the classes of events the instance is no longer interested in. | 314 * <code>PP_InputEvent_Class</code> that identify the classes of events the |
| 315 * instance is no longer interested in. |
304 */ | 316 */ |
305 void ClearInputEventRequest([in] PP_Instance instance, | 317 void ClearInputEventRequest([in] PP_Instance instance, |
306 [in] uint32_t event_classes); | 318 [in] uint32_t event_classes); |
307 | 319 |
308 /** | 320 /** |
309 * Returns true if the given resource is a valid input event resource. | 321 * IsInputEvent() returns true if the given resource is a valid input event |
| 322 * resource. |
| 323 * |
| 324 * @param[in] resource A <code>PP_Resource</code>. |
| 325 * |
| 326 * @return True if the given resource is a valid input event |
| 327 * resource. |
310 */ | 328 */ |
311 PP_Bool IsInputEvent([in] PP_Resource resource); | 329 PP_Bool IsInputEvent([in] PP_Resource resource); |
312 | 330 |
313 /** | 331 /** |
314 * Returns the type of input event for the given input event resource. | 332 * GetType() returns the type of input event for the given input event |
315 * This is valid for all input events. Returns PP_INPUTEVENT_TYPE_UNDEFINED | 333 * resource. |
316 * if the resource is invalid. | 334 * |
| 335 * @param[in] resource A <code>PP_Resource</code> containing the input event. |
| 336 * |
| 337 * @return A <code>PP_InputEvent_Type</code> if its a valid input event or |
| 338 * <code>PP_INPUTEVENT_TYPE_UNDEFINED</code> if the resource is invalid. |
317 */ | 339 */ |
318 PP_InputEvent_Type GetType([in] PP_Resource event); | 340 PP_InputEvent_Type GetType([in] PP_Resource event); |
319 | 341 |
320 /** | 342 /** |
321 * Returns the time that the event was generated. This will be before the | 343 * GetTimeStamp() Returns the time that the event was generated. This will be |
322 * current time since processing and dispatching the event has some overhead. | 344 * before the current time since processing and dispatching the event has |
323 * Use this value to compare the times the user generated two events without | 345 * some overhead. Use this value to compare the times the user generated two |
324 * being sensitive to variable processing time. | 346 * events without being sensitive to variable processing time. |
325 * | 347 * |
326 * The return value is in time ticks, which is a monotonically increasing | 348 * @param[in] resource A <code>PP_Resource</code> containing the event. |
327 * clock not related to the wall clock time. It will not change if the user | 349 * |
328 * changes their clock or daylight savings time starts, so can be reliably | 350 * @return The return value is in time ticks, which is a monotonically |
329 * used to compare events. This means, however, that you can't correlate | 351 * increasing clock not related to the wall clock time. It will not change |
330 * event times to a particular time of day on the system clock. | 352 * if the user changes their clock or daylight savings time starts, so can |
| 353 * be reliably used to compare events. This means, however, that you can't |
| 354 * correlate event times to a particular time of day on the system clock. |
331 */ | 355 */ |
332 PP_TimeTicks GetTimeStamp([in] PP_Resource event); | 356 PP_TimeTicks GetTimeStamp([in] PP_Resource event); |
333 | 357 |
334 /** | 358 /** |
335 * Returns a bitfield indicating which modifiers were down at the time of | 359 * GetModifiers() returns a bitfield indicating which modifiers were down |
336 * the event. This is a combination of the flags in the | 360 * at the time of the event. This is a combination of the flags in the |
337 * PP_InputEvent_Modifier enum. | 361 * <code>PP_InputEvent_Modifier</code> enum. |
| 362 * |
| 363 * @param[in] resource A <code>PP_Resource</code> containing the input event. |
338 * | 364 * |
339 * @return The modifiers associated with the event, or 0 if the given | 365 * @return The modifiers associated with the event, or 0 if the given |
340 * resource is not a valid event resource. | 366 * resource is not a valid event resource. |
341 */ | 367 */ |
342 uint32_t GetModifiers([in] PP_Resource event); | 368 uint32_t GetModifiers([in] PP_Resource event); |
343 }; | 369 }; |
344 | 370 |
| 371 /** |
| 372 * The <code>PPB_MouseInputEvent</code> interface contains pointers to several |
| 373 * functions related to mouse input events. |
| 374 */ |
345 [version=1.0, macro="PPB_MOUSE_INPUT_EVENT_INTERFACE"] | 375 [version=1.0, macro="PPB_MOUSE_INPUT_EVENT_INTERFACE"] |
346 interface PPB_MouseInputEvent { | 376 interface PPB_MouseInputEvent { |
347 /** | 377 /** |
348 * Creates a mouse input event with the given parameters. Normally you will | 378 * Create() creates a mouse input event with the given parameters. Normally |
349 * get a mouse event passed through the HandleInputEvent and will not need | 379 * you will get a mouse event passed through the |
350 * to create them, but some applications may want to create their own for | 380 * <code>HandleInputEvent</code> and will not need to create them, but some |
351 * internal use. The type must be one of the mouse event types. | 381 * applications may want to create their own for internal use. The type must |
| 382 * be one of the mouse event types. |
| 383 * |
| 384 * @param[in] instance The instance for which this event occurred. |
| 385 * |
| 386 * @param[in] type A <code>PP_InputEvent_Type</code> identifying the type of |
| 387 * input event. |
| 388 * |
| 389 * @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time |
| 390 * when the event occurred. |
| 391 * |
| 392 * @param[in] modifiers A bit field combination of the |
| 393 * <code>PP_InputEvent_Modifier</code> flags. |
| 394 * |
| 395 * @param[in] mouse_button The button that changed for mouse down or up |
| 396 * events. This value will be <code>PP_EVENT_MOUSEBUTTON_NONE</code> for |
| 397 * mouse move, enter, and leave events. |
| 398 * |
| 399 * @param[in] mouse_position A <code>Point</code> containing the x and y |
| 400 * position of the mouse when the event occurred. |
| 401 * |
| 402 * @return A <code>PP_Resource</code> containing the new mouse input event. |
352 */ | 403 */ |
353 PP_Resource Create([in] PP_Instance instance, | 404 PP_Resource Create([in] PP_Instance instance, |
354 [in] PP_InputEvent_Type type, | 405 [in] PP_InputEvent_Type type, |
355 [in] PP_TimeTicks time_stamp, | 406 [in] PP_TimeTicks time_stamp, |
356 [in] uint32_t modifiers, | 407 [in] uint32_t modifiers, |
357 [in] PP_InputEvent_MouseButton mouse_button, | 408 [in] PP_InputEvent_MouseButton mouse_button, |
358 [in] PP_Point mouse_position, | 409 [in] PP_Point mouse_position, |
359 [in] int32_t click_count); | 410 [in] int32_t click_count); |
360 | 411 |
361 /** | 412 /** |
362 * Determines if a resource is a mouse event. | 413 * IsMouseInputEvent() determines if a resource is a mouse event. |
363 * | 414 * |
364 * @return PP_TRUE if the given resource is a valid mouse input event. | 415 * @param[in] resource A <code>PP_Resource</code> containing the event. |
| 416 * |
| 417 * @return <code>PP_TRUE</code> if the given resource is a valid mouse input |
| 418 * event, otherwise <code>PP_FALSE</code>. |
365 */ | 419 */ |
366 PP_Bool IsMouseInputEvent([in] PP_Resource resource); | 420 PP_Bool IsMouseInputEvent([in] PP_Resource resource); |
367 | 421 |
368 /** | 422 /** |
369 * Returns which mouse button generated a mouse down or up event. | 423 * GetButton() returns the mouse button that generated a mouse down or up |
| 424 * event. |
| 425 * |
| 426 * @param[in] mouse_event A <code>PP_Resource</code> containing the mouse |
| 427 * event. |
370 * | 428 * |
371 * @return The mouse button associated with mouse down and up events. This | 429 * @return The mouse button associated with mouse down and up events. This |
372 * value will be PP_EVENT_MOUSEBUTTON_NONE for mouse move, enter, and leave | 430 * value will be <code>PP_EVENT_MOUSEBUTTON_NONE</code> for mouse move, |
373 * events, and for all non-mouse events. | 431 * enter, and leave events, and for all non-mouse events. |
374 */ | 432 */ |
375 PP_InputEvent_MouseButton GetButton([in] PP_Resource mouse_event); | 433 PP_InputEvent_MouseButton GetButton([in] PP_Resource mouse_event); |
376 | 434 |
377 /** | 435 /** |
378 * Returns the pixel location of a mouse input event. | 436 * GetPosition() returns the pixel location of a mouse input event. |
| 437 * |
| 438 * @param[in] mouse_event A <code>PP_Resource</code> containing the mouse |
| 439 * event. |
379 * | 440 * |
380 * @return The point associated with the mouse event, relative to the upper- | 441 * @return The point associated with the mouse event, relative to the upper- |
381 * left of the instance receiving the event. These values can be negative for | 442 * left of the instance receiving the event. These values can be negative for |
382 * mouse drags. The return value will be (0, 0) for non-mouse events. | 443 * mouse drags. The return value will be (0, 0) for non-mouse events. |
383 */ | 444 */ |
384 [returnByValue] PP_Point GetPosition([in] PP_Resource mouse_event); | 445 [returnByValue] PP_Point GetPosition([in] PP_Resource mouse_event); |
385 | 446 |
386 /** | 447 /** |
387 * TODO(brettw) figure out exactly what this means. | 448 * TODO(brettw) figure out exactly what this means. |
388 */ | 449 */ |
389 int32_t GetClickCount([in] PP_Resource mouse_event); | 450 int32_t GetClickCount([in] PP_Resource mouse_event); |
390 }; | 451 }; |
391 | 452 |
| 453 |
| 454 /** |
| 455 * The <code>PPB_WheelIputEvent</code> interface contains pointers to several |
| 456 * functions related to wheel input events. |
| 457 */ |
392 [version=1.0, macro="PPB_WHEEL_INPUT_EVENT_INTERFACE"] | 458 [version=1.0, macro="PPB_WHEEL_INPUT_EVENT_INTERFACE"] |
393 interface PPB_WheelInputEvent { | 459 interface PPB_WheelInputEvent { |
394 /** | 460 /** |
395 * Creates a wheel input event with the given parameters. Normally you will | 461 * Create() creates a wheel input event with the given parameters. Normally |
396 * get a wheel event passed through the HandleInputEvent and will not need | 462 * you will get a wheel event passed through the |
397 * to create them, but some applications may want to create their own for | 463 * <code>HandleInputEvent</code> and will not need to create them, but some |
398 * internal use. | 464 * applications may want to create their own for internal use. |
| 465 * |
| 466 * @param[in] instance The instance for which this event occurred. |
| 467 * |
| 468 * @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time |
| 469 * when the event occurred. |
| 470 * |
| 471 * @param[in] modifiers A bit field combination of the |
| 472 * <code>PP_InputEvent_Modifier</code> flags. |
| 473 * |
| 474 * @param[in] wheel_delta The scroll wheel's horizontal and vertical scroll |
| 475 * amounts. |
| 476 * |
| 477 * @param[in] wheel_ticks The number of "clicks" of the scroll wheel that |
| 478 * have produced the event. |
| 479 * |
| 480 * @param[in] scroll_by_page When true, the user is requesting to scroll |
| 481 * by pages. When false, the user is requesting to scroll by lines. |
| 482 * |
| 483 * @return A <code>PP_Resource</code> containing the new wheel input event. |
399 */ | 484 */ |
400 PP_Resource Create([in] PP_Instance instance, | 485 PP_Resource Create([in] PP_Instance instance, |
401 [in] PP_TimeTicks time_stamp, | 486 [in] PP_TimeTicks time_stamp, |
402 [in] uint32_t modifiers, | 487 [in] uint32_t modifiers, |
403 [in] PP_FloatPoint wheel_delta, | 488 [in] PP_FloatPoint wheel_delta, |
404 [in] PP_FloatPoint wheel_ticks, | 489 [in] PP_FloatPoint wheel_ticks, |
405 [in] PP_Bool scroll_by_page); | 490 [in] PP_Bool scroll_by_page); |
406 | 491 |
407 /** | 492 /** |
408 * Determines if a resource is a wheel event. | 493 * IsWheelInputEvent() determines if a resource is a wheel event. |
409 * | 494 * |
410 * @return PP_TRUE if the given resource is a valid wheel input event. | 495 * @param[in] wheel_event A <code>PP_Resource</code> containing the event. |
| 496 * |
| 497 * @return <code>PP_TRUE</code> if the given resource is a valid wheel input |
| 498 * event. |
411 */ | 499 */ |
412 PP_Bool IsWheelInputEvent([in] PP_Resource resource); | 500 PP_Bool IsWheelInputEvent([in] PP_Resource resource); |
413 | 501 |
414 /** | 502 /** |
415 * Indicates the amount vertically and horizontally the user has requested | 503 * GetDelta() returns the amount vertically and horizontally the user has |
416 * to scroll by with their mouse wheel. A scroll down or to the right (where | 504 * requested to scroll by with their mouse wheel. A scroll down or to the |
417 * the content moves up or left) is represented as positive values, and | 505 * right (where the content moves up or left) is represented as positive |
418 * a scroll up or to the left (where the content moves down or right) is | 506 * values, and a scroll up or to the left (where the content moves down or |
419 * represented as negative values. | 507 * right) is represented as negative values. |
420 * | |
421 * The units are either in pixels (when scroll_by_page is false) or pages | |
422 * (when scroll_by_page is true). For example, y = -3 means scroll up 3 | |
423 * pixels when scroll_by_page is false, and scroll up 3 pages when | |
424 * scroll_by_page is true. | |
425 * | 508 * |
426 * This amount is system dependent and will take into account the user's | 509 * This amount is system dependent and will take into account the user's |
427 * preferred scroll sensitivity and potentially also nonlinear acceleration | 510 * preferred scroll sensitivity and potentially also nonlinear acceleration |
428 * based on the speed of the scrolling. | 511 * based on the speed of the scrolling. |
429 * | 512 * |
430 * Devices will be of varying resolution. Some mice with large detents will | 513 * Devices will be of varying resolution. Some mice with large detents will |
431 * only generate integer scroll amounts. But fractional values are also | 514 * only generate integer scroll amounts. But fractional values are also |
432 * possible, for example, on some trackpads and newer mice that don't have | 515 * possible, for example, on some trackpads and newer mice that don't have |
433 * "clicks". | 516 * "clicks". |
| 517 * |
| 518 * @param[in] wheel_event A <code>PP_Resource</code> containing the wheel |
| 519 * event. |
| 520 * |
| 521 * @return The vertical and horizontal scroll values. The units are either in |
| 522 * pixels (when scroll_by_page is false) or pages (when scroll_by_page is |
| 523 * true). For example, y = -3 means scroll up 3 pixels when scroll_by_page |
| 524 * is false, and scroll up 3 pages when scroll_by_page is true. |
434 */ | 525 */ |
435 PP_FloatPoint GetDelta([in] PP_Resource wheel_event); | 526 PP_FloatPoint GetDelta([in] PP_Resource wheel_event); |
436 | 527 |
437 /** | 528 /** |
438 * The number of "clicks" of the scroll wheel that have produced the | 529 * GetTicks() returns the number of "clicks" of the scroll wheel |
439 * event. The value may have system-specific acceleration applied to it, | 530 * that have produced the event. The value may have system-specific |
440 * depending on the device. The positive and negative meanings are the same | 531 * acceleration applied to it, depending on the device. The positive and |
441 * as for GetWheelDelta(). | 532 * negative meanings are the same as for GetDelta(). |
442 * | 533 * |
443 * If you are scrolling, you probably want to use the delta values. These | 534 * If you are scrolling, you probably want to use the delta values. These |
444 * tick events can be useful if you aren't doing actual scrolling and don't | 535 * tick events can be useful if you aren't doing actual scrolling and don't |
445 * want or pixel values. An example may be cycling between different items in | 536 * want or pixel values. An example may be cycling between different items in |
446 * a game. | 537 * a game. |
447 * | 538 * |
448 * You may receive fractional values for the wheel ticks if the mouse wheel | 539 * @param[in] wheel_event A <code>PP_Resource</code> containing the wheel |
449 * is high resolution or doesn't have "clicks". If your program wants | 540 * event. |
450 * discrete events (as in the "picking items" example) you should accumulate | 541 * |
| 542 * @return The number of "clicks" of the scroll wheel. You may receive |
| 543 * fractional values for the wheel ticks if the mouse wheel is high |
| 544 * resolution or doesn't have "clicks". If your program wants discrete |
| 545 * events (as in the "picking items" example) you should accumulate |
451 * fractional click values from multiple messages until the total value | 546 * fractional click values from multiple messages until the total value |
452 * reaches positive or negative one. This should represent a similar amount | 547 * reaches positive or negative one. This should represent a similar amount |
453 * of scrolling as for a mouse that has a discrete mouse wheel. | 548 * of scrolling as for a mouse that has a discrete mouse wheel. |
454 */ | 549 */ |
455 PP_FloatPoint GetTicks([in] PP_Resource wheel_event); | 550 PP_FloatPoint GetTicks([in] PP_Resource wheel_event); |
456 | 551 |
457 /** | 552 /** |
458 * Indicates if the scroll delta x/y indicates pages or lines to | 553 * GetScrollByPage() indicates if the scroll delta x/y indicates pages or |
459 * scroll by. | 554 * lines to scroll by. |
460 * | 555 * |
461 * @return PP_TRUE if the event is a wheel event and the user is scrolling | 556 * @param[in] wheel_event A <code>PP_Resource</code> containing the wheel |
462 * by pages. PP_FALSE if not or if the resource is not a wheel event. | 557 * event. |
| 558 * |
| 559 * @return <code>PP_TRUE</code> if the event is a wheel event and the user is |
| 560 * scrolling by pages. <code>PP_FALSE</code> if not or if the resource is not |
| 561 * a wheel event. |
463 */ | 562 */ |
464 PP_Bool GetScrollByPage([in] PP_Resource wheel_event); | 563 PP_Bool GetScrollByPage([in] PP_Resource wheel_event); |
465 }; | 564 }; |
466 | 565 |
| 566 /** |
| 567 * The <code>PPB_KeyboardInputEvent</code> interface contains pointers to |
| 568 * several functions related to keyboard input events. |
| 569 */ |
467 [version=1.0, macro="PPB_KEYBOARD_INPUT_EVENT_INTERFACE"] | 570 [version=1.0, macro="PPB_KEYBOARD_INPUT_EVENT_INTERFACE"] |
468 interface PPB_KeyboardInputEvent { | 571 interface PPB_KeyboardInputEvent { |
469 /** | 572 /** |
470 * Creates a keyboard input event with the given parameters. Normally you | 573 * Creates a keyboard input event with the given parameters. Normally you |
471 * will get a keyboard event passed through the HandleInputEvent and will not | 574 * will get a keyboard event passed through the HandleInputEvent and will not |
472 * need to create them, but some applications may want to create their own | 575 * need to create them, but some applications may want to create their own |
473 * for internal use. The type must be one of the keyboard event types. | 576 * for internal use. The type must be one of the keyboard event types. |
| 577 * |
| 578 * @param[in] instance The instance for which this event occurred. |
| 579 * |
| 580 * @param[in] type A <code>PP_InputEvent_Type</code> identifying the type of |
| 581 * input event. |
| 582 * |
| 583 * @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time |
| 584 * when the event occurred. |
| 585 * |
| 586 * @param[in] modifiers A bit field combination of the |
| 587 * <code>PP_InputEvent_Modifier</code> flags. |
| 588 * |
| 589 * @param[in] key_code This value reflects the DOM KeyboardEvent |
| 590 * <code>keyCode</code> field. Chrome populates this with the Windows-style |
| 591 * Virtual Key code of the key. |
| 592 * |
| 593 * @param[in] character_text This value represents the typed character as a |
| 594 * UTF-8 string. |
| 595 * |
| 596 * @return A <code>PP_Resource</code> containing the new keyboard input |
| 597 * event. |
474 */ | 598 */ |
475 PP_Resource Create([in] PP_Instance instance, | 599 PP_Resource Create([in] PP_Instance instance, |
476 [in] PP_InputEvent_Type type, | 600 [in] PP_InputEvent_Type type, |
477 [in] PP_TimeTicks time_stamp, | 601 [in] PP_TimeTicks time_stamp, |
478 [in] uint32_t modifiers, | 602 [in] uint32_t modifiers, |
479 [in] uint32_t key_code, | 603 [in] uint32_t key_code, |
480 [in] PP_Var character_text); | 604 [in] PP_Var character_text); |
481 | 605 |
482 /** | 606 /** |
483 * Determines if a resource is a keyboard event. | 607 * IsKeyboardInputEvent() determines if a resource is a keyboard event. |
| 608 * |
| 609 * @param[in] resource A <code>PP_Resource</code> containing the event. |
484 * | 610 * |
485 * @return PP_TRUE if the given resource is a valid mouse input event. | 611 * @return <code>PP_TRUE</code> if the given resource is a valid input event. |
486 */ | 612 */ |
487 PP_Bool IsKeyboardInputEvent([in] PP_Resource resource); | 613 PP_Bool IsKeyboardInputEvent([in] PP_Resource resource); |
488 | 614 |
489 /** | 615 /** |
490 * Returns the DOM |keyCode| field for the keyboard event. | 616 * GetKeyCode() returns the DOM keyCode field for the keyboard event. |
491 * Chrome populates this with the Windows-style Virtual Key code of the key. | 617 * Chrome populates this with the Windows-style Virtual Key code of the key. |
| 618 * |
| 619 * @param[in] key_event A <code>PP_Resource</code> containing the keyboard |
| 620 * event. |
| 621 * |
| 622 * @return The DOM keyCode field for the keyboard event. |
492 */ | 623 */ |
493 uint32_t GetKeyCode([in] PP_Resource key_event); | 624 uint32_t GetKeyCode([in] PP_Resource key_event); |
494 | 625 |
495 /** | 626 /** |
496 * Returns the typed character for the given character event. | 627 * GetCharacterText() returns the typed character as a UTF-8 string for the |
| 628 * given character event. |
| 629 * |
| 630 * @param[in] character_event A <code>PP_Resource</code> containing the |
| 631 * keyboard event. |
497 * | 632 * |
498 * @return A string var representing a single typed character for character | 633 * @return A string var representing a single typed character for character |
499 * input events. For non-character input events the return value will be an | 634 * input events. For non-character input events the return value will be an |
500 * undefined var. | 635 * undefined var. |
501 */ | 636 */ |
502 PP_Var GetCharacterText([in] PP_Resource character_event); | 637 PP_Var GetCharacterText([in] PP_Resource character_event); |
503 }; | 638 }; |
504 | 639 |
OLD | NEW |