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

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

Issue 7399016: More trivial cleanupi of ppapi/c headers (Closed) Base URL: svn://chrome-svn/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
« no previous file with comments | « ppapi/c/ppb_image_data.h ('k') | ppapi/c/ppb_instance.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5
6 /* From ppb_input_event.idl modified Tue Jul 12 15:22:36 2011. */
7
6 #ifndef PPAPI_C_PPB_INPUT_EVENT_H_ 8 #ifndef PPAPI_C_PPB_INPUT_EVENT_H_
7 #define PPAPI_C_PPB_INPUT_EVENT_H_ 9 #define PPAPI_C_PPB_INPUT_EVENT_H_
8 10
11 #include "ppapi/c/pp_bool.h"
9 #include "ppapi/c/pp_instance.h" 12 #include "ppapi/c/pp_instance.h"
10 #include "ppapi/c/pp_macros.h" 13 #include "ppapi/c/pp_macros.h"
11 #include "ppapi/c/pp_point.h" 14 #include "ppapi/c/pp_point.h"
12 #include "ppapi/c/pp_resource.h" 15 #include "ppapi/c/pp_resource.h"
13 #include "ppapi/c/pp_stdint.h" 16 #include "ppapi/c/pp_stdint.h"
14 #include "ppapi/c/pp_time.h" 17 #include "ppapi/c/pp_time.h"
15 #include "ppapi/c/pp_var.h" 18 #include "ppapi/c/pp_var.h"
16 19
17 #define PPB_INPUT_EVENT_INTERFACE_0_1 "PPB_InputEvent;0.1" 20 /**
18 #define PPB_INPUT_EVENT_INTERFACE PPB_INPUT_EVENT_INTERFACE_0_1 21 * @file
22 * This file defines the Input Event interfaces.
23 */
19 24
20 #define PPB_MOUSE_INPUT_EVENT_INTERFACE_0_1 "PPB_MouseInputEvent;0.1"
21 #define PPB_MOUSE_INPUT_EVENT_INTERFACE PPB_MOUSE_INPUT_EVENT_INTERFACE_0_1
22
23 #define PPB_WHEEL_INPUT_EVENT_INTERFACE_0_1 "PPB_WheelInputEvent;0.1"
24 #define PPB_WHEEL_INPUT_EVENT_INTERFACE PPB_WHEEL_INPUT_EVENT_INTERFACE_0_1
25
26 #define PPB_KEYBOARD_INPUT_EVENT_INTERFACE_0_1 "PPB_KeyboardInputEvent;0.1"
27 #define PPB_KEYBOARD_INPUT_EVENT_INTERFACE \
28 PPB_KEYBOARD_INPUT_EVENT_INTERFACE_0_1
29 25
30 /** 26 /**
31 * @addtogroup Enums 27 * @addtogroup Enums
32 * @{ 28 * @{
33 */ 29 */
34
35 /** 30 /**
36 * This enumeration contains the types of input events. 31 * This enumeration contains the types of input events.
37 */ 32 */
38 typedef enum { 33 typedef enum {
39 PP_INPUTEVENT_TYPE_UNDEFINED = -1, 34 PP_INPUTEVENT_TYPE_UNDEFINED = -1,
40
41 /** 35 /**
42 * Notification that a mouse button was pressed. 36 * Notification that a mouse button was pressed.
43 * 37 *
44 * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class. 38 * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class.
45 */ 39 */
46 PP_INPUTEVENT_TYPE_MOUSEDOWN = 0, 40 PP_INPUTEVENT_TYPE_MOUSEDOWN = 0,
47
48 /** 41 /**
49 * Notification that a mouse button was released. 42 * Notification that a mouse button was released.
50 * 43 *
51 * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class. 44 * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class.
52 */ 45 */
53 PP_INPUTEVENT_TYPE_MOUSEUP = 1, 46 PP_INPUTEVENT_TYPE_MOUSEUP = 1,
54
55 /** 47 /**
56 * Notification that a mouse button was moved when it is over the instance 48 * Notification that a mouse button was moved when it is over the instance
57 * or dragged out of it. 49 * or dragged out of it.
58 * 50 *
59 * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class. 51 * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class.
60 */ 52 */
61 PP_INPUTEVENT_TYPE_MOUSEMOVE = 2, 53 PP_INPUTEVENT_TYPE_MOUSEMOVE = 2,
62
63 /** 54 /**
64 * Notification that the mouse entered the instance's bounds. 55 * Notification that the mouse entered the instance's bounds.
65 * 56 *
66 * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class. 57 * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class.
67 */ 58 */
68 PP_INPUTEVENT_TYPE_MOUSEENTER = 3, 59 PP_INPUTEVENT_TYPE_MOUSEENTER = 3,
69
70 /** 60 /**
71 * Notification that a mouse left the instance's bounds. 61 * Notification that a mouse left the instance's bounds.
72 * 62 *
73 * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class. 63 * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class.
74 */ 64 */
75 PP_INPUTEVENT_TYPE_MOUSELEAVE = 4, 65 PP_INPUTEVENT_TYPE_MOUSELEAVE = 4,
76
77 /** 66 /**
78 * Notification that the scroll wheel was used. 67 * Notification that the scroll wheel was used.
79 * 68 *
80 * Register for this event using the PP_INPUTEVENT_CLASS_WHEEL class. 69 * Register for this event using the PP_INPUTEVENT_CLASS_WHEEL class.
81 */ 70 */
82 PP_INPUTEVENT_TYPE_MOUSEWHEEL = 5, 71 PP_INPUTEVENT_TYPE_MOUSEWHEEL = 5,
83
84 /** 72 /**
85 * Notification that a key transitioned from "up" to "down". 73 * Notification that a key transitioned from "up" to "down".
86 * TODO(brettw) differentiate from KEYDOWN. 74 * TODO(brettw) differentiate from KEYDOWN.
87 * 75 *
88 * Register for this event using the PP_INPUTEVENT_CLASS_KEYBOARD class. 76 * Register for this event using the PP_INPUTEVENT_CLASS_KEYBOARD class.
89 */ 77 */
90 PP_INPUTEVENT_TYPE_RAWKEYDOWN = 6, 78 PP_INPUTEVENT_TYPE_RAWKEYDOWN = 6,
91
92 /** 79 /**
93 * Notification that a key was pressed. This does not necessarily correspond 80 * Notification that a key was pressed. This does not necessarily correspond
94 * to a character depending on the key and language. Use the 81 * to a character depending on the key and language. Use the
95 * PP_INPUTEVENT_TYPE_CHAR for character input. 82 * PP_INPUTEVENT_TYPE_CHAR for character input.
96 * 83 *
97 * Register for this event using the PP_INPUTEVENT_CLASS_KEYBOARD class. 84 * Register for this event using the PP_INPUTEVENT_CLASS_KEYBOARD class.
98 */ 85 */
99 PP_INPUTEVENT_TYPE_KEYDOWN = 7, 86 PP_INPUTEVENT_TYPE_KEYDOWN = 7,
100
101 /** 87 /**
102 * Notification that a key was released. 88 * Notification that a key was released.
103 * 89 *
104 * Register for this event using the PP_INPUTEVENT_CLASS_KEYBOARD class. 90 * Register for this event using the PP_INPUTEVENT_CLASS_KEYBOARD class.
105 */ 91 */
106 PP_INPUTEVENT_TYPE_KEYUP = 8, 92 PP_INPUTEVENT_TYPE_KEYUP = 8,
107
108 /** 93 /**
109 * Notification that a character was typed. Use this for text input. Key 94 * Notification that a character was typed. Use this for text input. Key
110 * down events may generate 0, 1, or more than one character event depending 95 * down events may generate 0, 1, or more than one character event depending
111 * on the key, locale, and operating system. 96 * on the key, locale, and operating system.
112 * 97 *
113 * Register for this event using the PP_INPUTEVENT_CLASS_KEYBOARD class. 98 * Register for this event using the PP_INPUTEVENT_CLASS_KEYBOARD class.
114 */ 99 */
115 PP_INPUTEVENT_TYPE_CHAR = 9, 100 PP_INPUTEVENT_TYPE_CHAR = 9,
116
117 /** 101 /**
118 * TODO(brettw) when is this used? 102 * TODO(brettw) when is this used?
119 * 103 *
120 * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class. 104 * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class.
121 */ 105 */
122 PP_INPUTEVENT_TYPE_CONTEXTMENU = 10 106 PP_INPUTEVENT_TYPE_CONTEXTMENU = 10
123 } PP_InputEvent_Type; 107 } PP_InputEvent_Type;
124 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_Type, 4); 108 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_Type, 4);
125 109
126 /** 110 /**
127 * This enumeration contains event modifier constants. Each modifier is one 111 * This enumeration contains event modifier constants. Each modifier is one
128 * bit. Retrieve the modifiers from an input event using the GetEventModifiers 112 * bit. Retrieve the modifiers from an input event using the GetEventModifiers
129 * function on PPB_InputEvent. 113 * function on PPB_InputEvent.
130 */ 114 */
131 typedef enum { 115 typedef enum {
132 PP_INPUTEVENT_MODIFIER_SHIFTKEY = 1 << 0, 116 PP_INPUTEVENT_MODIFIER_SHIFTKEY = 1 << 0,
133 PP_INPUTEVENT_MODIFIER_CONTROLKEY = 1 << 1, 117 PP_INPUTEVENT_MODIFIER_CONTROLKEY = 1 << 1,
134 PP_INPUTEVENT_MODIFIER_ALTKEY = 1 << 2, 118 PP_INPUTEVENT_MODIFIER_ALTKEY = 1 << 2,
135 PP_INPUTEVENT_MODIFIER_METAKEY = 1 << 3, 119 PP_INPUTEVENT_MODIFIER_METAKEY = 1 << 3,
136 PP_INPUTEVENT_MODIFIER_ISKEYPAD = 1 << 4, 120 PP_INPUTEVENT_MODIFIER_ISKEYPAD = 1 << 4,
137 PP_INPUTEVENT_MODIFIER_ISAUTOREPEAT = 1 << 5, 121 PP_INPUTEVENT_MODIFIER_ISAUTOREPEAT = 1 << 5,
138 PP_INPUTEVENT_MODIFIER_LEFTBUTTONDOWN = 1 << 6, 122 PP_INPUTEVENT_MODIFIER_LEFTBUTTONDOWN = 1 << 6,
139 PP_INPUTEVENT_MODIFIER_MIDDLEBUTTONDOWN = 1 << 7, 123 PP_INPUTEVENT_MODIFIER_MIDDLEBUTTONDOWN = 1 << 7,
140 PP_INPUTEVENT_MODIFIER_RIGHTBUTTONDOWN = 1 << 8, 124 PP_INPUTEVENT_MODIFIER_RIGHTBUTTONDOWN = 1 << 8,
141 PP_INPUTEVENT_MODIFIER_CAPSLOCKKEY = 1 << 9, 125 PP_INPUTEVENT_MODIFIER_CAPSLOCKKEY = 1 << 9,
142 PP_INPUTEVENT_MODIFIER_NUMLOCKKEY = 1 << 10 126 PP_INPUTEVENT_MODIFIER_NUMLOCKKEY = 1 << 10
143 } PP_InputEvent_Modifier; 127 } PP_InputEvent_Modifier;
144 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_Modifier, 4); 128 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_Modifier, 4);
145 129
146 /** 130 /**
147 * This enumeration contains constants representing each mouse button. To get 131 * This enumeration contains constants representing each mouse button. To get
148 * the mouse button for a mouse down or up event, use GetMouseButton on 132 * the mouse button for a mouse down or up event, use GetMouseButton on
149 * PPB_InputEvent. 133 * PPB_InputEvent.
150 */ 134 */
151 typedef enum { 135 typedef enum {
152 PP_INPUTEVENT_MOUSEBUTTON_NONE = -1, 136 PP_INPUTEVENT_MOUSEBUTTON_NONE = -1,
153 PP_INPUTEVENT_MOUSEBUTTON_LEFT = 0, 137 PP_INPUTEVENT_MOUSEBUTTON_LEFT = 0,
154 PP_INPUTEVENT_MOUSEBUTTON_MIDDLE = 1, 138 PP_INPUTEVENT_MOUSEBUTTON_MIDDLE = 1,
155 PP_INPUTEVENT_MOUSEBUTTON_RIGHT = 2 139 PP_INPUTEVENT_MOUSEBUTTON_RIGHT = 2
156 } PP_InputEvent_MouseButton; 140 } PP_InputEvent_MouseButton;
157 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_MouseButton, 4); 141 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_MouseButton, 4);
158 142
159 /**
160 * @}
161 */
162
163 typedef enum { 143 typedef enum {
164 /** 144 /**
165 * Request mouse input events. 145 * Request mouse input events.
166 * 146 *
167 * Normally you will request mouse events by calling RequestInputEvents(). 147 * Normally you will request mouse events by calling RequestInputEvents().
168 * The only use case for filtered events (via RequestFilteringInputEvents()) 148 * The only use case for filtered events (via RequestFilteringInputEvents())
169 * is for instances that have irregular outlines and you want to perform hit 149 * is for instances that have irregular outlines and you want to perform hit
170 * testing, which is very uncommon. Requesting non-filtered mouse events will 150 * testing, which is very uncommon. Requesting non-filtered mouse events will
171 * lead to higher performance. 151 * lead to higher performance.
172 */ 152 */
173 PP_INPUTEVENT_CLASS_MOUSE = 1 << 0, 153 PP_INPUTEVENT_CLASS_MOUSE = 1 << 0,
174
175 /** 154 /**
176 * Requests keyboard events. Keyboard events must be requested in filtering 155 * Requests keyboard events. Keyboard events must be requested in filtering
177 * mode via RequestFilteringInputEvents(). This is because many commands 156 * mode via RequestFilteringInputEvents(). This is because many commands
178 * should be forwarded to the page. 157 * should be forwarded to the page.
179 * 158 *
180 * A small number of tab and window management commands like Alt-F4 are never 159 * A small number of tab and window management commands like Alt-F4 are never
181 * sent to the page. You can not request these keyboard commands since it 160 * sent to the page. You can not request these keyboard commands since it
182 * would allow pages to trap users on a page. 161 * would allow pages to trap users on a page.
183 */ 162 */
184 PP_INPUTEVENT_CLASS_KEYBOARD = 1 << 1, 163 PP_INPUTEVENT_CLASS_KEYBOARD = 1 << 1,
185
186 /** 164 /**
187 * Identifies scroll wheel input event. Wheel events must be requested in 165 * Identifies scroll wheel input event. Wheel events must be requested in
188 * filtering mode via RequestFilteringInputEvents(). This is because many 166 * filtering mode via RequestFilteringInputEvents(). This is because many
189 * wheel commands should be forwarded to the page. 167 * wheel commands should be forwarded to the page.
190 * 168 *
191 * Most instances will not need this event. Consuming wheel events by 169 * Most instances will not need this event. Consuming wheel events by
192 * returning true from your filtered event handler will prevent the user from 170 * returning true from your filtered event handler will prevent the user from
193 * scrolling the page when the mouse is over the instance which can be very 171 * scrolling the page when the mouse is over the instance which can be very
194 * annoying. 172 * annoying.
195 * 173 *
196 * If you handle wheel events (for example, you have a document viewer which 174 * If you handle wheel events (for example, you have a document viewer which
197 * the user can scroll), the recommended behavior is to return false only if 175 * the user can scroll), the recommended behavior is to return false only if
198 * the wheel event actually causes your document to scroll. When the user 176 * the wheel event actually causes your document to scroll. When the user
199 * reaches the end of the document, return false to indicating that the event 177 * reaches the end of the document, return false to indicating that the event
200 * was not handled. This will then forward the event to the containing page 178 * was not handled. This will then forward the event to the containing page
201 * for scrolling, producing the nested scrolling behavior users expect from 179 * for scrolling, producing the nested scrolling behavior users expect from
202 * frames in a page. 180 * frames in a page.
203 */ 181 */
204 PP_INPUTEVENT_CLASS_WHEEL = 1 << 2, 182 PP_INPUTEVENT_CLASS_WHEEL = 1 << 2,
205
206 /** 183 /**
207 * Identifies touch input events. 184 * Identifies touch input events.
208 * 185 *
209 * Request touch events only if you intend to handle them. If the browser 186 * Request touch events only if you intend to handle them. If the browser
210 * knows you do not need to handle touch events, it can handle them at a 187 * knows you do not need to handle touch events, it can handle them at a
211 * higher level and achieve higher performance. 188 * higher level and achieve higher performance.
212 */ 189 */
213 PP_INPUTEVENT_CLASS_TOUCH = 1 << 3, 190 PP_INPUTEVENT_CLASS_TOUCH = 1 << 3,
214
215 /** 191 /**
216 * Identifies IME composition input events. 192 * Identifies IME composition input events.
217 * 193 *
218 * Request this input event class if you allow on-the-spot IME input. 194 * Request this input event class if you allow on-the-spot IME input.
219 */ 195 */
220 PP_INPUTEVENT_CLASS_IME = 1 << 4 196 PP_INPUTEVENT_CLASS_IME = 1 << 4
221 } PP_InputEvent_Class; 197 } PP_InputEvent_Class;
222 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_Class, 4); 198 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_Class, 4);
199 /**
200 * @}
201 */
202
203 /**
204 * @addtogroup Interfaces
205 * @{
206 */
207 #define PPB_INPUT_EVENT_INTERFACE_0_1 "PPB_InputEvent;0.1"
208 #define PPB_INPUT_EVENT_INTERFACE PPB_INPUT_EVENT_INTERFACE_0_1
223 209
224 struct PPB_InputEvent { 210 struct PPB_InputEvent {
225 /** 211 /**
226 * Request that input events corresponding to the given input events are 212 * Request that input events corresponding to the given input events are
227 * delivered to the instance. 213 * delivered to the instance.
228 * 214 *
229 * You can not use this function to request keyboard events 215 * You can not use this function to request keyboard events
230 * (PP_INPUTEVENT_CLASS_KEYBOARD). You must use RequestFilteringInputEvents() 216 * (PP_INPUTEVENT_CLASS_KEYBOARD). You must use RequestFilteringInputEvents()
231 * for this class of input. 217 * for this class of input.
232 * 218 *
(...skipping 29 matching lines...) Expand all
262 * identifies the classes of events the instance is requesting. The flags 248 * identifies the classes of events the instance is requesting. The flags
263 * are combined by logically ORing their values. 249 * are combined by logically ORing their values.
264 * 250 *
265 * @return PP_OK if the operation succeeded, PP_ERROR_BADARGUMENT if instance 251 * @return PP_OK if the operation succeeded, PP_ERROR_BADARGUMENT if instance
266 * is invalid, or PP_ERROR_NOTSUPPORTED if one of the event class bits were 252 * is invalid, or PP_ERROR_NOTSUPPORTED if one of the event class bits were
267 * 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
268 * 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
269 * PP_ERROR_NOTSUPPORTED return value is requesting keyboard events, these 255 * PP_ERROR_NOTSUPPORTED return value is requesting keyboard events, these
270 * must use RequestFilteringInputEvents(). 256 * must use RequestFilteringInputEvents().
271 */ 257 */
272 int32_t (*RequestInputEvents)(PP_Instance instance, 258 int32_t (*RequestInputEvents)(PP_Instance instance, uint32_t event_classes);
273 uint32_t event_classes);
274
275 /** 259 /**
276 * Request that input events corresponding to the given input events are 260 * Request that input events corresponding to the given input events are
277 * delivered to the instance for filtering. 261 * delivered to the instance for filtering.
278 * 262 *
279 * By default, no input events are delivered. In most cases you would 263 * By default, no input events are delivered. In most cases you would
280 * register to receive events by calling RequestInputEvents(). In some cases, 264 * register to receive events by calling RequestInputEvents(). In some cases,
281 * however, you may wish to filter events such that they can be bubbled up 265 * however, you may wish to filter events such that they can be bubbled up
282 * to the DOM. In this case, register for those classes of events using 266 * to the DOM. In this case, register for those classes of events using
283 * this function instead of RequestInputEvents(). Keyboard events must always 267 * this function instead of RequestInputEvents(). Keyboard events must always
284 * be registered in filtering mode. 268 * be registered in filtering mode.
(...skipping 10 matching lines...) Expand all
295 * RequestFilteringInputEvents(instance, 279 * RequestFilteringInputEvents(instance,
296 * PP_INPUTEVENT_CLASS_WHEEL | PP_INPUTEVENT_CLASS_KEYBOARD); 280 * PP_INPUTEVENT_CLASS_WHEEL | PP_INPUTEVENT_CLASS_KEYBOARD);
297 * 281 *
298 * @return PP_OK if the operation succeeded, PP_ERROR_BADARGUMENT if instance 282 * @return PP_OK if the operation succeeded, PP_ERROR_BADARGUMENT if instance
299 * is invalid, or PP_ERROR_NOTSUPPORTED if one of the event class bits were 283 * is invalid, or PP_ERROR_NOTSUPPORTED if one of the event class bits were
300 * illegal. In the case of an invalid bit, all valid bits will be applied 284 * illegal. In the case of an invalid bit, all valid bits will be applied
301 * and only the illegal bits will be ignored. 285 * and only the illegal bits will be ignored.
302 */ 286 */
303 int32_t (*RequestFilteringInputEvents)(PP_Instance instance, 287 int32_t (*RequestFilteringInputEvents)(PP_Instance instance,
304 uint32_t event_classes); 288 uint32_t event_classes);
305
306 /** 289 /**
307 * Request that input events corresponding to the given input classes no 290 * Request that input events corresponding to the given input classes no
308 * longer be delivered to the instance. 291 * longer be delivered to the instance.
309 * 292 *
310 * By default, no input events are delivered. If you have previously 293 * By default, no input events are delivered. If you have previously
311 * requested input events via RequestInputEvents() or 294 * requested input events via RequestInputEvents() or
312 * RequestFilteringInputEvents(), this function will unregister handling 295 * RequestFilteringInputEvents(), this function will unregister handling
313 * for the given instance. This will allow greater browser performance for 296 * for the given instance. This will allow greater browser performance for
314 * those events. 297 * those events.
315 * 298 *
316 * Note that you may still get some input events after clearing the flag if 299 * Note that you may still get some input events after clearing the flag if
317 * they were dispatched before the request was cleared. For example, if 300 * they were dispatched before the request was cleared. For example, if
318 * there are 3 mouse move events waiting to be delivered, and you clear the 301 * there are 3 mouse move events waiting to be delivered, and you clear the
319 * mouse event class during the processing of the first one, you'll still 302 * mouse event class during the processing of the first one, you'll still
320 * receive the next two. You just won't get more events generated. 303 * receive the next two. You just won't get more events generated.
321 * 304 *
322 * @param instance The <code>PP_Instance</code> of the instance requesting 305 * @param instance The <code>PP_Instance</code> of the instance requesting
323 * to no longer receive the given events. 306 * to no longer receive the given events.
324 * 307 *
325 * @param event_classes A combination of flags from PP_InputEvent_Class that 308 * @param event_classes A combination of flags from PP_InputEvent_Class that
326 * identifies the classes of events the instance is no longer interested in. 309 * identifies the classes of events the instance is no longer interested in.
327 */ 310 */
328 void (*ClearInputEventRequest)(PP_Instance instance, 311 void (*ClearInputEventRequest)(PP_Instance instance, uint32_t event_classes);
329 uint32_t event_classes);
330
331 /** 312 /**
332 * Returns true if the given resource is a valid input event resource. 313 * Returns true if the given resource is a valid input event resource.
333 */ 314 */
334 PP_Bool (*IsInputEvent)(PP_Resource resource); 315 PP_Bool (*IsInputEvent)(PP_Resource resource);
335
336 /** 316 /**
337 * Returns the type of input event for the given input event resource. 317 * Returns the type of input event for the given input event resource.
338 * This is valid for all input events. Returns PP_INPUTEVENT_TYPE_UNDEFINED 318 * This is valid for all input events. Returns PP_INPUTEVENT_TYPE_UNDEFINED
339 * if the resource is invalid. 319 * if the resource is invalid.
340 */ 320 */
341 PP_InputEvent_Type (*GetType)(PP_Resource event); 321 PP_InputEvent_Type (*GetType)(PP_Resource event);
342
343 /** 322 /**
344 * Returns the time that the event was generated. This will be before the 323 * Returns the time that the event was generated. This will be before the
345 * current time since processing and dispatching the event has some overhead. 324 * current time since processing and dispatching the event has some overhead.
346 * Use this value to compare the times the user generated two events without 325 * Use this value to compare the times the user generated two events without
347 * being sensitive to variable processing time. 326 * being sensitive to variable processing time.
348 * 327 *
349 * The return value is in time ticks, which is a monotonically increasing 328 * The return value is in time ticks, which is a monotonically increasing
350 * clock not related to the wall clock time. It will not change if the user 329 * clock not related to the wall clock time. It will not change if the user
351 * changes their clock or daylight savings time starts, so can be reliably 330 * changes their clock or daylight savings time starts, so can be reliably
352 * used to compare events. This means, however, that you can't correlate 331 * used to compare events. This means, however, that you can't correlate
353 * event times to a particular time of day on the system clock. 332 * event times to a particular time of day on the system clock.
354 */ 333 */
355 PP_TimeTicks (*GetTimeStamp)(PP_Resource event); 334 PP_TimeTicks (*GetTimeStamp)(PP_Resource event);
356
357 /** 335 /**
358 * Returns a bitfield indicating which modifiers were down at the time of 336 * Returns a bitfield indicating which modifiers were down at the time of
359 * the event. This is a combination of the flags in the 337 * the event. This is a combination of the flags in the
360 * PP_InputEvent_Modifier enum. 338 * PP_InputEvent_Modifier enum.
361 * 339 *
362 * @return The modifiers associated with the event, or 0 if the given 340 * @return The modifiers associated with the event, or 0 if the given
363 * resource is not a valid event resource. 341 * resource is not a valid event resource.
364 */ 342 */
365 uint32_t (*GetModifiers)(PP_Resource event); 343 uint32_t (*GetModifiers)(PP_Resource event);
366 }; 344 };
367 345
346 #define PPB_MOUSE_INPUT_EVENT_INTERFACE_0_1 "PPB_MouseInputEvent;0.1"
347 #define PPB_MOUSE_INPUT_EVENT_INTERFACE PPB_MOUSE_INPUT_EVENT_INTERFACE_0_1
348
368 struct PPB_MouseInputEvent { 349 struct PPB_MouseInputEvent {
369 /** 350 /**
370 * Determines if a resource is a mouse event. 351 * Determines if a resource is a mouse event.
371 * 352 *
372 * @return PP_TRUE if the given resource is a valid mouse input event. 353 * @return PP_TRUE if the given resource is a valid mouse input event.
373 */ 354 */
374 PP_Bool (*IsMouseInputEvent)(PP_Resource resource); 355 PP_Bool (*IsMouseInputEvent)(PP_Resource resource);
375
376 /** 356 /**
377 * Returns which mouse button generated a mouse down or up event. 357 * Returns which mouse button generated a mouse down or up event.
378 * 358 *
379 * @return The mouse button associated with mouse down and up events. This 359 * @return The mouse button associated with mouse down and up events. This
380 * value will be PP_EVENT_MOUSEBUTTON_NONE for mouse move, enter, and leave 360 * value will be PP_EVENT_MOUSEBUTTON_NONE for mouse move, enter, and leave
381 * events, and for all non-mouse events. 361 * events, and for all non-mouse events.
382 */ 362 */
383 PP_InputEvent_MouseButton (*GetMouseButton)(PP_Resource mouse_event); 363 PP_InputEvent_MouseButton (*GetMouseButton)(PP_Resource mouse_event);
384
385 /** 364 /**
386 * Returns the pixel location of a mouse input event. 365 * Returns the pixel location of a mouse input event.
387 * 366 *
388 * @return The point associated with the mouse event, relative to the upper- 367 * @return The point associated with the mouse event, relative to the upper-
389 * left of the instance receiving the event. These values can be negative for 368 * left of the instance receiving the event. These values can be negative for
390 * mouse drags. The return value will be (0, 0) for non-mouse events. 369 * mouse drags. The return value will be (0, 0) for non-mouse events.
391 */ 370 */
392 struct PP_Point (*GetMousePosition)(PP_Resource mouse_event); 371 struct PP_Point (*GetMousePosition)(PP_Resource mouse_event);
393
394 /** 372 /**
395 * TODO(brettw) figure out exactly what this means. 373 * TODO(brettw) figure out exactly what this means.
396 */ 374 */
397 int32_t (*GetMouseClickCount)(PP_Resource mouse_event); 375 int32_t (*GetMouseClickCount)(PP_Resource mouse_event);
398 }; 376 };
399 377
378 #define PPB_WHEEL_INPUT_EVENT_INTERFACE_0_1 "PPB_WheelInputEvent;0.1"
379 #define PPB_WHEEL_INPUT_EVENT_INTERFACE PPB_WHEEL_INPUT_EVENT_INTERFACE_0_1
380
400 struct PPB_WheelInputEvent { 381 struct PPB_WheelInputEvent {
401 /** 382 /**
402 * Determines if a resource is a wheel event. 383 * Determines if a resource is a wheel event.
403 * 384 *
404 * @return PP_TRUE if the given resource is a valid wheel input event. 385 * @return PP_TRUE if the given resource is a valid wheel input event.
405 */ 386 */
406 PP_Bool (*IsWheelInputEvent)(PP_Resource resource); 387 PP_Bool (*IsWheelInputEvent)(PP_Resource resource);
407
408 /** 388 /**
409 * Indicates the amount vertically and horizontally the user has requested 389 * Indicates the amount vertically and horizontally the user has requested
410 * to scroll by with their mouse wheel. A scroll down or to the right (where 390 * to scroll by with their mouse wheel. A scroll down or to the right (where
411 * the content moves up or left) is represented as positive values, and 391 * the content moves up or left) is represented as positive values, and
412 * a scroll up or to the left (where the content moves down or right) is 392 * a scroll up or to the left (where the content moves down or right) is
413 * represented as negative values. 393 * represented as negative values.
414 * 394 *
415 * The units are either in pixels (when scroll_by_page is false) or pages 395 * The units are either in pixels (when scroll_by_page is false) or pages
416 * (when scroll_by_page is true). For example, y = -3 means scroll up 3 396 * (when scroll_by_page is true). For example, y = -3 means scroll up 3
417 * pixels when scroll_by_page is false, and scroll up 3 pages when 397 * pixels when scroll_by_page is false, and scroll up 3 pages when
418 * scroll_by_page is true. 398 * scroll_by_page is true.
419 * 399 *
420 * This amount is system dependent and will take into account the user's 400 * This amount is system dependent and will take into account the user's
421 * preferred scroll sensitivity and potentially also nonlinear acceleration 401 * preferred scroll sensitivity and potentially also nonlinear acceleration
422 * based on the speed of the scrolling. 402 * based on the speed of the scrolling.
423 * 403 *
424 * Devices will be of varying resolution. Some mice with large detents will 404 * Devices will be of varying resolution. Some mice with large detents will
425 * only generate integer scroll amounts. But fractional values are also 405 * only generate integer scroll amounts. But fractional values are also
426 * possible, for example, on some trackpads and newer mice that don't have 406 * possible, for example, on some trackpads and newer mice that don't have
427 * "clicks". 407 * "clicks".
428 */ 408 */
429 struct PP_FloatPoint (*GetWheelDelta)(PP_Resource wheel_event); 409 struct PP_FloatPoint (*GetWheelDelta)(PP_Resource wheel_event);
430
431 /** 410 /**
432 * The number of "clicks" of the scroll wheel that have produced the 411 * The number of "clicks" of the scroll wheel that have produced the
433 * event. The value may have system-specific acceleration applied to it, 412 * event. The value may have system-specific acceleration applied to it,
434 * depending on the device. The positive and negative meanings are the same 413 * depending on the device. The positive and negative meanings are the same
435 * as for GetWheelDelta(). 414 * as for GetWheelDelta().
436 * 415 *
437 * If you are scrolling, you probably want to use the delta values. These 416 * If you are scrolling, you probably want to use the delta values. These
438 * tick events can be useful if you aren't doing actual scrolling and don't 417 * tick events can be useful if you aren't doing actual scrolling and don't
439 * want or pixel values. An example may be cycling between different items in 418 * want or pixel values. An example may be cycling between different items in
440 * a game. 419 * a game.
441 * 420 *
442 * You may receive fractional values for the wheel ticks if the mouse wheel 421 * You may receive fractional values for the wheel ticks if the mouse wheel
443 * is high resolution or doesn't have "clicks". If your program wants 422 * is high resolution or doesn't have "clicks". If your program wants
444 * discrete events (as in the "picking items" example) you should accumulate 423 * discrete events (as in the "picking items" example) you should accumulate
445 * fractional click values from multiple messages until the total value 424 * fractional click values from multiple messages until the total value
446 * reaches positive or negative one. This should represent a similar amount 425 * reaches positive or negative one. This should represent a similar amount
447 * of scrolling as for a mouse that has a discrete mouse wheel. 426 * of scrolling as for a mouse that has a discrete mouse wheel.
448 */ 427 */
449 struct PP_FloatPoint (*GetWheelTicks)(PP_Resource wheel_event); 428 struct PP_FloatPoint (*GetWheelTicks)(PP_Resource wheel_event);
450
451 /** 429 /**
452 * Indicates if the scroll delta x/y indicates pages or lines to 430 * Indicates if the scroll delta x/y indicates pages or lines to
453 * scroll by. 431 * scroll by.
454 * 432 *
455 * @return PP_TRUE if the event is a wheel event and the user is scrolling 433 * @return PP_TRUE if the event is a wheel event and the user is scrolling
456 * by pages. PP_FALSE if not or if the resource is not a wheel event. 434 * by pages. PP_FALSE if not or if the resource is not a wheel event.
457 */ 435 */
458 PP_Bool (*GetScrollByPage)(PP_Resource wheel_event); 436 PP_Bool (*GetScrollByPage)(PP_Resource wheel_event);
459 }; 437 };
460 438
439 #define PPB_KEYBOARD_INPUT_EVENT_INTERFACE_0_1 "PPB_KeyboardInputEvent;0.1"
440 #define PPB_KEYBOARD_INPUT_EVENT_INTERFACE \
441 PPB_KEYBOARD_INPUT_EVENT_INTERFACE_0_1
442
461 struct PPB_KeyboardInputEvent { 443 struct PPB_KeyboardInputEvent {
462 /** 444 /**
463 * Determines if a resource is a keyboard event. 445 * Determines if a resource is a keyboard event.
464 * 446 *
465 * @return PP_TRUE if the given resource is a valid mouse input event. 447 * @return PP_TRUE if the given resource is a valid mouse input event.
466 */ 448 */
467 PP_Bool (*IsKeyboardInputEvent)(PP_Resource resource); 449 PP_Bool (*IsKeyboardInputEvent)(PP_Resource resource);
468
469 /** 450 /**
470 * Returns the DOM |keyCode| field for the keyboard event. 451 * Returns the DOM |keyCode| field for the keyboard event.
471 * Chrome populates this with the Windows-style Virtual Key code of the key. 452 * Chrome populates this with the Windows-style Virtual Key code of the key.
472 */ 453 */
473 uint32_t (*GetKeyCode)(PP_Resource key_event); 454 uint32_t (*GetKeyCode)(PP_Resource key_event);
474
475 /** 455 /**
476 * Returns the typed character for the given character event. 456 * Returns the typed character for the given character event.
477 * 457 *
478 * @return A string var representing a single typed character for character 458 * @return A string var representing a single typed character for character
479 * input events. For non-character input events the return value will be an 459 * input events. For non-character input events the return value will be an
480 * undefined var. 460 * undefined var.
481 */ 461 */
482 struct PP_Var (*GetCharacterText)(PP_Resource character_event); 462 struct PP_Var (*GetCharacterText)(PP_Resource character_event);
483 }; 463 };
464 /**
465 * @}
466 */
484 467
485 #endif /* PPAPI_C_PPB_INPUT_EVENT_H_ */ 468 #endif /* PPAPI_C_PPB_INPUT_EVENT_H_ */
469
OLDNEW
« no previous file with comments | « ppapi/c/ppb_image_data.h ('k') | ppapi/c/ppb_instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698