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