Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 * found in the LICENSE file. | |
| 4 */ | |
| 5 #ifndef PPAPI_C_DEV_PPB_TOUCH_EVENT_DEV_H_ | |
|
brettw
2012/06/19 21:20:52
You should convert this file to IDL and then gener
sadrul
2012/06/20 20:19:03
Done.
| |
| 6 #define PPAPI_C_DEV_PPB_TOUCH_EVENT_DEV_H_ | |
| 7 | |
| 8 #include "ppapi/c/pp_bool.h" | |
| 9 #include "ppapi/c/pp_point.h" | |
| 10 #include "ppapi/c/pp_resource.h" | |
| 11 #include "ppapi/c/pp_stdint.h" | |
| 12 | |
| 13 #define PPB_TOUCH_INPUT_EVENT_DEV_INTERFACE_0_1 "PPB_TouchInputEvent(Dev);0.1" | |
| 14 #define PPB_TOUCH_INPUT_EVENT_DEV_INTERFACE PPB_TOUCH_INPUT_EVENT_DEV_INTERFACE_ 0_1 | |
| 15 | |
| 16 /** | |
| 17 * Represents a single touch point. | |
| 18 */ | |
| 19 struct PP_TouchPoint_Dev { | |
| 20 /** | |
| 21 * The identifier for this TouchPoint. This corresponds to the order | |
| 22 * in which the points were pressed. For example, the first point to be | |
| 23 * pressed has an id of 0, the second has an id of 1, and so on. An id can be | |
| 24 * reused when a touch point is released. For example, if two fingers are | |
| 25 * down, with id 0 and 1, and finger 0 releases, the next finger to be | |
| 26 * pressed can be assigned to id 0. | |
| 27 */ | |
| 28 uint32_t id; | |
| 29 | |
| 30 /** | |
| 31 * The x-y coordinates of this TouchPoint, in DOM coordinate space. | |
|
brettw
2012/06/19 21:20:52
One thing that we need to clarify is the coordinat
sadrul
2012/06/20 20:19:03
These values are indeed in the same coordinate spa
| |
| 32 */ | |
| 33 struct PP_FloatPoint position; | |
| 34 /** | |
| 35 * The elliptical radii, in screen pixels, in the x and y direction of this | |
| 36 * TouchPoint. | |
| 37 */ | |
| 38 struct PP_FloatPoint radius; | |
| 39 /** | |
| 40 * The angle of rotation in degrees of the elliptical model of this TouchPoint | |
| 41 * clockwise from "up." | |
| 42 */ | |
| 43 float rotation_angle; | |
| 44 /** | |
| 45 * The pressure applied to this TouchPoint. This is typically a | |
| 46 * value between 0 and 1, with 0 indicating no pressure and 1 indicating | |
| 47 * some maximum pressure, but scaling differs depending on the hardware and | |
| 48 * the value is not guaranteed to stay within that range. | |
| 49 */ | |
| 50 float pressure; | |
| 51 }; | |
| 52 | |
| 53 PP_INLINE struct PP_TouchPoint_Dev PP_MakeTouchPoint() { | |
| 54 struct PP_TouchPoint_Dev result = { 0, {0, 0}, {0, 0}, 0, 0 }; | |
| 55 return result; | |
| 56 } | |
| 57 | |
| 58 typedef enum { | |
| 59 | |
| 60 /** | |
| 61 * The list of all TouchPoints which are currently down. | |
| 62 */ | |
| 63 PP_TOUCHLIST_TYPE_TOUCHES, | |
| 64 | |
| 65 /** | |
| 66 * The list of all TouchPoints whose state has changed since the last | |
| 67 * TouchInputEvent. | |
| 68 */ | |
| 69 PP_TOUCHLIST_TYPE_CHANGEDTOUCHES, | |
| 70 | |
| 71 /** | |
| 72 * The list of all TouchPoints which are targeting this plugin. This is a | |
| 73 * subset of Touches. | |
| 74 */ | |
| 75 PP_TOUCHLIST_TYPE_TARGETTOUCHES | |
| 76 } PP_TouchListType; | |
| 77 | |
| 78 struct PPB_TouchInputEvent_Dev { | |
|
brettw
2012/06/19 21:20:52
I think we will want a "create" function like we h
sadrul
2012/06/20 20:19:03
Done. I have currently left CreateTouchInputEvent
| |
| 79 /** | |
| 80 * Determines if a resource is a touch event. | |
| 81 * | |
| 82 * @return PP_TRUE if the given resource is a valid touch input event. | |
| 83 */ | |
| 84 PP_Bool (*IsTouchInputEvent)(PP_Resource resource); | |
| 85 | |
| 86 /** | |
| 87 * @return The number of TouchPoints in the given list | |
| 88 */ | |
| 89 uint32_t (*GetTouchCount)(PP_Resource resource, PP_TouchListType list); | |
| 90 | |
| 91 /** | |
| 92 * @return The TouchPoint at the given index, or an empty TouchPoint if the | |
| 93 * given index is out of range | |
| 94 */ | |
| 95 PP_TouchPoint_Dev (*GetTouchByIndex)(PP_Resource resource, | |
| 96 PP_TouchListType list, | |
| 97 uint32_t index); | |
| 98 | |
| 99 /** | |
| 100 * @return The TouchPoint with the given identifier, or an empty TouchPoint | |
| 101 * if this TouchList does not contain a TouchPoint with that identifier. | |
| 102 */ | |
| 103 PP_TouchPoint_Dev (*GetTouchById)(PP_Resource resource, | |
| 104 PP_TouchListType list, | |
| 105 uint32_t id); | |
| 106 }; | |
| 107 | |
| 108 #endif /* PPAPI_C_DEV_PPB_TOUCH_EVENT_DEV_H_ */ | |
| OLD | NEW |