Chromium Code Reviews| 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; |