提交 4e0ec4c2 编写于 作者: A Adam Barth

Fix the units for Pointer events

The time_stamp is supposed to be in microseconds. Previously we were using
milliseconds.
上级 0114460c
......@@ -186,7 +186,7 @@ public class PlatformViewAndroid extends SurfaceView {
Pointer pointer = new Pointer();
pointer.timeStamp = event.getEventTime();
pointer.timeStamp = event.getEventTime() * 1000; // Convert from milliseconds to microseconds.
pointer.pointer = event.getPointerId(pointerIndex);
pointer.type = pointerType;
pointer.kind = PointerKind.TOUCH;
......
......@@ -52,7 +52,7 @@ static inline PointerTypeMapperPhase PointerTypePhaseFromUITouchPhase(
static inline int64 InputEventTimestampFromNSTimeInterval(
NSTimeInterval interval) {
return base::TimeDelta::FromSecondsD(interval).InMilliseconds();
return base::TimeDelta::FromSecondsD(interval).InMicroseconds();
}
// UITouch pointers cannot be used as touch ids (even though they remain
......
......@@ -150,7 +150,7 @@ static inline pointer::PointerType EventTypeFromNSEventPhase(NSEventPhase phase)
auto pointer_data = pointer::Pointer::New();
pointer_data->time_stamp =
base::TimeDelta::FromSecondsD(event.timestamp).InMilliseconds();
base::TimeDelta::FromSecondsD(event.timestamp).InMicroseconds();
pointer_data->type = EventTypeFromNSEventPhase(phase);
pointer_data->kind = pointer::PointerKind::TOUCH;
pointer_data->pointer = 0;
......
......@@ -122,9 +122,7 @@ void PlatformViewMojo::OnEvent(mojo::EventPtr event,
if (!data)
break;
pointer::PointerPtr pointer = pointer::Pointer::New();
// TODO(abarth): Sort out the units for time_stamp.
// See https://github.com/domokit/mojo/issues/541
pointer->time_stamp = event->time_stamp / 1000;
pointer->time_stamp = event->time_stamp;
pointer->pointer = data->pointer_id;
pointer->type = GetTypeFromAction(event->action);
pointer->kind = GetKindFromKind(data->kind);
......
......@@ -68,8 +68,6 @@ Shell::Shell(const Settings& settings) : settings_(settings) {
io_thread_.reset(new base::Thread("io_thread"));
io_thread_->StartWithOptions(options);
io_task_runner_ = io_thread_->message_loop()->task_runner();
ui_task_runner()->PostTask(FROM_HERE, base::Bind(&Engine::Init));
}
Shell::~Shell() {
......@@ -91,7 +89,9 @@ void Shell::InitStandalone() {
void Shell::Init(const Settings& settings) {
base::DiscardableMemoryAllocator::SetInstance(&g_discardable.Get());
DCHECK(!g_shell);
g_shell = new Shell(settings);
g_shell->ui_task_runner()->PostTask(FROM_HERE, base::Bind(&Engine::Init));
}
Shell& Shell::Shared() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册