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

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

Issue 1071353003: Prevent DisplayPreferences from saving incorrect rotations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 8 months 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
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // read and used by touchpad/mouse driver directly on X (contact 102 // read and used by touchpad/mouse driver directly on X (contact
103 // adlr@ for more details on touchpad/mouse driver side). The value 103 // adlr@ for more details on touchpad/mouse driver side). The value
104 // of the rotation is one of 0 (normal), 1 (90 degrees clockwise), 2 104 // of the rotation is one of 0 (normal), 1 (90 degrees clockwise), 2
105 // (180 degree) or 3 (270 degrees clockwise). The value of the 105 // (180 degree) or 3 (270 degrees clockwise). The value of the
106 // scale factor is in percent (100, 140, 200 etc). 106 // scale factor is in percent (100, 140, 200 etc).
107 const char kRotationProp[] = "_CHROME_DISPLAY_ROTATION"; 107 const char kRotationProp[] = "_CHROME_DISPLAY_ROTATION";
108 const char kScaleFactorProp[] = "_CHROME_DISPLAY_SCALE_FACTOR"; 108 const char kScaleFactorProp[] = "_CHROME_DISPLAY_SCALE_FACTOR";
109 const char kInternalProp[] = "_CHROME_DISPLAY_INTERNAL"; 109 const char kInternalProp[] = "_CHROME_DISPLAY_INTERNAL";
110 const char kCARDINAL[] = "CARDINAL"; 110 const char kCARDINAL[] = "CARDINAL";
111 int xrandr_rotation = RR_Rotate_0; 111 int xrandr_rotation = RR_Rotate_0;
112 switch (info.rotation()) { 112 switch (info.GetActiveRotation()) {
113 case gfx::Display::ROTATE_0: 113 case gfx::Display::ROTATE_0:
114 xrandr_rotation = RR_Rotate_0; 114 xrandr_rotation = RR_Rotate_0;
115 break; 115 break;
116 case gfx::Display::ROTATE_90: 116 case gfx::Display::ROTATE_90:
117 xrandr_rotation = RR_Rotate_90; 117 xrandr_rotation = RR_Rotate_90;
118 break; 118 break;
119 case gfx::Display::ROTATE_180: 119 case gfx::Display::ROTATE_180:
120 xrandr_rotation = RR_Rotate_180; 120 xrandr_rotation = RR_Rotate_180;
121 break; 121 break;
122 case gfx::Display::ROTATE_270: 122 case gfx::Display::ROTATE_270:
(...skipping 10 matching lines...) Expand all
133 kCARDINAL, 133 kCARDINAL,
134 100 * display.device_scale_factor()); 134 100 * display.device_scale_factor());
135 #elif defined(USE_OZONE) 135 #elif defined(USE_OZONE)
136 // Scale all motion on High-DPI displays. 136 // Scale all motion on High-DPI displays.
137 float scale = display.device_scale_factor(); 137 float scale = display.device_scale_factor();
138 138
139 if (!display.IsInternal()) 139 if (!display.IsInternal())
140 scale *= kCursorMultiplierForExternalDisplays; 140 scale *= kCursorMultiplierForExternalDisplays;
141 141
142 ui::CursorController::GetInstance()->SetCursorConfigForWindow( 142 ui::CursorController::GetInstance()->SetCursorConfigForWindow(
143 host->GetAcceleratedWidget(), info.rotation(), scale); 143 host->GetAcceleratedWidget(), info.GetActiveRotation(), scale);
144 #endif 144 #endif
145 #endif 145 #endif
146 scoped_ptr<RootWindowTransformer> transformer( 146 scoped_ptr<RootWindowTransformer> transformer(
147 CreateRootWindowTransformerForDisplay(host->window(), display)); 147 CreateRootWindowTransformerForDisplay(host->window(), display));
148 ash_host->SetRootWindowTransformer(transformer.Pass()); 148 ash_host->SetRootWindowTransformer(transformer.Pass());
149 149
150 DisplayMode mode = 150 DisplayMode mode =
151 GetDisplayManager()->GetActiveModeForDisplayId(display.id()); 151 GetDisplayManager()->GetActiveModeForDisplayId(display.id());
152 if (mode.refresh_rate > 0.0f) { 152 if (mode.refresh_rate > 0.0f) {
153 host->compositor()->vsync_manager()->SetAuthoritativeVSyncInterval( 153 host->compositor()->vsync_manager()->SetAuthoritativeVSyncInterval(
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 Shell::GetInstance()->display_configurator_animation() 838 Shell::GetInstance()->display_configurator_animation()
839 ->StartFadeInAnimation(); 839 ->StartFadeInAnimation();
840 #endif 840 #endif
841 } 841 }
842 842
843 void DisplayController::SetMirrorModeAfterAnimation(bool mirror) { 843 void DisplayController::SetMirrorModeAfterAnimation(bool mirror) {
844 GetDisplayManager()->SetMirrorMode(mirror); 844 GetDisplayManager()->SetMirrorMode(mirror);
845 } 845 }
846 846
847 } // namespace ash 847 } // namespace ash
OLDNEW
« no previous file with comments | « ash/content/display/screen_orientation_controller_chromeos_unittest.cc ('k') | ash/display/display_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698