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