Index: components/exo/wayland/server.cc |
diff --git a/components/exo/wayland/server.cc b/components/exo/wayland/server.cc |
index d45ee41f71e591c1f37dc8b186d3eb5ac9ca065c..ee8f1e6d3a4530a024b4da72d589b4427b32bdfe 100644 |
--- a/components/exo/wayland/server.cc |
+++ b/components/exo/wayland/server.cc |
@@ -102,6 +102,10 @@ void SetImplementation(wl_resource* resource, |
DestroyUserData<T>); |
} |
+int64_t InMilliseconds(base::TimeTicks ticks) { |
+ return (ticks - base::TimeTicks()).InMilliseconds(); |
+} |
+ |
// A property key containing the surface resource that is associated with |
// window. If unset, no surface resource is associated with window. |
DEFINE_WINDOW_PROPERTY_KEY(wl_resource*, kSurfaceResourceKey, nullptr); |
@@ -1449,13 +1453,13 @@ class WaylandPointerDelegate : public PointerDelegate { |
DCHECK(surface_resource); |
wl_pointer_send_leave(pointer_resource_, next_serial(), surface_resource); |
} |
- void OnPointerMotion(base::TimeDelta time_stamp, |
+ void OnPointerMotion(base::TimeTicks time_stamp, |
const gfx::PointF& location) override { |
- wl_pointer_send_motion(pointer_resource_, time_stamp.InMilliseconds(), |
+ wl_pointer_send_motion(pointer_resource_, InMilliseconds(time_stamp), |
wl_fixed_from_double(location.x()), |
wl_fixed_from_double(location.y())); |
} |
- void OnPointerButton(base::TimeDelta time_stamp, |
+ void OnPointerButton(base::TimeTicks time_stamp, |
int button_flags, |
bool pressed) override { |
struct { |
@@ -1472,14 +1476,14 @@ class WaylandPointerDelegate : public PointerDelegate { |
for (auto button : buttons) { |
if (button_flags & button.flag) { |
wl_pointer_send_button(pointer_resource_, serial, |
- time_stamp.InMilliseconds(), button.value, |
+ InMilliseconds(time_stamp), button.value, |
pressed ? WL_POINTER_BUTTON_STATE_PRESSED |
: WL_POINTER_BUTTON_STATE_RELEASED); |
} |
} |
} |
- void OnPointerScroll(base::TimeDelta time_stamp, |
+ void OnPointerScroll(base::TimeTicks time_stamp, |
const gfx::Vector2dF& offset, |
bool discrete) override { |
// Same as Weston, the reference compositor. |
@@ -1493,29 +1497,29 @@ class WaylandPointerDelegate : public PointerDelegate { |
} |
double x_value = offset.x() * kAxisStepDistance; |
- wl_pointer_send_axis(pointer_resource_, time_stamp.InMilliseconds(), |
+ wl_pointer_send_axis(pointer_resource_, InMilliseconds(time_stamp), |
WL_POINTER_AXIS_HORIZONTAL_SCROLL, |
wl_fixed_from_double(-x_value)); |
double y_value = offset.y() * kAxisStepDistance; |
- wl_pointer_send_axis(pointer_resource_, time_stamp.InMilliseconds(), |
+ wl_pointer_send_axis(pointer_resource_, InMilliseconds(time_stamp), |
WL_POINTER_AXIS_VERTICAL_SCROLL, |
wl_fixed_from_double(-y_value)); |
} |
- void OnPointerScrollCancel(base::TimeDelta time_stamp) override { |
+ void OnPointerScrollCancel(base::TimeTicks time_stamp) override { |
// Wayland doesn't know the concept of a canceling kinetic scrolling. |
// But we can send a 0 distance scroll to emulate this behavior. |
OnPointerScroll(time_stamp, gfx::Vector2dF(0, 0), false); |
OnPointerScrollStop(time_stamp); |
} |
- void OnPointerScrollStop(base::TimeDelta time_stamp) override { |
+ void OnPointerScrollStop(base::TimeTicks time_stamp) override { |
if (wl_resource_get_version(pointer_resource_) >= |
WL_POINTER_AXIS_STOP_SINCE_VERSION) { |
- wl_pointer_send_axis_stop(pointer_resource_, time_stamp.InMilliseconds(), |
+ wl_pointer_send_axis_stop(pointer_resource_, InMilliseconds(time_stamp), |
WL_POINTER_AXIS_HORIZONTAL_SCROLL); |
- wl_pointer_send_axis_stop(pointer_resource_, time_stamp.InMilliseconds(), |
+ wl_pointer_send_axis_stop(pointer_resource_, InMilliseconds(time_stamp), |
WL_POINTER_AXIS_VERTICAL_SCROLL); |
} |
} |
@@ -1626,11 +1630,11 @@ class WaylandKeyboardDelegate : public KeyboardDelegate { |
wl_keyboard_send_leave(keyboard_resource_, next_serial(), surface_resource); |
wl_client_flush(client()); |
} |
- void OnKeyboardKey(base::TimeDelta time_stamp, |
+ void OnKeyboardKey(base::TimeTicks time_stamp, |
ui::DomCode key, |
bool pressed) override { |
wl_keyboard_send_key(keyboard_resource_, next_serial(), |
- time_stamp.InMilliseconds(), DomCodeToKey(key), |
+ InMilliseconds(time_stamp), DomCodeToKey(key), |
pressed ? WL_KEYBOARD_KEY_STATE_PRESSED |
: WL_KEYBOARD_KEY_STATE_RELEASED); |
wl_client_flush(client()); |
@@ -1735,26 +1739,26 @@ class WaylandTouchDelegate : public TouchDelegate { |
wl_resource_get_client(surface_resource) == client(); |
} |
void OnTouchDown(Surface* surface, |
- base::TimeDelta time_stamp, |
+ base::TimeTicks time_stamp, |
int id, |
const gfx::Point& location) override { |
wl_resource* surface_resource = surface->GetProperty(kSurfaceResourceKey); |
DCHECK(surface_resource); |
wl_touch_send_down(touch_resource_, next_serial(), |
- time_stamp.InMilliseconds(), surface_resource, id, |
+ InMilliseconds(time_stamp), surface_resource, id, |
wl_fixed_from_int(location.x()), |
wl_fixed_from_int(location.y())); |
wl_client_flush(client()); |
} |
- void OnTouchUp(base::TimeDelta time_stamp, int id) override { |
- wl_touch_send_up(touch_resource_, next_serial(), |
- time_stamp.InMilliseconds(), id); |
+ void OnTouchUp(base::TimeTicks time_stamp, int id) override { |
+ wl_touch_send_up(touch_resource_, next_serial(), InMilliseconds(time_stamp), |
+ id); |
wl_client_flush(client()); |
} |
- void OnTouchMotion(base::TimeDelta time_stamp, |
+ void OnTouchMotion(base::TimeTicks time_stamp, |
int id, |
const gfx::Point& location) override { |
- wl_touch_send_motion(touch_resource_, time_stamp.InMilliseconds(), id, |
+ wl_touch_send_motion(touch_resource_, InMilliseconds(time_stamp), id, |
wl_fixed_from_int(location.x()), |
wl_fixed_from_int(location.y())); |
wl_client_flush(client()); |