OLD | NEW |
---|---|
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 Loading... | |
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 display root of |display|. | |
37 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.
| |
38 const ServerWindow* window) { | |
39 if (!display) | |
40 return false; | |
41 | |
42 const WindowManagerDisplayRoot* display_root = | |
43 display->GetActiveWindowManagerDisplayRoot(); | |
44 if (!display_root) | |
45 return false; | |
46 | |
47 if (window == display_root->root()) | |
48 return true; | |
49 | |
50 // If the window manager manually creates displays then there is an extra | |
51 // window, the window supplied via SetDisplayRoot(). | |
52 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
| |
53 ->window_tree() | |
54 ->automatically_create_display_roots() && | |
55 window->parent() == display_root->root(); | |
56 } | |
57 | |
58 } // namespace | |
59 | |
34 struct WindowServer::CurrentMoveLoopState { | 60 struct WindowServer::CurrentMoveLoopState { |
35 uint32_t change_id; | 61 uint32_t change_id; |
36 ServerWindow* window; | 62 ServerWindow* window; |
37 WindowTree* initiator; | 63 WindowTree* initiator; |
38 gfx::Rect revert_bounds; | 64 gfx::Rect revert_bounds; |
39 }; | 65 }; |
40 | 66 |
41 struct WindowServer::CurrentDragLoopState { | 67 struct WindowServer::CurrentDragLoopState { |
42 uint32_t change_id; | 68 uint32_t change_id; |
43 ServerWindow* window; | 69 ServerWindow* window; |
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
818 if (!window) { | 844 if (!window) { |
819 frame_sink_manager_->DropTemporaryReference(surface_info.id()); | 845 frame_sink_manager_->DropTemporaryReference(surface_info.id()); |
820 return; | 846 return; |
821 } | 847 } |
822 | 848 |
823 // 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 |
824 // CompositorFrame. | 850 // CompositorFrame. |
825 if (!window_paint_callback_.is_null()) | 851 if (!window_paint_callback_.is_null()) |
826 window_paint_callback_.Run(window); | 852 window_paint_callback_.Run(window); |
827 | 853 |
828 auto* display = display_manager_->GetDisplayContaining(window); | 854 Display* display = display_manager_->GetDisplayContaining(window); |
829 if (display && window == display->GetActiveRootWindow()) { | 855 if (IsWindowConsideredDisplayRoot(display, window)) { |
830 // 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 |
831 // special case because ServerWindows created by the WindowServer are not | 857 // special case because ServerWindows created by the WindowServer are not |
832 // part of a WindowTree. Send the SurfaceId directly to FrameGenerator and | 858 // part of a WindowTree. Send the SurfaceId directly to FrameGenerator and |
833 // claim the temporary reference for the display root. | 859 // claim the temporary reference for the display root. |
834 display->platform_display()->GetFrameGenerator()->OnSurfaceCreated( | 860 display->platform_display()->GetFrameGenerator()->OnSurfaceCreated( |
835 surface_info); | 861 surface_info); |
836 display->root_window() | 862 display->root_window() |
837 ->GetOrCreateCompositorFrameSinkManager() | 863 ->GetOrCreateCompositorFrameSinkManager() |
838 ->ClaimTemporaryReference(surface_info.id()); | 864 ->ClaimTemporaryReference(surface_info.id()); |
839 return; | 865 return; |
(...skipping 16 matching lines...) Expand all Loading... | |
856 void WindowServer::OnUserIdAdded(const UserId& id) { | 882 void WindowServer::OnUserIdAdded(const UserId& id) { |
857 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); | 883 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); |
858 } | 884 } |
859 | 885 |
860 void WindowServer::OnUserIdRemoved(const UserId& id) { | 886 void WindowServer::OnUserIdRemoved(const UserId& id) { |
861 activity_monitor_map_.erase(id); | 887 activity_monitor_map_.erase(id); |
862 } | 888 } |
863 | 889 |
864 } // namespace ws | 890 } // namespace ws |
865 } // namespace ui | 891 } // namespace ui |
OLD | NEW |