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 16 matching lines...) Expand all Loading... |
27 #include "ui/aura/client/activation_client.h" | 27 #include "ui/aura/client/activation_client.h" |
28 #include "ui/aura/client/capture_client.h" | 28 #include "ui/aura/client/capture_client.h" |
29 #include "ui/aura/client/focus_client.h" | 29 #include "ui/aura/client/focus_client.h" |
30 #include "ui/aura/client/screen_position_client.h" | 30 #include "ui/aura/client/screen_position_client.h" |
31 #include "ui/aura/root_window.h" | 31 #include "ui/aura/root_window.h" |
32 #include "ui/aura/root_window_transformer.h" | 32 #include "ui/aura/root_window_transformer.h" |
33 #include "ui/aura/window.h" | 33 #include "ui/aura/window.h" |
34 #include "ui/aura/window_property.h" | 34 #include "ui/aura/window_property.h" |
35 #include "ui/aura/window_tracker.h" | 35 #include "ui/aura/window_tracker.h" |
36 #include "ui/compositor/compositor.h" | 36 #include "ui/compositor/compositor.h" |
| 37 #include "ui/compositor/compositor_vsync_manager.h" |
37 #include "ui/gfx/display.h" | 38 #include "ui/gfx/display.h" |
38 #include "ui/gfx/screen.h" | 39 #include "ui/gfx/screen.h" |
39 | 40 |
40 #if defined(OS_CHROMEOS) | 41 #if defined(OS_CHROMEOS) |
41 #include "base/sys_info.h" | 42 #include "base/sys_info.h" |
42 #include "base/time/time.h" | 43 #include "base/time/time.h" |
43 #if defined(USE_X11) | 44 #if defined(USE_X11) |
44 #include "ash/display/output_configurator_animation.h" | 45 #include "ash/display/output_configurator_animation.h" |
45 #include "chromeos/display/output_configurator.h" | 46 #include "chromeos/display/output_configurator.h" |
46 #include "ui/base/x/x11_util.h" | 47 #include "ui/base/x/x11_util.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 ui::SetIntProperty(xwindow, kInternalProp, kCARDINAL, internal); | 114 ui::SetIntProperty(xwindow, kInternalProp, kCARDINAL, internal); |
114 ui::SetIntProperty(xwindow, kRotationProp, kCARDINAL, xrandr_rotation); | 115 ui::SetIntProperty(xwindow, kRotationProp, kCARDINAL, xrandr_rotation); |
115 ui::SetIntProperty(xwindow, | 116 ui::SetIntProperty(xwindow, |
116 kScaleFactorProp, | 117 kScaleFactorProp, |
117 kCARDINAL, | 118 kCARDINAL, |
118 100 * display.device_scale_factor()); | 119 100 * display.device_scale_factor()); |
119 #endif | 120 #endif |
120 scoped_ptr<aura::RootWindowTransformer> transformer( | 121 scoped_ptr<aura::RootWindowTransformer> transformer( |
121 internal::CreateRootWindowTransformerForDisplay(root->window(), display)); | 122 internal::CreateRootWindowTransformerForDisplay(root->window(), display)); |
122 root->host()->SetRootWindowTransformer(transformer.Pass()); | 123 root->host()->SetRootWindowTransformer(transformer.Pass()); |
| 124 |
| 125 internal::DisplayMode mode; |
| 126 if (GetDisplayManager()->GetSelectedModeForDisplayId(display.id(), &mode) && |
| 127 mode.refresh_rate > 0.0f) { |
| 128 root->host()->compositor()->vsync_manager()->SetAuthoritativeVSyncInterval( |
| 129 base::TimeDelta::FromMicroseconds(base::Time::kMicrosecondsPerSecond / |
| 130 mode.refresh_rate)); |
| 131 } |
123 } | 132 } |
124 | 133 |
125 } // namespace | 134 } // namespace |
126 | 135 |
127 namespace internal { | 136 namespace internal { |
128 | 137 |
129 // A utility class to store/restore focused/active window | 138 // A utility class to store/restore focused/active window |
130 // when the display configuration has changed. | 139 // when the display configuration has changed. |
131 class FocusActivationStore { | 140 class FocusActivationStore { |
132 public: | 141 public: |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 std::string name = | 751 std::string name = |
743 root_windows[i] == primary ? "aura_root_0" : "aura_root_x"; | 752 root_windows[i] == primary ? "aura_root_0" : "aura_root_x"; |
744 gfx::AcceleratedWidget xwindow = | 753 gfx::AcceleratedWidget xwindow = |
745 root_windows[i]->GetDispatcher()->host()->GetAcceleratedWidget(); | 754 root_windows[i]->GetDispatcher()->host()->GetAcceleratedWidget(); |
746 XStoreName(gfx::GetXDisplay(), xwindow, name.c_str()); | 755 XStoreName(gfx::GetXDisplay(), xwindow, name.c_str()); |
747 } | 756 } |
748 #endif | 757 #endif |
749 } | 758 } |
750 | 759 |
751 } // namespace ash | 760 } // namespace ash |
OLD | NEW |