OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef PPAPI_C_DEV_PPB_CURSOR_CONTROL_DEV_H_ | 5 #ifndef PPAPI_C_DEV_PPB_CURSOR_CONTROL_DEV_H_ |
6 #define PPAPI_C_DEV_PPB_CURSOR_CONTROL_DEV_H_ | 6 #define PPAPI_C_DEV_PPB_CURSOR_CONTROL_DEV_H_ |
7 | 7 |
| 8 #include "ppapi/c/pp_bool.h" |
8 #include "ppapi/c/dev/pp_cursor_type_dev.h" | 9 #include "ppapi/c/dev/pp_cursor_type_dev.h" |
9 #include "ppapi/c/pp_instance.h" | 10 #include "ppapi/c/pp_instance.h" |
10 #include "ppapi/c/pp_point.h" | 11 #include "ppapi/c/pp_point.h" |
11 #include "ppapi/c/pp_resource.h" | 12 #include "ppapi/c/pp_resource.h" |
12 | 13 |
13 #define PPB_CURSOR_CONTROL_DEV_INTERFACE "PPB_CursorControl(Dev);0.1" | 14 #define PPB_CURSOR_CONTROL_DEV_INTERFACE "PPB_CursorControl(Dev);0.2" |
14 | 15 |
15 struct PPB_CursorControl_Dev { | 16 struct PPB_CursorControl_Dev { |
16 // Set a cursor. If "type" is PP_CURSOR_TYPE_CUSTOM, then "custom_image" | 17 // Set a cursor. If "type" is PP_CURSOR_TYPE_CUSTOM, then "custom_image" |
17 // must be an ImageData resource containing the cursor and "hot_spot" must | 18 // must be an ImageData resource containing the cursor and "hot_spot" must |
18 // contain the offset within that image that refers to the cursor's position. | 19 // contain the offset within that image that refers to the cursor's position. |
19 bool (*SetCursor)(PP_Instance instance, | 20 PP_Bool (*SetCursor)(PP_Instance instance, |
20 enum PP_CursorType_Dev type, | 21 enum PP_CursorType_Dev type, |
21 PP_Resource custom_image, | 22 PP_Resource custom_image, |
22 const struct PP_Point* hot_spot); | 23 const struct PP_Point* hot_spot); |
23 | 24 |
24 // This method causes the cursor to be moved to the center of the | 25 // This method causes the cursor to be moved to the center of the |
25 // instance and be locked, preventing the user from moving it. | 26 // instance and be locked, preventing the user from moving it. |
26 // The cursor is implicitly hidden from the user while locked. | 27 // The cursor is implicitly hidden from the user while locked. |
27 // Cursor lock may only be requested in response to a | 28 // Cursor lock may only be requested in response to a |
28 // PP_InputEvent_MouseDown, and then only if the event was generated via | 29 // PP_InputEvent_MouseDown, and then only if the event was generated via |
29 // user gesture. | 30 // user gesture. |
30 // | 31 // |
31 // While the cursor is locked, any movement of the mouse will | 32 // While the cursor is locked, any movement of the mouse will |
32 // generate a PP_InputEvent_Type_MouseMove, whose x and y values | 33 // generate a PP_InputEvent_Type_MouseMove, whose x and y values |
33 // indicate the position the cursor would have been moved to had | 34 // indicate the position the cursor would have been moved to had |
34 // the cursor not been locked, and had the screen been infinite in size. | 35 // the cursor not been locked, and had the screen been infinite in size. |
35 // | 36 // |
36 // The browser may revoke cursor lock for reasons including but not | 37 // The browser may revoke cursor lock for reasons including but not |
37 // limited to the user pressing the ESC key, the user activating | 38 // limited to the user pressing the ESC key, the user activating |
38 // another program via a reserved keystroke (e.g., ALT+TAB), or | 39 // another program via a reserved keystroke (e.g., ALT+TAB), or |
39 // some other system event. | 40 // some other system event. |
40 // | 41 // |
41 // Returns true if the cursor could be locked. | 42 // Returns PP_TRUE if the cursor could be locked, PP_FALSE otherwise. |
42 bool (*LockCursor)(PP_Instance); | 43 PP_Bool (*LockCursor)(PP_Instance); |
43 | 44 |
44 // Causes the cursor to be unlocked, allowing it to track user | 45 // Causes the cursor to be unlocked, allowing it to track user |
45 // movement again. | 46 // movement again. |
46 bool (*UnlockCursor)(PP_Instance); | 47 PP_Bool (*UnlockCursor)(PP_Instance); |
47 | 48 |
48 // Returns true if the cursor is locked. | 49 // Returns PP_TRUE if the cursor is locked, PP_FALSE otherwise. |
49 bool (*HasCursorLock)(PP_Instance); | 50 PP_Bool (*HasCursorLock)(PP_Instance); |
50 | 51 |
51 // Returns true if the cursor can be locked. | 52 // Returns PP_TRUE if the cursor can be locked, PP_FALSE otherwise. |
52 bool (*CanLockCursor)(PP_Instance); | 53 PP_Bool (*CanLockCursor)(PP_Instance); |
53 }; | 54 }; |
54 | 55 |
55 #endif // PPAPI_C_DEV_PPB_CURSOR_CONTROL_DEV_H_ | 56 #endif // PPAPI_C_DEV_PPB_CURSOR_CONTROL_DEV_H_ |
56 | |
OLD | NEW |