Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(439)

Side by Side Diff: services/ui/ws/window_finder.cc

Issue 2369793002: WIP: Propagate SurfaceID up window tree hierarchy
Patch Set: Fix input events: EventDispatcher ignores container windows Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « services/ui/ws/server_window_surface_manager.cc ('k') | services/ui/ws/window_server.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
9 #include "services/ui/ws/server_window.h" 8 #include "services/ui/ws/server_window.h"
10 #include "services/ui/ws/server_window_delegate.h" 9 #include "services/ui/ws/server_window_delegate.h"
11 #include "services/ui/ws/server_window_surface.h" 10 #include "services/ui/ws/server_window_surface.h"
12 #include "services/ui/ws/server_window_surface_manager.h" 11 #include "services/ui/ws/server_window_surface_manager.h"
13 #include "services/ui/ws/window_coordinate_conversions.h" 12 #include "services/ui/ws/window_coordinate_conversions.h"
14 #include "ui/gfx/geometry/point.h" 13 #include "ui/gfx/geometry/point.h"
15 #include "ui/gfx/geometry/point_f.h" 14 #include "ui/gfx/geometry/point_f.h"
16 #include "ui/gfx/transform.h" 15 #include "ui/gfx/transform.h"
17 16
18 namespace ui { 17 namespace ui {
19 namespace ws { 18 namespace ws {
20 19
21 bool IsValidWindowForEvents(ServerWindow* window) { 20 bool IsValidWindowForEvents(ServerWindow* window) {
22 ServerWindowSurfaceManager* surface_manager = window->surface_manager();
23 // Valid windows have at least one of the two surface types. Only an underlay 21 // 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 22 // is valid as we assume the window manager will likely get the event in this
25 // case. 23 // case.
26 return surface_manager && 24 ServerWindowSurfaceManager* surface_manager = window->surface_manager();
27 (surface_manager->HasSurfaceOfType(mojom::SurfaceType::DEFAULT) || 25 return !window->IsContainer() && surface_manager &&
28 surface_manager->HasSurfaceOfType(mojom::SurfaceType::UNDERLAY)); 26 (surface_manager->HasSurfaceOfType(mojom::SurfaceType::DEFAULT) ||
27 surface_manager->HasSurfaceOfType(mojom::SurfaceType::UNDERLAY));
29 } 28 }
30 29
31 ServerWindow* FindDeepestVisibleWindowForEvents(ServerWindow* window, 30 ServerWindow* FindDeepestVisibleWindowForEvents(ServerWindow* window,
32 gfx::Point* location) { 31 gfx::Point* location) {
33 if (!window->can_accept_events()) 32 if (!window->can_accept_events())
34 return nullptr; 33 return nullptr;
35 34
36 const ServerWindow::Windows& children = window->children(); 35 const ServerWindow::Windows& children = window->children();
37 for (ServerWindow* child : base::Reversed(children)) { 36 for (ServerWindow* child : base::Reversed(children)) {
38 if (!child->visible() || !child->can_accept_events()) 37 if (!child->visible() || !child->can_accept_events())
(...skipping 27 matching lines...) Expand all
66 ServerWindow* current = window; 65 ServerWindow* current = window;
67 while (current->parent()) { 66 while (current->parent()) {
68 transform.Translate(-current->bounds().x(), -current->bounds().y()); 67 transform.Translate(-current->bounds().x(), -current->bounds().y());
69 current = current->parent(); 68 current = current->parent();
70 } 69 }
71 return transform; 70 return transform;
72 } 71 }
73 72
74 } // namespace ws 73 } // namespace ws
75 } // namespace ui 74 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/server_window_surface_manager.cc ('k') | services/ui/ws/window_server.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698