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 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1146 return; | 1146 return; |
1147 } | 1147 } |
1148 | 1148 |
1149 WindowTreeHostMus* host = GetWindowTreeHostMus(window); | 1149 WindowTreeHostMus* host = GetWindowTreeHostMus(window); |
1150 DCHECK(host); | 1150 DCHECK(host); |
1151 | 1151 |
1152 // The location of the event is relative to |window|. As the event is handed | 1152 // The location of the event is relative to |window|. As the event is handed |
1153 // to WindowTreeHost we need it to be relative to WindowTreeHost. | 1153 // to WindowTreeHost we need it to be relative to WindowTreeHost. |
1154 if (event->IsLocatedEvent()) { | 1154 if (event->IsLocatedEvent()) { |
1155 gfx::Point host_location = event->AsLocatedEvent()->location(); | 1155 gfx::Point host_location = event->AsLocatedEvent()->location(); |
1156 aura::Window::ConvertPointToTarget(window->GetWindow(), host->window(), | 1156 gfx::Transform transform; |
1157 &host_location); | 1157 window->GetWindow()->layer()->GetTargetTransformRelativeTo( |
| 1158 host->window()->layer(), &transform); |
| 1159 transform.Scale(1, ScaleFactorForDisplay(window->GetWindow())); |
| 1160 auto transformed_host_location = gfx::Point3F(gfx::PointF(host_location)); |
| 1161 transform.TransformPoint(&transformed_host_location); |
| 1162 host_location = gfx::ToFlooredPoint(transformed_host_location.AsPointF()); |
1158 event->AsLocatedEvent()->set_location(host_location); | 1163 event->AsLocatedEvent()->set_location(host_location); |
1159 } | 1164 } |
1160 | 1165 |
1161 EventAckHandler ack_handler(CreateEventResultCallback(event_id)); | 1166 EventAckHandler ack_handler(CreateEventResultCallback(event_id)); |
1162 // TODO(moshayedi): crbug.com/617222. No need to convert to ui::MouseEvent or | 1167 // TODO(moshayedi): crbug.com/617222. No need to convert to ui::MouseEvent or |
1163 // ui::TouchEvent once we have proper support for pointer events. | 1168 // ui::TouchEvent once we have proper support for pointer events. |
1164 if (event->IsMousePointerEvent()) { | 1169 if (event->IsMousePointerEvent()) { |
1165 if (event->type() == ui::ET_POINTER_WHEEL_CHANGED) { | 1170 if (event->type() == ui::ET_POINTER_WHEEL_CHANGED) { |
1166 ui::MouseWheelEvent mapped_event(*event->AsPointerEvent()); | 1171 ui::MouseWheelEvent mapped_event(*event->AsPointerEvent()); |
1167 host->SendEventToProcessor(&mapped_event); | 1172 host->SendEventToProcessor(&mapped_event); |
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1818 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( | 1823 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( |
1819 this, capture_synchronizer_.get(), window)); | 1824 this, capture_synchronizer_.get(), window)); |
1820 } | 1825 } |
1821 | 1826 |
1822 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { | 1827 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { |
1823 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( | 1828 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( |
1824 this, focus_synchronizer_.get(), window)); | 1829 this, focus_synchronizer_.get(), window)); |
1825 } | 1830 } |
1826 | 1831 |
1827 } // namespace aura | 1832 } // namespace aura |
OLD | NEW |