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

Side by Side Diff: ash/display/display_controller.cc

Issue 72503002: Remove some pass-thrus on RootWindow API in favor of exposing the RootWindowHost again. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 break; 107 break;
108 case gfx::Display::ROTATE_180: 108 case gfx::Display::ROTATE_180:
109 xrandr_rotation = RR_Rotate_180; 109 xrandr_rotation = RR_Rotate_180;
110 break; 110 break;
111 case gfx::Display::ROTATE_270: 111 case gfx::Display::ROTATE_270:
112 xrandr_rotation = RR_Rotate_270; 112 xrandr_rotation = RR_Rotate_270;
113 break; 113 break;
114 } 114 }
115 115
116 int internal = display.IsInternal() ? 1 : 0; 116 int internal = display.IsInternal() ? 1 : 0;
117 gfx::AcceleratedWidget xwindow = root->GetAcceleratedWidget(); 117 gfx::AcceleratedWidget xwindow = root->host()->GetAcceleratedWidget();
118 ui::SetIntProperty(xwindow, kInternalProp, kCARDINAL, internal); 118 ui::SetIntProperty(xwindow, kInternalProp, kCARDINAL, internal);
119 ui::SetIntProperty(xwindow, kRotationProp, kCARDINAL, xrandr_rotation); 119 ui::SetIntProperty(xwindow, kRotationProp, kCARDINAL, xrandr_rotation);
120 ui::SetIntProperty(xwindow, 120 ui::SetIntProperty(xwindow,
121 kScaleFactorProp, 121 kScaleFactorProp,
122 kCARDINAL, 122 kCARDINAL,
123 100 * display.device_scale_factor()); 123 100 * display.device_scale_factor());
124 #endif 124 #endif
125 scoped_ptr<aura::RootWindowTransformer> transformer( 125 scoped_ptr<aura::RootWindowTransformer> transformer(
126 internal::CreateRootWindowTransformerForDisplay(root->window(), display)); 126 internal::CreateRootWindowTransformerForDisplay(root->window(), display));
127 root->SetRootWindowTransformer(transformer.Pass()); 127 root->SetRootWindowTransformer(transformer.Pass());
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 // We don't care about actual distance, only relative to other displays, so 518 // We don't care about actual distance, only relative to other displays, so
519 // using the LengthSquared() is cheaper than Length(). 519 // using the LengthSquared() is cheaper than Length().
520 520
521 int64 distance_squared = (center - point_in_screen).LengthSquared(); 521 int64 distance_squared = (center - point_in_screen).LengthSquared();
522 if (closest_distance_squared < 0 || 522 if (closest_distance_squared < 0 ||
523 closest_distance_squared > distance_squared) { 523 closest_distance_squared > distance_squared) {
524 aura::Window* root_window = GetRootWindowForDisplayId(display.id()); 524 aura::Window* root_window = GetRootWindowForDisplayId(display.id());
525 aura::client::ScreenPositionClient* client = 525 aura::client::ScreenPositionClient* client =
526 aura::client::GetScreenPositionClient(root_window); 526 aura::client::GetScreenPositionClient(root_window);
527 client->ConvertPointFromScreen(root_window, &center); 527 client->ConvertPointFromScreen(root_window, &center);
528 root_window->GetDispatcher()->ConvertPointToNativeScreen(&center); 528 root_window->GetDispatcher()->host()->ConvertPointToNativeScreen(&center);
529 dst_root_window = root_window; 529 dst_root_window = root_window;
530 target_location_in_native = center; 530 target_location_in_native = center;
531 closest_distance_squared = distance_squared; 531 closest_distance_squared = distance_squared;
532 } 532 }
533 } 533 }
534 dst_root_window->GetDispatcher()->ConvertPointFromNativeScreen( 534 dst_root_window->GetDispatcher()->host()->ConvertPointFromNativeScreen(
535 &target_location_in_native); 535 &target_location_in_native);
536 dst_root_window->MoveCursorTo(target_location_in_native); 536 dst_root_window->MoveCursorTo(target_location_in_native);
537 } 537 }
538 538
539 bool DisplayController::UpdateWorkAreaOfDisplayNearestWindow( 539 bool DisplayController::UpdateWorkAreaOfDisplayNearestWindow(
540 const aura::Window* window, 540 const aura::Window* window,
541 const gfx::Insets& insets) { 541 const gfx::Insets& insets) {
542 const aura::Window* root_window = window->GetRootWindow(); 542 const aura::Window* root_window = window->GetRootWindow();
543 int64 id = internal::GetRootWindowSettings(root_window)->display_id; 543 int64 id = internal::GetRootWindowSettings(root_window)->display_id;
544 // if id is |kInvaildDisplayID|, it's being deleted. 544 // if id is |kInvaildDisplayID|, it's being deleted.
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 // root window itself yet because the stack may be using it. 669 // root window itself yet because the stack may be using it.
670 controller->Shutdown(); 670 controller->Shutdown();
671 base::MessageLoop::current()->DeleteSoon(FROM_HERE, controller); 671 base::MessageLoop::current()->DeleteSoon(FROM_HERE, controller);
672 } 672 }
673 673
674 void DisplayController::OnRootWindowHostResized(const aura::RootWindow* root) { 674 void DisplayController::OnRootWindowHostResized(const aura::RootWindow* root) {
675 internal::DisplayManager* display_manager = GetDisplayManager(); 675 internal::DisplayManager* display_manager = GetDisplayManager();
676 gfx::Display display = GetDisplayNearestWindow(root->window()); 676 gfx::Display display = GetDisplayNearestWindow(root->window());
677 if (display_manager->UpdateDisplayBounds( 677 if (display_manager->UpdateDisplayBounds(
678 display.id(), 678 display.id(),
679 gfx::Rect(root->GetHostOrigin(), root->GetHostSize()))) { 679 root->host()->GetBounds())) {
680 mirror_window_controller_->UpdateWindow(); 680 mirror_window_controller_->UpdateWindow();
681 } 681 }
682 } 682 }
683 683
684 void DisplayController::CreateOrUpdateNonDesktopDisplay( 684 void DisplayController::CreateOrUpdateNonDesktopDisplay(
685 const internal::DisplayInfo& info) { 685 const internal::DisplayInfo& info) {
686 switch (GetDisplayManager()->second_display_mode()) { 686 switch (GetDisplayManager()->second_display_mode()) {
687 case internal::DisplayManager::MIRRORING: 687 case internal::DisplayManager::MIRRORING:
688 mirror_window_controller_->UpdateWindow(info); 688 mirror_window_controller_->UpdateWindow(info);
689 virtual_keyboard_window_controller_->Close(); 689 virtual_keyboard_window_controller_->Close();
(...skipping 17 matching lines...) Expand all
707 focus_activation_store_->Store(clear_focus); 707 focus_activation_store_->Store(clear_focus);
708 708
709 gfx::Point point_in_screen = Shell::GetScreen()->GetCursorScreenPoint(); 709 gfx::Point point_in_screen = Shell::GetScreen()->GetCursorScreenPoint();
710 gfx::Display display = 710 gfx::Display display =
711 Shell::GetScreen()->GetDisplayNearestPoint(point_in_screen); 711 Shell::GetScreen()->GetDisplayNearestPoint(point_in_screen);
712 aura::Window* root_window = GetRootWindowForDisplayId(display.id()); 712 aura::Window* root_window = GetRootWindowForDisplayId(display.id());
713 713
714 aura::client::ScreenPositionClient* client = 714 aura::client::ScreenPositionClient* client =
715 aura::client::GetScreenPositionClient(root_window); 715 aura::client::GetScreenPositionClient(root_window);
716 client->ConvertPointFromScreen(root_window, &point_in_screen); 716 client->ConvertPointFromScreen(root_window, &point_in_screen);
717 root_window->GetDispatcher()->ConvertPointToNativeScreen(&point_in_screen); 717 root_window->GetDispatcher()->host()->ConvertPointToNativeScreen(
718 &point_in_screen);
718 cursor_location_in_native_coords_for_restore_ = point_in_screen; 719 cursor_location_in_native_coords_for_restore_ = point_in_screen;
719 } 720 }
720 721
721 void DisplayController::PostDisplayConfigurationChange() { 722 void DisplayController::PostDisplayConfigurationChange() {
722 if (limiter_) 723 if (limiter_)
723 limiter_->SetThrottleTimeout(kAfterDisplayChangeThrottleTimeoutMs); 724 limiter_->SetThrottleTimeout(kAfterDisplayChangeThrottleTimeoutMs);
724 725
725 focus_activation_store_->Restore(); 726 focus_activation_store_->Restore();
726 727
727 internal::DisplayManager* display_manager = GetDisplayManager(); 728 internal::DisplayManager* display_manager = GetDisplayManager();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 root_window->Init(); 770 root_window->Init();
770 771
771 root_windows_[display.id()] = root_window->window(); 772 root_windows_[display.id()] = root_window->window();
772 SetDisplayPropertiesOnHostWindow(root_window, display); 773 SetDisplayPropertiesOnHostWindow(root_window, display);
773 774
774 #if defined(OS_CHROMEOS) 775 #if defined(OS_CHROMEOS)
775 static bool force_constrain_pointer_to_root = 776 static bool force_constrain_pointer_to_root =
776 CommandLine::ForCurrentProcess()->HasSwitch( 777 CommandLine::ForCurrentProcess()->HasSwitch(
777 switches::kAshConstrainPointerToRoot); 778 switches::kAshConstrainPointerToRoot);
778 if (base::SysInfo::IsRunningOnChromeOS() || force_constrain_pointer_to_root) 779 if (base::SysInfo::IsRunningOnChromeOS() || force_constrain_pointer_to_root)
779 root_window->ConfineCursorToWindow(); 780 root_window->host()->ConfineCursorToRootWindow();
780 #endif 781 #endif
781 return root_window; 782 return root_window;
782 } 783 }
783 784
784 void DisplayController::OnFadeOutForSwapDisplayFinished() { 785 void DisplayController::OnFadeOutForSwapDisplayFinished() {
785 #if defined(OS_CHROMEOS) && defined(USE_X11) 786 #if defined(OS_CHROMEOS) && defined(USE_X11)
786 SetPrimaryDisplay(ScreenAsh::GetSecondaryDisplay()); 787 SetPrimaryDisplay(ScreenAsh::GetSecondaryDisplay());
787 Shell::GetInstance()->output_configurator_animation()->StartFadeInAnimation(); 788 Shell::GetInstance()->output_configurator_animation()->StartFadeInAnimation();
788 #endif 789 #endif
789 } 790 }
790 791
791 void DisplayController::UpdateHostWindowNames() { 792 void DisplayController::UpdateHostWindowNames() {
792 #if defined(USE_X11) 793 #if defined(USE_X11)
793 // crbug.com/120229 - set the window title for the primary dislpay 794 // crbug.com/120229 - set the window title for the primary dislpay
794 // to "aura_root_0" so gtalk can find the primary root window to broadcast. 795 // to "aura_root_0" so gtalk can find the primary root window to broadcast.
795 // TODO(jhorwich) Remove this once Chrome supports window-based broadcasting. 796 // TODO(jhorwich) Remove this once Chrome supports window-based broadcasting.
796 aura::Window* primary = Shell::GetPrimaryRootWindow(); 797 aura::Window* primary = Shell::GetPrimaryRootWindow();
797 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 798 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
798 for (size_t i = 0; i < root_windows.size(); ++i) { 799 for (size_t i = 0; i < root_windows.size(); ++i) {
799 std::string name = 800 std::string name =
800 root_windows[i] == primary ? "aura_root_0" : "aura_root_x"; 801 root_windows[i] == primary ? "aura_root_0" : "aura_root_x";
801 gfx::AcceleratedWidget xwindow = 802 gfx::AcceleratedWidget xwindow =
802 root_windows[i]->GetDispatcher()->GetAcceleratedWidget(); 803 root_windows[i]->GetDispatcher()->host()->GetAcceleratedWidget();
803 XStoreName(gfx::GetXDisplay(), xwindow, name.c_str()); 804 XStoreName(gfx::GetXDisplay(), xwindow, name.c_str());
804 } 805 }
805 #endif 806 #endif
806 } 807 }
807 808
808 } // namespace ash 809 } // namespace ash
OLDNEW
« no previous file with comments | « ash/accelerators/nested_dispatcher_controller_unittest.cc ('k') | ash/display/display_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698