Index: views/events/event_x.cc |
diff --git a/views/events/event_x.cc b/views/events/event_x.cc |
index fda4affb3038f172432e0f45dd3c2641d69a66f7..a014e2ee62113ea5b97643a684b13bb2795a04e8 100644 |
--- a/views/events/event_x.cc |
+++ b/views/events/event_x.cc |
@@ -122,18 +122,22 @@ ui::EventType GetTouchEventType(XEvent* xev) { |
} |
int GetTouchIDFromXEvent(XEvent* xev) { |
- float id = 0; |
+ float slot = 0; |
Daniel Kurtz
2011/09/24 01:53:36
id is a better name, since it is used for both tou
sadrul
2011/09/24 03:06:31
I think 'slot' is fine. Right now, 'slot id' is es
|
#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(); |
Daniel Kurtz
2011/09/24 01:53:36
Pull "TouchFactory*" and "return slot" out of the
ningxin.hu
2011/09/25 16:35:39
Thanks. I will follow up.
|
+ if (factory->ExtractTouchParam( |
+ *xev, TouchFactory::TP_TRACKING_ID, &tracking_id)) |
+ slot = factory->GetSlotForTrackingID(tracking_id); |
+ else |
+ LOG(ERROR) << "Could not get the touch ID for the event. Using 0."; |
+ return slot; |
#else |
- TouchFactory::TouchParam tp = TouchFactory::TP_SLOT_ID; |
-#endif |
if (!TouchFactory::GetInstance()->ExtractTouchParam( |
- *xev, tp, &id)) |
+ *xev, TouchFactory::TP_SLOT_ID, &slot)) |
LOG(ERROR) << "Could not get the touch ID for the event. Using 0."; |
Daniel Kurtz
2011/09/24 01:53:36
Could not get the slot ID ...
sadrul
2011/09/24 03:06:31
Ditto.
ningxin.hu
2011/09/25 16:35:39
Thanks. Will correct.
|
- return id; |
+ return slot; |
+#endif |
} |
ui::EventType EventTypeFromNative(NativeEvent2 native_event) { |
@@ -424,7 +428,20 @@ 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) { |
+ // NOTE: The slot is allocated by TouchFactory for each XI_TouchBegin |
+ // event, which carries a new tracking ID to identify a new touch |
+ // sequence. |
+ TouchFactory* factory = TouchFactory::GetInstance(); |
+ float tracking_id; |
+ if (factory->ExtractTouchParam(*native_event_2, |
+ TouchFactory::TP_TRACKING_ID, |
+ &tracking_id)) { |
+ factory->ReleaseSlotForTrackingID(tracking_id); |
+ } |
+ } |
+#else |
if (type() == ui::ET_TOUCH_PRESSED || type() == ui::ET_TOUCH_RELEASED) { |
TouchFactory* factory = TouchFactory::GetInstance(); |
float slot; |