Index: services/ui/ws/window_server.cc |
diff --git a/services/ui/ws/window_server.cc b/services/ui/ws/window_server.cc |
index d012b886dc2f0bc50ecc2246398ff6bcdc5aef36..4cb1064682706afd84a83acda0af428ae32ec7a4 100644 |
--- a/services/ui/ws/window_server.cc |
+++ b/services/ui/ws/window_server.cc |
@@ -31,6 +31,32 @@ |
namespace ui { |
namespace ws { |
+namespace { |
+ |
+// Returns true if |window| is considered the active display root of |display|. |
+bool IsWindowConsideredDisplayRoot(const Display* display, |
kylechar
2017/04/27 14:26:31
nit: The term display root is used elsewhere for t
sky
2017/04/27 15:09:53
Done.
|
+ const ServerWindow* window) { |
+ if (!display) |
+ return false; |
+ |
+ const WindowManagerDisplayRoot* display_root = |
+ display->GetActiveWindowManagerDisplayRoot(); |
+ if (!display_root) |
+ return false; |
+ |
+ if (window == display_root->root()) |
+ return true; |
+ |
+ // If the window manager manually creates displays then there is an extra |
+ // window, the window supplied via SetDisplayRoot(). |
+ return !display_root->window_manager_state() |
kylechar
2017/04/27 14:26:31
Can we remove this extra level of window hierarchy
sky
2017/04/27 15:09:53
Possibly. If I get rid of the mode where mus autom
|
+ ->window_tree() |
+ ->automatically_create_display_roots() && |
+ window->parent() == display_root->root(); |
+} |
+ |
+} // namespace |
+ |
struct WindowServer::CurrentMoveLoopState { |
uint32_t change_id; |
ServerWindow* window; |
@@ -825,8 +851,8 @@ void WindowServer::OnSurfaceCreated(const cc::SurfaceInfo& surface_info) { |
if (!window_paint_callback_.is_null()) |
window_paint_callback_.Run(window); |
- auto* display = display_manager_->GetDisplayContaining(window); |
- if (display && window == display->GetActiveRootWindow()) { |
+ Display* display = display_manager_->GetDisplayContaining(window); |
+ if (IsWindowConsideredDisplayRoot(display, window)) { |
// A new surface for a WindowManager root has been created. This is a |
// special case because ServerWindows created by the WindowServer are not |
// part of a WindowTree. Send the SurfaceId directly to FrameGenerator and |