15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/**
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * This file defines the <code>PPB_CursorControl_Dev</code> interface
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * implemented by the browser for controlling the cursor.
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)label Chrome {
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  M14 = 0.4
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)[macro="PPB_CURSOR_CONTROL_DEV_INTERFACE"]
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)interface PPB_CursorControl_Dev {
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /**
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   * Set a cursor.  If "type" is PP_CURSORTYPE_CUSTOM, then "custom_image"
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   * must be an ImageData resource containing the cursor and "hot_spot" must
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   * contain the offset within that image that refers to the cursor's position.
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   */
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   PP_Bool SetCursor([in] PP_Instance instance,
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                     [in] PP_CursorType_Dev type,
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                     [in] PP_Resource custom_image,
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                     [in] PP_Point hot_spot);
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /**
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   * This method causes the cursor to be moved to the center of the
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   * instance and be locked, preventing the user from moving it.
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   * The cursor is implicitly hidden from the user while locked.
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   * Cursor lock may only be requested in response to a
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   * PP_InputEvent_MouseDown, and then only if the event was generated via
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   * user gesture.
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   *
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   * While the cursor is locked, any movement of the mouse will
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   * generate a PP_InputEvent_Type_MouseMove, whose x and y values
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   * indicate the position the cursor would have been moved to had
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   * the cursor not been locked, and had the screen been infinite in size.
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   *
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   * The browser may revoke cursor lock for reasons including but not
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   * limited to the user pressing the ESC key, the user activating
425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   * another program via a reserved keystroke (e.g., ALT+TAB), or
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   * some other system event.
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   *
455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   * Returns PP_TRUE if the cursor could be locked, PP_FALSE otherwise.
465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   */
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  PP_Bool LockCursor([in] PP_Instance instance);
485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /**
505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   * Causes the cursor to be unlocked, allowing it to track user
515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   * movement again.
525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   */
535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  PP_Bool UnlockCursor([in] PP_Instance instance);
545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /**
565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   * Returns PP_TRUE if the cursor is locked, PP_FALSE otherwise.
575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   */
585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  PP_Bool HasCursorLock([in] PP_Instance instance);
595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /**
615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   * Returns PP_TRUE if the cursor can be locked, PP_FALSE otherwise.
625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   */
635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  PP_Bool CanLockCursor([in] PP_Instance instance);
645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
66