summaryrefslogtreecommitdiffstats
path: root/ppapi/native_client
diff options
context:
space:
mode:
authoryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-31 17:15:18 +0000
committeryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-31 17:15:18 +0000
commit8047326498cbb57b90940d7375eb1e834e90fe4c (patch)
tree70c367c8e0905218c1c9c3a6fb0481d6f521d646 /ppapi/native_client
parentbca6d271896444890973db203a9f153e188ddae9 (diff)
downloadchromium_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/native_client')
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_input_event_rpc_server.cc6
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_input_event.cc2
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/input_event_data.cc1
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/input_event_data.h3
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb.cc6
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.cc64
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.h4
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/ppb_input_event.srpc4
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/ppb_rpc_client.cc6
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/ppb_rpc_server.cc4
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppb_rpc.h2
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppb_rpc.h2
12 files changed, 84 insertions, 20 deletions
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_input_event_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_input_event_rpc_server.cc
index 8d21cd7..ab77f78 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_input_event_rpc_server.cc
+++ b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_input_event_rpc_server.cc
@@ -81,6 +81,8 @@ void PpbInputEventRpcServer::PPB_InputEvent_CreateMouseInputEvent(
int32_t position_x, // PP_Point.x
int32_t position_y, // PP_Point.y
int32_t click_count,
+ int32_t movement_x, // PP_Point.x
+ int32_t movement_y, // PP_Point.y
PP_Resource* resource_id) {
NaClSrpcClosureRunner runner(done);
rpc->result = NACL_SRPC_RESULT_APP_ERROR;
@@ -92,6 +94,7 @@ void PpbInputEventRpcServer::PPB_InputEvent_CreateMouseInputEvent(
return;
}
PP_Point mouse_position = { position_x, position_y };
+ PP_Point mouse_movement = { movement_x, movement_y };
*resource_id = input_event_if->Create(
instance,
static_cast<PP_InputEvent_Type>(type),
@@ -99,7 +102,8 @@ void PpbInputEventRpcServer::PPB_InputEvent_CreateMouseInputEvent(
static_cast<uint32_t>(modifiers),
static_cast<PP_InputEvent_MouseButton>(mouse_button),
&mouse_position,
- click_count);
+ click_count,
+ &mouse_movement);
DebugPrintf("PPB_InputEvent::CreateMouseInputEvent: resource_id="
"%"NACL_PRId32"\n",
*resource_id);
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_input_event.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_input_event.cc
index f71aecb..917f40c 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_input_event.cc
+++ b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_input_event.cc
@@ -44,6 +44,8 @@ PP_Bool HandleInputEvent(PP_Instance instance, PP_Resource input_event) {
PPBMouseInputEventInterface()->GetPosition(input_event);
data.mouse_click_count =
PPBMouseInputEventInterface()->GetClickCount(input_event);
+ data.mouse_movement =
+ PPBMouseInputEventInterface()->GetMovement(input_event);
break;
// This event uses the PPB_WheelInputEvent interface.
case PP_INPUTEVENT_TYPE_WHEEL:
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/input_event_data.cc b/ppapi/native_client/src/shared/ppapi_proxy/input_event_data.cc
index d94ad24..1d5b60c 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/input_event_data.cc
+++ b/ppapi/native_client/src/shared/ppapi_proxy/input_event_data.cc
@@ -13,6 +13,7 @@ InputEventData::InputEventData()
mouse_button(PP_INPUTEVENT_MOUSEBUTTON_NONE),
mouse_click_count(0),
mouse_position(PP_MakePoint(0, 0)),
+ mouse_movement(PP_MakePoint(0, 0)),
wheel_delta(PP_MakeFloatPoint(0.0f, 0.0f)),
wheel_ticks(PP_MakeFloatPoint(0.0f, 0.0f)),
wheel_scroll_by_page(PP_FALSE),
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/input_event_data.h b/ppapi/native_client/src/shared/ppapi_proxy/input_event_data.h
index 325d3d6..b92057f 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/input_event_data.h
+++ b/ppapi/native_client/src/shared/ppapi_proxy/input_event_data.h
@@ -25,6 +25,7 @@ struct InputEventData {
PP_InputEvent_MouseButton mouse_button;
int32_t mouse_click_count;
PP_Point mouse_position;
+ PP_Point mouse_movement;
PP_FloatPoint wheel_delta;
PP_FloatPoint wheel_ticks;
@@ -38,7 +39,7 @@ struct InputEventData {
// and alignment. TODO(dmichael): This is only required because we don't pickle
// the type. As a short-cut, we memcpy it instead. It would be cleaner to
// pickle this struct.
-PP_COMPILE_ASSERT_SIZE_IN_BYTES(InputEventData, 56);
+PP_COMPILE_ASSERT_SIZE_IN_BYTES(InputEventData, 64);
} // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb.cc
index cb47725..1c1140c 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb.cc
+++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb.cc
@@ -67,8 +67,10 @@ InterfaceMapElement interface_map[] = {
PluginInputEvent::GetKeyboardInterface(), true },
{ PPB_MEMORY_DEV_INTERFACE, PluginMemory::GetInterface(), true },
{ PPB_MESSAGING_INTERFACE, PluginMessaging::GetInterface(), true },
- { PPB_MOUSE_INPUT_EVENT_INTERFACE, PluginInputEvent::GetMouseInterface(),
- true },
+ { PPB_MOUSE_INPUT_EVENT_INTERFACE_1_0,
+ PluginInputEvent::GetMouseInterface1_0(), true },
+ { PPB_MOUSE_INPUT_EVENT_INTERFACE_1_1,
+ PluginInputEvent::GetMouseInterface1_1(), true },
{ PPB_OPENGLES2_DEV_INTERFACE, PluginGraphics3D::GetOpenGLESInterface(),
true },
{ PPB_PDF_INTERFACE, PluginPDF::GetInterface(), true },
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.cc
index d9e15d8..3a1e700 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.cc
+++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.cc
@@ -130,19 +130,22 @@ uint32_t GetModifiers(PP_Resource event) {
// 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_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) {
DebugPrintf("PPB_InputEvent::CreateMouseInputEvent: instance="
"%"NACL_PRIu32", type=%d, time_stamp=%lf, modifiers="
"%"NACL_PRIu32", mouse_button=%d, x=%"NACL_PRId32", y="
- "%"NACL_PRId32", click_count=%d\n",
+ "%"NACL_PRId32", click_count=%d, movement_x="
+ "%"NACL_PRId32", movement_y=%"NACL_PRId32"\n",
instance, type, time_stamp, modifiers, mouse_button,
- mouse_position->x, mouse_position->y, click_count);
+ mouse_position->x, mouse_position->y, click_count,
+ mouse_movement->x, mouse_movement->y);
PP_Resource resource_id = kInvalidResourceId;
NaClSrpcError srpc_result =
PpbInputEventRpcClient::PPB_InputEvent_CreateMouseInputEvent(
@@ -155,12 +158,28 @@ PP_Resource CreateMouseInputEvent(PP_Instance instance,
mouse_position->x,
mouse_position->y,
click_count,
+ mouse_movement->x,
+ mouse_movement->y,
&resource_id);
if (srpc_result == NACL_SRPC_RESULT_OK)
return resource_id;
return kInvalidResourceId;
}
+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) {
+ PP_Point mouse_movement = PP_MakePoint(0, 0);
+ return CreateMouseInputEvent1_1(instance, type, time_stamp, modifiers,
+ mouse_button, mouse_position, click_count,
+ &mouse_movement);
+
+}
+
PP_Bool IsMouseInputEvent(PP_Resource resource) {
if (!IsInputEvent(resource))
return PP_FALSE;
@@ -186,6 +205,10 @@ int32_t GetMouseClickCount(PP_Resource mouse_event) {
IMPLEMENT_RESOURCE_THUNK(GetMouseClickCount, mouse_event, 0);
}
+PP_Point GetMouseMovement(PP_Resource mouse_event) {
+ IMPLEMENT_RESOURCE_THUNK(GetMouseMovement, mouse_event, PP_MakePoint(0, 0));
+}
+
// Wheel -----------------------------------------------------------------------
PP_Resource CreateWheelInputEvent(PP_Instance instance,
@@ -306,9 +329,9 @@ const PPB_InputEvent* PluginInputEvent::GetInterface() {
}
// static
-const PPB_MouseInputEvent* PluginInputEvent::GetMouseInterface() {
- static const PPB_MouseInputEvent mouse_input_event_interface = {
- CreateMouseInputEvent,
+const PPB_MouseInputEvent_1_0* PluginInputEvent::GetMouseInterface1_0() {
+ static const PPB_MouseInputEvent_1_0 mouse_input_event_interface = {
+ CreateMouseInputEvent1_0,
IsMouseInputEvent,
::GetMouseButton,
::GetMousePosition,
@@ -318,6 +341,19 @@ const PPB_MouseInputEvent* PluginInputEvent::GetMouseInterface() {
}
// static
+const PPB_MouseInputEvent* PluginInputEvent::GetMouseInterface1_1() {
+ static const PPB_MouseInputEvent mouse_input_event_interface = {
+ CreateMouseInputEvent1_1,
+ IsMouseInputEvent,
+ ::GetMouseButton,
+ ::GetMousePosition,
+ ::GetMouseClickCount,
+ ::GetMouseMovement
+ };
+ return &mouse_input_event_interface;
+}
+
+// static
const PPB_WheelInputEvent* PluginInputEvent::GetWheelInterface() {
static const PPB_WheelInputEvent wheel_input_event_interface = {
CreateWheelInputEvent,
@@ -379,6 +415,10 @@ int32_t PluginInputEvent::GetMouseClickCount() const {
return input_event_data_.mouse_click_count;
}
+PP_Point PluginInputEvent::GetMouseMovement() const {
+ return input_event_data_.mouse_movement;
+}
+
PP_FloatPoint PluginInputEvent::GetWheelDelta() const {
return input_event_data_.wheel_delta;
}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.h
index b22346d..14c94bb 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.h
+++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.h
@@ -27,7 +27,8 @@ class PluginInputEvent : public PluginResource {
}
static const PPB_InputEvent* GetInterface();
- static const PPB_MouseInputEvent* GetMouseInterface();
+ static const PPB_MouseInputEvent_1_0* GetMouseInterface1_0();
+ static const PPB_MouseInputEvent* GetMouseInterface1_1();
static const PPB_WheelInputEvent* GetWheelInterface();
static const PPB_KeyboardInputEvent* GetKeyboardInterface();
@@ -38,6 +39,7 @@ class PluginInputEvent : public PluginResource {
PP_InputEvent_MouseButton GetMouseButton() const;
PP_Point GetMousePosition() const;
int32_t GetMouseClickCount() const;
+ PP_Point GetMouseMovement() const;
PP_FloatPoint GetWheelDelta() const;
PP_FloatPoint GetWheelTicks() const;
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_input_event.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_input_event.srpc
index cb28783c..71c2cc74 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_input_event.srpc
+++ b/ppapi/native_client/src/shared/ppapi_proxy/ppb_input_event.srpc
@@ -29,7 +29,9 @@
['mouse_button', 'int32_t'], # PP_InputEvent_MouseButton
['mouse_position_x', 'int32_t'], # PP_Point.x
['mouse_position_y', 'int32_t'], # PP_Point.y
- ['click_count', 'int32_t']
+ ['click_count', 'int32_t'],
+ ['mouse_movement_x', 'int32_t'], # PP_Point.x
+ ['mouse_movement_y', 'int32_t'], # PP_Point.y
],
'outputs': [['resource_id', 'PP_Resource']]
},
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_rpc_client.cc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_rpc_client.cc
index 1481c1f..4b633bd0 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_rpc_client.cc
+++ b/ppapi/native_client/src/shared/ppapi_proxy/ppb_rpc_client.cc
@@ -1670,6 +1670,8 @@ NaClSrpcError PpbInputEventRpcClient::PPB_InputEvent_CreateMouseInputEvent(
int32_t mouse_position_x,
int32_t mouse_position_y,
int32_t click_count,
+ int32_t mouse_movement_x,
+ int32_t mouse_movement_y,
PP_Resource* resource_id) {
VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(),
("%s: PPAPI calls are not supported off the main thread\n",
@@ -1677,7 +1679,7 @@ NaClSrpcError PpbInputEventRpcClient::PPB_InputEvent_CreateMouseInputEvent(
NaClSrpcError retval;
retval = NaClSrpcInvokeBySignature(
channel,
- "PPB_InputEvent_CreateMouseInputEvent:iidiiiii:i",
+ "PPB_InputEvent_CreateMouseInputEvent:iidiiiiiii:i",
instance,
type,
time_stamp,
@@ -1686,6 +1688,8 @@ NaClSrpcError PpbInputEventRpcClient::PPB_InputEvent_CreateMouseInputEvent(
mouse_position_x,
mouse_position_y,
click_count,
+ mouse_movement_x,
+ mouse_movement_y,
resource_id
);
return retval;
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_rpc_server.cc
index e436d3a..30552e3 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_rpc_server.cc
+++ b/ppapi/native_client/src/shared/ppapi_proxy/ppb_rpc_server.cc
@@ -1351,6 +1351,8 @@ static void PPB_InputEvent_CreateMouseInputEventDispatcher(
inputs[5]->u.ival,
inputs[6]->u.ival,
inputs[7]->u.ival,
+ inputs[8]->u.ival,
+ inputs[9]->u.ival,
&(outputs[0]->u.ival)
);
}
@@ -2276,7 +2278,7 @@ NaClSrpcHandlerDesc PpbRpcs::srpc_methods[] = {
{ "PPB_ImageData_Describe:i:Chii", PPB_ImageData_DescribeDispatcher },
{ "PPB_InputEvent_RequestInputEvents:iii:i", PPB_InputEvent_RequestInputEventsDispatcher },
{ "PPB_InputEvent_ClearInputEventRequest:ii:", PPB_InputEvent_ClearInputEventRequestDispatcher },
- { "PPB_InputEvent_CreateMouseInputEvent:iidiiiii:i", PPB_InputEvent_CreateMouseInputEventDispatcher },
+ { "PPB_InputEvent_CreateMouseInputEvent:iidiiiiiii:i", PPB_InputEvent_CreateMouseInputEventDispatcher },
{ "PPB_InputEvent_CreateWheelInputEvent:ididdddi:i", PPB_InputEvent_CreateWheelInputEventDispatcher },
{ "PPB_InputEvent_CreateKeyboardInputEvent:iidiiC:i", PPB_InputEvent_CreateKeyboardInputEventDispatcher },
{ "PPB_Instance_BindGraphics:ii:i", PPB_Instance_BindGraphicsDispatcher },
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppb_rpc.h b/ppapi/native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppb_rpc.h
index 274c548..15221d17 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppb_rpc.h
+++ b/ppapi/native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppb_rpc.h
@@ -678,6 +678,8 @@ class PpbInputEventRpcServer {
int32_t mouse_position_x,
int32_t mouse_position_y,
int32_t click_count,
+ int32_t mouse_movement_x,
+ int32_t mouse_movement_y,
PP_Resource* resource_id);
static void PPB_InputEvent_CreateWheelInputEvent(
NaClSrpcRpc* rpc,
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppb_rpc.h b/ppapi/native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppb_rpc.h
index de11eb6..8e1eaad 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppb_rpc.h
+++ b/ppapi/native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppb_rpc.h
@@ -591,6 +591,8 @@ class PpbInputEventRpcClient {
int32_t mouse_position_x,
int32_t mouse_position_y,
int32_t click_count,
+ int32_t mouse_movement_x,
+ int32_t mouse_movement_y,
PP_Resource* resource_id);
static NaClSrpcError PPB_InputEvent_CreateWheelInputEvent(
NaClSrpcChannel* channel,