Chromium Code Reviews| Index: ui/aura/mus/window_tree_client.cc |
| diff --git a/ui/aura/mus/window_tree_client.cc b/ui/aura/mus/window_tree_client.cc |
| index ec6baf2c07d166cdac5c86ca8da39c8cadd9ecaf..3640b28759771742f39af3c375e8c84e52968566 100644 |
| --- a/ui/aura/mus/window_tree_client.cc |
| +++ b/ui/aura/mus/window_tree_client.cc |
| @@ -160,6 +160,16 @@ void ConvertEventLocationToDip(int64_t display_id, ui::LocatedEvent* event) { |
| event->set_root_location(root_location); |
| } |
| +// Set the |target| to be the target window of this |event| and send it to the |
| +// EventProcessor. |
| +void DispatchEventToTarget(ui::Event* event, |
| + Window* target, |
| + WindowTreeHostMus* host) { |
| + ui::Event::DispatcherApi dispatch_helper(event); |
|
sadrul
2017/02/13 17:05:42
This can just take the ui::Event, and the WindowMu
riajiang
2017/02/13 23:30:34
Done.
|
| + dispatch_helper.set_target(target); |
| + host->SendEventToProcessor(event); |
| +} |
| + |
| } // namespace |
| WindowTreeClient::WindowTreeClient( |
| @@ -1165,31 +1175,22 @@ void WindowTreeClient::OnWindowInputEvent(uint32_t event_id, |
| WindowTreeHostMus* host = GetWindowTreeHostMus(window); |
| DCHECK(host); |
| - // The location of the event is relative to |window|. As the event is handed |
| - // to WindowTreeHost we need it to be relative to WindowTreeHost. |
| - if (event->IsLocatedEvent()) { |
| - gfx::Point host_location = event->AsLocatedEvent()->location(); |
| - aura::Window::ConvertPointToTarget(window->GetWindow(), host->window(), |
| - &host_location); |
| - event->AsLocatedEvent()->set_location(host_location); |
| - } |
| - |
| EventAckHandler ack_handler(CreateEventResultCallback(event_id)); |
| // TODO(moshayedi): crbug.com/617222. No need to convert to ui::MouseEvent or |
| // ui::TouchEvent once we have proper support for pointer events. |
| if (event->IsMousePointerEvent()) { |
| if (event->type() == ui::ET_POINTER_WHEEL_CHANGED) { |
| ui::MouseWheelEvent mapped_event(*event->AsPointerEvent()); |
| - host->SendEventToProcessor(&mapped_event); |
| + DispatchEventToTarget(&mapped_event, window->GetWindow(), host); |
| } else { |
| ui::MouseEvent mapped_event(*event->AsPointerEvent()); |
| - host->SendEventToProcessor(&mapped_event); |
| + DispatchEventToTarget(&mapped_event, window->GetWindow(), host); |
| } |
| } else if (event->IsTouchPointerEvent()) { |
| ui::TouchEvent mapped_event(*event->AsPointerEvent()); |
| - host->SendEventToProcessor(&mapped_event); |
| + DispatchEventToTarget(&mapped_event, window->GetWindow(), host); |
| } else { |
| - host->SendEventToProcessor(event.get()); |
| + DispatchEventToTarget(event.get(), window->GetWindow(), host); |
| } |
| ack_handler.set_handled(event->handled()); |
| } |