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

Unified Diff: services/ui/ws/window_server.cc

Issue 2840043003: chromeos: Makes mushrome use simplified display management (Closed)
Patch Set: merge Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/ui/display/screen_manager_forwarding.cc ('k') | ui/aura/mus/window_manager_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/ws/window_server.cc
diff --git a/services/ui/ws/window_server.cc b/services/ui/ws/window_server.cc
index f48149ee5dd483917c1e429a9702f8da3553e522..c1fff169fc9dcddf0c9b6f3360b2167665bafbb2 100644
--- a/services/ui/ws/window_server.cc
+++ b/services/ui/ws/window_server.cc
@@ -31,6 +31,33 @@
namespace ui {
namespace ws {
+namespace {
+
+// Returns true if |window| is considered the active window manager for
+// |display|.
+bool IsWindowConsideredWindowManagerRoot(const Display* display,
+ 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()
+ ->window_tree()
+ ->automatically_create_display_roots() &&
+ window->parent() == display_root->root();
+}
+
+} // namespace
+
struct WindowServer::CurrentMoveLoopState {
uint32_t change_id;
ServerWindow* window;
@@ -824,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 (IsWindowConsideredWindowManagerRoot(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
« no previous file with comments | « services/ui/display/screen_manager_forwarding.cc ('k') | ui/aura/mus/window_manager_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698