| 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 "services/ui/ws/window_finder.h" | 5 #include "services/ui/ws/window_finder.h" |
| 6 | 6 |
| 7 #include "base/containers/adapters.h" | 7 #include "base/containers/adapters.h" |
| 8 #include "services/ui/ws/server_window.h" | 8 #include "services/ui/ws/server_window.h" |
| 9 #include "services/ui/ws/server_window_compositor_frame_sink.h" |
| 10 #include "services/ui/ws/server_window_compositor_frame_sink_manager.h" |
| 9 #include "services/ui/ws/server_window_delegate.h" | 11 #include "services/ui/ws/server_window_delegate.h" |
| 10 #include "services/ui/ws/server_window_surface.h" | |
| 11 #include "services/ui/ws/server_window_surface_manager.h" | |
| 12 #include "services/ui/ws/window_coordinate_conversions.h" | 12 #include "services/ui/ws/window_coordinate_conversions.h" |
| 13 #include "ui/gfx/geometry/point.h" | 13 #include "ui/gfx/geometry/point.h" |
| 14 #include "ui/gfx/geometry/point_f.h" | 14 #include "ui/gfx/geometry/point_f.h" |
| 15 #include "ui/gfx/transform.h" | 15 #include "ui/gfx/transform.h" |
| 16 | 16 |
| 17 namespace ui { | 17 namespace ui { |
| 18 namespace ws { | 18 namespace ws { |
| 19 | 19 |
| 20 bool IsValidWindowForEvents(ServerWindow* window) { | 20 bool IsValidWindowForEvents(ServerWindow* window) { |
| 21 ServerWindowSurfaceManager* surface_manager = window->surface_manager(); | 21 ServerWindowCompositorFrameSinkManager* compositor_frame_sink_manager = |
| 22 window->compositor_frame_sink_manager(); |
| 22 // Valid windows have at least one of the two surface types. Only an underlay | 23 // Valid windows have at least one of the two surface types. Only an underlay |
| 23 // is valid as we assume the window manager will likely get the event in this | 24 // is valid as we assume the window manager will likely get the event in this |
| 24 // case. | 25 // case. |
| 25 return surface_manager && | 26 return compositor_frame_sink_manager && |
| 26 (surface_manager->HasSurfaceOfType(mojom::SurfaceType::DEFAULT) || | 27 (compositor_frame_sink_manager->HasCompositorFrameSinkOfType( |
| 27 surface_manager->HasSurfaceOfType(mojom::SurfaceType::UNDERLAY)); | 28 mojom::CompositorFrameSinkType::DEFAULT) || |
| 29 compositor_frame_sink_manager->HasCompositorFrameSinkOfType( |
| 30 mojom::CompositorFrameSinkType::UNDERLAY)); |
| 28 } | 31 } |
| 29 | 32 |
| 30 ServerWindow* FindDeepestVisibleWindowForEvents(ServerWindow* window, | 33 ServerWindow* FindDeepestVisibleWindowForEvents(ServerWindow* window, |
| 31 gfx::Point* location) { | 34 gfx::Point* location) { |
| 32 if (!window->can_accept_events()) | 35 if (!window->can_accept_events()) |
| 33 return nullptr; | 36 return nullptr; |
| 34 | 37 |
| 35 const ServerWindow::Windows& children = window->children(); | 38 const ServerWindow::Windows& children = window->children(); |
| 36 for (ServerWindow* child : base::Reversed(children)) { | 39 for (ServerWindow* child : base::Reversed(children)) { |
| 37 if (!child->visible() || !child->can_accept_events()) | 40 if (!child->visible() || !child->can_accept_events()) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 65 ServerWindow* current = window; | 68 ServerWindow* current = window; |
| 66 while (current->parent()) { | 69 while (current->parent()) { |
| 67 transform.Translate(-current->bounds().x(), -current->bounds().y()); | 70 transform.Translate(-current->bounds().x(), -current->bounds().y()); |
| 68 current = current->parent(); | 71 current = current->parent(); |
| 69 } | 72 } |
| 70 return transform; | 73 return transform; |
| 71 } | 74 } |
| 72 | 75 |
| 73 } // namespace ws | 76 } // namespace ws |
| 74 } // namespace ui | 77 } // namespace ui |
| OLD | NEW |