Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/aura/mus/window_tree_client.h" | 5 #include "ui/aura/mus/window_tree_client.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1093 } | 1093 } |
| 1094 | 1094 |
| 1095 // TODO: deal with no window or host here. This could happen if during | 1095 // TODO: deal with no window or host here. This could happen if during |
| 1096 // dispatch a window is deleted or moved. In either case we still need to | 1096 // dispatch a window is deleted or moved. In either case we still need to |
| 1097 // dispatch. Most likely need the display id. | 1097 // dispatch. Most likely need the display id. |
| 1098 if (!window || !window->GetWindow()->GetHost()) { | 1098 if (!window || !window->GetWindow()->GetHost()) { |
| 1099 tree_->OnWindowInputEventAck(event_id, ui::mojom::EventResult::UNHANDLED); | 1099 tree_->OnWindowInputEventAck(event_id, ui::mojom::EventResult::UNHANDLED); |
| 1100 return; | 1100 return; |
| 1101 } | 1101 } |
| 1102 | 1102 |
| 1103 WindowTreeHostMus* host = GetWindowTreeHostMus(window); | |
| 1104 DCHECK(host); | |
| 1105 | |
| 1106 // The location of the event is relative to |window|. As the event is handed | |
| 1107 // to WindowTreeHost we need it to be relative to WindowTreeHost. | |
| 1108 if (event->IsLocatedEvent()) { | |
| 1109 gfx::Point host_location = event->AsLocatedEvent()->location(); | |
| 1110 aura::Window::ConvertPointToTarget(window->GetWindow(), host->window(), | |
| 1111 &host_location); | |
| 1112 event->AsLocatedEvent()->set_location(host_location); | |
|
sadrul
2016/11/30 21:41:29
This should update the root-location too I think?
| |
| 1113 } | |
| 1114 | |
| 1103 EventAckHandler ack_handler(CreateEventResultCallback(event_id)); | 1115 EventAckHandler ack_handler(CreateEventResultCallback(event_id)); |
| 1104 WindowTreeHostMus* host = GetWindowTreeHostMus(window); | |
| 1105 // TODO(moshayedi): crbug.com/617222. No need to convert to ui::MouseEvent or | 1116 // TODO(moshayedi): crbug.com/617222. No need to convert to ui::MouseEvent or |
| 1106 // ui::TouchEvent once we have proper support for pointer events. | 1117 // ui::TouchEvent once we have proper support for pointer events. |
| 1107 if (event->IsMousePointerEvent()) { | 1118 if (event->IsMousePointerEvent()) { |
| 1108 if (event->type() == ui::ET_POINTER_WHEEL_CHANGED) { | 1119 if (event->type() == ui::ET_POINTER_WHEEL_CHANGED) { |
| 1109 ui::MouseWheelEvent mapped_event(*event->AsPointerEvent()); | 1120 ui::MouseWheelEvent mapped_event(*event->AsPointerEvent()); |
| 1110 host->SendEventToProcessor(&mapped_event); | 1121 host->SendEventToProcessor(&mapped_event); |
| 1111 } else { | 1122 } else { |
| 1112 ui::MouseEvent mapped_event(*event->AsPointerEvent()); | 1123 ui::MouseEvent mapped_event(*event->AsPointerEvent()); |
| 1113 host->SendEventToProcessor(&mapped_event); | 1124 host->SendEventToProcessor(&mapped_event); |
| 1114 } | 1125 } |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1595 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( | 1606 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( |
| 1596 this, capture_synchronizer_.get(), window)); | 1607 this, capture_synchronizer_.get(), window)); |
| 1597 } | 1608 } |
| 1598 | 1609 |
| 1599 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { | 1610 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { |
| 1600 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( | 1611 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( |
| 1601 this, focus_synchronizer_.get(), window)); | 1612 this, focus_synchronizer_.get(), window)); |
| 1602 } | 1613 } |
| 1603 | 1614 |
| 1604 } // namespace aura | 1615 } // namespace aura |
| OLD | NEW |