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
3 * found in the LICENSE file.
6 /* From ppb_mouse_lock.idl modified Mon Dec 17 16:09:50 2012. */
8 #ifndef PPAPI_C_PPB_MOUSE_LOCK_H_
9 #define PPAPI_C_PPB_MOUSE_LOCK_H_
11 #include "ppapi/c/pp_completion_callback.h"
12 #include "ppapi/c/pp_instance.h"
13 #include "ppapi/c/pp_macros.h"
14 #include "ppapi/c/pp_stdint.h"
16 #define PPB_MOUSELOCK_INTERFACE_1_0 "PPB_MouseLock;1.0"
17 #define PPB_MOUSELOCK_INTERFACE PPB_MOUSELOCK_INTERFACE_1_0
21 * This file defines the <code>PPB_MouseLock</code> interface for
22 * locking the target of mouse events to a specific module instance.
27 * @addtogroup Interfaces
31 * The <code>PPB_MouseLock</code> interface is implemented by the browser.
32 * This interface provides a way of locking the target of mouse events to a
33 * single module instance and removing the cursor from view. This mode is
34 * useful for certain classes of applications, especially first-person
35 * perspective 3D applications and 3D modeling software.
37 struct PPB_MouseLock_1_0
{
39 * LockMouse() requests the mouse to be locked.
41 * While the mouse is locked, the cursor is implicitly hidden from the user.
42 * Any movement of the mouse will generate a
43 * <code>PP_INPUTEVENT_TYPE_MOUSEMOVE</code> event. The
44 * <code>GetPosition()</code> function in the <code>PPB_MouseInputEvent</code>
45 * interface reports the last known mouse position just as mouse lock was
46 * entered. The <code>GetMovement()</code> function provides relative movement
47 * information indicating what the change in position of the mouse would be
48 * had it not been locked.
50 * The browser may revoke the mouse lock for reasons including (but not
51 * limited to) the user pressing the ESC key, the user activating another
52 * program using a reserved keystroke (e.g. ALT+TAB), or some other system
55 * @param[in] instance A <code>PP_Instance</code> identifying one instance
57 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
60 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
62 int32_t (*LockMouse
)(PP_Instance instance
,
63 struct PP_CompletionCallback callback
);
65 * UnlockMouse() causes the mouse to be unlocked, allowing it to track user
66 * movement again. This is an asynchronous operation. The module instance
67 * will be notified using the <code>PPP_MouseLock</code> interface when it
68 * has lost the mouse lock.
70 * @param[in] instance A <code>PP_Instance</code> identifying one instance
73 void (*UnlockMouse
)(PP_Instance instance
);
76 typedef struct PPB_MouseLock_1_0 PPB_MouseLock
;
81 #endif /* PPAPI_C_PPB_MOUSE_LOCK_H_ */