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_controller.h" | 5 #include "ash/display/display_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
10 #include "ash/display/multi_display_manager.h" | 10 #include "ash/display/multi_display_manager.h" |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
462 static bool force_constrain_pointer_to_root = | 462 static bool force_constrain_pointer_to_root = |
463 CommandLine::ForCurrentProcess()->HasSwitch( | 463 CommandLine::ForCurrentProcess()->HasSwitch( |
464 switches::kAshConstrainPointerToRoot); | 464 switches::kAshConstrainPointerToRoot); |
465 if (base::chromeos::IsRunningOnChromeOS() || force_constrain_pointer_to_root) | 465 if (base::chromeos::IsRunningOnChromeOS() || force_constrain_pointer_to_root) |
466 root->ConfineCursorToWindow(); | 466 root->ConfineCursorToWindow(); |
467 #endif | 467 #endif |
468 return root; | 468 return root; |
469 } | 469 } |
470 | 470 |
471 void DisplayController::UpdateDisplayBoundsForLayout() { | 471 void DisplayController::UpdateDisplayBoundsForLayout() { |
472 if (gfx::Screen::GetNumDisplays() <= 1) | 472 if (gfx::Screen::GetNumDisplays(ash::Shell::GetRootNativeView()) <= 1) |
Ben Goodger (Google)
2012/10/04 15:38:37
is it acceptable to use the active root window in
| |
473 return; | 473 return; |
474 | 474 |
475 DCHECK_EQ(2, gfx::Screen::GetNumDisplays()); | 475 DCHECK_EQ(2, gfx::Screen::GetNumDisplays(ash::Shell::GetRootNativeView())); |
476 const gfx::Rect& primary_bounds = GetPrimaryDisplay().bounds(); | 476 const gfx::Rect& primary_bounds = GetPrimaryDisplay().bounds(); |
477 | 477 |
478 gfx::Display* secondary_display = GetSecondaryDisplay(); | 478 gfx::Display* secondary_display = GetSecondaryDisplay(); |
479 const gfx::Rect& secondary_bounds = secondary_display->bounds(); | 479 const gfx::Rect& secondary_bounds = secondary_display->bounds(); |
480 gfx::Point new_secondary_origin = primary_bounds.origin(); | 480 gfx::Point new_secondary_origin = primary_bounds.origin(); |
481 | 481 |
482 const DisplayLayout& layout = GetLayoutForDisplay(*secondary_display); | 482 const DisplayLayout& layout = GetLayoutForDisplay(*secondary_display); |
483 DisplayLayout::Position position = layout.position; | 483 DisplayLayout::Position position = layout.position; |
484 | 484 |
485 // Ignore the offset in case the secondary display doesn't share edges with | 485 // Ignore the offset in case the secondary display doesn't share edges with |
(...skipping 28 matching lines...) Expand all Loading... | |
514 secondary_display->set_bounds( | 514 secondary_display->set_bounds( |
515 gfx::Rect(new_secondary_origin, secondary_bounds.size())); | 515 gfx::Rect(new_secondary_origin, secondary_bounds.size())); |
516 secondary_display->UpdateWorkAreaFromInsets(insets); | 516 secondary_display->UpdateWorkAreaFromInsets(insets); |
517 } | 517 } |
518 | 518 |
519 void DisplayController::NotifyDisplayConfigurationChanging() { | 519 void DisplayController::NotifyDisplayConfigurationChanging() { |
520 FOR_EACH_OBSERVER(Observer, observers_, OnDisplayConfigurationChanging()); | 520 FOR_EACH_OBSERVER(Observer, observers_, OnDisplayConfigurationChanging()); |
521 } | 521 } |
522 | 522 |
523 } // namespace ash | 523 } // namespace ash |
OLD | NEW |