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

Unified Diff: views/touchui/gesture_manager.cc

Issue 8364039: Initial views touchui GestureRecognizer support (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Added ForwardGestureEvents()in RootView and incorporated comments Created 9 years, 2 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
Index: views/touchui/gesture_manager.cc
diff --git a/views/touchui/gesture_manager.cc b/views/touchui/gesture_manager.cc
index 723db77792244d63a4763b5bbb500ebeb69516d7..a9213482e9a3a37c008d16cc0ac1a3ca4a2f09f0 100644
--- a/views/touchui/gesture_manager.cc
+++ b/views/touchui/gesture_manager.cc
@@ -28,42 +28,26 @@ bool GestureManager::ProcessTouchEventForGesture(const TouchEvent& event,
if (status != ui::TOUCH_STATUS_UNKNOWN)
return false; // The event was consumed by a touch sequence.
- // TODO(rjkroege): A realistic version of the GestureManager will
- // appear in a subsequent CL. This interim version permits verifying that the
- // event distribution code works by turning all touch inputs into
- // mouse approximations.
-
- // Conver the touch-event into a mouse-event. This mouse-event gets its
- // location information from the native-event, so it needs to convert the
- // coordinate to the target widget.
- MouseEvent mouseev(event);
- if (ViewsDelegate::views_delegate->GetDefaultParentView()) {
- // TODO(oshima): We may need to send the event back through
- // window manager to handle mouse capture correctly.
- Widget* desktop =
- ViewsDelegate::views_delegate->GetDefaultParentView()->GetWidget();
- Widget* source_widget = source->GetWidget();
- MouseEvent converted(
- mouseev, desktop->GetRootView(), source_widget->GetRootView());
- source_widget->OnMouseEvent(converted);
+ if (root_view_ == NULL || root_view_ == source->GetWidget()->GetRootView()) {
rjkroege 2011/10/27 23:10:07 This code is not really right. It needs to look mo
Gajen 2011/10/31 13:34:30 Now GM is restored to original stage, and GR is de
+ // Get the GestureEvent list processed from GestureManager.
+ scoped_ptr<Gestures> gestures;
+ gestures.reset(gesture_recognizer_.ProcessTouchEventForGesture(event,
+ false));
+ source->GetWidget()->GetRootView()->ForwardGestureEvents(
+ gestures.release());
+ return true;
} else {
- Widget* source_widget = source->GetWidget();
- Widget* top_widget = source_widget->GetTopLevelWidget();
- if (source_widget != top_widget) {
- // This is necessary as TYPE_CHILD widget is still NativeWidgetGtk.
- // Fix this once TYPE_CHILD is switched to NativeWidgetViews.
- MouseEvent converted(mouseev,
- top_widget->GetRootView(),
- source_widget->GetRootView());
- source_widget->OnMouseEvent(mouseev);
- } else {
- source_widget->OnMouseEvent(mouseev);
- }
+ // Reset GestureRecognizer state.
+ // TODO(Gajen): Do we need to support Gesture across different RootViews
+ // except where TYPE_CHILD widget is still NativeWidgetGtk.
+ gesture_recognizer_.Reset();
+ root_view_ = NULL;
+ return false;
}
- return true;
}
-GestureManager::GestureManager() {
+GestureManager::GestureManager()
+ : root_view_(NULL) {
rjkroege 2011/10/27 23:10:07 Why do you have this code? I believe it is unnece
Gajen 2011/10/31 13:34:30 Done.
}
} // namespace views

Powered by Google App Engine
This is Rietveld 408576698