diff options
author | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-31 17:15:18 +0000 |
---|---|---|
committer | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-31 17:15:18 +0000 |
commit | 8047326498cbb57b90940d7375eb1e834e90fe4c (patch) | |
tree | 70c367c8e0905218c1c9c3a6fb0481d6f521d646 /ppapi/thunk | |
parent | bca6d271896444890973db203a9f153e188ddae9 (diff) | |
download | chromium_src-8047326498cbb57b90940d7375eb1e834e90fe4c.zip chromium_src-8047326498cbb57b90940d7375eb1e834e90fe4c.tar.gz chromium_src-8047326498cbb57b90940d7375eb1e834e90fe4c.tar.bz2 |
Add movement information to PPB_MouseInputEvent.
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/7715021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98994 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/thunk')
-rw-r--r-- | ppapi/thunk/ppb_input_event_api.h | 1 | ||||
-rw-r--r-- | ppapi/thunk/ppb_input_event_thunk.cc | 64 | ||||
-rw-r--r-- | ppapi/thunk/resource_creation_api.h | 3 | ||||
-rw-r--r-- | ppapi/thunk/thunk.h | 6 |
4 files changed, 60 insertions, 14 deletions
diff --git a/ppapi/thunk/ppb_input_event_api.h b/ppapi/thunk/ppb_input_event_api.h index d0e8c4b..28b6c58 100644 --- a/ppapi/thunk/ppb_input_event_api.h +++ b/ppapi/thunk/ppb_input_event_api.h @@ -28,6 +28,7 @@ class PPAPI_THUNK_EXPORT PPB_InputEvent_API { virtual PP_InputEvent_MouseButton GetMouseButton() = 0; virtual PP_Point GetMousePosition() = 0; virtual int32_t GetMouseClickCount() = 0; + virtual PP_Point GetMouseMovement() = 0; virtual PP_FloatPoint GetWheelDelta() = 0; virtual PP_FloatPoint GetWheelTicks() = 0; virtual PP_Bool GetWheelScrollByPage() = 0; diff --git a/ppapi/thunk/ppb_input_event_thunk.cc b/ppapi/thunk/ppb_input_event_thunk.cc index bcfe8f7..bd28495 100644 --- a/ppapi/thunk/ppb_input_event_thunk.cc +++ b/ppapi/thunk/ppb_input_event_thunk.cc @@ -80,19 +80,39 @@ const PPB_InputEvent g_ppb_input_event_thunk = { // Mouse ----------------------------------------------------------------------- -PP_Resource CreateMouseInputEvent(PP_Instance instance, - PP_InputEvent_Type type, - PP_TimeTicks time_stamp, - uint32_t modifiers, - PP_InputEvent_MouseButton mouse_button, - const PP_Point* mouse_position, - int32_t click_count) { +PP_Resource CreateMouseInputEvent1_0(PP_Instance instance, + PP_InputEvent_Type type, + PP_TimeTicks time_stamp, + uint32_t modifiers, + PP_InputEvent_MouseButton mouse_button, + const PP_Point* mouse_position, + int32_t click_count) { + EnterFunction<ResourceCreationAPI> enter(instance, true); + if (enter.failed()) + return 0; + + PP_Point mouse_movement = PP_MakePoint(0, 0); + return enter.functions()->CreateMouseInputEvent(instance, type, time_stamp, + modifiers, mouse_button, + mouse_position, click_count, + &mouse_movement); +} + +PP_Resource CreateMouseInputEvent1_1(PP_Instance instance, + PP_InputEvent_Type type, + PP_TimeTicks time_stamp, + uint32_t modifiers, + PP_InputEvent_MouseButton mouse_button, + const PP_Point* mouse_position, + int32_t click_count, + const PP_Point* mouse_movement) { EnterFunction<ResourceCreationAPI> enter(instance, true); if (enter.failed()) return 0; return enter.functions()->CreateMouseInputEvent(instance, type, time_stamp, modifiers, mouse_button, - mouse_position, click_count); + mouse_position, click_count, + mouse_movement); } PP_Bool IsMouseInputEvent(PP_Resource resource) { @@ -128,14 +148,30 @@ int32_t GetMouseClickCount(PP_Resource mouse_event) { return enter.object()->GetMouseClickCount(); } -const PPB_MouseInputEvent g_ppb_mouse_input_event_thunk = { - &CreateMouseInputEvent, +PP_Point GetMouseMovement(PP_Resource mouse_event) { + EnterInputEvent enter(mouse_event, true); + if (enter.failed()) + return PP_MakePoint(0, 0); + return enter.object()->GetMouseMovement(); +} + +const PPB_MouseInputEvent_1_0 g_ppb_mouse_input_event_1_0_thunk = { + &CreateMouseInputEvent1_0, &IsMouseInputEvent, &GetMouseButton, &GetMousePosition, &GetMouseClickCount }; +const PPB_MouseInputEvent g_ppb_mouse_input_event_1_1_thunk = { + &CreateMouseInputEvent1_1, + &IsMouseInputEvent, + &GetMouseButton, + &GetMousePosition, + &GetMouseClickCount, + &GetMouseMovement +}; + // Wheel ----------------------------------------------------------------------- PP_Resource CreateWheelInputEvent(PP_Instance instance, @@ -241,8 +277,12 @@ const PPB_InputEvent* GetPPB_InputEvent_Thunk() { return &g_ppb_input_event_thunk; } -const PPB_MouseInputEvent* GetPPB_MouseInputEvent_Thunk() { - return &g_ppb_mouse_input_event_thunk; +const PPB_MouseInputEvent_1_0* GetPPB_MouseInputEvent_1_0_Thunk() { + return &g_ppb_mouse_input_event_1_0_thunk; +} + +const PPB_MouseInputEvent* GetPPB_MouseInputEvent_1_1_Thunk() { + return &g_ppb_mouse_input_event_1_1_thunk; } const PPB_KeyboardInputEvent* GetPPB_KeyboardInputEvent_Thunk() { diff --git a/ppapi/thunk/resource_creation_api.h b/ppapi/thunk/resource_creation_api.h index 5564eec..8757382 100644 --- a/ppapi/thunk/resource_creation_api.h +++ b/ppapi/thunk/resource_creation_api.h @@ -101,7 +101,8 @@ class ResourceCreationAPI { uint32_t modifiers, PP_InputEvent_MouseButton mouse_button, const PP_Point* mouse_position, - int32_t click_count) = 0; + int32_t click_count, + const PP_Point* mouse_movement) = 0; virtual PP_Resource CreateScrollbar(PP_Instance instance, PP_Bool vertical) = 0; virtual PP_Resource CreateSurface3D(PP_Instance instance, diff --git a/ppapi/thunk/thunk.h b/ppapi/thunk/thunk.h index 342a9ed..2871fff 100644 --- a/ppapi/thunk/thunk.h +++ b/ppapi/thunk/thunk.h @@ -41,6 +41,7 @@ struct PPB_Instance_Private; struct PPB_KeyboardInputEvent; struct PPB_LayerCompositor_Dev; struct PPB_Messaging; +struct PPB_MouseInputEvent_1_0; struct PPB_MouseInputEvent; struct PPB_QueryPolicy_Dev; struct PPB_Scrollbar_0_5_Dev; @@ -104,7 +105,10 @@ PPAPI_THUNK_EXPORT const PPB_LayerCompositor_Dev* GetPPB_LayerCompositor_Thunk(); PPAPI_THUNK_EXPORT const PPB_QueryPolicy_Dev* GetPPB_QueryPolicy_Thunk(); PPAPI_THUNK_EXPORT const PPB_Messaging* GetPPB_Messaging_Thunk(); -PPAPI_THUNK_EXPORT const PPB_MouseInputEvent* GetPPB_MouseInputEvent_Thunk(); +PPAPI_THUNK_EXPORT const PPB_MouseInputEvent_1_0* + GetPPB_MouseInputEvent_1_0_Thunk(); +PPAPI_THUNK_EXPORT const PPB_MouseInputEvent* + GetPPB_MouseInputEvent_1_1_Thunk(); PPAPI_THUNK_EXPORT const PPB_Scrollbar_0_5_Dev* GetPPB_Scrollbar_Thunk(); PPAPI_THUNK_EXPORT const PPB_Surface3D_Dev* GetPPB_Surface3D_Thunk(); PPAPI_THUNK_EXPORT const PPB_Transport_Dev* GetPPB_Transport_Thunk(); |