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

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

Issue 2840043003: chromeos: Makes mushrome use simplified display management (Closed)
Patch Set: merge 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
34 struct WindowServer::CurrentMoveLoopState { 61 struct WindowServer::CurrentMoveLoopState {
35 uint32_t change_id; 62 uint32_t change_id;
36 ServerWindow* window; 63 ServerWindow* window;
37 WindowTree* initiator; 64 WindowTree* initiator;
38 gfx::Rect revert_bounds; 65 gfx::Rect revert_bounds;
39 }; 66 };
40 67
41 struct WindowServer::CurrentDragLoopState { 68 struct WindowServer::CurrentDragLoopState {
42 uint32_t change_id; 69 uint32_t change_id;
43 ServerWindow* window; 70 ServerWindow* window;
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 if (!window) { 844 if (!window) {
818 frame_sink_manager_->DropTemporaryReference(surface_info.id()); 845 frame_sink_manager_->DropTemporaryReference(surface_info.id());
819 return; 846 return;
820 } 847 }
821 848
822 // This is only used for testing to observe that a window has a 849 // This is only used for testing to observe that a window has a
823 // CompositorFrame. 850 // CompositorFrame.
824 if (!window_paint_callback_.is_null()) 851 if (!window_paint_callback_.is_null())
825 window_paint_callback_.Run(window); 852 window_paint_callback_.Run(window);
826 853
827 auto* display = display_manager_->GetDisplayContaining(window); 854 Display* display = display_manager_->GetDisplayContaining(window);
828 if (display && window == display->GetActiveRootWindow()) { 855 if (IsWindowConsideredWindowManagerRoot(display, window)) {
829 // A new surface for a WindowManager root has been created. This is a 856 // A new surface for a WindowManager root has been created. This is a
830 // special case because ServerWindows created by the WindowServer are not 857 // special case because ServerWindows created by the WindowServer are not
831 // part of a WindowTree. Send the SurfaceId directly to FrameGenerator and 858 // part of a WindowTree. Send the SurfaceId directly to FrameGenerator and
832 // claim the temporary reference for the display root. 859 // claim the temporary reference for the display root.
833 display->platform_display()->GetFrameGenerator()->OnSurfaceCreated( 860 display->platform_display()->GetFrameGenerator()->OnSurfaceCreated(
834 surface_info); 861 surface_info);
835 display->root_window() 862 display->root_window()
836 ->GetOrCreateCompositorFrameSinkManager() 863 ->GetOrCreateCompositorFrameSinkManager()
837 ->ClaimTemporaryReference(surface_info.id()); 864 ->ClaimTemporaryReference(surface_info.id());
838 return; 865 return;
(...skipping 16 matching lines...) Expand all
855 void WindowServer::OnUserIdAdded(const UserId& id) { 882 void WindowServer::OnUserIdAdded(const UserId& id) {
856 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); 883 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr);
857 } 884 }
858 885
859 void WindowServer::OnUserIdRemoved(const UserId& id) { 886 void WindowServer::OnUserIdRemoved(const UserId& id) {
860 activity_monitor_map_.erase(id); 887 activity_monitor_map_.erase(id);
861 } 888 }
862 889
863 } // namespace ws 890 } // namespace ws
864 } // namespace ui 891 } // 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