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

Unified Diff: components/html_viewer/touch_handler.cc

Issue 1313353010: Overhaul Mandoline event transport code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed gn check Created 5 years, 3 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 | « components/html_viewer/input_events_unittest.cc ('k') | components/mus/display_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/html_viewer/touch_handler.cc
diff --git a/components/html_viewer/touch_handler.cc b/components/html_viewer/touch_handler.cc
index 4764867eb15e7dc7be50c8f2100b61d494d0311d..23deaa731e382f171dfdf75833cacd726da740c5 100644
--- a/components/html_viewer/touch_handler.cc
+++ b/components/html_viewer/touch_handler.cc
@@ -15,17 +15,33 @@
namespace html_viewer {
namespace {
+// TODO(rjkroege): Gesture recognition currently happens in the html_viewer.
+// In phase2, it will be relocated to MUS. Update this code at that time.
void SetPropertiesFromEvent(const mojo::Event& event,
ui::PointerProperties* properties) {
properties->id = event.pointer_data->pointer_id;
- properties->x = event.pointer_data->x;
- properties->y = event.pointer_data->y;
- properties->raw_x = event.pointer_data->screen_x;
- properties->raw_y = event.pointer_data->screen_y;
- properties->pressure = event.pointer_data->pressure;
- properties->SetAxesAndOrientation(event.pointer_data->radius_major,
- event.pointer_data->radius_minor,
- event.pointer_data->orientation);
+ properties->x = event.pointer_data->location->x;
+ properties->y = event.pointer_data->location->y;
+ properties->raw_x = event.pointer_data->location->screen_x;
+ properties->raw_y = event.pointer_data->location->screen_y;
+
+ if (event.pointer_data->kind == mojo::POINTER_KIND_TOUCH ||
+ event.pointer_data->kind == mojo::POINTER_KIND_PEN) {
+ properties->pressure = event.pointer_data->brush_data->pressure;
+
+ // TODO(rjkroege): vary orientation for width, height.
+ properties->SetAxesAndOrientation(event.pointer_data->brush_data->width,
+ event.pointer_data->brush_data->height,
+ 0.0);
+ } else {
+ if (event.flags & mojo::EVENT_FLAGS_LEFT_MOUSE_BUTTON ||
+ event.flags & mojo::EVENT_FLAGS_MIDDLE_MOUSE_BUTTON ||
+ event.flags & mojo::EVENT_FLAGS_MIDDLE_MOUSE_BUTTON) {
+ properties->pressure = 0.5;
+ } else {
+ properties->pressure = 0.0;
+ }
+ }
// TODO(sky): Add support for tool_type.
}
« no previous file with comments | « components/html_viewer/input_events_unittest.cc ('k') | components/mus/display_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698