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 #include <cmath> | 8 #include <cmath> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 // Fallback to the primary display if there is no matching display. | 609 // Fallback to the primary display if there is no matching display. |
610 return matching ? *matching : GetPrimaryDisplay(); | 610 return matching ? *matching : GetPrimaryDisplay(); |
611 } | 611 } |
612 | 612 |
613 void DisplayController::OnDisplayBoundsChanged(const gfx::Display& display) { | 613 void DisplayController::OnDisplayBoundsChanged(const gfx::Display& display) { |
614 const internal::DisplayInfo& display_info = | 614 const internal::DisplayInfo& display_info = |
615 GetDisplayManager()->GetDisplayInfo(display.id()); | 615 GetDisplayManager()->GetDisplayInfo(display.id()); |
616 DCHECK(!display_info.bounds_in_native().IsEmpty()); | 616 DCHECK(!display_info.bounds_in_native().IsEmpty()); |
617 aura::WindowEventDispatcher* dispatcher = | 617 aura::WindowEventDispatcher* dispatcher = |
618 root_windows_[display.id()]->GetDispatcher(); | 618 root_windows_[display.id()]->GetDispatcher(); |
619 dispatcher->SetHostBounds(display_info.bounds_in_native()); | 619 dispatcher->host()->SetBounds(display_info.bounds_in_native()); |
620 SetDisplayPropertiesOnHostWindow(dispatcher, display); | 620 SetDisplayPropertiesOnHostWindow(dispatcher, display); |
621 } | 621 } |
622 | 622 |
623 void DisplayController::OnDisplayAdded(const gfx::Display& display) { | 623 void DisplayController::OnDisplayAdded(const gfx::Display& display) { |
624 if (primary_root_window_for_replace_) { | 624 if (primary_root_window_for_replace_) { |
625 DCHECK(root_windows_.empty()); | 625 DCHECK(root_windows_.empty()); |
626 primary_display_id = display.id(); | 626 primary_display_id = display.id(); |
627 root_windows_[display.id()] = primary_root_window_for_replace_; | 627 root_windows_[display.id()] = primary_root_window_for_replace_; |
628 internal::GetRootWindowSettings(primary_root_window_for_replace_)-> | 628 internal::GetRootWindowSettings(primary_root_window_for_replace_)-> |
629 display_id = display.id(); | 629 display_id = display.id(); |
630 primary_root_window_for_replace_ = NULL; | 630 primary_root_window_for_replace_ = NULL; |
631 const internal::DisplayInfo& display_info = | 631 const internal::DisplayInfo& display_info = |
632 GetDisplayManager()->GetDisplayInfo(display.id()); | 632 GetDisplayManager()->GetDisplayInfo(display.id()); |
633 aura::WindowEventDispatcher* dispatcher = | 633 aura::WindowEventDispatcher* dispatcher = |
634 root_windows_[display.id()]->GetDispatcher(); | 634 root_windows_[display.id()]->GetDispatcher(); |
635 dispatcher->SetHostBounds(display_info.bounds_in_native()); | 635 dispatcher->host()->SetBounds(display_info.bounds_in_native()); |
636 SetDisplayPropertiesOnHostWindow(dispatcher, display); | 636 SetDisplayPropertiesOnHostWindow(dispatcher, display); |
637 } else { | 637 } else { |
638 if (primary_display_id == gfx::Display::kInvalidDisplayID) | 638 if (primary_display_id == gfx::Display::kInvalidDisplayID) |
639 primary_display_id = display.id(); | 639 primary_display_id = display.id(); |
640 DCHECK(!root_windows_.empty()); | 640 DCHECK(!root_windows_.empty()); |
641 aura::RootWindow* root = AddRootWindowForDisplay(display); | 641 aura::RootWindow* root = AddRootWindowForDisplay(display); |
642 internal::RootWindowController::CreateForSecondaryDisplay(root); | 642 internal::RootWindowController::CreateForSecondaryDisplay(root); |
643 } | 643 } |
644 } | 644 } |
645 | 645 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 std::string name = | 815 std::string name = |
816 root_windows[i] == primary ? "aura_root_0" : "aura_root_x"; | 816 root_windows[i] == primary ? "aura_root_0" : "aura_root_x"; |
817 gfx::AcceleratedWidget xwindow = | 817 gfx::AcceleratedWidget xwindow = |
818 root_windows[i]->GetDispatcher()->host()->GetAcceleratedWidget(); | 818 root_windows[i]->GetDispatcher()->host()->GetAcceleratedWidget(); |
819 XStoreName(gfx::GetXDisplay(), xwindow, name.c_str()); | 819 XStoreName(gfx::GetXDisplay(), xwindow, name.c_str()); |
820 } | 820 } |
821 #endif | 821 #endif |
822 } | 822 } |
823 | 823 |
824 } // namespace ash | 824 } // namespace ash |
OLD | NEW |