Commit 79b64cf4 authored by sadrul@chromium.org's avatar sadrul@chromium.org

x11: Use kernel timestamps for touch events (if available).

BUG=153450

Review URL: https://chromiumcodereview.appspot.com/10868100

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161396 0039d316-1c4b-4281-b951-d872f2087c98
parent 5572eef0
......@@ -803,9 +803,13 @@ base::TimeDelta EventTimeFromNative(const base::NativeEvent& native_event) {
break;
case GenericEvent: {
double start, end;
float touch_timestamp;
if (GetGestureTimes(native_event, &start, &end)) {
// If the driver supports gesture times, use them.
return base::TimeDelta::FromMicroseconds(end * 1000000);
} else if (ValuatorTracker::GetInstance()->ExtractValuator(*native_event,
ValuatorTracker::VAL_TOUCH_RAW_TIMESTAMP, &touch_timestamp)) {
return base::TimeDelta::FromMicroseconds(touch_timestamp * 1000000);
} else {
XIDeviceEvent* xide =
static_cast<XIDeviceEvent*>(native_event->xcookie.data);
......
......@@ -18,6 +18,7 @@ namespace {
#define AXIS_LABEL_ABS_MT_PRESSURE "Abs MT Pressure"
#define AXIS_LABEL_ABS_MT_SLOT_ID "Abs MT Slot ID"
#define AXIS_LABEL_ABS_MT_TRACKING_ID "Abs MT Tracking ID"
#define AXIS_LABEL_TOUCH_TIMESTAMP "Touch Timestamp"
// Given the Valuator, return the correspoding XIValuatorClassInfo using
// the X device information through Atom name matching.
......@@ -47,6 +48,8 @@ XIValuatorClassInfo* FindValuator(Display* display,
#endif
{ ui::ValuatorTracker::VAL_TRACKING_ID,
XInternAtom(ui::GetXDisplay(), AXIS_LABEL_ABS_MT_TRACKING_ID, false) },
{ ui::ValuatorTracker::VAL_TOUCH_RAW_TIMESTAMP,
XInternAtom(ui::GetXDisplay(), AXIS_LABEL_TOUCH_TIMESTAMP, false) },
{ ui::ValuatorTracker::VAL_LAST_ENTRY, None },
};
......
......@@ -55,6 +55,9 @@ class UI_EXPORT ValuatorTracker {
// the numerical limit.
VAL_TRACKING_ID, // ID of the touch point.
// Kernel timestamp from touch screen (if available).
VAL_TOUCH_RAW_TIMESTAMP,
VAL_LAST_ENTRY
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment