Pepper_47_C_interfaces
ppb_mouse_lock.h
Go to the documentation of this file.
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.
4  */
5 
6 /* From ppb_mouse_lock.idl modified Thu Oct 20 13:57:04 2016. */
7 
8 #ifndef PPAPI_C_PPB_MOUSE_LOCK_H_
9 #define PPAPI_C_PPB_MOUSE_LOCK_H_
10 
12 #include "ppapi/c/pp_instance.h"
13 #include "ppapi/c/pp_macros.h"
14 #include "ppapi/c/pp_stdint.h"
15 
16 #define PPB_MOUSELOCK_INTERFACE_1_0 "PPB_MouseLock;1.0"
17 #define PPB_MOUSELOCK_INTERFACE PPB_MOUSELOCK_INTERFACE_1_0
18 
19 /**
20  * @file
21  * This file defines the <code>PPB_MouseLock</code> interface for
22  * locking the target of mouse events to a specific module instance.
23  */
24 
25 
26 /**
27  * @addtogroup Interfaces
28  * @{
29  */
30 /**
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.
36  */
38  /**
39  * LockMouse() requests the mouse to be locked.
40  *
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.
49  *
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
53  * event.
54  *
55  * @param[in] instance A <code>PP_Instance</code> identifying one instance
56  * of a module.
57  * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
58  * completion.
59  *
60  * @return An int32_t containing an error code from <code>pp_errors.h</code>.
61  */
62  int32_t (*LockMouse)(PP_Instance instance,
63  struct PP_CompletionCallback callback);
64  /**
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.
69  *
70  * @param[in] instance A <code>PP_Instance</code> identifying one instance
71  * of a module.
72  */
73  void (*UnlockMouse)(PP_Instance instance);
74 };
75 
77 /**
78  * @}
79  */
80 
81 #endif /* PPAPI_C_PPB_MOUSE_LOCK_H_ */
82 
int32_t PP_Instance
Definition: pp_instance.h:34
void(* UnlockMouse)(PP_Instance instance)
int32_t(* LockMouse)(PP_Instance instance, struct PP_CompletionCallback callback)