summaryrefslogtreecommitdiffstats
path: root/ppapi/cpp
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/cpp
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/cpp')
-rw-r--r--ppapi/cpp/input_event.cc11
-rw-r--r--ppapi/cpp/input_event.h18
2 files changed, 24 insertions, 5 deletions
diff --git a/ppapi/cpp/input_event.cc b/ppapi/cpp/input_event.cc
index fbf8ac7..632b1ec 100644
--- a/ppapi/cpp/input_event.cc
+++ b/ppapi/cpp/input_event.cc
@@ -90,13 +90,14 @@ MouseInputEvent::MouseInputEvent(Instance* instance,
uint32_t modifiers,
PP_InputEvent_MouseButton mouse_button,
const Point& mouse_position,
- int32_t click_count) {
+ int32_t click_count,
+ const Point& mouse_movement) {
// Type check the input event before setting it.
if (!has_interface<PPB_MouseInputEvent>())
return;
PassRefFromConstructor(get_interface<PPB_MouseInputEvent>()->Create(
instance->pp_instance(), type, time_stamp, modifiers, mouse_button,
- &mouse_position.pp_point(), click_count));
+ &mouse_position.pp_point(), click_count, &mouse_movement.pp_point()));
}
PP_InputEvent_MouseButton MouseInputEvent::GetButton() const {
@@ -117,6 +118,12 @@ int32_t MouseInputEvent::GetClickCount() const {
return get_interface<PPB_MouseInputEvent>()->GetClickCount(pp_resource());
}
+Point MouseInputEvent::GetMovement() const {
+ if (!has_interface<PPB_MouseInputEvent>())
+ return Point();
+ return get_interface<PPB_MouseInputEvent>()->GetMovement(pp_resource());
+}
+
// WheelInputEvent -------------------------------------------------------------
WheelInputEvent::WheelInputEvent() : InputEvent() {
diff --git a/ppapi/cpp/input_event.h b/ppapi/cpp/input_event.h
index 74c9e25..d64e826 100644
--- a/ppapi/cpp/input_event.h
+++ b/ppapi/cpp/input_event.h
@@ -123,13 +123,15 @@ class MouseInputEvent : public InputEvent {
/// @param[in] click_count
/// TODO(brettw) figure out exactly what this means.
///
+ /// @param[in] mouse_movement The change in position of the mouse.
MouseInputEvent(Instance* instance,
PP_InputEvent_Type type,
PP_TimeTicks time_stamp,
uint32_t modifiers,
PP_InputEvent_MouseButton mouse_button,
const Point& mouse_position,
- int32_t click_count);
+ int32_t click_count,
+ const Point& mouse_movement);
/// GetButton() returns the mouse position for a mouse input event.
///
@@ -138,8 +140,9 @@ class MouseInputEvent : public InputEvent {
/// events, and for all non-mouse events.
PP_InputEvent_MouseButton GetButton() const;
- /// GetPostion() returns the pixel location of a mouse input event. This
- /// value is in floating-point units to support high-resolution input events.
+ /// GetPosition() returns the pixel location of a mouse input event. When
+ /// the mouse is locked, it returns the last known mouse position just as
+ /// mouse lock was entered.
///
/// @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
@@ -148,6 +151,15 @@ class MouseInputEvent : public InputEvent {
// TODO(brettw) figure out exactly what this means.
int32_t GetClickCount() const;
+
+ /// Returns the change in position of the mouse. When the mouse is locked,
+ /// although the mouse position doesn't actually change, this function
+ /// still provides movement information, which indicates what the change in
+ /// position would be had the mouse not been locked.
+ ///
+ /// @return The change in position of the mouse, relative to the previous
+ /// position.
+ Point GetMovement() const;
};
class WheelInputEvent : public InputEvent {