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

Unified Diff: views/focus/accelerator_handler_touch.cc

Issue 7792094: touchui: support XInput2 MT (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Add gyp switch to support both XI2.0 and XI2.1. Correct the style issues also. Created 9 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
Index: views/focus/accelerator_handler_touch.cc
diff --git a/views/focus/accelerator_handler_touch.cc b/views/focus/accelerator_handler_touch.cc
index c76e8badbe38773b3d2fd21bf235ddc388c381af..ac0768c9cde6fd452a4be3773e9e4504c2fadf77 100644
--- a/views/focus/accelerator_handler_touch.cc
+++ b/views/focus/accelerator_handler_touch.cc
@@ -47,6 +47,33 @@ bool DispatchX2Event(Widget* widget, XEvent* xev) {
// TODO(sad): We don't capture XInput2 events from keyboard yet.
break;
}
+#if defined(USE_XI2_1)
+ case XI_TouchBegin:
+ case XI_TouchEnd:
+ case XI_TouchUpdate: {
+ XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(cookie->data);
+ Event::FromNativeEvent2 from_native;
+
+ // Is the event coming from a touch device?
+ if (TouchFactory::GetInstance()->IsTouchDevice(xievent->sourceid)) {
sadrul 2011/09/07 14:56:37 This check is probably not necessary here. If some
ningxin.hu 2011/09/08 08:24:50 Agree. I am removing the check.
+ // Hide the cursor when a touch event comes in.
+ TouchFactory::GetInstance()->SetCursorVisible(false, false);
+
+ // If the TouchEvent is processed by |root|, then return. Otherwise let
+ // it fall through so it can be used as a MouseEvent, if desired.
sadrul 2011/09/07 14:56:37 |root| should become |widget| (and possibly correc
ningxin.hu 2011/09/08 08:24:50 Will correct the comments. Thanks.
+ TouchEvent touch(xev, from_native);
+ if (widget->OnTouchEvent(touch) != ui::TOUCH_STATUS_UNKNOWN)
+ return true;
+
+ // We do not want to generate a mouse event for an unprocessed touch
+ // event here. That is already done by the gesture manager in
+ // RootView::OnTouchEvent.
+ return false;
+ } else {
+ return false;
+ }
+ }
+#else
case XI_ButtonPress:
case XI_ButtonRelease:
case XI_Motion: {
@@ -97,6 +124,7 @@ bool DispatchX2Event(Widget* widget, XEvent* xev) {
return widget->OnMouseEvent(mouseev);
}
}
+#endif
sadrul 2011/09/07 14:56:37 #endif // defined(USE_XI2_1)
ningxin.hu 2011/09/08 08:24:50 Added. Thanks.
}
return false;
}

Powered by Google App Engine
This is Rietveld 408576698