Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(797)

Unified Diff: ui/base/event.cc

Issue 10824295: Rid the world of the last of views::Event types: TouchEvent, GestureEvent, MouseWheelEvent, ScrollE… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/base/event.h ('k') | ui/base/event_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/event.cc
===================================================================
--- ui/base/event.cc (revision 151481)
+++ ui/base/event.cc (working copy)
@@ -227,9 +227,34 @@
MouseEvent::MouseEvent(const MouseEvent& model) : LocatedEvent(model) {
}
+MouseWheelEvent::MouseWheelEvent(const NativeEvent& native_event)
+#if defined(USE_AURA)
+ : MouseEvent(static_cast<const MouseEvent&>(*native_event)),
+ offset_(GetMouseWheelOffset(native_event->native_event())) {
+#else
+ : MouseEvent(native_event),
+ offset_(GetMouseWheelOffset(native_event)) {
+#endif
+}
+
+MouseWheelEvent::MouseWheelEvent(const ScrollEvent& scroll_event)
+ : MouseEvent(scroll_event),
+ offset_(scroll_event.y_offset()) {
+ set_type(ET_MOUSEWHEEL);
+}
+
+#if defined(OS_WIN)
+// This value matches windows WHEEL_DELTA.
+// static
+const int MouseWheelEvent::kWheelDelta = 120;
+#else
+// This value matches GTK+ wheel scroll amount.
+const int MouseWheelEvent::kWheelDelta = 53;
+#endif
+
TouchEvent::TouchEvent(const base::NativeEvent& native_event)
: LocatedEvent(native_event),
- touch_id_(ui::GetTouchId(native_event)),
+ touch_id_(GetTouchId(native_event)),
radius_x_(GetTouchRadiusX(native_event)),
radius_y_(GetTouchRadiusY(native_event)),
rotation_angle_(GetTouchAngle(native_event)),
@@ -237,9 +262,9 @@
}
TouchEvent::TouchEvent(EventType type,
- const gfx::Point& location,
- int touch_id,
- base::TimeDelta time_stamp)
+ const gfx::Point& location,
+ int touch_id,
+ base::TimeDelta time_stamp)
: LocatedEvent(type, location, location, 0),
touch_id_(touch_id),
radius_x_(0.0f),
@@ -262,6 +287,22 @@
radius_y_ /= scale.y();
}
+TestTouchEvent::TestTouchEvent(EventType type,
+ int x,
+ int y,
+ int flags,
+ int touch_id,
+ float radius_x,
+ float radius_y,
+ float angle,
+ float force)
+ : TouchEvent(type, gfx::Point(x, y), touch_id, base::TimeDelta()) {
+ set_flags(flags);
+ set_radius(radius_x, radius_y);
+ set_rotation_angle(angle);
+ set_force(force);
+}
+
KeyEvent::KeyEvent(const base::NativeEvent& native_event, bool is_char)
: Event(native_event,
EventTypeFromNative(native_event),
« no previous file with comments | « ui/base/event.h ('k') | ui/base/event_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698