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

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

Issue 2858563002: Revert of chromeos: Makes mushrome use simplified display management (Closed)
Patch Set: Created 3 years, 7 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/display/screen_manager_forwarding.cc ('k') | ui/aura/mus/window_manager_delegate.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_server.h" 5 #include "services/ui/ws/window_server.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 13 matching lines...) Expand all
24 #include "services/ui/ws/window_manager_state.h" 24 #include "services/ui/ws/window_manager_state.h"
25 #include "services/ui/ws/window_manager_window_tree_factory.h" 25 #include "services/ui/ws/window_manager_window_tree_factory.h"
26 #include "services/ui/ws/window_server_delegate.h" 26 #include "services/ui/ws/window_server_delegate.h"
27 #include "services/ui/ws/window_tree.h" 27 #include "services/ui/ws/window_tree.h"
28 #include "services/ui/ws/window_tree_binding.h" 28 #include "services/ui/ws/window_tree_binding.h"
29 #include "ui/gfx/geometry/size_conversions.h" 29 #include "ui/gfx/geometry/size_conversions.h"
30 30
31 namespace ui { 31 namespace ui {
32 namespace ws { 32 namespace ws {
33 33
34 namespace {
35
36 // Returns true if |window| is considered the active window manager for
37 // |display|.
38 bool IsWindowConsideredWindowManagerRoot(const Display* display,
39 const ServerWindow* window) {
40 if (!display)
41 return false;
42
43 const WindowManagerDisplayRoot* display_root =
44 display->GetActiveWindowManagerDisplayRoot();
45 if (!display_root)
46 return false;
47
48 if (window == display_root->root())
49 return true;
50
51 // If the window manager manually creates displays then there is an extra
52 // window, the window supplied via SetDisplayRoot().
53 return !display_root->window_manager_state()
54 ->window_tree()
55 ->automatically_create_display_roots() &&
56 window->parent() == display_root->root();
57 }
58
59 } // namespace
60
61 struct WindowServer::CurrentMoveLoopState { 34 struct WindowServer::CurrentMoveLoopState {
62 uint32_t change_id; 35 uint32_t change_id;
63 ServerWindow* window; 36 ServerWindow* window;
64 WindowTree* initiator; 37 WindowTree* initiator;
65 gfx::Rect revert_bounds; 38 gfx::Rect revert_bounds;
66 }; 39 };
67 40
68 struct WindowServer::CurrentDragLoopState { 41 struct WindowServer::CurrentDragLoopState {
69 uint32_t change_id; 42 uint32_t change_id;
70 ServerWindow* window; 43 ServerWindow* window;
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 if (!window) { 817 if (!window) {
845 frame_sink_manager_->DropTemporaryReference(surface_info.id()); 818 frame_sink_manager_->DropTemporaryReference(surface_info.id());
846 return; 819 return;
847 } 820 }
848 821
849 // This is only used for testing to observe that a window has a 822 // This is only used for testing to observe that a window has a
850 // CompositorFrame. 823 // CompositorFrame.
851 if (!window_paint_callback_.is_null()) 824 if (!window_paint_callback_.is_null())
852 window_paint_callback_.Run(window); 825 window_paint_callback_.Run(window);
853 826
854 Display* display = display_manager_->GetDisplayContaining(window); 827 auto* display = display_manager_->GetDisplayContaining(window);
855 if (IsWindowConsideredWindowManagerRoot(display, window)) { 828 if (display && window == display->GetActiveRootWindow()) {
856 // A new surface for a WindowManager root has been created. This is a 829 // A new surface for a WindowManager root has been created. This is a
857 // special case because ServerWindows created by the WindowServer are not 830 // special case because ServerWindows created by the WindowServer are not
858 // part of a WindowTree. Send the SurfaceId directly to FrameGenerator and 831 // part of a WindowTree. Send the SurfaceId directly to FrameGenerator and
859 // claim the temporary reference for the display root. 832 // claim the temporary reference for the display root.
860 display->platform_display()->GetFrameGenerator()->OnSurfaceCreated( 833 display->platform_display()->GetFrameGenerator()->OnSurfaceCreated(
861 surface_info); 834 surface_info);
862 display->root_window() 835 display->root_window()
863 ->GetOrCreateCompositorFrameSinkManager() 836 ->GetOrCreateCompositorFrameSinkManager()
864 ->ClaimTemporaryReference(surface_info.id()); 837 ->ClaimTemporaryReference(surface_info.id());
865 return; 838 return;
(...skipping 16 matching lines...) Expand all
882 void WindowServer::OnUserIdAdded(const UserId& id) { 855 void WindowServer::OnUserIdAdded(const UserId& id) {
883 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); 856 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr);
884 } 857 }
885 858
886 void WindowServer::OnUserIdRemoved(const UserId& id) { 859 void WindowServer::OnUserIdRemoved(const UserId& id) {
887 activity_monitor_map_.erase(id); 860 activity_monitor_map_.erase(id);
888 } 861 }
889 862
890 } // namespace ws 863 } // namespace ws
891 } // namespace ui 864 } // namespace ui
OLDNEW
« 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