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

Unified Diff: views/events/event_x.cc

Issue 7927001: touchui: Convert XI2 MT tracking id to slot id for gesture recognizer (Closed) Base URL: nhu@powerbuilder.sh.intel.com:/home/www-data/git-repos/chromium/chromium.git@trunk
Patch Set: 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
« no previous file with comments | « no previous file | views/touchui/touch_factory.h » ('j') | views/touchui/touch_factory.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/events/event_x.cc
diff --git a/views/events/event_x.cc b/views/events/event_x.cc
index 31300551fad4ff6fc7e14c160bc09b8983ebfccf..1bcc20b297c6fcde94458a560c5dd7007159718f 100644
--- a/views/events/event_x.cc
+++ b/views/events/event_x.cc
@@ -124,16 +124,20 @@ ui::EventType GetTouchEventType(XEvent* xev) {
int GetTouchIDFromXEvent(XEvent* xev) {
float id = 0;
#if defined(USE_XI2_MT)
- // TODO(ningxin.hu@gmail.com): Make the id always start from 0 for a new
- // touch-sequence when TRACKING_ID is used to extract the touch id.
- TouchFactory::TouchParam tp = TouchFactory::TP_TRACKING_ID;
+ float tracking_id;
+ TouchFactory* factory = TouchFactory::GetInstance();
+ if (factory->ExtractTouchParam(
+ *xev, TouchFactory::TP_TRACKING_ID, &tracking_id))
sadrul 2011/09/19 16:13:36 4-space indent here and in line 137
ningxin.hu 2011/09/20 16:08:49 Will fix. Thanks.
+ id = factory->AllocateSlotIdForTrackingId(tracking_id);
+ else
+ LOG(ERROR) << "Could not get the touch ID for the event. Using 0.";
+ return id;
#else
- TouchFactory::TouchParam tp = TouchFactory::TP_SLOT_ID;
-#endif
if (!TouchFactory::GetInstance()->ExtractTouchParam(
- *xev, tp, &id))
+ *xev, TouchFactory::TP_SLOT_ID, &id))
LOG(ERROR) << "Could not get the touch ID for the event. Using 0.";
return id;
+#endif
}
ui::EventType EventTypeFromNative(NativeEvent2 native_event) {
@@ -424,7 +428,17 @@ TouchEvent::TouchEvent(NativeEvent2 native_event_2,
TouchFactory::TP_ORIENTATION,
0.0)),
force_(GetTouchForceFromXEvent(native_event_2)) {
-#if !defined(USE_XI2_MT)
+#if defined(USE_XI2_MT)
+ if (type() == ui::ET_TOUCH_RELEASED) {
+ TouchFactory* factory = TouchFactory::GetInstance();
sadrul 2011/09/19 16:13:36 Please add a NOTE here explaining that for PRESSED
ningxin.hu 2011/09/20 16:08:49 Will do that. Thanks.
+ float tracking_id;
+ if (factory->ExtractTouchParam(*native_event_2,
+ TouchFactory::TP_TRACKING_ID,
+ &tracking_id)) {
+ factory->ReleaseSlotIdForTrackingId(tracking_id);
+ }
+ }
+#else
if (type() == ui::ET_TOUCH_PRESSED || type() == ui::ET_TOUCH_RELEASED) {
TouchFactory* factory = TouchFactory::GetInstance();
float slot;
« no previous file with comments | « no previous file | views/touchui/touch_factory.h » ('j') | views/touchui/touch_factory.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698