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 /* From ppb_input_event.idl modified Wed Aug 17 11:16:34 2011. */ | 6 /* From ppb_input_event.idl modified Wed Aug 24 09:43:38 2011. */ |
7 | 7 |
8 #ifndef PPAPI_C_PPB_INPUT_EVENT_H_ | 8 #ifndef PPAPI_C_PPB_INPUT_EVENT_H_ |
9 #define PPAPI_C_PPB_INPUT_EVENT_H_ | 9 #define PPAPI_C_PPB_INPUT_EVENT_H_ |
10 | 10 |
11 #include "ppapi/c/pp_bool.h" | 11 #include "ppapi/c/pp_bool.h" |
12 #include "ppapi/c/pp_instance.h" | 12 #include "ppapi/c/pp_instance.h" |
13 #include "ppapi/c/pp_macros.h" | 13 #include "ppapi/c/pp_macros.h" |
14 #include "ppapi/c/pp_point.h" | 14 #include "ppapi/c/pp_point.h" |
15 #include "ppapi/c/pp_resource.h" | 15 #include "ppapi/c/pp_resource.h" |
16 #include "ppapi/c/pp_stdint.h" | 16 #include "ppapi/c/pp_stdint.h" |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 * | 329 * |
330 * @param event_classes A combination of flags from | 330 * @param event_classes A combination of flags from |
331 * <code>PP_InputEvent_Class</code> that identify the classes of events the | 331 * <code>PP_InputEvent_Class</code> that identify the classes of events the |
332 * instance is no longer interested in. | 332 * instance is no longer interested in. |
333 */ | 333 */ |
334 void (*ClearInputEventRequest)(PP_Instance instance, uint32_t event_classes); | 334 void (*ClearInputEventRequest)(PP_Instance instance, uint32_t event_classes); |
335 /** | 335 /** |
336 * IsInputEvent() returns true if the given resource is a valid input event | 336 * IsInputEvent() returns true if the given resource is a valid input event |
337 * resource. | 337 * resource. |
338 * | 338 * |
339 * @param[in] resource A <code>PP_Resource</code>. | 339 * @param[in] resource A <code>PP_Resource</code> corresponding to a generic |
| 340 * resource. |
340 * | 341 * |
341 * @return True if the given resource is a valid input event | 342 * @return <code>PP_TRUE</code> if the given resource is a valid input event |
342 * resource. | 343 * resource. |
343 */ | 344 */ |
344 PP_Bool (*IsInputEvent)(PP_Resource resource); | 345 PP_Bool (*IsInputEvent)(PP_Resource resource); |
345 /** | 346 /** |
346 * GetType() returns the type of input event for the given input event | 347 * GetType() returns the type of input event for the given input event |
347 * resource. | 348 * resource. |
348 * | 349 * |
349 * @param[in] resource A <code>PP_Resource</code> containing the input event. | 350 * @param[in] resource A <code>PP_Resource</code> corresponding to an input |
| 351 * event. |
350 * | 352 * |
351 * @return A <code>PP_InputEvent_Type</code> if its a valid input event or | 353 * @return A <code>PP_InputEvent_Type</code> if its a valid input event or |
352 * <code>PP_INPUTEVENT_TYPE_UNDEFINED</code> if the resource is invalid. | 354 * <code>PP_INPUTEVENT_TYPE_UNDEFINED</code> if the resource is invalid. |
353 */ | 355 */ |
354 PP_InputEvent_Type (*GetType)(PP_Resource event); | 356 PP_InputEvent_Type (*GetType)(PP_Resource event); |
355 /** | 357 /** |
356 * GetTimeStamp() Returns the time that the event was generated. This will be | 358 * GetTimeStamp() Returns the time that the event was generated. This will be |
357 * before the current time since processing and dispatching the event has | 359 * before the current time since processing and dispatching the event has |
358 * some overhead. Use this value to compare the times the user generated two | 360 * some overhead. Use this value to compare the times the user generated two |
359 * events without being sensitive to variable processing time. | 361 * events without being sensitive to variable processing time. |
360 * | 362 * |
361 * @param[in] resource A <code>PP_Resource</code> containing the event. | 363 * @param[in] resource A <code>PP_Resource</code> corresponding to the event. |
362 * | 364 * |
363 * @return The return value is in time ticks, which is a monotonically | 365 * @return The return value is in time ticks, which is a monotonically |
364 * increasing clock not related to the wall clock time. It will not change | 366 * increasing clock not related to the wall clock time. It will not change |
365 * if the user changes their clock or daylight savings time starts, so can | 367 * if the user changes their clock or daylight savings time starts, so can |
366 * be reliably used to compare events. This means, however, that you can't | 368 * be reliably used to compare events. This means, however, that you can't |
367 * correlate event times to a particular time of day on the system clock. | 369 * correlate event times to a particular time of day on the system clock. |
368 */ | 370 */ |
369 PP_TimeTicks (*GetTimeStamp)(PP_Resource event); | 371 PP_TimeTicks (*GetTimeStamp)(PP_Resource event); |
370 /** | 372 /** |
371 * GetModifiers() returns a bitfield indicating which modifiers were down | 373 * GetModifiers() returns a bitfield indicating which modifiers were down |
372 * at the time of the event. This is a combination of the flags in the | 374 * at the time of the event. This is a combination of the flags in the |
373 * <code>PP_InputEvent_Modifier</code> enum. | 375 * <code>PP_InputEvent_Modifier</code> enum. |
374 * | 376 * |
375 * @param[in] resource A <code>PP_Resource</code> containing the input event. | 377 * @param[in] resource A <code>PP_Resource</code> corresponding to an input |
| 378 * event. |
376 * | 379 * |
377 * @return The modifiers associated with the event, or 0 if the given | 380 * @return The modifiers associated with the event, or 0 if the given |
378 * resource is not a valid event resource. | 381 * resource is not a valid event resource. |
379 */ | 382 */ |
380 uint32_t (*GetModifiers)(PP_Resource event); | 383 uint32_t (*GetModifiers)(PP_Resource event); |
381 }; | 384 }; |
382 | 385 |
383 /** | 386 /** |
384 * The <code>PPB_MouseInputEvent</code> interface contains pointers to several | 387 * The <code>PPB_MouseInputEvent</code> interface contains pointers to several |
385 * functions related to mouse input events. | 388 * functions related to mouse input events. |
(...skipping 29 matching lines...) Expand all Loading... |
415 PP_Resource (*Create)(PP_Instance instance, | 418 PP_Resource (*Create)(PP_Instance instance, |
416 PP_InputEvent_Type type, | 419 PP_InputEvent_Type type, |
417 PP_TimeTicks time_stamp, | 420 PP_TimeTicks time_stamp, |
418 uint32_t modifiers, | 421 uint32_t modifiers, |
419 PP_InputEvent_MouseButton mouse_button, | 422 PP_InputEvent_MouseButton mouse_button, |
420 const struct PP_Point* mouse_position, | 423 const struct PP_Point* mouse_position, |
421 int32_t click_count); | 424 int32_t click_count); |
422 /** | 425 /** |
423 * IsMouseInputEvent() determines if a resource is a mouse event. | 426 * IsMouseInputEvent() determines if a resource is a mouse event. |
424 * | 427 * |
425 * @param[in] resource A <code>PP_Resource</code> containing the event. | 428 * @param[in] resource A <code>PP_Resource</code> corresponding to an event. |
426 * | 429 * |
427 * @return <code>PP_TRUE</code> if the given resource is a valid mouse input | 430 * @return <code>PP_TRUE</code> if the given resource is a valid mouse input |
428 * event, otherwise <code>PP_FALSE</code>. | 431 * event, otherwise <code>PP_FALSE</code>. |
429 */ | 432 */ |
430 PP_Bool (*IsMouseInputEvent)(PP_Resource resource); | 433 PP_Bool (*IsMouseInputEvent)(PP_Resource resource); |
431 /** | 434 /** |
432 * GetButton() returns the mouse button that generated a mouse down or up | 435 * GetButton() returns the mouse button that generated a mouse down or up |
433 * event. | 436 * event. |
434 * | 437 * |
435 * @param[in] mouse_event A <code>PP_Resource</code> containing the mouse | 438 * @param[in] mouse_event A <code>PP_Resource</code> corresponding to a |
436 * event. | 439 * mouse event. |
437 * | 440 * |
438 * @return The mouse button associated with mouse down and up events. This | 441 * @return The mouse button associated with mouse down and up events. This |
439 * value will be <code>PP_EVENT_MOUSEBUTTON_NONE</code> for mouse move, | 442 * value will be <code>PP_EVENT_MOUSEBUTTON_NONE</code> for mouse move, |
440 * enter, and leave events, and for all non-mouse events. | 443 * enter, and leave events, and for all non-mouse events. |
441 */ | 444 */ |
442 PP_InputEvent_MouseButton (*GetButton)(PP_Resource mouse_event); | 445 PP_InputEvent_MouseButton (*GetButton)(PP_Resource mouse_event); |
443 /** | 446 /** |
444 * GetPosition() returns the pixel location of a mouse input event. | 447 * GetPosition() returns the pixel location of a mouse input event. |
445 * | 448 * |
446 * @param[in] mouse_event A <code>PP_Resource</code> containing the mouse | 449 * @param[in] mouse_event A <code>PP_Resource</code> corresponding to an |
447 * event. | 450 * mouse event. |
448 * | 451 * |
449 * @return The point associated with the mouse event, relative to the upper- | 452 * @return The point associated with the mouse event, relative to the upper- |
450 * left of the instance receiving the event. These values can be negative for | 453 * left of the instance receiving the event. These values can be negative for |
451 * mouse drags. The return value will be (0, 0) for non-mouse events. | 454 * mouse drags. The return value will be (0, 0) for non-mouse events. |
452 */ | 455 */ |
453 struct PP_Point (*GetPosition)(PP_Resource mouse_event); | 456 struct PP_Point (*GetPosition)(PP_Resource mouse_event); |
454 /** | 457 /** |
455 * TODO(brettw) figure out exactly what this means. | 458 * TODO(brettw) figure out exactly what this means. |
456 */ | 459 */ |
457 int32_t (*GetClickCount)(PP_Resource mouse_event); | 460 int32_t (*GetClickCount)(PP_Resource mouse_event); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 */ | 492 */ |
490 PP_Resource (*Create)(PP_Instance instance, | 493 PP_Resource (*Create)(PP_Instance instance, |
491 PP_TimeTicks time_stamp, | 494 PP_TimeTicks time_stamp, |
492 uint32_t modifiers, | 495 uint32_t modifiers, |
493 const struct PP_FloatPoint* wheel_delta, | 496 const struct PP_FloatPoint* wheel_delta, |
494 const struct PP_FloatPoint* wheel_ticks, | 497 const struct PP_FloatPoint* wheel_ticks, |
495 PP_Bool scroll_by_page); | 498 PP_Bool scroll_by_page); |
496 /** | 499 /** |
497 * IsWheelInputEvent() determines if a resource is a wheel event. | 500 * IsWheelInputEvent() determines if a resource is a wheel event. |
498 * | 501 * |
499 * @param[in] wheel_event A <code>PP_Resource</code> containing the event. | 502 * @param[in] wheel_event A <code>PP_Resource</code> corresponding to an |
| 503 * event. |
500 * | 504 * |
501 * @return <code>PP_TRUE</code> if the given resource is a valid wheel input | 505 * @return <code>PP_TRUE</code> if the given resource is a valid wheel input |
502 * event. | 506 * event. |
503 */ | 507 */ |
504 PP_Bool (*IsWheelInputEvent)(PP_Resource resource); | 508 PP_Bool (*IsWheelInputEvent)(PP_Resource resource); |
505 /** | 509 /** |
506 * GetDelta() returns the amount vertically and horizontally the user has | 510 * GetDelta() returns the amount vertically and horizontally the user has |
507 * requested to scroll by with their mouse wheel. A scroll down or to the | 511 * requested to scroll by with their mouse wheel. A scroll down or to the |
508 * right (where the content moves up or left) is represented as positive | 512 * right (where the content moves up or left) is represented as positive |
509 * values, and a scroll up or to the left (where the content moves down or | 513 * values, and a scroll up or to the left (where the content moves down or |
510 * right) is represented as negative values. | 514 * right) is represented as negative values. |
511 * | 515 * |
512 * This amount is system dependent and will take into account the user's | 516 * This amount is system dependent and will take into account the user's |
513 * preferred scroll sensitivity and potentially also nonlinear acceleration | 517 * preferred scroll sensitivity and potentially also nonlinear acceleration |
514 * based on the speed of the scrolling. | 518 * based on the speed of the scrolling. |
515 * | 519 * |
516 * Devices will be of varying resolution. Some mice with large detents will | 520 * Devices will be of varying resolution. Some mice with large detents will |
517 * only generate integer scroll amounts. But fractional values are also | 521 * only generate integer scroll amounts. But fractional values are also |
518 * possible, for example, on some trackpads and newer mice that don't have | 522 * possible, for example, on some trackpads and newer mice that don't have |
519 * "clicks". | 523 * "clicks". |
520 * | 524 * |
521 * @param[in] wheel_event A <code>PP_Resource</code> containing the wheel | 525 * @param[in] wheel_event A <code>PP_Resource</code> corresponding to a wheel |
522 * event. | 526 * event. |
523 * | 527 * |
524 * @return The vertical and horizontal scroll values. The units are either in | 528 * @return The vertical and horizontal scroll values. The units are either in |
525 * pixels (when scroll_by_page is false) or pages (when scroll_by_page is | 529 * pixels (when scroll_by_page is false) or pages (when scroll_by_page is |
526 * true). For example, y = -3 means scroll up 3 pixels when scroll_by_page | 530 * true). For example, y = -3 means scroll up 3 pixels when scroll_by_page |
527 * is false, and scroll up 3 pages when scroll_by_page is true. | 531 * is false, and scroll up 3 pages when scroll_by_page is true. |
528 */ | 532 */ |
529 struct PP_FloatPoint (*GetDelta)(PP_Resource wheel_event); | 533 struct PP_FloatPoint (*GetDelta)(PP_Resource wheel_event); |
530 /** | 534 /** |
531 * GetTicks() returns the number of "clicks" of the scroll wheel | 535 * GetTicks() returns the number of "clicks" of the scroll wheel |
532 * that have produced the event. The value may have system-specific | 536 * that have produced the event. The value may have system-specific |
533 * acceleration applied to it, depending on the device. The positive and | 537 * acceleration applied to it, depending on the device. The positive and |
534 * negative meanings are the same as for GetDelta(). | 538 * negative meanings are the same as for GetDelta(). |
535 * | 539 * |
536 * If you are scrolling, you probably want to use the delta values. These | 540 * If you are scrolling, you probably want to use the delta values. These |
537 * tick events can be useful if you aren't doing actual scrolling and don't | 541 * tick events can be useful if you aren't doing actual scrolling and don't |
538 * want or pixel values. An example may be cycling between different items in | 542 * want or pixel values. An example may be cycling between different items in |
539 * a game. | 543 * a game. |
540 * | 544 * |
541 * @param[in] wheel_event A <code>PP_Resource</code> containing the wheel | 545 * @param[in] wheel_event A <code>PP_Resource</code> corresponding to a wheel |
542 * event. | 546 * event. |
543 * | 547 * |
544 * @return The number of "clicks" of the scroll wheel. You may receive | 548 * @return The number of "clicks" of the scroll wheel. You may receive |
545 * fractional values for the wheel ticks if the mouse wheel is high | 549 * fractional values for the wheel ticks if the mouse wheel is high |
546 * resolution or doesn't have "clicks". If your program wants discrete | 550 * resolution or doesn't have "clicks". If your program wants discrete |
547 * events (as in the "picking items" example) you should accumulate | 551 * events (as in the "picking items" example) you should accumulate |
548 * fractional click values from multiple messages until the total value | 552 * fractional click values from multiple messages until the total value |
549 * reaches positive or negative one. This should represent a similar amount | 553 * reaches positive or negative one. This should represent a similar amount |
550 * of scrolling as for a mouse that has a discrete mouse wheel. | 554 * of scrolling as for a mouse that has a discrete mouse wheel. |
551 */ | 555 */ |
552 struct PP_FloatPoint (*GetTicks)(PP_Resource wheel_event); | 556 struct PP_FloatPoint (*GetTicks)(PP_Resource wheel_event); |
553 /** | 557 /** |
554 * GetScrollByPage() indicates if the scroll delta x/y indicates pages or | 558 * GetScrollByPage() indicates if the scroll delta x/y indicates pages or |
555 * lines to scroll by. | 559 * lines to scroll by. |
556 * | 560 * |
557 * @param[in] wheel_event A <code>PP_Resource</code> containing the wheel | 561 * @param[in] wheel_event A <code>PP_Resource</code> corresponding to a wheel |
558 * event. | 562 * event. |
559 * | 563 * |
560 * @return <code>PP_TRUE</code> if the event is a wheel event and the user is | 564 * @return <code>PP_TRUE</code> if the event is a wheel event and the user is |
561 * scrolling by pages. <code>PP_FALSE</code> if not or if the resource is not | 565 * scrolling by pages. <code>PP_FALSE</code> if not or if the resource is not |
562 * a wheel event. | 566 * a wheel event. |
563 */ | 567 */ |
564 PP_Bool (*GetScrollByPage)(PP_Resource wheel_event); | 568 PP_Bool (*GetScrollByPage)(PP_Resource wheel_event); |
565 }; | 569 }; |
566 | 570 |
567 /** | 571 /** |
(...skipping 30 matching lines...) Expand all Loading... |
598 */ | 602 */ |
599 PP_Resource (*Create)(PP_Instance instance, | 603 PP_Resource (*Create)(PP_Instance instance, |
600 PP_InputEvent_Type type, | 604 PP_InputEvent_Type type, |
601 PP_TimeTicks time_stamp, | 605 PP_TimeTicks time_stamp, |
602 uint32_t modifiers, | 606 uint32_t modifiers, |
603 uint32_t key_code, | 607 uint32_t key_code, |
604 struct PP_Var character_text); | 608 struct PP_Var character_text); |
605 /** | 609 /** |
606 * IsKeyboardInputEvent() determines if a resource is a keyboard event. | 610 * IsKeyboardInputEvent() determines if a resource is a keyboard event. |
607 * | 611 * |
608 * @param[in] resource A <code>PP_Resource</code> containing the event. | 612 * @param[in] resource A <code>PP_Resource</code> corresponding to an event. |
609 * | 613 * |
610 * @return <code>PP_TRUE</code> if the given resource is a valid input event. | 614 * @return <code>PP_TRUE</code> if the given resource is a valid input event. |
611 */ | 615 */ |
612 PP_Bool (*IsKeyboardInputEvent)(PP_Resource resource); | 616 PP_Bool (*IsKeyboardInputEvent)(PP_Resource resource); |
613 /** | 617 /** |
614 * GetKeyCode() returns the DOM keyCode field for the keyboard event. | 618 * GetKeyCode() returns the DOM keyCode field for the keyboard event. |
615 * Chrome populates this with the Windows-style Virtual Key code of the key. | 619 * Chrome populates this with the Windows-style Virtual Key code of the key. |
616 * | 620 * |
617 * @param[in] key_event A <code>PP_Resource</code> containing the keyboard | 621 * @param[in] key_event A <code>PP_Resource</code> corresponding to a |
618 * event. | 622 * keyboard event. |
619 * | 623 * |
620 * @return The DOM keyCode field for the keyboard event. | 624 * @return The DOM keyCode field for the keyboard event. |
621 */ | 625 */ |
622 uint32_t (*GetKeyCode)(PP_Resource key_event); | 626 uint32_t (*GetKeyCode)(PP_Resource key_event); |
623 /** | 627 /** |
624 * GetCharacterText() returns the typed character as a UTF-8 string for the | 628 * GetCharacterText() returns the typed character as a UTF-8 string for the |
625 * given character event. | 629 * given character event. |
626 * | 630 * |
627 * @param[in] character_event A <code>PP_Resource</code> containing the | 631 * @param[in] character_event A <code>PP_Resource</code> corresponding to a |
628 * keyboard event. | 632 * keyboard event. |
629 * | 633 * |
630 * @return A string var representing a single typed character for character | 634 * @return A string var representing a single typed character for character |
631 * input events. For non-character input events the return value will be an | 635 * input events. For non-character input events the return value will be an |
632 * undefined var. | 636 * undefined var. |
633 */ | 637 */ |
634 struct PP_Var (*GetCharacterText)(PP_Resource character_event); | 638 struct PP_Var (*GetCharacterText)(PP_Resource character_event); |
635 }; | 639 }; |
636 /** | 640 /** |
637 * @} | 641 * @} |
638 */ | 642 */ |
639 | 643 |
640 #endif /* PPAPI_C_PPB_INPUT_EVENT_H_ */ | 644 #endif /* PPAPI_C_PPB_INPUT_EVENT_H_ */ |
641 | 645 |
OLD | NEW |