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

Unified Diff: mojo/converters/input_events/input_events_type_converters.cc

Issue 788953007: Populate details of Mojo gesture events (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 | « no previous file | mojo/services/input_events/public/interfaces/input_events.mojom » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/converters/input_events/input_events_type_converters.cc
diff --git a/mojo/converters/input_events/input_events_type_converters.cc b/mojo/converters/input_events/input_events_type_converters.cc
index ae4138dd0e400fedea876abdb62cb7d9fd2a8cee..78ea0c2212a60447bedf7c756e29a2c0e1f4ff1a 100644
--- a/mojo/converters/input_events/input_events_type_converters.cc
+++ b/mojo/converters/input_events/input_events_type_converters.cc
@@ -117,8 +117,36 @@ EventPtr TypeConverter<EventPtr, ui::Event>::Convert(const ui::Event& input) {
touch_data->pointer_id = touch_event->touch_id();
event->touch_data = touch_data.Pass();
} else if (input.IsGestureEvent()) {
- // TODO(abarth): Create GestureData struct for |event| once we have that
- // struct in input_events.mojom.
+ auto details = input.AsGestureEvent()->details();
+ GestureDataPtr gesture_data(GestureData::New());
+ gesture_data->bounding_box = RectF::From(details.bounding_box_f());
+ switch (input.type()) {
+ case ui::ET_GESTURE_SCROLL_UPDATE:
+ gesture_data->scroll_x = details.scroll_x();
+ gesture_data->scroll_y = details.scroll_y();
+ break;
+ case ui::ET_SCROLL_FLING_START:
+ gesture_data->velocity_x = details.velocity_x();
+ gesture_data->velocity_y = details.velocity_y();
+ break;
+ case ui::ET_GESTURE_PINCH_UPDATE:
+ gesture_data->scale = details.scale();
+ break;
+ case ui::ET_GESTURE_SWIPE:
+ gesture_data->swipe_left = details.swipe_left();
+ gesture_data->swipe_right = details.swipe_right();
+ gesture_data->swipe_up = details.swipe_up();
+ gesture_data->swipe_down = details.swipe_down();
+ break;
+ case ui::ET_GESTURE_TAP:
+ case ui::ET_GESTURE_TAP_UNCONFIRMED:
+ case ui::ET_GESTURE_DOUBLE_TAP:
+ gesture_data->tap_count = details.tap_count();
+ break;
+ default:
+ break;
+ }
+ event->gesture_data = gesture_data.Pass();
} else if (input.IsKeyEvent()) {
const ui::KeyEvent* key_event = static_cast<const ui::KeyEvent*>(&input);
KeyDataPtr key_data(KeyData::New());
« no previous file with comments | « no previous file | mojo/services/input_events/public/interfaces/input_events.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698