OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/mus/ws/window_finder.h" | 5 #include "components/mus/ws/window_finder.h" |
6 | 6 |
7 #include "cc/surfaces/surface_id.h" | 7 #include "cc/surfaces/surface_id.h" |
8 #include "components/mus/surfaces/surfaces_state.h" | 8 #include "components/mus/surfaces/surfaces_state.h" |
9 #include "components/mus/ws/server_window.h" | 9 #include "components/mus/ws/server_window.h" |
10 #include "components/mus/ws/server_window_delegate.h" | 10 #include "components/mus/ws/server_window_delegate.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // CompositorFrame has been submitted (e.g. in unit-tests). | 91 // CompositorFrame has been submitted (e.g. in unit-tests). |
92 return FindDeepestVisibleWindowNonSurface(root_window, location); | 92 return FindDeepestVisibleWindowNonSurface(root_window, location); |
93 } | 93 } |
94 | 94 |
95 gfx::Transform transform; | 95 gfx::Transform transform; |
96 cc::SurfaceId target_surface = | 96 cc::SurfaceId target_surface = |
97 root_window->delegate() | 97 root_window->delegate() |
98 ->GetSurfacesState() | 98 ->GetSurfacesState() |
99 ->hit_tester() | 99 ->hit_tester() |
100 ->GetTargetSurfaceAtPoint(display_surface_id, *location, &transform); | 100 ->GetTargetSurfaceAtPoint(display_surface_id, *location, &transform); |
| 101 // TODO(sky): this is now wrong, needs mapping from client to window. |
101 WindowId id = WindowIdFromTransportId( | 102 WindowId id = WindowIdFromTransportId( |
102 cc::SurfaceIdAllocator::NamespaceForId(target_surface)); | 103 cc::SurfaceIdAllocator::NamespaceForId(target_surface)); |
103 // TODO(fsamuel): This should be a DCHECK but currently we use stale | 104 // TODO(fsamuel): This should be a DCHECK but currently we use stale |
104 // information to decide where to route input events. This should be fixed | 105 // information to decide where to route input events. This should be fixed |
105 // once we implement a UI scheduler. | 106 // once we implement a UI scheduler. |
106 ServerWindow* target = root_window->GetChildWindow(id); | 107 ServerWindow* target = root_window->GetChildWindow(id); |
107 if (target) | 108 if (target) |
108 transform.TransformPoint(location); | 109 transform.TransformPoint(location); |
109 return target; | 110 return target; |
110 } | 111 } |
111 | 112 |
112 gfx::Transform GetTransformToWindow(cc::SurfaceId display_surface_id, | 113 gfx::Transform GetTransformToWindow(cc::SurfaceId display_surface_id, |
113 ServerWindow* window) { | 114 ServerWindow* window) { |
114 if (!display_surface_id.is_null()) { | 115 if (!display_surface_id.is_null()) { |
115 gfx::Transform transform; | 116 gfx::Transform transform; |
116 if (HitTestSurfaceOfType(display_surface_id, window, | 117 if (HitTestSurfaceOfType(display_surface_id, window, |
117 mus::mojom::SurfaceType::DEFAULT, &transform) || | 118 mus::mojom::SurfaceType::DEFAULT, &transform) || |
118 HitTestSurfaceOfType(display_surface_id, window, | 119 HitTestSurfaceOfType(display_surface_id, window, |
119 mus::mojom::SurfaceType::UNDERLAY, &transform)) { | 120 mus::mojom::SurfaceType::UNDERLAY, &transform)) { |
120 return transform; | 121 return transform; |
121 } | 122 } |
122 } | 123 } |
123 | 124 |
124 return GetTransformToWindowNonSurface(window); | 125 return GetTransformToWindowNonSurface(window); |
125 } | 126 } |
126 | 127 |
127 } // namespace ws | 128 } // namespace ws |
128 } // namespace mus | 129 } // namespace mus |
OLD | NEW |