diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-20 22:04:32 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-20 22:04:32 +0000 |
commit | d912c698831fee8a5dd35ec603c2127663f593ed (patch) | |
tree | 2652decd8a67ee8dfe1b409006665ad21cdd0919 | |
parent | 45cce16952513f09dc045533d16e0135094fc3e3 (diff) | |
download | chromium_src-d912c698831fee8a5dd35ec603c2127663f593ed.zip chromium_src-d912c698831fee8a5dd35ec603c2127663f593ed.tar.gz chromium_src-d912c698831fee8a5dd35ec603c2127663f593ed.tar.bz2 |
Convert input event to interface version 1.0. Rename some of the mouse and
wheel events to remove the redundant "Mouse" and "Wheel" in the getters.
Rename PP_INPUTEVENT_TYPE_MOUSEWHEEL to .._WHEEL so that it doesn't look
like a mouse event (it's its own type).
Add documentation to the C++ wrapper from the C wrappers. Do some minor
documentation updates.
Update IDL for some of the recent changes we've made. Update the way points
are passed for resource creation since IDL wanted to do it by pointer.
TEST=it compiles.
Review URL: http://codereview.chromium.org/7464003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93263 0039d316-1c4b-4281-b951-d872f2087c98
24 files changed, 435 insertions, 191 deletions
diff --git a/ppapi/api/pp_input_event.idl b/ppapi/api/pp_input_event.idl index 1ed93cc..7e43b8f 100644 --- a/ppapi/api/pp_input_event.idl +++ b/ppapi/api/pp_input_event.idl @@ -184,47 +184,3 @@ struct PP_InputEvent_Mouse { PP_Bool scroll_by_page; }; -/** - * The PP_InputEventData union represents all input event data types. - */ -[union] struct PP_InputEventData { - [wcomment] PP_InputEvent_Key key; - [wcomment] PP_InputEvent_Character character; - [wcomment] PP_InputEvent_Mouse mouse; - [wcomment] PP_InputEvent_Wheel wheel; - - /** - * This value allows new events to be added without changing the size of - * this struct. - */ - char[64] padding; - -}; - -/** - * The PP_InputEvent struct represents all input events. - */ -[assert_size(80)] -struct PP_InputEvent { - /** This value represents the type of the event. */ - PP_InputEvent_Type type; - - /** This value ensure the time_stamp is aligned on an 8-byte boundary - * relative to the start of the struct. Some compilers align doubles - * on 8-byte boundaries for 32-bit x86, and some align on 4-byte boundaries. - */ - int32_t padding; - - /** - * This value represents the time that this event was generated. This value - * is not relative to any particular epoch; the most you can do is compare - * time stamps. - */ - PP_TimeTicks time_stamp; - - /** - * This value represents the event type and its specific data. - */ - PP_InputEventData u; -}; - diff --git a/ppapi/api/ppb_input_event.idl b/ppapi/api/ppb_input_event.idl index 07e3ea8..ba4536a 100644 --- a/ppapi/api/ppb_input_event.idl +++ b/ppapi/api/ppb_input_event.idl @@ -8,7 +8,7 @@ */ label Chrome { - M14 = 0.1 + M14 = 1.0 }; /** @@ -59,7 +59,7 @@ enum PP_InputEvent_Type { * * Register for this event using the PP_INPUTEVENT_CLASS_WHEEL class. */ - PP_INPUTEVENT_TYPE_MOUSEWHEEL = 5, + PP_INPUTEVENT_TYPE_WHEEL = 5, /** * Notification that a key transitioned from "up" to "down". @@ -196,7 +196,7 @@ enum PP_InputEvent_Class { PP_INPUTEVENT_CLASS_IME = 1 << 4 }; -[version=0.1, macro="PPB_INPUT_EVENT_INTERFACE"] +[version=1.0, macro="PPB_INPUT_EVENT_INTERFACE"] interface PPB_InputEvent { /** * Request that input events corresponding to the given input events are @@ -341,9 +341,23 @@ interface PPB_InputEvent { uint32_t GetModifiers([in] PP_Resource event); }; -[version=0.1, macro="PPB_MOUSE_INPUT_EVENT_INTERFACE"] +[version=1.0, macro="PPB_MOUSE_INPUT_EVENT_INTERFACE"] interface PPB_MouseInputEvent { /** + * Creates a mouse input event with the given parameters. Normally you will + * get a mouse event passed through the HandleInputEvent and will not need + * to create them, but some applications may want to create their own for + * internal use. The type must be one of the mouse event types. + */ + PP_Resource Create([in] PP_Instance instance, + [in] PP_InputEvent_Type type, + [in] PP_TimeTicks time_stamp, + [in] uint32_t modifiers, + [in] PP_InputEvent_MouseButton mouse_button, + [in] PP_Point mouse_position, + [in] int32_t click_count); + + /** * Determines if a resource is a mouse event. * * @return PP_TRUE if the given resource is a valid mouse input event. @@ -357,7 +371,7 @@ interface PPB_MouseInputEvent { * value will be PP_EVENT_MOUSEBUTTON_NONE for mouse move, enter, and leave * events, and for all non-mouse events. */ - PP_InputEvent_MouseButton GetMouseButton([in] PP_Resource mouse_event); + PP_InputEvent_MouseButton GetButton([in] PP_Resource mouse_event); /** * Returns the pixel location of a mouse input event. @@ -366,17 +380,30 @@ interface PPB_MouseInputEvent { * left of the instance receiving the event. These values can be negative for * mouse drags. The return value will be (0, 0) for non-mouse events. */ - [returnByValue] PP_Point GetMousePosition([in] PP_Resource mouse_event); + [returnByValue] PP_Point GetPosition([in] PP_Resource mouse_event); /** * TODO(brettw) figure out exactly what this means. */ - int32_t GetMouseClickCount([in] PP_Resource mouse_event); + int32_t GetClickCount([in] PP_Resource mouse_event); }; -[version=0.1, macro="PPB_WHEEL_INPUT_EVENT_INTERFACE"] +[version=1.0, macro="PPB_WHEEL_INPUT_EVENT_INTERFACE"] interface PPB_WheelInputEvent { /** + * Creates a wheel input event with the given parameters. Normally you will + * get a wheel event passed through the HandleInputEvent and will not need + * to create them, but some applications may want to create their own for + * internal use. + */ + PP_Resource Create([in] PP_Instance instance, + [in] PP_TimeTicks time_stamp, + [in] uint32_t modifiers, + [in] PP_FloatPoint wheel_delta, + [in] PP_FloatPoint wheel_ticks, + [in] PP_Bool scroll_by_page); + + /** * Determines if a resource is a wheel event. * * @return PP_TRUE if the given resource is a valid wheel input event. @@ -404,7 +431,7 @@ interface PPB_WheelInputEvent { * possible, for example, on some trackpads and newer mice that don't have * "clicks". */ - PP_FloatPoint GetWheelDelta([in] PP_Resource wheel_event); + PP_FloatPoint GetDelta([in] PP_Resource wheel_event); /** * The number of "clicks" of the scroll wheel that have produced the @@ -424,7 +451,7 @@ interface PPB_WheelInputEvent { * reaches positive or negative one. This should represent a similar amount * of scrolling as for a mouse that has a discrete mouse wheel. */ - PP_FloatPoint GetWheelTicks([in] PP_Resource wheel_event); + PP_FloatPoint GetTicks([in] PP_Resource wheel_event); /** * Indicates if the scroll delta x/y indicates pages or lines to @@ -436,9 +463,22 @@ interface PPB_WheelInputEvent { PP_Bool GetScrollByPage([in] PP_Resource wheel_event); }; -[version=0.1, macro="PPB_KEYBOARD_INPUT_EVENT_INTERFACE"] +[version=1.0, macro="PPB_KEYBOARD_INPUT_EVENT_INTERFACE"] interface PPB_KeyboardInputEvent { /** + * Creates a keyboard input event with the given parameters. Normally you + * will get a keyboard event passed through the HandleInputEvent and will not + * need to create them, but some applications may want to create their own + * for internal use. The type must be one of the keyboard event types. + */ + PP_Resource Create([in] PP_Instance instance, + [in] PP_InputEvent_Type type, + [in] PP_TimeTicks time_stamp, + [in] uint32_t modifiers, + [in] uint32_t key_code, + [in] PP_Var character_text); + + /** * Determines if a resource is a keyboard event. * * @return PP_TRUE if the given resource is a valid mouse input event. diff --git a/ppapi/api/ppb_instance.idl b/ppapi/api/ppb_instance.idl index fefc785..12bf46f 100644 --- a/ppapi/api/ppb_instance.idl +++ b/ppapi/api/ppb_instance.idl @@ -28,15 +28,14 @@ interface PPB_Instance { PP_Var GetOwnerElementObject([in] PP_Instance instance); /** - * BindGraphics() binds the given graphics as the current drawing surface. - * The contents of this device is what will be displayed in the module's + * BindGraphics() binds the given graphics as the current display surface. + * The contents of this device is what will be displayed in the instance's * area on the web page. The device must be a 2D or a 3D device. * * You can pass a <code>NULL</code> resource as the device parameter to * unbind all devices from the given instance. The instance will then appear * transparent. Re-binding the same device will return <code>PP_TRUE</code> - * and will do nothing. Unbinding a device will drop any pending flush - * callbacks. + * and will do nothing. * * Any previously-bound device will be released. It is an error to bind * a device when it is already bound to another instance. If you want @@ -59,11 +58,11 @@ interface PPB_Instance { [in] PP_Resource device); /** - * IsFullFrame() determines if the module instance is full-frame (repr). - * Such a module represents the entire document in a frame rather than an - * embedded resource. This can happen if the user does a top-level - * navigation or the page specifies an iframe to a resource with a MIME - * type registered by the module. + * IsFullFrame() determines if the instance is full-frame. Such an instance + * represents the entire document in a frame rather than an embedded + * resource. This can happen if the user does a top-level navigation or the + * page specifies an iframe to a resource with a MIME type registered by the + * module. * * @param[in] instance A <code>PP_Instance</code> indentifying one instance * of a module. diff --git a/ppapi/api/ppp_input_event.idl b/ppapi/api/ppp_input_event.idl index cfaf398..41af2ad 100644 --- a/ppapi/api/ppp_input_event.idl +++ b/ppapi/api/ppp_input_event.idl @@ -20,6 +20,19 @@ interface PPP_InputEvent { * PPB_InputEvent.RequestInputEvents() or RequestFilteringInputEvents(). By * default, no events are delivered. * + * If the event was handled, it will not be forwarded to the web page or + * browser. If it was not handled, it will bubble according to the normal + * rules. So it is important that an instance respond accurately with whether + * event propagation should continue. + * + * Event propagation also controls focus. If you handle an event like a mouse + * event, typically the instance will be given focus. Returning false from + * a filtered event handler or not registering for an event type means that + * the click will be given to a lower part of the page and your instance will + * not receive focus. This allows an instance to be partially transparent, + * where clicks on the transparent areas will behave like clicks to the + * underlying page. + * * In general, you should try to keep input event handling short. Especially * for filtered input events, the browser or page may be blocked waiting for * you to respond. @@ -28,6 +41,16 @@ interface PPP_InputEvent { * resource during this call. Unless you take a reference to the resource * to hold it for later, you don't need to release it. * + * <strong>Note:</strong> If you're not receiving input events, make sure you + * register for the event classes you want by calling RequestInputEvents or + * RequestFilteringInputEvents. If you're still not receiving keyboard input + * events, make sure you're returning true (or using a non-filtered event + * handler) for mouse events. Otherwise, the instance will not receive focus + * and keyboard events will not be sent. + * + * \see PPB_InputEvent.ReqeustInputEvents and + * PPB_InputEvent.RequestFilteringInputEvents + * * @return PP_TRUE if the event was handled, PP_FALSE if not. If you have * registered to filter this class of events by calling * RequestFilteringInputEvents, and you return PP_FALSE, the event will diff --git a/ppapi/c/pp_input_event.h b/ppapi/c/pp_input_event.h index c3defc9..a81bf2c 100644 --- a/ppapi/c/pp_input_event.h +++ b/ppapi/c/pp_input_event.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From pp_input_event.idl modified Sat Jul 16 16:50:26 2011. */ +/* From pp_input_event.idl modified Wed Jul 20 11:21:44 2011. */ #ifndef PPAPI_C_PP_INPUT_EVENT_H_ #define PPAPI_C_PP_INPUT_EVENT_H_ @@ -11,7 +11,6 @@ #include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_macros.h" #include "ppapi/c/pp_stdint.h" -#include "ppapi/c/pp_time.h" #include "ppapi/c/ppb_input_event.h" /** @@ -190,7 +189,6 @@ struct PP_InputEvent_Wheel { PP_Bool scroll_by_page; }; PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent_Wheel, 24); - /** * @} */ diff --git a/ppapi/c/ppb_input_event.h b/ppapi/c/ppb_input_event.h index b3c62a7..de66615 100644 --- a/ppapi/c/ppb_input_event.h +++ b/ppapi/c/ppb_input_event.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From ppb_input_event.idl modified Tue Jul 12 15:22:36 2011. */ +/* From ppb_input_event.idl modified Wed Jul 20 12:19:12 2011. */ #ifndef PPAPI_C_PPB_INPUT_EVENT_H_ #define PPAPI_C_PPB_INPUT_EVENT_H_ @@ -68,7 +68,7 @@ typedef enum { * * Register for this event using the PP_INPUTEVENT_CLASS_WHEEL class. */ - PP_INPUTEVENT_TYPE_MOUSEWHEEL = 5, + PP_INPUTEVENT_TYPE_WHEEL = 5, /** * Notification that a key transitioned from "up" to "down". * TODO(brettw) differentiate from KEYDOWN. @@ -204,8 +204,8 @@ PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_Class, 4); * @addtogroup Interfaces * @{ */ -#define PPB_INPUT_EVENT_INTERFACE_0_1 "PPB_InputEvent;0.1" -#define PPB_INPUT_EVENT_INTERFACE PPB_INPUT_EVENT_INTERFACE_0_1 +#define PPB_INPUT_EVENT_INTERFACE_1_0 "PPB_InputEvent;1.0" +#define PPB_INPUT_EVENT_INTERFACE PPB_INPUT_EVENT_INTERFACE_1_0 struct PPB_InputEvent { /** @@ -343,8 +343,8 @@ struct PPB_InputEvent { uint32_t (*GetModifiers)(PP_Resource event); }; -#define PPB_MOUSE_INPUT_EVENT_INTERFACE_0_1 "PPB_MouseInputEvent;0.1" -#define PPB_MOUSE_INPUT_EVENT_INTERFACE PPB_MOUSE_INPUT_EVENT_INTERFACE_0_1 +#define PPB_MOUSE_INPUT_EVENT_INTERFACE_1_0 "PPB_MouseInputEvent;1.0" +#define PPB_MOUSE_INPUT_EVENT_INTERFACE PPB_MOUSE_INPUT_EVENT_INTERFACE_1_0 struct PPB_MouseInputEvent { /** @@ -358,9 +358,8 @@ struct PPB_MouseInputEvent { PP_TimeTicks time_stamp, uint32_t modifiers, PP_InputEvent_MouseButton mouse_button, - struct PP_Point mouse_position, + const struct PP_Point* mouse_position, int32_t click_count); - /** * Determines if a resource is a mouse event. * @@ -374,7 +373,7 @@ struct PPB_MouseInputEvent { * value will be PP_EVENT_MOUSEBUTTON_NONE for mouse move, enter, and leave * events, and for all non-mouse events. */ - PP_InputEvent_MouseButton (*GetMouseButton)(PP_Resource mouse_event); + PP_InputEvent_MouseButton (*GetButton)(PP_Resource mouse_event); /** * Returns the pixel location of a mouse input event. * @@ -382,15 +381,15 @@ struct PPB_MouseInputEvent { * left of the instance receiving the event. These values can be negative for * mouse drags. The return value will be (0, 0) for non-mouse events. */ - struct PP_Point (*GetMousePosition)(PP_Resource mouse_event); + struct PP_Point (*GetPosition)(PP_Resource mouse_event); /** * TODO(brettw) figure out exactly what this means. */ - int32_t (*GetMouseClickCount)(PP_Resource mouse_event); + int32_t (*GetClickCount)(PP_Resource mouse_event); }; -#define PPB_WHEEL_INPUT_EVENT_INTERFACE_0_1 "PPB_WheelInputEvent;0.1" -#define PPB_WHEEL_INPUT_EVENT_INTERFACE PPB_WHEEL_INPUT_EVENT_INTERFACE_0_1 +#define PPB_WHEEL_INPUT_EVENT_INTERFACE_1_0 "PPB_WheelInputEvent;1.0" +#define PPB_WHEEL_INPUT_EVENT_INTERFACE PPB_WHEEL_INPUT_EVENT_INTERFACE_1_0 struct PPB_WheelInputEvent { /** @@ -402,10 +401,9 @@ struct PPB_WheelInputEvent { PP_Resource (*Create)(PP_Instance instance, PP_TimeTicks time_stamp, uint32_t modifiers, - struct PP_FloatPoint wheel_delta, - struct PP_FloatPoint wheel_ticks, + const struct PP_FloatPoint* wheel_delta, + const struct PP_FloatPoint* wheel_ticks, PP_Bool scroll_by_page); - /** * Determines if a resource is a wheel event. * @@ -433,7 +431,7 @@ struct PPB_WheelInputEvent { * possible, for example, on some trackpads and newer mice that don't have * "clicks". */ - struct PP_FloatPoint (*GetWheelDelta)(PP_Resource wheel_event); + struct PP_FloatPoint (*GetDelta)(PP_Resource wheel_event); /** * The number of "clicks" of the scroll wheel that have produced the * event. The value may have system-specific acceleration applied to it, @@ -452,7 +450,7 @@ struct PPB_WheelInputEvent { * reaches positive or negative one. This should represent a similar amount * of scrolling as for a mouse that has a discrete mouse wheel. */ - struct PP_FloatPoint (*GetWheelTicks)(PP_Resource wheel_event); + struct PP_FloatPoint (*GetTicks)(PP_Resource wheel_event); /** * Indicates if the scroll delta x/y indicates pages or lines to * scroll by. @@ -463,9 +461,9 @@ struct PPB_WheelInputEvent { PP_Bool (*GetScrollByPage)(PP_Resource wheel_event); }; -#define PPB_KEYBOARD_INPUT_EVENT_INTERFACE_0_1 "PPB_KeyboardInputEvent;0.1" +#define PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_0 "PPB_KeyboardInputEvent;1.0" #define PPB_KEYBOARD_INPUT_EVENT_INTERFACE \ - PPB_KEYBOARD_INPUT_EVENT_INTERFACE_0_1 + PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_0 struct PPB_KeyboardInputEvent { /** @@ -480,7 +478,6 @@ struct PPB_KeyboardInputEvent { uint32_t modifiers, uint32_t key_code, struct PP_Var character_text); - /** * Determines if a resource is a keyboard event. * diff --git a/ppapi/c/ppb_instance.h b/ppapi/c/ppb_instance.h index cff11b6..7985071 100644 --- a/ppapi/c/ppb_instance.h +++ b/ppapi/c/ppb_instance.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From ppb_instance.idl modified Mon Jul 18 12:54:08 2011. */ +/* From ppb_instance.idl modified Wed Jul 20 11:13:48 2011. */ #ifndef PPAPI_C_PPB_INSTANCE_H_ #define PPAPI_C_PPB_INSTANCE_H_ @@ -37,15 +37,14 @@ struct PPB_Instance { /** - * BindGraphics() binds the given graphics as the current drawing surface. - * The contents of this device is what will be displayed in the module's + * BindGraphics() binds the given graphics as the current display surface. + * The contents of this device is what will be displayed in the instance's * area on the web page. The device must be a 2D or a 3D device. * * You can pass a <code>NULL</code> resource as the device parameter to * unbind all devices from the given instance. The instance will then appear * transparent. Re-binding the same device will return <code>PP_TRUE</code> - * and will do nothing. Unbinding a device will drop any pending flush - * callbacks. + * and will do nothing. * * Any previously-bound device will be released. It is an error to bind * a device when it is already bound to another instance. If you want @@ -65,11 +64,11 @@ struct PPB_Instance { */ PP_Bool (*BindGraphics)(PP_Instance instance, PP_Resource device); /** - * IsFullFrame() determines if the module instance is full-frame (repr). - * Such a module represents the entire document in a frame rather than an - * embedded resource. This can happen if the user does a top-level - * navigation or the page specifies an iframe to a resource with a MIME - * type registered by the module. + * IsFullFrame() determines if the instance is full-frame. Such an instance + * represents the entire document in a frame rather than an embedded + * resource. This can happen if the user does a top-level navigation or the + * page specifies an iframe to a resource with a MIME type registered by the + * module. * * @param[in] instance A <code>PP_Instance</code> indentifying one instance * of a module. diff --git a/ppapi/c/ppp_input_event.h b/ppapi/c/ppp_input_event.h index e0067e6a..6429207 100644 --- a/ppapi/c/ppp_input_event.h +++ b/ppapi/c/ppp_input_event.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From ppp_input_event.idl modified Wed Jul 13 17:03:43 2011. */ +/* From ppp_input_event.idl modified Wed Jul 20 11:12:41 2011. */ #ifndef PPAPI_C_PPP_INPUT_EVENT_H_ #define PPAPI_C_PPP_INPUT_EVENT_H_ @@ -35,6 +35,19 @@ struct PPP_InputEvent { * PPB_InputEvent.RequestInputEvents() or RequestFilteringInputEvents(). By * default, no events are delivered. * + * If the event was handled, it will not be forwarded to the web page or + * browser. If it was not handled, it will bubble according to the normal + * rules. So it is important that an instance respond accurately with whether + * event propagation should continue. + * + * Event propagation also controls focus. If you handle an event like a mouse + * event, typically the instance will be given focus. Returning false from + * a filtered event handler or not registering for an event type means that + * the click will be given to a lower part of the page and your instance will + * not receive focus. This allows an instance to be partially transparent, + * where clicks on the transparent areas will behave like clicks to the + * underlying page. + * * In general, you should try to keep input event handling short. Especially * for filtered input events, the browser or page may be blocked waiting for * you to respond. @@ -43,6 +56,16 @@ struct PPP_InputEvent { * resource during this call. Unless you take a reference to the resource * to hold it for later, you don't need to release it. * + * <strong>Note:</strong> If you're not receiving input events, make sure you + * register for the event classes you want by calling RequestInputEvents or + * RequestFilteringInputEvents. If you're still not receiving keyboard input + * events, make sure you're returning true (or using a non-filtered event + * handler) for mouse events. Otherwise, the instance will not receive focus + * and keyboard events will not be sent. + * + * \see PPB_InputEvent.ReqeustInputEvents and + * PPB_InputEvent.RequestFilteringInputEvents + * * @return PP_TRUE if the event was handled, PP_FALSE if not. If you have * registered to filter this class of events by calling * RequestFilteringInputEvents, and you return PP_FALSE, the event will diff --git a/ppapi/c/ppp_instance.h b/ppapi/c/ppp_instance.h index 31f93a3..6a0125a 100644 --- a/ppapi/c/ppp_instance.h +++ b/ppapi/c/ppp_instance.h @@ -3,13 +3,12 @@ * found in the LICENSE file. */ -/* From ppp_instance.idl modified Sat Jul 16 16:50:26 2011. */ +/* From ppp_instance.idl modified Wed Jul 20 11:17:15 2011. */ #ifndef PPAPI_C_PPP_INSTANCE_H_ #define PPAPI_C_PPP_INSTANCE_H_ #include "ppapi/c/pp_bool.h" -#include "ppapi/c/pp_input_event.h" #include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_macros.h" #include "ppapi/c/pp_point.h" @@ -17,8 +16,6 @@ #include "ppapi/c/pp_resource.h" #include "ppapi/c/pp_size.h" #include "ppapi/c/pp_stdint.h" -#include "ppapi/c/pp_time.h" -#include "ppapi/c/ppb_input_event.h" /** * @file diff --git a/ppapi/c/ppp_messaging.h b/ppapi/c/ppp_messaging.h index 56ff612..97f2745 100644 --- a/ppapi/c/ppp_messaging.h +++ b/ppapi/c/ppp_messaging.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From ppp_messaging.idl modified Wed Jul 13 16:51:47 2011. */ +/* From ppp_messaging.idl modified Mon Jul 18 10:06:08 2011. */ #ifndef PPAPI_C_PPP_MESSAGING_H_ #define PPAPI_C_PPP_MESSAGING_H_ diff --git a/ppapi/cpp/input_event.cc b/ppapi/cpp/input_event.cc index d983603..fbf8ac7 100644 --- a/ppapi/cpp/input_event.cc +++ b/ppapi/cpp/input_event.cc @@ -96,26 +96,25 @@ MouseInputEvent::MouseInputEvent(Instance* instance, return; PassRefFromConstructor(get_interface<PPB_MouseInputEvent>()->Create( instance->pp_instance(), type, time_stamp, modifiers, mouse_button, - mouse_position, click_count)); + &mouse_position.pp_point(), click_count)); } -PP_InputEvent_MouseButton MouseInputEvent::GetMouseButton() const { +PP_InputEvent_MouseButton MouseInputEvent::GetButton() const { if (!has_interface<PPB_MouseInputEvent>()) return PP_INPUTEVENT_MOUSEBUTTON_NONE; - return get_interface<PPB_MouseInputEvent>()->GetMouseButton(pp_resource()); + return get_interface<PPB_MouseInputEvent>()->GetButton(pp_resource()); } -Point MouseInputEvent::GetMousePosition() const { +Point MouseInputEvent::GetPosition() const { if (!has_interface<PPB_MouseInputEvent>()) return Point(); - return get_interface<PPB_MouseInputEvent>()->GetMousePosition(pp_resource()); + return get_interface<PPB_MouseInputEvent>()->GetPosition(pp_resource()); } -int32_t MouseInputEvent::GetMouseClickCount() const { +int32_t MouseInputEvent::GetClickCount() const { if (!has_interface<PPB_MouseInputEvent>()) return 0; - return get_interface<PPB_MouseInputEvent>()->GetMouseClickCount( - pp_resource()); + return get_interface<PPB_MouseInputEvent>()->GetClickCount(pp_resource()); } // WheelInputEvent ------------------------------------------------------------- @@ -144,20 +143,21 @@ WheelInputEvent::WheelInputEvent(Instance* instance, if (!has_interface<PPB_WheelInputEvent>()) return; PassRefFromConstructor(get_interface<PPB_WheelInputEvent>()->Create( - instance->pp_instance(), time_stamp, modifiers, wheel_delta, - wheel_ticks, PP_FromBool(scroll_by_page))); + instance->pp_instance(), time_stamp, modifiers, + &wheel_delta.pp_float_point(), &wheel_ticks.pp_float_point(), + PP_FromBool(scroll_by_page))); } -FloatPoint WheelInputEvent::GetWheelDelta() const { +FloatPoint WheelInputEvent::GetDelta() const { if (!has_interface<PPB_WheelInputEvent>()) return FloatPoint(); - return get_interface<PPB_WheelInputEvent>()->GetWheelDelta(pp_resource()); + return get_interface<PPB_WheelInputEvent>()->GetDelta(pp_resource()); } -FloatPoint WheelInputEvent::GetWheelTicks() const { +FloatPoint WheelInputEvent::GetTicks() const { if (!has_interface<PPB_WheelInputEvent>()) return FloatPoint(); - return get_interface<PPB_WheelInputEvent>()->GetWheelTicks(pp_resource()); + return get_interface<PPB_WheelInputEvent>()->GetTicks(pp_resource()); } bool WheelInputEvent::GetScrollByPage() const { diff --git a/ppapi/cpp/input_event.h b/ppapi/cpp/input_event.h index 40e4aa0..2b66527 100644 --- a/ppapi/cpp/input_event.h +++ b/ppapi/cpp/input_event.h @@ -94,7 +94,7 @@ class MouseInputEvent : public InputEvent { /// @return The mouse button associated with mouse down and up events. This /// value will be PP_EVENT_MOUSEBUTTON_NONE for mouse move, enter, and leave /// events, and for all non-mouse events. - PP_InputEvent_MouseButton GetMouseButton() const; + PP_InputEvent_MouseButton GetButton() const; /// Returns the pixel location of a mouse input event. This value is in /// floating-point units to support high-resolution input events. @@ -102,10 +102,10 @@ class MouseInputEvent : public InputEvent { /// @return The point associated with the mouse event, relative to the upper- /// left of the instance receiving the event. These values can be negative for /// mouse drags. The return value will be (0, 0) for non-mouse events. - Point GetMousePosition() const; + Point GetPosition() const; // TODO(brettw) figure out exactly what this means. - int32_t GetMouseClickCount() const; + int32_t GetClickCount() const; }; class WheelInputEvent : public InputEvent { @@ -145,12 +145,12 @@ class WheelInputEvent : public InputEvent { /// only generate integer scroll amounts. But fractional values are also /// possible, for example, on some trackpads and newer mice that don't have /// "clicks". - FloatPoint GetWheelDelta() const; + FloatPoint GetDelta() const; /// The number of "clicks" of the scroll wheel that have produced the /// event. The value may have system-specific acceleration applied to it, /// depending on the device. The positive and negative meanings are the same - /// as for GetWheelDelta(). + /// as for GetDelta(). /// /// If you are scrolling, you probably want to use the delta values. These /// tick events can be useful if you aren't doing actual scrolling and don't @@ -163,7 +163,7 @@ class WheelInputEvent : public InputEvent { /// fractional click values from multiple messages until the total value /// reaches positive or negative one. This should represent a similar amount /// of scrolling as for a mouse that has a discrete mouse wheel. - FloatPoint GetWheelTicks() const; + FloatPoint GetTicks() const; // Indicates if the scroll delta x/y indicates pages or lines to // scroll by. diff --git a/ppapi/cpp/instance.h b/ppapi/cpp/instance.h index f08c2d5..8bd1ead 100644 --- a/ppapi/cpp/instance.h +++ b/ppapi/cpp/instance.h @@ -136,24 +136,48 @@ class Instance { /// @param[in] has_focus Indicates the new focused state of the instance. virtual void DidChangeFocus(bool has_focus); - /// Handles input events. Returns true if the event was handled or false if - /// it was not. The default implementation does nothing and returns false. + /// Function for receiving input events from the browser. The default + /// implementation does nothing and returns false. + /// + /// In order to receive input events, you must register for them by calling + /// RequestInputEvents() or RequestFilteringInputEvents(). By + /// default, no events are delivered. /// /// If the event was handled, it will not be forwarded to the web page or /// browser. If it was not handled, it will bubble according to the normal - /// rules. So it is important that a module respond accurately with whether + /// rules. So it is important that an instance respond accurately with whether /// event propagation should continue. /// /// Event propagation also controls focus. If you handle an event like a mouse - /// event, typically the instance will be given focus. Returning false means - /// that the click will be given to a lower part of the page and your module - /// will not receive focus. This allows an instance to be partially - /// transparent, where clicks on the transparent areas will behave like clicks - /// to the underlying page. + /// event, typically the instance will be given focus. Returning false from + /// a filtered event handler or not registering for an event type means that + /// the click will be given to a lower part of the page and your instance will + /// not receive focus. This allows an instance to be partially transparent, + /// where clicks on the transparent areas will behave like clicks to the + /// underlying page. + /// + /// In general, you should try to keep input event handling short. Especially + /// for filtered input events, the browser or page may be blocked waiting for + /// you to respond. + /// + /// The caller of this function will maintain a reference to the input event + /// resource during this call. Unless you take a reference to the resource + /// to hold it for later, you don't need to release it. + /// + /// \note If you're not receiving input events, make sure you register for the + /// event classes you want by calling RequestInputEvents or + /// RequestFilteringInputEvents. If you're still not receiving keyboard input + /// events, make sure you're returning true (or using a non-filtered event + /// handler) for mouse events. Otherwise, the instance will not receive focus + /// and keyboard events will not be sent. /// - /// @param[in] event The input event. + /// \see RequestInputEvents and RequestFilteringInputEvents /// - /// @return true if @a event was handled, false otherwise. + /// @return true if the event was handled, false if not. If you have + /// registered to filter this class of events by calling + /// RequestFilteringInputEvents, and you return false, the event will + /// be forwarded to the page (and eventually the browser) for the default + /// handling. For non-filtered events, the return value will be ignored. virtual bool HandleInputEvent(const pp::InputEvent& event); /// Notification of a data stream available after an instance was created @@ -178,34 +202,222 @@ class Instance { /// @return true if the data was handled, false otherwise. virtual bool HandleDocumentLoad(const URLLoader& url_loader); + /// HandleMessage() is a function that the browser calls when PostMessage() + /// is invoked on the DOM element for the instance in JavaScript. Note + /// that PostMessage() in the JavaScript interface is asynchronous, meaning + /// JavaScript execution will not be blocked while HandleMessage() is + /// processing the message. + /// + /// @param[in] message A <code>Var</code> containing the data sent from + /// JavaScript. Message can have an int32_t, double, bool, or string value + /// (objects are not supported). + /// + /// \see PostMessage for sending messages to JavaScript. + /// + /// <strong>Example:</strong> + /// + /// The following JavaScript code invokes <code>HandleMessage</code>, passing + /// the instance on which it was invoked, with <code>message</code> being a + /// string <code>Var</code> containing "Hello world!" + /// + /// @code + /// + /// <body> + /// <object id="plugin" + /// type="application/x-ppapi-postMessage-example"/> + /// <script type="text/javascript"> + /// document.getElementById('plugin').postMessage("Hello world!"); + /// </script> + /// </body> + /// + /// @endcode + virtual void HandleMessage(const Var& message); + /// @} /// @{ /// @name PPB_Instance methods for querying the browser: - /// See PPB_Instance.BindGraphics. + /// BindGraphics() binds the given graphics as the current display surface. + /// The contents of this device is what will be displayed in the instance's + /// area on the web page. The device must be a 2D or a 3D device. + /// + /// You can pass an <code>is_null()</code> (default constructed) Graphics2D + /// as the device parameter to unbind all devices from the given instance. + /// The instance will then appear transparent. Re-binding the same device + /// will return <code>true</code> and will do nothing. + /// + /// Any previously-bound device will be released. It is an error to bind + /// a device when it is already bound to another instance. If you want + /// to move a device between instances, first unbind it from the old one, and + /// then rebind it to the new one. + /// + /// Binding a device will invalidate that portion of the web page to flush the + /// contents of the new device to the screen. + /// + /// @param[in] graphics A Graphics2D object to bind. + /// + /// @return true if bind was successful or false if the device was not the + /// correct type. On success, a reference to the device will be held by the + /// instance, so the caller can release its reference if it chooses. bool BindGraphics(const Graphics2D& graphics); - /// See PPB_Instance.BindGraphics. + /// Binds the given Graphics3D as the current display surface. + /// See BindGraphics(const Graphics2D& graphics). bool BindGraphics(const Graphics3D_Dev& graphics); - /// See PPB_Instance.BindGraphics. + /// Binds the given Surface3D as the current display surface. + /// See BindGraphics(const Graphics2D& graphics). bool BindGraphics(const Surface3D_Dev& graphics); - /// See PPB_Instance.IsFullFrame. + /// IsFullFrame() determines if the instance is full-frame (repr). + /// Such an instance represents the entire document in a frame rather than an + /// embedded resource. This can happen if the user does a top-level + /// navigation or the page specifies an iframe to a resource with a MIME + /// type registered by the module. + /// + /// @return True if the instance is full-frame, false if not. bool IsFullFrame(); + /// Request that input events corresponding to the given input events are + /// delivered to the instance. + /// + /// You can not use this function to request keyboard events + /// (PP_INPUTEVENT_CLASS_KEYBOARD). You must use RequestFilteringInputEvents() + /// for this class of input. + /// + /// By default, no input events are delivered. Call this function with the + /// classes of events you are interested in to have them be delivered to + /// the instance. Calling this function will override any previous setting for + /// each specified class of input events (for example, if you previously + /// called RequestFilteringInputEvents(), this function will set those events + /// to non-filtering mode). + /// + /// Input events may have high overhead, so you should only request input + /// events that your plugin will actually handle. For example, the browser may + /// do optimizations for scroll or touch events that can be processed + /// substantially faster if it knows there are no non-default receivers for + /// that message. Requesting that such messages be delivered, even if they are + /// processed very quickly, may have a noticable effect on the performance of + /// the page. + /// + /// When requesting input events through this function, the events will be + /// delivered and <i>not</i> bubbled to the page. This means that even if you + /// aren't interested in the message, no other parts of the page will get + /// a crack at the message. + /// + /// Example: + /// RequestInputEvents(PP_INPUTEVENT_CLASS_MOUSE); + /// RequestFilteringInputEvents( + /// PP_INPUTEVENT_CLASS_WHEEL | PP_INPUTEVENT_CLASS_KEYBOARD); + /// + /// @param event_classes A combination of flags from PP_InputEvent_Class that + /// identifies the classes of events the instance is requesting. The flags + /// are combined by logically ORing their values. + /// + /// @return PP_OK if the operation succeeded, PP_ERROR_BADARGUMENT if instance + /// is invalid, or PP_ERROR_NOTSUPPORTED if one of the event class bits were + /// illegal. In the case of an invalid bit, all valid bits will be applied + /// and only the illegal bits will be ignored. The most common cause of a + /// PP_ERROR_NOTSUPPORTED return value is requesting keyboard events, these + /// must use RequestFilteringInputEvents(). int32_t RequestInputEvents(uint32_t event_classes); + + /// Request that input events corresponding to the given input events are + /// delivered to the instance for filtering. + /// + /// By default, no input events are delivered. In most cases you would + /// register to receive events by calling RequestInputEvents(). In some cases, + /// however, you may wish to filter events such that they can be bubbled up + /// to the DOM. In this case, register for those classes of events using + /// this function instead of RequestInputEvents(). Keyboard events must always + /// be registered in filtering mode. + /// + /// Filtering input events requires significantly more overhead than just + /// delivering them to the instance. As such, you should only request + /// filtering in those cases where it's absolutely necessary. The reason is + /// that it requires the browser to stop and block for the instance to handle + /// the input event, rather than sending the input event asynchronously. This + /// can have significant overhead. + /// + /// Example: + /// RequestInputEvents(PP_INPUTEVENT_CLASS_MOUSE); + /// RequestFilteringInputEvents( + /// PP_INPUTEVENT_CLASS_WHEEL | PP_INPUTEVENT_CLASS_KEYBOARD); + /// + /// @return PP_OK if the operation succeeded, PP_ERROR_BADARGUMENT if instance + /// is invalid, or PP_ERROR_NOTSUPPORTED if one of the event class bits were + /// illegal. In the case of an invalid bit, all valid bits will be applied + /// and only the illegal bits will be ignored. int32_t RequestFilteringInputEvents(uint32_t event_classes); - void ClearInputEventRequest(uint32_t event_classes); - // These functions use the PPP_Messaging and PPB_Messaging interfaces, so that - // messaging can be done conveniently for a pp::Instance without using a - // separate C++ class. + /// Request that input events corresponding to the given input classes no + /// longer be delivered to the instance. + /// + /// By default, no input events are delivered. If you have previously + /// requested input events via RequestInputEvents() or + /// RequestFilteringInputEvents(), this function will unregister handling + /// for the given instance. This will allow greater browser performance for + /// those events. + /// + /// Note that you may still get some input events after clearing the flag if + /// they were dispatched before the request was cleared. For example, if + /// there are 3 mouse move events waiting to be delivered, and you clear the + /// mouse event class during the processing of the first one, you'll still + /// receive the next two. You just won't get more events generated. + /// + /// @param event_classes A combination of flags from PP_InputEvent_Class that + /// identifies the classes of events the instance is no longer interested in. + void ClearInputEventRequest(uint32_t event_classes); - /// See PPP_Messaging.HandleMessage. - virtual void HandleMessage(const Var& message); - /// See PPB_Messaging.PostMessage. + /// PostMessage() asynchronously invokes any listeners for message events on + /// the DOM element for the given instance. A call to PostMessage() will + // /not block while the message is processed. + /// + /// @param[in] message A <code>Var</code> containing the data to be sent to + /// JavaScript. + /// Message can have a numeric, boolean, or string value; arrays and + /// dictionaries are not yet supported. Ref-counted var types are copied, and + /// are therefore not shared between the instance and the browser. + /// + /// Listeners for message events in JavaScript code will receive an object + /// conforming to the HTML 5 <code>MessageEvent</code> interface. + /// Specifically, the value of message will be contained as a property called + /// data in the received <code>MessageEvent</code>. + /// + /// This messaging system is similar to the system used for listening for + /// messages from Web Workers. Refer to + /// <code>http://www.whatwg.org/specs/web-workers/current-work/</code> for + /// further information. + /// + /// @see HandleMessage() for receiving events from JavaScript. + /// + /// <strong>Example:</strong> + /// + /// @code + /// + /// <body> + /// <object id="plugin" + /// type="application/x-ppapi-postMessage-example"/> + /// <script type="text/javascript"> + /// var plugin = document.getElementById('plugin'); + /// plugin.AddEventListener("message", + /// function(message) { alert(message.data); }, + /// false); + /// </script> + /// </body> + /// + /// @endcode + /// + /// The instance then invokes PostMessage() as follows: + /// + /// @code + /// + /// PostMessage(pp::Var("Hello world!")); + /// + /// @endcode + /// + /// The browser will pop-up an alert saying "Hello world!" void PostMessage(const Var& message); /// @} diff --git a/ppapi/examples/2d/paint_manager_example.cc b/ppapi/examples/2d/paint_manager_example.cc index c129f07..fdf5a8b 100644 --- a/ppapi/examples/2d/paint_manager_example.cc +++ b/ppapi/examples/2d/paint_manager_example.cc @@ -50,18 +50,18 @@ class MyInstance : public pp::Instance, public pp::PaintManager::Client { case PP_INPUTEVENT_TYPE_MOUSEDOWN: { pp::MouseInputEvent mouse_event(event); // Update the square on a mouse down. - if (mouse_event.GetMouseButton() == PP_INPUTEVENT_MOUSEBUTTON_LEFT) { - UpdateSquare(static_cast<int>(mouse_event.GetMousePosition().x()), - static_cast<int>(mouse_event.GetMousePosition().y())); + if (mouse_event.GetButton() == PP_INPUTEVENT_MOUSEBUTTON_LEFT) { + UpdateSquare(static_cast<int>(mouse_event.GetPosition().x()), + static_cast<int>(mouse_event.GetPosition().y())); } return true; } case PP_INPUTEVENT_TYPE_MOUSEMOVE: { pp::MouseInputEvent mouse_event(event); // Update the square on a drag. - if (mouse_event.GetMouseButton() == PP_INPUTEVENT_MOUSEBUTTON_LEFT) { - UpdateSquare(static_cast<int>(mouse_event.GetMousePosition().x()), - static_cast<int>(mouse_event.GetMousePosition().y())); + if (mouse_event.GetButton() == PP_INPUTEVENT_MOUSEBUTTON_LEFT) { + UpdateSquare(static_cast<int>(mouse_event.GetPosition().x()), + static_cast<int>(mouse_event.GetPosition().y())); } return true; } diff --git a/ppapi/examples/file_chooser/file_chooser.cc b/ppapi/examples/file_chooser/file_chooser.cc index e1eb6bd..dc12aa9 100644 --- a/ppapi/examples/file_chooser/file_chooser.cc +++ b/ppapi/examples/file_chooser/file_chooser.cc @@ -24,10 +24,9 @@ class MyInstance : public pp::InstancePrivate { switch (event.GetType()) { case PP_INPUTEVENT_TYPE_MOUSEDOWN: { pp::MouseInputEvent mouse_event(event); - if (mouse_event.GetMouseButton() == PP_INPUTEVENT_MOUSEBUTTON_LEFT) + if (mouse_event.GetButton() == PP_INPUTEVENT_MOUSEBUTTON_LEFT) ShowFileChooser(false); - else if (mouse_event.GetMouseButton() - == PP_INPUTEVENT_MOUSEBUTTON_RIGHT) + else if (mouse_event.GetButton() == PP_INPUTEVENT_MOUSEBUTTON_RIGHT) ShowFileChooser(true); else return false; diff --git a/ppapi/proxy/resource_creation_proxy.cc b/ppapi/proxy/resource_creation_proxy.cc index 8ebdb29..4de1127 100644 --- a/ppapi/proxy/resource_creation_proxy.cc +++ b/ppapi/proxy/resource_creation_proxy.cc @@ -223,7 +223,7 @@ PP_Resource ResourceCreationProxy::CreateMouseInputEvent( PP_TimeTicks time_stamp, uint32_t modifiers, PP_InputEvent_MouseButton mouse_button, - PP_Point mouse_position, + const PP_Point* mouse_position, int32_t click_count) { if (type != PP_INPUTEVENT_TYPE_MOUSEDOWN && type != PP_INPUTEVENT_TYPE_MOUSEUP && @@ -237,7 +237,7 @@ PP_Resource ResourceCreationProxy::CreateMouseInputEvent( data.event_time_stamp = time_stamp; data.event_modifiers = modifiers; data.mouse_button = mouse_button; - data.mouse_position = mouse_position; + data.mouse_position = *mouse_position; data.mouse_click_count = click_count; return PPB_InputEvent_Proxy::CreateProxyResource(instance, data); @@ -307,15 +307,15 @@ PP_Resource ResourceCreationProxy::CreateWheelInputEvent( PP_Instance instance, PP_TimeTicks time_stamp, uint32_t modifiers, - PP_FloatPoint wheel_delta, - PP_FloatPoint wheel_ticks, + const PP_FloatPoint* wheel_delta, + const PP_FloatPoint* wheel_ticks, PP_Bool scroll_by_page) { ppapi::InputEventData data; - data.event_type = PP_INPUTEVENT_TYPE_MOUSEWHEEL; + data.event_type = PP_INPUTEVENT_TYPE_WHEEL; data.event_time_stamp = time_stamp; data.event_modifiers = modifiers; - data.wheel_delta = wheel_delta; - data.wheel_ticks = wheel_ticks; + data.wheel_delta = *wheel_delta; + data.wheel_ticks = *wheel_ticks; data.wheel_scroll_by_page = PP_ToBool(scroll_by_page); return PPB_InputEvent_Proxy::CreateProxyResource(instance, data); diff --git a/ppapi/proxy/resource_creation_proxy.h b/ppapi/proxy/resource_creation_proxy.h index 18c6eff..304d7fb 100644 --- a/ppapi/proxy/resource_creation_proxy.h +++ b/ppapi/proxy/resource_creation_proxy.h @@ -90,14 +90,14 @@ class ResourceCreationProxy : public ::ppapi::FunctionGroupBase, PP_TimeTicks time_stamp, uint32_t modifiers, uint32_t key_code, - struct PP_Var character_text) OVERRIDE; + PP_Var character_text) OVERRIDE; virtual PP_Resource CreateMouseInputEvent( PP_Instance instance, PP_InputEvent_Type type, PP_TimeTicks time_stamp, uint32_t modifiers, PP_InputEvent_MouseButton mouse_button, - PP_Point mouse_position, + const PP_Point* mouse_position, int32_t click_count) OVERRIDE; virtual PP_Resource CreateScrollbar(PP_Instance instance, PP_Bool vertical) OVERRIDE; @@ -116,8 +116,8 @@ class ResourceCreationProxy : public ::ppapi::FunctionGroupBase, PP_Instance instance, PP_TimeTicks time_stamp, uint32_t modifiers, - PP_FloatPoint wheel_delta, - PP_FloatPoint wheel_ticks, + const PP_FloatPoint* wheel_delta, + const PP_FloatPoint* wheel_ticks, PP_Bool scroll_by_page) OVERRIDE; virtual bool Send(IPC::Message* msg) OVERRIDE; diff --git a/ppapi/shared_impl/ppp_instance_combined.h b/ppapi/shared_impl/ppp_instance_combined.h index 57b5beb..4bba1f8 100644 --- a/ppapi/shared_impl/ppp_instance_combined.h +++ b/ppapi/shared_impl/ppp_instance_combined.h @@ -7,6 +7,7 @@ #include "base/basictypes.h" #include "ppapi/c/ppp_instance.h" +#include "ppapi/c/pp_input_event.h" // TODO(dmichael): This is here only for temporary backwards compatibility so // that NaCl and other plugins aren't broken while the change propagates. This diff --git a/ppapi/thunk/ppb_input_event_thunk.cc b/ppapi/thunk/ppb_input_event_thunk.cc index 4fee1a1..258c9d3 100644 --- a/ppapi/thunk/ppb_input_event_thunk.cc +++ b/ppapi/thunk/ppb_input_event_thunk.cc @@ -85,7 +85,7 @@ PP_Resource CreateMouseInputEvent(PP_Instance instance, PP_TimeTicks time_stamp, uint32_t modifiers, PP_InputEvent_MouseButton mouse_button, - PP_Point mouse_position, + const PP_Point* mouse_position, int32_t click_count) { EnterFunction<ResourceCreationAPI> enter(instance, true); if (enter.failed()) @@ -141,8 +141,8 @@ const PPB_MouseInputEvent g_ppb_mouse_input_event_thunk = { PP_Resource CreateWheelInputEvent(PP_Instance instance, PP_TimeTicks time_stamp, uint32_t modifiers, - PP_FloatPoint wheel_delta, - PP_FloatPoint wheel_ticks, + const PP_FloatPoint* wheel_delta, + const PP_FloatPoint* wheel_ticks, PP_Bool scroll_by_page) { EnterFunction<ResourceCreationAPI> enter(instance, true); if (enter.failed()) @@ -156,7 +156,7 @@ PP_Bool IsWheelInputEvent(PP_Resource resource) { if (!IsInputEvent(resource)) return PP_FALSE; // Prevent warning log in GetType. PP_InputEvent_Type type = GetType(resource); - return PP_FromBool(type == PP_INPUTEVENT_TYPE_MOUSEWHEEL); + return PP_FromBool(type == PP_INPUTEVENT_TYPE_WHEEL); } PP_FloatPoint GetWheelDelta(PP_Resource wheel_event) { diff --git a/ppapi/thunk/resource_creation_api.h b/ppapi/thunk/resource_creation_api.h index 3ac84b2..4e6124e 100644 --- a/ppapi/thunk/resource_creation_api.h +++ b/ppapi/thunk/resource_creation_api.h @@ -97,7 +97,7 @@ class ResourceCreationAPI { PP_TimeTicks time_stamp, uint32_t modifiers, PP_InputEvent_MouseButton mouse_button, - PP_Point mouse_position, + const PP_Point* mouse_position, int32_t click_count) = 0; virtual PP_Resource CreateScrollbar(PP_Instance instance, PP_Bool vertical) = 0; @@ -116,8 +116,8 @@ class ResourceCreationAPI { PP_Instance instance, PP_TimeTicks time_stamp, uint32_t modifiers, - PP_FloatPoint wheel_delta, - PP_FloatPoint wheel_ticks, + const PP_FloatPoint* wheel_delta, + const PP_FloatPoint* wheel_ticks, PP_Bool scroll_by_page) = 0; static const ::pp::proxy::InterfaceID interface_id = diff --git a/remoting/client/plugin/pepper_input_handler.cc b/remoting/client/plugin/pepper_input_handler.cc index f94a402..01fd250 100644 --- a/remoting/client/plugin/pepper_input_handler.cc +++ b/remoting/client/plugin/pepper_input_handler.cc @@ -39,8 +39,8 @@ void PepperInputHandler::HandleCharacterEvent(const KeyboardInputEvent& event) { } void PepperInputHandler::HandleMouseMoveEvent(const MouseInputEvent& event) { - gfx::Point p(static_cast<int>(event.GetMousePosition().x()), - static_cast<int>(event.GetMousePosition().y())); + gfx::Point p(static_cast<int>(event.GetPosition().x()), + static_cast<int>(event.GetPosition().y())); // Pepper gives co-ordinates in the plugin instance's co-ordinate system, // which may be different from the host desktop's co-ordinate system. p = view_->ConvertScreenToHost(p); @@ -50,11 +50,11 @@ void PepperInputHandler::HandleMouseMoveEvent(const MouseInputEvent& event) { void PepperInputHandler::HandleMouseButtonEvent(bool button_down, const MouseInputEvent& event) { MouseEvent::MouseButton button = MouseEvent::BUTTON_UNDEFINED; - if (event.GetMouseButton() == PP_INPUTEVENT_MOUSEBUTTON_LEFT) { + if (event.GetButton() == PP_INPUTEVENT_MOUSEBUTTON_LEFT) { button = MouseEvent::BUTTON_LEFT; - } else if (event.GetMouseButton() == PP_INPUTEVENT_MOUSEBUTTON_MIDDLE) { + } else if (event.GetButton() == PP_INPUTEVENT_MOUSEBUTTON_MIDDLE) { button = MouseEvent::BUTTON_MIDDLE; - } else if (event.GetMouseButton() == PP_INPUTEVENT_MOUSEBUTTON_RIGHT) { + } else if (event.GetButton() == PP_INPUTEVENT_MOUSEBUTTON_RIGHT) { button = MouseEvent::BUTTON_RIGHT; } diff --git a/webkit/plugins/ppapi/event_conversion.cc b/webkit/plugins/ppapi/event_conversion.cc index d09faef..bfd9ee1 100644 --- a/webkit/plugins/ppapi/event_conversion.cc +++ b/webkit/plugins/ppapi/event_conversion.cc @@ -47,7 +47,7 @@ PP_InputEvent_Type ConvertEventTypes(WebInputEvent::Type wetype) { case WebInputEvent::ContextMenu: return PP_INPUTEVENT_TYPE_CONTEXTMENU; case WebInputEvent::MouseWheel: - return PP_INPUTEVENT_TYPE_MOUSEWHEEL; + return PP_INPUTEVENT_TYPE_WHEEL; case WebInputEvent::RawKeyDown: return PP_INPUTEVENT_TYPE_RAWKEYDOWN; case WebInputEvent::KeyDown: @@ -263,7 +263,7 @@ void InputEventDataToPPInputEvent(const InputEventData& data, result->u.mouse.y = static_cast<float>(data.mouse_position.y); result->u.mouse.click_count = data.mouse_click_count; break; - case PP_INPUTEVENT_TYPE_MOUSEWHEEL: + case PP_INPUTEVENT_TYPE_WHEEL: result->u.wheel.modifier = data.event_modifiers; result->u.wheel.delta_x = data.wheel_delta.x; result->u.wheel.delta_y = data.wheel_delta.y; @@ -341,7 +341,7 @@ WebInputEvent* CreateWebInputEvent(const InputEventData& event) { case PP_INPUTEVENT_TYPE_CONTEXTMENU: web_input_event.reset(BuildMouseEvent(event)); break; - case PP_INPUTEVENT_TYPE_MOUSEWHEEL: + case PP_INPUTEVENT_TYPE_WHEEL: web_input_event.reset(BuildMouseWheelEvent(event)); break; case PP_INPUTEVENT_TYPE_RAWKEYDOWN: diff --git a/webkit/plugins/ppapi/resource_creation_impl.cc b/webkit/plugins/ppapi/resource_creation_impl.cc index cadb4db..61b3d72 100644 --- a/webkit/plugins/ppapi/resource_creation_impl.cc +++ b/webkit/plugins/ppapi/resource_creation_impl.cc @@ -237,7 +237,7 @@ PP_Resource ResourceCreationImpl::CreateMouseInputEvent( PP_TimeTicks time_stamp, uint32_t modifiers, PP_InputEvent_MouseButton mouse_button, - PP_Point mouse_position, + const PP_Point* mouse_position, int32_t click_count) { if (type != PP_INPUTEVENT_TYPE_MOUSEDOWN && type != PP_INPUTEVENT_TYPE_MOUSEUP && @@ -251,7 +251,7 @@ PP_Resource ResourceCreationImpl::CreateMouseInputEvent( data.event_time_stamp = time_stamp; data.event_modifiers = modifiers; data.mouse_button = mouse_button; - data.mouse_position = mouse_position; + data.mouse_position = *mouse_position; data.mouse_click_count = click_count; return PPB_InputEvent_Impl::Create(instance_, data); @@ -296,15 +296,15 @@ PP_Resource ResourceCreationImpl::CreateWheelInputEvent( PP_Instance instance, PP_TimeTicks time_stamp, uint32_t modifiers, - PP_FloatPoint wheel_delta, - PP_FloatPoint wheel_ticks, + const PP_FloatPoint* wheel_delta, + const PP_FloatPoint* wheel_ticks, PP_Bool scroll_by_page) { InputEventData data; - data.event_type = PP_INPUTEVENT_TYPE_MOUSEWHEEL; + data.event_type = PP_INPUTEVENT_TYPE_WHEEL; data.event_time_stamp = time_stamp; data.event_modifiers = modifiers; - data.wheel_delta = wheel_delta; - data.wheel_ticks = wheel_ticks; + data.wheel_delta = *wheel_delta; + data.wheel_ticks = *wheel_ticks; data.wheel_scroll_by_page = PP_ToBool(scroll_by_page); return PPB_InputEvent_Impl::Create(instance_, data); diff --git a/webkit/plugins/ppapi/resource_creation_impl.h b/webkit/plugins/ppapi/resource_creation_impl.h index b49146d..5a8e734 100644 --- a/webkit/plugins/ppapi/resource_creation_impl.h +++ b/webkit/plugins/ppapi/resource_creation_impl.h @@ -81,14 +81,14 @@ class ResourceCreationImpl : public ::ppapi::FunctionGroupBase, PP_TimeTicks time_stamp, uint32_t modifiers, uint32_t key_code, - struct PP_Var character_text) OVERRIDE; + PP_Var character_text) OVERRIDE; virtual PP_Resource CreateMouseInputEvent( PP_Instance instance, PP_InputEvent_Type type, PP_TimeTicks time_stamp, uint32_t modifiers, PP_InputEvent_MouseButton mouse_button, - PP_Point mouse_position, + const PP_Point* mouse_position, int32_t click_count) OVERRIDE; virtual PP_Resource CreateScrollbar(PP_Instance instance, PP_Bool vertical) OVERRIDE; @@ -107,8 +107,8 @@ class ResourceCreationImpl : public ::ppapi::FunctionGroupBase, PP_Instance instance, PP_TimeTicks time_stamp, uint32_t modifiers, - PP_FloatPoint wheel_delta, - PP_FloatPoint wheel_ticks, + const PP_FloatPoint* wheel_delta, + const PP_FloatPoint* wheel_ticks, PP_Bool scroll_by_page) OVERRIDE; private: |