OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/display/display_manager.h" | 5 #include "ash/display/display_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 using aura::RootWindow; | 76 using aura::RootWindow; |
77 using aura::Window; | 77 using aura::Window; |
78 using std::string; | 78 using std::string; |
79 using std::vector; | 79 using std::vector; |
80 | 80 |
81 DEFINE_WINDOW_PROPERTY_KEY(int64, kDisplayIdKey, | 81 DEFINE_WINDOW_PROPERTY_KEY(int64, kDisplayIdKey, |
82 gfx::Display::kInvalidDisplayID); | 82 gfx::Display::kInvalidDisplayID); |
83 | 83 |
84 DisplayManager::DisplayManager() | 84 DisplayManager::DisplayManager() |
85 : first_display_id_(gfx::Display::kInvalidDisplayID), | 85 : first_display_id_(gfx::Display::kInvalidDisplayID), |
86 force_bounds_changed_(false) { | 86 force_bounds_changed_(false), |
| 87 change_display_upon_host_resize_(false) { |
| 88 #if defined(OS_CHROMEOS) |
| 89 change_display_upon_host_resize_ = !base::chromeos::IsRunningOnChromeOS(); |
| 90 #endif |
87 Init(); | 91 Init(); |
88 } | 92 } |
89 | 93 |
90 DisplayManager::~DisplayManager() { | 94 DisplayManager::~DisplayManager() { |
91 } | 95 } |
92 | 96 |
93 // static | 97 // static |
94 void DisplayManager::CycleDisplay() { | 98 void DisplayManager::CycleDisplay() { |
95 Shell::GetInstance()->display_manager()->CycleDisplayImpl(); | 99 Shell::GetInstance()->display_manager()->CycleDisplayImpl(); |
96 } | 100 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 iter != displays_.end(); ++iter) { | 141 iter != displays_.end(); ++iter) { |
138 const gfx::Display& display = *iter; | 142 const gfx::Display& display = *iter; |
139 if (display.bounds().Contains(point_in_screen)) | 143 if (display.bounds().Contains(point_in_screen)) |
140 return display; | 144 return display; |
141 } | 145 } |
142 return GetInvalidDisplay(); | 146 return GetInvalidDisplay(); |
143 } | 147 } |
144 | 148 |
145 void DisplayManager::SetOverscanInsets(int64 display_id, | 149 void DisplayManager::SetOverscanInsets(int64 display_id, |
146 const gfx::Insets& insets_in_dip) { | 150 const gfx::Insets& insets_in_dip) { |
| 151 // TODO(oshima): insets has to be rotated according to the |
| 152 // the current display rotation. |
147 display_info_[display_id].SetOverscanInsets(true, insets_in_dip); | 153 display_info_[display_id].SetOverscanInsets(true, insets_in_dip); |
148 DisplayInfoList display_info_list; | 154 DisplayInfoList display_info_list; |
149 for (DisplayList::const_iterator iter = displays_.begin(); | 155 for (DisplayList::const_iterator iter = displays_.begin(); |
150 iter != displays_.end(); ++iter) { | 156 iter != displays_.end(); ++iter) { |
151 display_info_list.push_back(GetDisplayInfo(*iter)); | 157 display_info_list.push_back(GetDisplayInfo(*iter)); |
152 } | 158 } |
153 UpdateDisplays(display_info_list); | 159 UpdateDisplays(display_info_list); |
154 } | 160 } |
155 | 161 |
156 void DisplayManager::ClearCustomOverscanInsets(int64 display_id) { | 162 void DisplayManager::ClearCustomOverscanInsets(int64 display_id) { |
157 display_info_[display_id].clear_has_custom_overscan_insets(); | 163 display_info_[display_id].clear_has_custom_overscan_insets(); |
158 DisplayInfoList display_info_list; | 164 DisplayInfoList display_info_list; |
159 for (DisplayList::const_iterator iter = displays_.begin(); | 165 for (DisplayList::const_iterator iter = displays_.begin(); |
160 iter != displays_.end(); ++iter) { | 166 iter != displays_.end(); ++iter) { |
161 display_info_list.push_back(GetDisplayInfo(*iter)); | 167 display_info_list.push_back(GetDisplayInfo(*iter)); |
162 } | 168 } |
163 UpdateDisplays(display_info_list); | 169 UpdateDisplays(display_info_list); |
164 } | 170 } |
165 | 171 |
| 172 void DisplayManager::SetDisplayRotation(int64 display_id, |
| 173 DisplayInfo::Rotation rotation) { |
| 174 DisplayInfoList display_info_list; |
| 175 for (DisplayList::const_iterator iter = displays_.begin(); |
| 176 iter != displays_.end(); ++iter) { |
| 177 DisplayInfo info = GetDisplayInfo(*iter); |
| 178 if (info.id() == display_id) |
| 179 info.set_rotation(rotation); |
| 180 display_info_list.push_back(info); |
| 181 } |
| 182 UpdateDisplays(display_info_list); |
| 183 } |
| 184 |
166 gfx::Insets DisplayManager::GetOverscanInsets(int64 display_id) const { | 185 gfx::Insets DisplayManager::GetOverscanInsets(int64 display_id) const { |
167 std::map<int64, DisplayInfo>::const_iterator it = | 186 std::map<int64, DisplayInfo>::const_iterator it = |
168 display_info_.find(display_id); | 187 display_info_.find(display_id); |
169 return (it != display_info_.end()) ? | 188 return (it != display_info_.end()) ? |
170 it->second.overscan_insets_in_dip() : gfx::Insets(); | 189 it->second.overscan_insets_in_dip() : gfx::Insets(); |
171 } | 190 } |
172 | 191 |
173 void DisplayManager::OnNativeDisplaysChanged( | 192 void DisplayManager::OnNativeDisplaysChanged( |
174 const std::vector<DisplayInfo>& updated_displays) { | 193 const std::vector<DisplayInfo>& updated_displays) { |
175 if (updated_displays.empty()) { | 194 if (updated_displays.empty()) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 internal_display_info_->SetBounds(gfx::Rect(0, 0, 800, 600)); | 226 internal_display_info_->SetBounds(gfx::Rect(0, 0, 800, 600)); |
208 } | 227 } |
209 new_display_info_list.push_back(*internal_display_info_.get()); | 228 new_display_info_list.push_back(*internal_display_info_.get()); |
210 } | 229 } |
211 | 230 |
212 UpdateDisplays(new_display_info_list); | 231 UpdateDisplays(new_display_info_list); |
213 } | 232 } |
214 | 233 |
215 void DisplayManager::UpdateDisplays( | 234 void DisplayManager::UpdateDisplays( |
216 const std::vector<DisplayInfo>& updated_display_info_list) { | 235 const std::vector<DisplayInfo>& updated_display_info_list) { |
217 #if defined(OS_CHROMEOS) | |
218 // Overscan is always enabled when not running on the device | |
219 // in order for unit tests to work. | |
220 bool can_overscan = | |
221 !base::chromeos::IsRunningOnChromeOS() || | |
222 (Shell::GetInstance()->output_configurator()->output_state() != | |
223 chromeos::STATE_DUAL_MIRROR && | |
224 updated_display_info_list.size() == 1); | |
225 #else | |
226 bool can_overscan = true; | |
227 #endif | |
228 DisplayInfoList new_display_info_list = updated_display_info_list; | 236 DisplayInfoList new_display_info_list = updated_display_info_list; |
229 std::sort(displays_.begin(), displays_.end(), DisplaySortFunctor()); | 237 std::sort(displays_.begin(), displays_.end(), DisplaySortFunctor()); |
230 std::sort(new_display_info_list.begin(), | 238 std::sort(new_display_info_list.begin(), |
231 new_display_info_list.end(), | 239 new_display_info_list.end(), |
232 DisplayInfoSortFunctor()); | 240 DisplayInfoSortFunctor()); |
233 DisplayList removed_displays; | 241 DisplayList removed_displays; |
234 std::vector<size_t> changed_display_indices; | 242 std::vector<size_t> changed_display_indices; |
235 std::vector<size_t> added_display_indices; | 243 std::vector<size_t> added_display_indices; |
236 gfx::Display current_primary; | 244 gfx::Display current_primary; |
237 if (DisplayController::HasPrimaryDisplay()) | 245 if (DisplayController::HasPrimaryDisplay()) |
238 current_primary = DisplayController::GetPrimaryDisplay(); | 246 current_primary = DisplayController::GetPrimaryDisplay(); |
239 | 247 |
240 DisplayList::iterator curr_iter = displays_.begin(); | 248 DisplayList::iterator curr_iter = displays_.begin(); |
241 DisplayInfoList::const_iterator new_info_iter = new_display_info_list.begin(); | 249 DisplayInfoList::const_iterator new_info_iter = new_display_info_list.begin(); |
242 | 250 |
243 DisplayList new_displays; | 251 DisplayList new_displays; |
244 while (curr_iter != displays_.end() || | 252 while (curr_iter != displays_.end() || |
245 new_info_iter != new_display_info_list.end()) { | 253 new_info_iter != new_display_info_list.end()) { |
246 if (curr_iter == displays_.end()) { | 254 if (curr_iter == displays_.end()) { |
247 // more displays in new list. | 255 // more displays in new list. |
248 added_display_indices.push_back(new_displays.size()); | 256 added_display_indices.push_back(new_displays.size()); |
249 InsertAndUpdateDisplayInfo(*new_info_iter, can_overscan); | 257 InsertAndUpdateDisplayInfo(*new_info_iter); |
250 new_displays.push_back( | 258 new_displays.push_back( |
251 CreateDisplayFromDisplayInfoById(new_info_iter->id())); | 259 CreateDisplayFromDisplayInfoById(new_info_iter->id())); |
252 ++new_info_iter; | 260 ++new_info_iter; |
253 } else if (new_info_iter == new_display_info_list.end()) { | 261 } else if (new_info_iter == new_display_info_list.end()) { |
254 // more displays in current list. | 262 // more displays in current list. |
255 removed_displays.push_back(*curr_iter); | 263 removed_displays.push_back(*curr_iter); |
256 ++curr_iter; | 264 ++curr_iter; |
257 } else if (curr_iter->id() == new_info_iter->id()) { | 265 } else if (curr_iter->id() == new_info_iter->id()) { |
258 const gfx::Display& current_display = *curr_iter; | 266 const gfx::Display& current_display = *curr_iter; |
259 // Copy the info because |CreateDisplayFromInfo| updates the instance. | 267 // Copy the info because |CreateDisplayFromInfo| updates the instance. |
260 const DisplayInfo current_display_info = GetDisplayInfo(current_display); | 268 const DisplayInfo current_display_info = GetDisplayInfo(current_display); |
261 InsertAndUpdateDisplayInfo(*new_info_iter, can_overscan); | 269 InsertAndUpdateDisplayInfo(*new_info_iter); |
262 gfx::Display new_display = | 270 gfx::Display new_display = |
263 CreateDisplayFromDisplayInfoById(new_info_iter->id()); | 271 CreateDisplayFromDisplayInfoById(new_info_iter->id()); |
264 const DisplayInfo& new_display_info = GetDisplayInfo(new_display); | 272 const DisplayInfo& new_display_info = GetDisplayInfo(new_display); |
| 273 // TODO(oshima): Rotating square dislay doesn't work as the size |
| 274 // won't change. This doesn't cause a problem now as there is no |
| 275 // such display. This will be fixed by comparing the rotation as |
| 276 // well when the rotation variable is added to gfx::Display. |
265 if (force_bounds_changed_ || | 277 if (force_bounds_changed_ || |
266 (current_display_info.bounds_in_pixel() != | 278 (current_display_info.bounds_in_pixel() != |
267 new_display_info.bounds_in_pixel()) || | 279 new_display_info.bounds_in_pixel()) || |
268 (current_display.device_scale_factor() != | 280 (current_display.device_scale_factor() != |
269 new_display.device_scale_factor())) { | 281 new_display.device_scale_factor()) || |
| 282 (current_display_info.size_in_pixel() != |
| 283 new_display.GetSizeInPixel())) { |
270 changed_display_indices.push_back(new_displays.size()); | 284 changed_display_indices.push_back(new_displays.size()); |
271 } | 285 } |
272 | 286 |
273 new_display.UpdateWorkAreaFromInsets(current_display.GetWorkAreaInsets()); | 287 new_display.UpdateWorkAreaFromInsets(current_display.GetWorkAreaInsets()); |
274 new_displays.push_back(new_display); | 288 new_displays.push_back(new_display); |
275 ++curr_iter; | 289 ++curr_iter; |
276 ++new_info_iter; | 290 ++new_info_iter; |
277 } else if (curr_iter->id() < new_info_iter->id()) { | 291 } else if (curr_iter->id() < new_info_iter->id()) { |
278 // more displays in current list between ids, which means it is deleted. | 292 // more displays in current list between ids, which means it is deleted. |
279 removed_displays.push_back(*curr_iter); | 293 removed_displays.push_back(*curr_iter); |
280 ++curr_iter; | 294 ++curr_iter; |
281 } else { | 295 } else { |
282 // more displays in new list between ids, which means it is added. | 296 // more displays in new list between ids, which means it is added. |
283 added_display_indices.push_back(new_displays.size()); | 297 added_display_indices.push_back(new_displays.size()); |
284 InsertAndUpdateDisplayInfo(*new_info_iter, can_overscan); | 298 InsertAndUpdateDisplayInfo(*new_info_iter); |
285 new_displays.push_back( | 299 new_displays.push_back( |
286 CreateDisplayFromDisplayInfoById(new_info_iter->id())); | 300 CreateDisplayFromDisplayInfoById(new_info_iter->id())); |
287 ++new_info_iter; | 301 ++new_info_iter; |
288 } | 302 } |
289 } | 303 } |
290 | 304 |
291 // Do not update |displays_| if there's nothing to be updated. Without this, | 305 // Do not update |displays_| if there's nothing to be updated. Without this, |
292 // it will not update the display layout, which causes the bug | 306 // it will not update the display layout, which causes the bug |
293 // http://crbug.com/155948. | 307 // http://crbug.com/155948. |
294 if (changed_display_indices.empty() && added_display_indices.empty() && | 308 if (changed_display_indices.empty() && added_display_indices.empty() && |
(...skipping 24 matching lines...) Expand all Loading... |
319 | 333 |
320 #if defined(USE_X11) && defined(OS_CHROMEOS) | 334 #if defined(USE_X11) && defined(OS_CHROMEOS) |
321 if (!changed_display_indices.empty() && base::chromeos::IsRunningOnChromeOS()) | 335 if (!changed_display_indices.empty() && base::chromeos::IsRunningOnChromeOS()) |
322 ui::ClearX11DefaultRootWindow(); | 336 ui::ClearX11DefaultRootWindow(); |
323 #endif | 337 #endif |
324 } | 338 } |
325 | 339 |
326 RootWindow* DisplayManager::CreateRootWindowForDisplay( | 340 RootWindow* DisplayManager::CreateRootWindowForDisplay( |
327 const gfx::Display& display) { | 341 const gfx::Display& display) { |
328 static int root_window_count = 0; | 342 static int root_window_count = 0; |
329 const gfx::Rect& bounds_in_pixel = GetDisplayInfo(display).bounds_in_pixel(); | 343 const DisplayInfo& display_info = GetDisplayInfo(display); |
| 344 const gfx::Rect& bounds_in_pixel = display_info.bounds_in_pixel(); |
330 RootWindow::CreateParams params(bounds_in_pixel); | 345 RootWindow::CreateParams params(bounds_in_pixel); |
331 params.host = Shell::GetInstance()->root_window_host_factory()-> | 346 params.host = Shell::GetInstance()->root_window_host_factory()-> |
332 CreateRootWindowHost(bounds_in_pixel); | 347 CreateRootWindowHost(bounds_in_pixel); |
| 348 params.initial_insets = display_info.GetOverscanInsetsInPixel(); |
333 aura::RootWindow* root_window = new aura::RootWindow(params); | 349 aura::RootWindow* root_window = new aura::RootWindow(params); |
334 root_window->SetName(StringPrintf("RootWindow-%d", root_window_count++)); | 350 root_window->SetName(StringPrintf("RootWindow-%d", root_window_count++)); |
335 | 351 |
336 // No need to remove RootWindowObserver because | 352 // No need to remove RootWindowObserver because |
337 // the DisplayManager object outlives RootWindow objects. | 353 // the DisplayManager object outlives RootWindow objects. |
338 root_window->AddRootWindowObserver(this); | 354 root_window->AddRootWindowObserver(this); |
339 root_window->SetProperty(kDisplayIdKey, display.id()); | 355 root_window->SetProperty(kDisplayIdKey, display.id()); |
340 root_window->Init(); | 356 root_window->Init(); |
341 return root_window; | 357 return root_window; |
342 } | 358 } |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 std::map<int64, DisplayInfo>::const_iterator iter = | 445 std::map<int64, DisplayInfo>::const_iterator iter = |
430 display_info_.find(display.id()); | 446 display_info_.find(display.id()); |
431 if (iter != display_info_.end() && !iter->second.name().empty()) | 447 if (iter != display_info_.end() && !iter->second.name().empty()) |
432 return iter->second.name(); | 448 return iter->second.name(); |
433 | 449 |
434 return base::StringPrintf("Display %d", static_cast<int>(display.id())); | 450 return base::StringPrintf("Display %d", static_cast<int>(display.id())); |
435 } | 451 } |
436 | 452 |
437 void DisplayManager::OnRootWindowResized(const aura::RootWindow* root, | 453 void DisplayManager::OnRootWindowResized(const aura::RootWindow* root, |
438 const gfx::Size& old_size) { | 454 const gfx::Size& old_size) { |
439 bool user_may_change_root = false; | 455 if (change_display_upon_host_resize_) { |
440 #if defined(OS_CHROMEOS) | |
441 user_may_change_root = !base::chromeos::IsRunningOnChromeOS(); | |
442 #endif | |
443 if (user_may_change_root) { | |
444 gfx::Display& display = FindDisplayForRootWindow(root); | 456 gfx::Display& display = FindDisplayForRootWindow(root); |
445 if (display.size() != root->GetHostSize()) { | 457 gfx::Size old_display_size_in_pixel = display.GetSizeInPixel(); |
446 display.SetSize(root->GetHostSize()); | 458 display_info_[display.id()].SetBounds( |
447 display_info_[display.id()].UpdateBounds( | 459 gfx::Rect(root->GetHostOrigin(), root->GetHostSize())); |
448 gfx::Rect(root->GetHostOrigin(), root->GetHostSize())); | 460 const gfx::Size& new_display_size_in_pixel = |
| 461 display_info_[display.id()].size_in_pixel(); |
| 462 if (old_display_size_in_pixel != new_display_size_in_pixel) { |
| 463 display.SetSize(new_display_size_in_pixel); |
449 Shell::GetInstance()->screen()->NotifyBoundsChanged(display); | 464 Shell::GetInstance()->screen()->NotifyBoundsChanged(display); |
450 } | 465 } |
451 } | 466 } |
452 } | 467 } |
453 | 468 |
454 void DisplayManager::Init() { | 469 void DisplayManager::Init() { |
455 // TODO(oshima): Move this logic to DisplayChangeObserver. | 470 // TODO(oshima): Move this logic to DisplayChangeObserver. |
456 const string size_str = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 471 const string size_str = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
457 switches::kAshHostWindowBounds); | 472 switches::kAshHostWindowBounds); |
458 vector<string> parts; | 473 vector<string> parts; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 iter != displays_.end(); ++iter) { | 526 iter != displays_.end(); ++iter) { |
512 if ((*iter).id() == id) | 527 if ((*iter).id() == id) |
513 return *iter; | 528 return *iter; |
514 } | 529 } |
515 DLOG(WARNING) << "Could not find display:" << id; | 530 DLOG(WARNING) << "Could not find display:" << id; |
516 return GetInvalidDisplay(); | 531 return GetInvalidDisplay(); |
517 } | 532 } |
518 | 533 |
519 void DisplayManager::AddDisplayFromSpec(const std::string& spec) { | 534 void DisplayManager::AddDisplayFromSpec(const std::string& spec) { |
520 DisplayInfo display_info = DisplayInfo::CreateFromSpec(spec); | 535 DisplayInfo display_info = DisplayInfo::CreateFromSpec(spec); |
521 InsertAndUpdateDisplayInfo(display_info, false); | 536 InsertAndUpdateDisplayInfo(display_info); |
522 gfx::Display display = CreateDisplayFromDisplayInfoById(display_info.id()); | 537 gfx::Display display = CreateDisplayFromDisplayInfoById(display_info.id()); |
523 displays_.push_back(display); | 538 displays_.push_back(display); |
524 } | 539 } |
525 | 540 |
526 void DisplayManager::EnsurePointerInDisplays() { | 541 void DisplayManager::EnsurePointerInDisplays() { |
527 // Don't try to move the pointer during the boot/startup. | 542 // Don't try to move the pointer during the boot/startup. |
528 if (!DisplayController::HasPrimaryDisplay()) | 543 if (!DisplayController::HasPrimaryDisplay()) |
529 return; | 544 return; |
530 gfx::Point location_in_screen = Shell::GetScreen()->GetCursorScreenPoint(); | 545 gfx::Point location_in_screen = Shell::GetScreen()->GetCursorScreenPoint(); |
531 gfx::Point target_location; | 546 gfx::Point target_location; |
(...skipping 22 matching lines...) Expand all Loading... |
554 } | 569 } |
555 | 570 |
556 aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); | 571 aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); |
557 aura::client::ScreenPositionClient* client = | 572 aura::client::ScreenPositionClient* client = |
558 aura::client::GetScreenPositionClient(root_window); | 573 aura::client::GetScreenPositionClient(root_window); |
559 client->ConvertPointFromScreen(root_window, &target_location); | 574 client->ConvertPointFromScreen(root_window, &target_location); |
560 | 575 |
561 root_window->MoveCursorTo(target_location); | 576 root_window->MoveCursorTo(target_location); |
562 } | 577 } |
563 | 578 |
564 void DisplayManager::InsertAndUpdateDisplayInfo(const DisplayInfo& new_info, | 579 void DisplayManager::InsertAndUpdateDisplayInfo(const DisplayInfo& new_info) { |
565 bool can_overscan) { | |
566 std::map<int64, DisplayInfo>::iterator info = | 580 std::map<int64, DisplayInfo>::iterator info = |
567 display_info_.find(new_info.id()); | 581 display_info_.find(new_info.id()); |
568 if (info != display_info_.end()) | 582 if (info != display_info_.end()) |
569 info->second.CopyFromNative(new_info); | 583 info->second.CopyFromNative(new_info); |
570 else | 584 else |
571 display_info_[new_info.id()] = new_info; | 585 display_info_[new_info.id()] = new_info; |
572 | 586 |
573 display_info_[new_info.id()].UpdateOverscanInfo(can_overscan); | 587 display_info_[new_info.id()].UpdateDisplaySize(); |
574 } | 588 } |
575 | 589 |
576 gfx::Display DisplayManager::CreateDisplayFromDisplayInfoById(int64 id) { | 590 gfx::Display DisplayManager::CreateDisplayFromDisplayInfoById(int64 id) { |
577 DCHECK(display_info_.find(id) != display_info_.end()); | 591 DCHECK(display_info_.find(id) != display_info_.end()); |
578 const DisplayInfo& display_info = display_info_[id]; | 592 const DisplayInfo& display_info = display_info_[id]; |
579 | 593 |
580 gfx::Display new_display(display_info.id()); | 594 gfx::Display new_display(display_info.id()); |
| 595 gfx::Rect bounds_in_pixel(display_info.size_in_pixel()); |
| 596 |
581 new_display.SetScaleAndBounds( | 597 new_display.SetScaleAndBounds( |
582 display_info.device_scale_factor(), display_info.bounds_in_pixel()); | 598 display_info.device_scale_factor(), bounds_in_pixel); |
583 | 599 |
584 // If the display is primary, then simply set the origin to (0,0). | 600 // If the display is primary, then simply set the origin to (0,0). |
585 // The secondary display's bounds will be updated by | 601 // The secondary display's bounds will be updated by |
586 // |DisplayController::UpdateDisplayBoundsForLayout|, so no need | 602 // |DisplayController::UpdateDisplayBoundsForLayout|, so no need |
587 // to change there. | 603 // to change there. |
588 if (DisplayController::HasPrimaryDisplay() && | 604 if (DisplayController::HasPrimaryDisplay() && |
589 display_info.id() == DisplayController::GetPrimaryDisplay().id()) { | 605 display_info.id() == DisplayController::GetPrimaryDisplay().id()) { |
590 new_display.set_bounds(gfx::Rect(new_display.bounds().size())); | 606 new_display.set_bounds(gfx::Rect(new_display.bounds().size())); |
591 } | 607 } |
592 return new_display; | 608 return new_display; |
593 } | 609 } |
594 | 610 |
595 } // namespace internal | 611 } // namespace internal |
596 } // namespace ash | 612 } // namespace ash |
OLD | NEW |