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

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

Issue 2230963003: Fix window/display bounds with multiple windows in mus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes. Created 4 years, 4 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/service.cc ('k') | services/ui/ws/platform_display.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/display.h" 5 #include "services/ui/ws/display.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 81 }
82 82
83 const DisplayManager* Display::display_manager() const { 83 const DisplayManager* Display::display_manager() const {
84 return window_server_->display_manager(); 84 return window_server_->display_manager();
85 } 85 }
86 86
87 mojom::WsDisplayPtr Display::ToWsDisplay() const { 87 mojom::WsDisplayPtr Display::ToWsDisplay() const {
88 mojom::WsDisplayPtr display_ptr = mojom::WsDisplay::New(); 88 mojom::WsDisplayPtr display_ptr = mojom::WsDisplay::New();
89 89
90 display_ptr->display = ToDisplay(); 90 display_ptr->display = ToDisplay();
91 display_ptr->is_primary = platform_display_->IsPrimaryDisplay();
91 92
92 // TODO(sky): make this real. 93 // TODO(sky): make this real.
93 display_ptr->is_primary = true;
94 // TODO(sky): make this real.
95 display_ptr->frame_decoration_values = mojom::FrameDecorationValues::New(); 94 display_ptr->frame_decoration_values = mojom::FrameDecorationValues::New();
96 return display_ptr; 95 return display_ptr;
97 } 96 }
98 97
99 display::Display Display::ToDisplay() const { 98 display::Display Display::ToDisplay() const {
100 display::Display display(GetId()); 99 display::Display display(GetId());
101 100
102 // TODO(sky): Display should know its origin. 101 display.set_bounds(platform_display_->GetBounds());
103 display.set_bounds(gfx::Rect(0, 0, root_->bounds().size().width(),
104 root_->bounds().size().height()));
105 // TODO(sky): window manager needs an API to set the work area. 102 // TODO(sky): window manager needs an API to set the work area.
106 display.set_work_area(display.bounds()); 103 display.set_work_area(display.bounds());
107 display.set_device_scale_factor(platform_display_->GetDeviceScaleFactor()); 104 display.set_device_scale_factor(platform_display_->GetDeviceScaleFactor());
108 display.set_rotation(platform_display_->GetRotation()); 105 display.set_rotation(platform_display_->GetRotation());
109 display.set_touch_support( 106 display.set_touch_support(
110 display::Display::TouchSupport::TOUCH_SUPPORT_UNKNOWN); 107 display::Display::TouchSupport::TOUCH_SUPPORT_UNKNOWN);
111 108
112 return display; 109 return display;
113 } 110 }
114 111
(...skipping 12 matching lines...) Expand all
127 return; 124 return;
128 windows_needing_frame_destruction_.insert(window); 125 windows_needing_frame_destruction_.insert(window);
129 window->AddObserver(this); 126 window->AddObserver(this);
130 } 127 }
131 128
132 display::Display::Rotation Display::GetRotation() const { 129 display::Display::Rotation Display::GetRotation() const {
133 return platform_display_->GetRotation(); 130 return platform_display_->GetRotation();
134 } 131 }
135 132
136 gfx::Size Display::GetSize() const { 133 gfx::Size Display::GetSize() const {
137 return root_->bounds().size(); 134 return platform_display_->GetBounds().size();
138 } 135 }
139 136
140 ServerWindow* Display::GetRootWithId(const WindowId& id) { 137 ServerWindow* Display::GetRootWithId(const WindowId& id) {
141 if (id == root_->id()) 138 if (id == root_->id())
142 return root_.get(); 139 return root_.get();
143 for (auto& pair : window_manager_display_root_map_) { 140 for (auto& pair : window_manager_display_root_map_) {
144 if (pair.second->root()->id() == id) 141 if (pair.second->root()->id() == id)
145 return pair.second->root(); 142 return pair.second->root();
146 } 143 }
147 return nullptr; 144 return nullptr;
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 root_.reset(window_server_->CreateServerWindow( 311 root_.reset(window_server_->CreateServerWindow(
315 display_manager()->GetAndAdvanceNextRootId(), 312 display_manager()->GetAndAdvanceNextRootId(),
316 ServerWindow::Properties())); 313 ServerWindow::Properties()));
317 root_->SetBounds(new_metrics.bounds); 314 root_->SetBounds(new_metrics.bounds);
318 root_->SetVisible(true); 315 root_->SetVisible(true);
319 focus_controller_.reset(new FocusController(this, root_.get())); 316 focus_controller_.reset(new FocusController(this, root_.get()));
320 focus_controller_->AddObserver(this); 317 focus_controller_->AddObserver(this);
321 InitWindowManagerDisplayRootsIfNecessary(); 318 InitWindowManagerDisplayRootsIfNecessary();
322 } else { 319 } else {
323 root_->SetBounds(new_metrics.bounds); 320 root_->SetBounds(new_metrics.bounds);
324 const gfx::Rect wm_bounds(root_->bounds().size());
325 for (auto& pair : window_manager_display_root_map_) 321 for (auto& pair : window_manager_display_root_map_)
326 pair.second->root()->SetBounds(wm_bounds); 322 pair.second->root()->SetBounds(new_metrics.bounds);
327 } 323 }
328 display_manager()->OnDisplayUpdate(this); 324 display_manager()->OnDisplayUpdate(this);
329 } 325 }
330 326
331 void Display::OnCompositorFrameDrawn() { 327 void Display::OnCompositorFrameDrawn() {
332 std::set<ServerWindow*> windows; 328 std::set<ServerWindow*> windows;
333 windows.swap(windows_needing_frame_destruction_); 329 windows.swap(windows_needing_frame_destruction_);
334 for (ServerWindow* window : windows) { 330 for (ServerWindow* window : windows) {
335 window->RemoveObserver(this); 331 window->RemoveObserver(this);
336 window->DestroySurfacesScheduledForDestruction(); 332 window->DestroySurfacesScheduledForDestruction();
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 } 419 }
424 420
425 void Display::OnWindowManagerWindowTreeFactoryReady( 421 void Display::OnWindowManagerWindowTreeFactoryReady(
426 WindowManagerWindowTreeFactory* factory) { 422 WindowManagerWindowTreeFactory* factory) {
427 if (!binding_) 423 if (!binding_)
428 CreateWindowManagerDisplayRootFromFactory(factory); 424 CreateWindowManagerDisplayRootFromFactory(factory);
429 } 425 }
430 426
431 } // namespace ws 427 } // namespace ws
432 } // namespace ui 428 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/service.cc ('k') | services/ui/ws/platform_display.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698