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. | |
102 WindowId id = WindowIdFromTransportId( | 101 WindowId id = WindowIdFromTransportId( |
103 cc::SurfaceIdAllocator::NamespaceForId(target_surface)); | 102 cc::SurfaceIdAllocator::NamespaceForId(target_surface)); |
104 // TODO(fsamuel): This should be a DCHECK but currently we use stale | 103 // TODO(fsamuel): This should be a DCHECK but currently we use stale |
105 // information to decide where to route input events. This should be fixed | 104 // information to decide where to route input events. This should be fixed |
106 // once we implement a UI scheduler. | 105 // once we implement a UI scheduler. |
107 ServerWindow* target = root_window->GetChildWindow(id); | 106 ServerWindow* target = root_window->GetChildWindow(id); |
108 if (target) | 107 if (target) |
109 transform.TransformPoint(location); | 108 transform.TransformPoint(location); |
110 return target; | 109 return target; |
111 } | 110 } |
112 | 111 |
113 gfx::Transform GetTransformToWindow(cc::SurfaceId display_surface_id, | 112 gfx::Transform GetTransformToWindow(cc::SurfaceId display_surface_id, |
114 ServerWindow* window) { | 113 ServerWindow* window) { |
115 if (!display_surface_id.is_null()) { | 114 if (!display_surface_id.is_null()) { |
116 gfx::Transform transform; | 115 gfx::Transform transform; |
117 if (HitTestSurfaceOfType(display_surface_id, window, | 116 if (HitTestSurfaceOfType(display_surface_id, window, |
118 mus::mojom::SurfaceType::DEFAULT, &transform) || | 117 mus::mojom::SurfaceType::DEFAULT, &transform) || |
119 HitTestSurfaceOfType(display_surface_id, window, | 118 HitTestSurfaceOfType(display_surface_id, window, |
120 mus::mojom::SurfaceType::UNDERLAY, &transform)) { | 119 mus::mojom::SurfaceType::UNDERLAY, &transform)) { |
121 return transform; | 120 return transform; |
122 } | 121 } |
123 } | 122 } |
124 | 123 |
125 return GetTransformToWindowNonSurface(window); | 124 return GetTransformToWindowNonSurface(window); |
126 } | 125 } |
127 | 126 |
128 } // namespace ws | 127 } // namespace ws |
129 } // namespace mus | 128 } // namespace mus |
OLD | NEW |