diff options
author | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-24 21:47:56 +0000 |
---|---|---|
committer | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-24 21:47:56 +0000 |
commit | 36df22b48817bc7fe7159e498f65b5e8b00f1605 (patch) | |
tree | 15e7aa8f769102d90479c5c59330a5309f4dbc3c /views/touchui | |
parent | af5ee7f3fe7c555578bd9c0cf1290bcf6af553e7 (diff) | |
download | chromium_src-36df22b48817bc7fe7159e498f65b5e8b00f1605.zip chromium_src-36df22b48817bc7fe7159e498f65b5e8b00f1605.tar.gz chromium_src-36df22b48817bc7fe7159e498f65b5e8b00f1605.tar.bz2 |
Transformable views: Use the transformation for points and events.
Added and updated API for converting points between views' coordinate systems,
taking transformations into consideration. This in turn gives us, for free,
transformation for located events (mouse events, touch events).
BUG=none
TEST=ViewTest.TransformEvent
Review URL: http://codereview.chromium.org/6534015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75960 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/touchui')
-rw-r--r-- | views/touchui/gesture_manager.cc | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/views/touchui/gesture_manager.cc b/views/touchui/gesture_manager.cc index 2d6c7d0..2442469 100644 --- a/views/touchui/gesture_manager.cc +++ b/views/touchui/gesture_manager.cc @@ -30,9 +30,19 @@ bool GestureManager::ProcessTouchEventForGesture(const TouchEvent& event, // appear in a subsequent CL. This interim version permits verifying that the // event distribution code works by turning all touch inputs into // mouse approximations. + + // TODO(sad): Clean this up. + // This is currently only called where |source| is a RootView. Now, RootView + // expects the mouse-events in the widget's coordinate system, and not in the + // RV's coordinate system. But |event| is in the RV's coordinate system. So it + // is necessary to construct the synthetic event in the widget's coordinate + // system. + gfx::Point location = event.location(); + View::ConvertPointToWidget(source, &location); + if (event.type() == ui::ET_TOUCH_PRESSED) { DVLOG(1) << "GestureManager::ProcessTouchEventForGesture: TouchPressed"; - MouseEvent mouse_event(ui::ET_MOUSE_PRESSED, event.x(), event.y(), + MouseEvent mouse_event(ui::ET_MOUSE_PRESSED, location.x(), location.y(), event.flags()); source->OnMousePressed(mouse_event); return true; @@ -40,7 +50,7 @@ bool GestureManager::ProcessTouchEventForGesture(const TouchEvent& event, if (event.type() == ui::ET_TOUCH_RELEASED) { DVLOG(1) << "GestureManager::ProcessTouchEventForGesture: TouchReleased"; - MouseEvent mouse_event(ui::ET_MOUSE_RELEASED, event.x(), event.y(), + MouseEvent mouse_event(ui::ET_MOUSE_RELEASED, location.x(), location.y(), event.flags()); source->OnMouseReleased(mouse_event, false); return true; @@ -48,7 +58,7 @@ bool GestureManager::ProcessTouchEventForGesture(const TouchEvent& event, if (event.type() == ui::ET_TOUCH_MOVED) { DVLOG(1) << "GestureManager::ProcessTouchEventForGesture: TouchMotion"; - MouseEvent mouse_event(ui::ET_MOUSE_DRAGGED, event.x(), event.y(), + MouseEvent mouse_event(ui::ET_MOUSE_DRAGGED, location.x(), location.y(), event.flags()); source->OnMouseDragged(mouse_event); return true; |