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

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

Issue 289583002: Lock rotation when screen is manually rotated. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Define sources for rotation Created 6 years, 7 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_manager.h" 5 #include "ash/display/display_manager.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 DisplayInfoList display_info_list; 386 DisplayInfoList display_info_list;
387 for (DisplayList::const_iterator iter = displays_.begin(); 387 for (DisplayList::const_iterator iter = displays_.begin();
388 iter != displays_.end(); ++iter) { 388 iter != displays_.end(); ++iter) {
389 display_info_list.push_back(GetDisplayInfo(iter->id())); 389 display_info_list.push_back(GetDisplayInfo(iter->id()));
390 } 390 }
391 AddMirrorDisplayInfoIfAny(&display_info_list); 391 AddMirrorDisplayInfoIfAny(&display_info_list);
392 UpdateDisplays(display_info_list); 392 UpdateDisplays(display_info_list);
393 } 393 }
394 394
395 void DisplayManager::SetDisplayRotation(int64 display_id, 395 void DisplayManager::SetDisplayRotation(int64 display_id,
396 gfx::Display::Rotation rotation) { 396 gfx::Display::Rotation rotation,
397 ui::RotationSource source) {
397 DisplayInfoList display_info_list; 398 DisplayInfoList display_info_list;
398 for (DisplayList::const_iterator iter = displays_.begin(); 399 for (DisplayList::const_iterator iter = displays_.begin();
399 iter != displays_.end(); ++iter) { 400 iter != displays_.end(); ++iter) {
400 DisplayInfo info = GetDisplayInfo(iter->id()); 401 DisplayInfo info = GetDisplayInfo(iter->id());
401 if (info.id() == display_id) { 402 if (info.id() == display_id) {
402 if (info.rotation() == rotation) 403 if (info.rotation() == rotation)
403 return; 404 return;
404 info.set_rotation(rotation); 405 info.SetRotation(rotation, source);
405 } 406 }
406 display_info_list.push_back(info); 407 display_info_list.push_back(info);
407 } 408 }
408 AddMirrorDisplayInfoIfAny(&display_info_list); 409 AddMirrorDisplayInfoIfAny(&display_info_list);
409 if (virtual_keyboard_root_window_enabled() && 410 if (virtual_keyboard_root_window_enabled() &&
410 display_id == non_desktop_display_.id()) { 411 display_id == non_desktop_display_.id()) {
411 DisplayInfo info = GetDisplayInfo(display_id); 412 DisplayInfo info = GetDisplayInfo(display_id);
412 info.set_rotation(rotation); 413 info.SetRotation(rotation, source);
413 display_info_list.push_back(info); 414 display_info_list.push_back(info);
414 } 415 }
415 UpdateDisplays(display_info_list); 416 UpdateDisplays(display_info_list);
416 } 417 }
417 418
418 void DisplayManager::SetDisplayUIScale(int64 display_id, 419 void DisplayManager::SetDisplayUIScale(int64 display_id,
419 float ui_scale) { 420 float ui_scale) {
420 if (!IsDisplayUIScalingEnabled() || 421 if (!IsDisplayUIScalingEnabled() ||
421 gfx::Display::InternalDisplayId() != display_id) { 422 gfx::Display::InternalDisplayId() != display_id) {
422 return; 423 return;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 void DisplayManager::RegisterDisplayProperty( 469 void DisplayManager::RegisterDisplayProperty(
469 int64 display_id, 470 int64 display_id,
470 gfx::Display::Rotation rotation, 471 gfx::Display::Rotation rotation,
471 float ui_scale, 472 float ui_scale,
472 const gfx::Insets* overscan_insets, 473 const gfx::Insets* overscan_insets,
473 const gfx::Size& resolution_in_pixels, 474 const gfx::Size& resolution_in_pixels,
474 ui::ColorCalibrationProfile color_profile) { 475 ui::ColorCalibrationProfile color_profile) {
475 if (display_info_.find(display_id) == display_info_.end()) 476 if (display_info_.find(display_id) == display_info_.end())
476 display_info_[display_id] = DisplayInfo(display_id, std::string(), false); 477 display_info_[display_id] = DisplayInfo(display_id, std::string(), false);
477 478
478 display_info_[display_id].set_rotation(rotation); 479 display_info_[display_id].SetRotation(rotation, ui::USER);
479 display_info_[display_id].SetColorProfile(color_profile); 480 display_info_[display_id].SetColorProfile(color_profile);
480 // Just in case the preference file was corrupted. 481 // Just in case the preference file was corrupted.
481 if (0.5f <= ui_scale && ui_scale <= 2.0f) 482 if (0.5f <= ui_scale && ui_scale <= 2.0f)
482 display_info_[display_id].set_configured_ui_scale(ui_scale); 483 display_info_[display_id].set_configured_ui_scale(ui_scale);
483 if (overscan_insets) 484 if (overscan_insets)
484 display_info_[display_id].SetOverscanInsets(*overscan_insets); 485 display_info_[display_id].SetOverscanInsets(*overscan_insets);
485 if (!resolution_in_pixels.IsEmpty()) { 486 if (!resolution_in_pixels.IsEmpty()) {
486 // Default refresh rate, until OnNativeDisplaysChanged() updates us with the 487 // Default refresh rate, until OnNativeDisplaysChanged() updates us with the
487 // actual display info, is 60 Hz. 488 // actual display info, is 60 Hz.
488 display_modes_[display_id] = 489 display_modes_[display_id] =
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 new_secondary_origin.Offset(-secondary_bounds.width(), offset); 1116 new_secondary_origin.Offset(-secondary_bounds.width(), offset);
1116 break; 1117 break;
1117 } 1118 }
1118 gfx::Insets insets = secondary_display->GetWorkAreaInsets(); 1119 gfx::Insets insets = secondary_display->GetWorkAreaInsets();
1119 secondary_display->set_bounds( 1120 secondary_display->set_bounds(
1120 gfx::Rect(new_secondary_origin, secondary_bounds.size())); 1121 gfx::Rect(new_secondary_origin, secondary_bounds.size()));
1121 secondary_display->UpdateWorkAreaFromInsets(insets); 1122 secondary_display->UpdateWorkAreaFromInsets(insets);
1122 } 1123 }
1123 1124
1124 } // namespace ash 1125 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698