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 |
11 #include "ash/ash_root_window_transformer.h" | |
12 #include "ash/ash_switches.h" | 11 #include "ash/ash_switches.h" |
13 #include "ash/display/display_manager.h" | 12 #include "ash/display/display_manager.h" |
14 #include "ash/display/display_pref_util.h" | 13 #include "ash/display/display_pref_util.h" |
| 14 #include "ash/display/root_window_transformers.h" |
15 #include "ash/host/root_window_host_factory.h" | 15 #include "ash/host/root_window_host_factory.h" |
16 #include "ash/root_window_controller.h" | 16 #include "ash/root_window_controller.h" |
17 #include "ash/screen_ash.h" | 17 #include "ash/screen_ash.h" |
18 #include "ash/shell.h" | 18 #include "ash/shell.h" |
19 #include "ash/wm/coordinate_conversion.h" | 19 #include "ash/wm/coordinate_conversion.h" |
20 #include "ash/wm/property_util.h" | 20 #include "ash/wm/property_util.h" |
21 #include "ash/wm/window_util.h" | 21 #include "ash/wm/window_util.h" |
22 #include "base/command_line.h" | 22 #include "base/command_line.h" |
23 #include "base/json/json_value_converter.h" | 23 #include "base/json/json_value_converter.h" |
24 #include "base/stringprintf.h" | 24 #include "base/stringprintf.h" |
25 #include "base/strings/string_number_conversions.h" | 25 #include "base/strings/string_number_conversions.h" |
26 #include "base/strings/string_piece.h" | 26 #include "base/strings/string_piece.h" |
27 #include "base/values.h" | 27 #include "base/values.h" |
28 #include "third_party/skia/include/utils/SkMatrix44.h" | 28 #include "third_party/skia/include/utils/SkMatrix44.h" |
29 #include "ui/aura/client/activation_client.h" | 29 #include "ui/aura/client/activation_client.h" |
30 #include "ui/aura/client/capture_client.h" | 30 #include "ui/aura/client/capture_client.h" |
31 #include "ui/aura/client/cursor_client.h" | 31 #include "ui/aura/client/cursor_client.h" |
32 #include "ui/aura/client/focus_client.h" | 32 #include "ui/aura/client/focus_client.h" |
33 #include "ui/aura/client/screen_position_client.h" | 33 #include "ui/aura/client/screen_position_client.h" |
34 #include "ui/aura/env.h" | 34 #include "ui/aura/env.h" |
35 #include "ui/aura/root_window.h" | 35 #include "ui/aura/root_window.h" |
| 36 #include "ui/aura/root_window_transformer.h" |
36 #include "ui/aura/window.h" | 37 #include "ui/aura/window.h" |
37 #include "ui/aura/window_property.h" | 38 #include "ui/aura/window_property.h" |
38 #include "ui/aura/window_tracker.h" | 39 #include "ui/aura/window_tracker.h" |
39 #include "ui/compositor/compositor.h" | 40 #include "ui/compositor/compositor.h" |
40 #include "ui/compositor/dip_util.h" | 41 #include "ui/compositor/dip_util.h" |
41 #include "ui/gfx/display.h" | 42 #include "ui/gfx/display.h" |
42 #include "ui/gfx/screen.h" | 43 #include "ui/gfx/screen.h" |
43 | 44 |
44 #if defined(OS_CHROMEOS) | 45 #if defined(OS_CHROMEOS) |
45 #include "base/chromeos/chromeos_version.h" | 46 #include "base/chromeos/chromeos_version.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 int internal = display.IsInternal() ? 1 : 0; | 162 int internal = display.IsInternal() ? 1 : 0; |
162 gfx::AcceleratedWidget xwindow = root->GetAcceleratedWidget(); | 163 gfx::AcceleratedWidget xwindow = root->GetAcceleratedWidget(); |
163 ui::SetIntProperty(xwindow, kInternalProp, kCARDINAL, internal); | 164 ui::SetIntProperty(xwindow, kInternalProp, kCARDINAL, internal); |
164 ui::SetIntProperty(xwindow, kRotationProp, kCARDINAL, xrandr_rotation); | 165 ui::SetIntProperty(xwindow, kRotationProp, kCARDINAL, xrandr_rotation); |
165 ui::SetIntProperty(xwindow, | 166 ui::SetIntProperty(xwindow, |
166 kScaleFactorProp, | 167 kScaleFactorProp, |
167 kCARDINAL, | 168 kCARDINAL, |
168 100 * display.device_scale_factor()); | 169 100 * display.device_scale_factor()); |
169 #endif | 170 #endif |
170 scoped_ptr<aura::RootWindowTransformer> transformer( | 171 scoped_ptr<aura::RootWindowTransformer> transformer( |
171 new AshRootWindowTransformer(root, display)); | 172 internal::CreateRootWindowTransformerForDisplay(root, display)); |
172 root->SetRootWindowTransformer(transformer.Pass()); | 173 root->SetRootWindowTransformer(transformer.Pass()); |
173 } | 174 } |
174 | 175 |
175 } // namespace | 176 } // namespace |
176 | 177 |
177 namespace internal { | 178 namespace internal { |
178 | 179 |
179 // A utility class to store/restore focused/active window | 180 // A utility class to store/restore focused/active window |
180 // when the display configuration has changed. | 181 // when the display configuration has changed. |
181 class FocusActivationStore { | 182 class FocusActivationStore { |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 // primary. | 594 // primary. |
594 return pair.first == primary.id() ? layout : layout.Invert(); | 595 return pair.first == primary.id() ? layout : layout.Invert(); |
595 } | 596 } |
596 // On release build, just fallback to default instead of blowing up. | 597 // On release build, just fallback to default instead of blowing up. |
597 return default_display_layout_; | 598 return default_display_layout_; |
598 } | 599 } |
599 | 600 |
600 DisplayIdPair DisplayController::GetCurrentDisplayIdPair() const { | 601 DisplayIdPair DisplayController::GetCurrentDisplayIdPair() const { |
601 internal::DisplayManager* display_manager = GetDisplayManager(); | 602 internal::DisplayManager* display_manager = GetDisplayManager(); |
602 const gfx::Display& primary = GetPrimaryDisplay(); | 603 const gfx::Display& primary = GetPrimaryDisplay(); |
603 if (display_manager->IsMirrored()) | 604 if (display_manager->IsMirrored()) { |
604 return std::make_pair(primary.id(), display_manager->mirrored_display_id()); | 605 return std::make_pair(primary.id(), |
| 606 display_manager->mirrored_display().id()); |
| 607 } |
605 | 608 |
606 const gfx::Display& secondary = ScreenAsh::GetSecondaryDisplay(); | 609 const gfx::Display& secondary = ScreenAsh::GetSecondaryDisplay(); |
607 if (primary.IsInternal() || | 610 if (primary.IsInternal() || |
608 GetDisplayManager()->first_display_id() == primary.id()) { | 611 GetDisplayManager()->first_display_id() == primary.id()) { |
609 return std::make_pair(primary.id(), secondary.id()); | 612 return std::make_pair(primary.id(), secondary.id()); |
610 } else { | 613 } else { |
611 // Display has been Swapped. | 614 // Display has been Swapped. |
612 return std::make_pair(secondary.id(), primary.id()); | 615 return std::make_pair(secondary.id(), primary.id()); |
613 } | 616 } |
614 } | 617 } |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1027 } | 1030 } |
1028 | 1031 |
1029 void DisplayController::OnFadeOutForSwapDisplayFinished() { | 1032 void DisplayController::OnFadeOutForSwapDisplayFinished() { |
1030 #if defined(OS_CHROMEOS) && defined(USE_X11) | 1033 #if defined(OS_CHROMEOS) && defined(USE_X11) |
1031 SetPrimaryDisplay(ScreenAsh::GetSecondaryDisplay()); | 1034 SetPrimaryDisplay(ScreenAsh::GetSecondaryDisplay()); |
1032 Shell::GetInstance()->output_configurator_animation()->StartFadeInAnimation(); | 1035 Shell::GetInstance()->output_configurator_animation()->StartFadeInAnimation(); |
1033 #endif | 1036 #endif |
1034 } | 1037 } |
1035 | 1038 |
1036 } // namespace ash | 1039 } // namespace ash |
OLD | NEW |