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

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

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

Powered by Google App Engine
This is Rietveld 408576698