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

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

Issue 10543159: ppapi: Add support for touch events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: idl-goodness Created 8 years, 6 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) 2012 The Chromium Authors. All rights reserved. 1 /* Copyright (c) 2012 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 Mon Mar 5 10:11:05 2012. */ 6 /* From ppb_input_event.idl modified Wed Jun 20 15:23:02 2012. */
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"
17 #include "ppapi/c/pp_time.h" 17 #include "ppapi/c/pp_time.h"
18 #include "ppapi/c/pp_var.h" 18 #include "ppapi/c/pp_var.h"
19 #include "ppapi/c/ppb_touch_point.h"
19 20
20 #define PPB_INPUT_EVENT_INTERFACE_1_0 "PPB_InputEvent;1.0" 21 #define PPB_INPUT_EVENT_INTERFACE_1_0 "PPB_InputEvent;1.0"
21 #define PPB_INPUT_EVENT_INTERFACE PPB_INPUT_EVENT_INTERFACE_1_0 22 #define PPB_INPUT_EVENT_INTERFACE PPB_INPUT_EVENT_INTERFACE_1_0
22 23
23 #define PPB_MOUSE_INPUT_EVENT_INTERFACE_1_0 "PPB_MouseInputEvent;1.0" 24 #define PPB_MOUSE_INPUT_EVENT_INTERFACE_1_0 "PPB_MouseInputEvent;1.0"
24 #define PPB_MOUSE_INPUT_EVENT_INTERFACE_1_1 "PPB_MouseInputEvent;1.1" 25 #define PPB_MOUSE_INPUT_EVENT_INTERFACE_1_1 "PPB_MouseInputEvent;1.1"
25 #define PPB_MOUSE_INPUT_EVENT_INTERFACE PPB_MOUSE_INPUT_EVENT_INTERFACE_1_1 26 #define PPB_MOUSE_INPUT_EVENT_INTERFACE PPB_MOUSE_INPUT_EVENT_INTERFACE_1_1
26 27
27 #define PPB_WHEEL_INPUT_EVENT_INTERFACE_1_0 "PPB_WheelInputEvent;1.0" 28 #define PPB_WHEEL_INPUT_EVENT_INTERFACE_1_0 "PPB_WheelInputEvent;1.0"
28 #define PPB_WHEEL_INPUT_EVENT_INTERFACE PPB_WHEEL_INPUT_EVENT_INTERFACE_1_0 29 #define PPB_WHEEL_INPUT_EVENT_INTERFACE PPB_WHEEL_INPUT_EVENT_INTERFACE_1_0
29 30
30 #define PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_0 "PPB_KeyboardInputEvent;1.0" 31 #define PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_0 "PPB_KeyboardInputEvent;1.0"
31 #define PPB_KEYBOARD_INPUT_EVENT_INTERFACE \ 32 #define PPB_KEYBOARD_INPUT_EVENT_INTERFACE \
32 PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_0 33 PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_0
33 34
35 #define PPB_TOUCH_INPUT_EVENT_INTERFACE_1_0 "PPB_TouchInputEvent;1.0"
36 #define PPB_TOUCH_INPUT_EVENT_INTERFACE PPB_TOUCH_INPUT_EVENT_INTERFACE_1_0
37
34 /** 38 /**
35 * @file 39 * @file
36 * This file defines the Input Event interfaces. 40 * This file defines the Input Event interfaces.
37 */ 41 */
38 42
39 43
40 /** 44 /**
41 * @addtogroup Enums 45 * @addtogroup Enums
42 * @{ 46 * @{
43 */ 47 */
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 * Notification that an input method composition process has completed. 141 * Notification that an input method composition process has completed.
138 * 142 *
139 * Register for this event using the PP_INPUTEVENT_CLASS_IME class. 143 * Register for this event using the PP_INPUTEVENT_CLASS_IME class.
140 */ 144 */
141 PP_INPUTEVENT_TYPE_IME_COMPOSITION_END = 13, 145 PP_INPUTEVENT_TYPE_IME_COMPOSITION_END = 13,
142 /** 146 /**
143 * Notification that an input method committed a string. 147 * Notification that an input method committed a string.
144 * 148 *
145 * Register for this event using the PP_INPUTEVENT_CLASS_IME class. 149 * Register for this event using the PP_INPUTEVENT_CLASS_IME class.
146 */ 150 */
147 PP_INPUTEVENT_TYPE_IME_TEXT = 14 151 PP_INPUTEVENT_TYPE_IME_TEXT = 14,
152 /**
153 * Notification that a finger was placed on a touch-enabled device.
154 *
155 * Register for this event using the PP_INPUTEVENT_CLASS_TOUCH class.
156 */
157 PP_INPUTEVENT_TYPE_TOUCHSTART = 15,
158 /**
159 * Notification that a finger was moved on a touch-enabled device.
160 *
161 * Register for this event using the PP_INPUTEVENT_CLASS_TOUCH class.
162 */
163 PP_INPUTEVENT_TYPE_TOUCHMOVE = 16,
164 /**
165 * Notification that a finger was released on a touch-enabled device.
166 *
167 * Register for this event using the PP_INPUTEVENT_CLASS_TOUCH class.
168 */
169 PP_INPUTEVENT_TYPE_TOUCHEND = 17,
170 /**
171 * Notification that a touch event was canceled.
172 *
173 * Register for this event using the PP_INPUTEVENT_CLASS_TOUCH class.
174 */
175 PP_INPUTEVENT_TYPE_TOUCHCANCEL = 18
148 } PP_InputEvent_Type; 176 } PP_InputEvent_Type;
149 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_Type, 4); 177 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_Type, 4);
150 178
151 /** 179 /**
152 * This enumeration contains event modifier constants. Each modifier is one 180 * This enumeration contains event modifier constants. Each modifier is one
153 * bit. Retrieve the modifiers from an input event using the GetEventModifiers 181 * bit. Retrieve the modifiers from an input event using the GetEventModifiers
154 * function on PPB_InputEvent. 182 * function on PPB_InputEvent.
155 */ 183 */
156 typedef enum { 184 typedef enum {
157 PP_INPUTEVENT_MODIFIER_SHIFTKEY = 1 << 0, 185 PP_INPUTEVENT_MODIFIER_SHIFTKEY = 1 << 0,
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 * undefined var. 730 * undefined var.
703 */ 731 */
704 struct PP_Var (*GetCharacterText)(PP_Resource character_event); 732 struct PP_Var (*GetCharacterText)(PP_Resource character_event);
705 }; 733 };
706 734
707 typedef struct PPB_KeyboardInputEvent_1_0 PPB_KeyboardInputEvent; 735 typedef struct PPB_KeyboardInputEvent_1_0 PPB_KeyboardInputEvent;
708 /** 736 /**
709 * @} 737 * @}
710 */ 738 */
711 739
740 /**
741 * @addtogroup Enums
742 * @{
743 */
744 typedef enum {
745 /**
746 * The list of all TouchPoints which are currently down.
747 */
748 PP_TOUCHLIST_TYPE_TOUCHES = 0,
749 /**
750 * The list of all TouchPoints whose state has changed since the last
751 * TouchInputEvent.
752 */
753 PP_TOUCHLIST_TYPE_CHANGEDTOUCHES = 1,
754 /**
755 * The list of all TouchPoints which are targeting this plugin. This is a
756 * subset of Touches.
757 */
758 PP_TOUCHLIST_TYPE_TARGETTOUCHES = 2
759 } PP_TouchListType;
760 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TouchListType, 4);
761 /**
762 * @}
763 */
764
765 /**
766 * @addtogroup Interfaces
767 * @{
768 */
769 /**
770 * The <code>PPB_TouchInputEvent</code> interface contains pointers to several
771 * functions related to touch events.
772 */
773 struct PPB_TouchInputEvent_1_0 {
774 /**
775 * Creates a touch input event with the given parameters. Normally you
776 * will get a touch event passed through the HandleInputEvent and will not
777 * need to create them, but some applications may want to create their own
778 * for internal use. The type must be one of the touch event types.
brettw 2012/06/21 21:09:32 Can you note that you should call AddTouchPoint to
sadrul 2012/06/21 21:25:12 Done.
779 *
780 * @param[in] instance The instance for which this event occurred.
781 *
782 * @param[in] type A <code>PP_InputEvent_Type</code> identifying the type of
783 * input event.
784 *
785 * @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time
786 * when the event occurred.
787 *
788 * @param[in] modifiers A bit field combination of the
789 * <code>PP_InputEvent_Modifier</code> flags.
790 *
791 * @return A <code>PP_Resource</code> containing the new touch input event.
792 */
793 PP_Resource (*Create)(PP_Instance instance,
794 PP_InputEvent_Type type,
795 PP_TimeTicks time_stamp,
796 uint32_t modifiers);
797 /**
798 * Adds a touch point to the touch event in the specified toucyh-list.
brettw 2012/06/21 21:09:32 toucyh -> touch
sadrul 2012/06/21 21:25:12 Done.
799 *
800 * @param[in] touch_event A <code>PP_Resource</code> corresponding to a touch
801 * event.
802 *
803 * @param[in] list The list to add the touch point to.
804 *
805 * @param[in] point The point to add to the list.
806 */
807 void (*AddTouchPoint)(PP_Resource touch_event,
808 PP_TouchListType list,
809 const struct PP_TouchPoint* point);
810 /**
811 * IsTouchInputEvent() determines if a resource is a touch event.
812 *
813 * @param[in] resource A <code>PP_Resource</code> corresponding to an event.
814 *
815 * @return <code>PP_TRUE</code> if the given resource is a valid touch input
816 * event, otherwise <code>PP_FALSE</code>.
817 */
818 PP_Bool (*IsTouchInputEvent)(PP_Resource resource);
819 /**
820 * Returns the number of touch-points in the specified list.
821 *
822 * @param[in] resource A <code>PP_Resource</code> corresponding to a touch
823 * event.
824 *
825 * @param[in] list The list.
826 *
827 * @return The number of touch-points in the specified list.
828 */
829 uint32_t (*GetTouchCount)(PP_Resource resource, PP_TouchListType list);
830 /**
831 * Returns the touch-point at the specified index from the specified list.
832 *
833 * @param[in] resource A <code>PP_Resource</code> corresponding to a touch
834 * event.
835 *
836 * @param[in] list The list.
837 *
838 * @param[in] index The index.
839 *
840 * @return A <code>PP_TouchPoint</code> representing the touch-point.
841 */
842 struct PP_TouchPoint (*GetTouchByIndex)(PP_Resource resource,
843 PP_TouchListType list,
844 uint32_t index);
845 /**
846 * Returns the touch-point with the spcified touch-id in the specified list.
847 *
848 * @param[in] resource A <code>PP_Resource</code> corresponding to a touch
849 * event.
850 *
851 * @param[in] list The list.
852 *
853 * @param[in] touch_id The id of the touch-point.
854 *
855 * @return A <code>PP_TouchPoint</code> representing the touch-point.
856 */
857 struct PP_TouchPoint (*GetTouchById)(PP_Resource resource,
858 PP_TouchListType list,
859 uint32_t touch_id);
860 };
861
862 typedef struct PPB_TouchInputEvent_1_0 PPB_TouchInputEvent;
863 /**
864 * @}
865 */
866
712 #endif /* PPAPI_C_PPB_INPUT_EVENT_H_ */ 867 #endif /* PPAPI_C_PPB_INPUT_EVENT_H_ */
713 868
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698