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

Unified Diff: views/events/event_x.cc

Issue 7792094: touchui: support XInput2 MT (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: update patch set according to comment #12 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/events/event_x.cc
diff --git a/views/events/event_x.cc b/views/events/event_x.cc
index 1f54303e6b30ca1533e295e2336fc2fee3361d31..aaa148f2d9fa37658a381c1d41a814e544da23f1 100644
--- a/views/events/event_x.cc
+++ b/views/events/event_x.cc
@@ -77,6 +77,19 @@ int GetButtonMaskForX2Event(XIDeviceEvent* xievent) {
}
ui::EventType GetTouchEventType(XEvent* xev) {
+#if defined(USE_XI2_MT)
+ XIEvent* event = static_cast<XIEvent*>(xev->xcookie.data);
+ switch(event->evtype) {
+ case XI_TouchBegin:
+ return ui::ET_TOUCH_PRESSED;
+ case XI_TouchUpdate:
+ return ui::ET_TOUCH_MOVED;
+ case XI_TouchEnd:
+ return ui::ET_TOUCH_RELEASED;
+ }
+
+ return ui::ET_UNKNOWN;
+#else
XGenericEventCookie* cookie = &xev->xcookie;
DCHECK_EQ(cookie->evtype, XI_Motion);
@@ -105,14 +118,20 @@ ui::EventType GetTouchEventType(XEvent* xev) {
}
return ui::ET_TOUCH_MOVED;
+#endif
}
int GetTouchIDFromXEvent(XEvent* xev) {
- float slot = 0;
+ float id = 0;
+#if defined(USE_XI2_MT)
+ TouchFactory::TouchParam tp = TouchFactory::TP_TRACKING_ID;
sadrul 2011/09/12 16:20:38 Please add a TODO for fixing up the touch-id (i.e.
ningxin.hu 2011/09/13 00:51:08 Will add the TODO and follow up with a patch. Than
+#else
+ TouchFactory::TouchParam tp = TouchFactory::TP_SLOT_ID;
+#endif
if (!TouchFactory::GetInstance()->ExtractTouchParam(
- *xev, TouchFactory::TP_SLOT_ID, &slot))
- LOG(ERROR) << "Could not get the slot ID for the event. Using 0.";
- return slot;
+ *xev, tp, &id))
+ LOG(ERROR) << "Could not get the touch ID for the event. Using 0.";
+ return id;
}
ui::EventType EventTypeFromNative(NativeEvent2 native_event) {
@@ -403,6 +422,7 @@ TouchEvent::TouchEvent(NativeEvent2 native_event_2,
TouchFactory::TP_ORIENTATION,
0.0)),
force_(GetTouchForceFromXEvent(native_event_2)) {
+#if !defined(USE_XI2_MT)
if (type() == ui::ET_TOUCH_PRESSED || type() == ui::ET_TOUCH_RELEASED) {
TouchFactory* factory = TouchFactory::GetInstance();
float slot;
@@ -411,6 +431,7 @@ TouchEvent::TouchEvent(NativeEvent2 native_event_2,
factory->SetSlotUsed(slot, type() == ui::ET_TOUCH_PRESSED);
}
}
+#endif
}
} // namespace views

Powered by Google App Engine
This is Rietveld 408576698