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

Unified Diff: ash/display/multi_display_manager.cc

Issue 10909043: Cancel drag if display configuration changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/display/multi_display_manager.h ('k') | ash/display/multi_display_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/display/multi_display_manager.cc
diff --git a/ash/display/multi_display_manager.cc b/ash/display/multi_display_manager.cc
index 12bd18393928d7876f598a223971470eab674ef2..6612b766a296ea852ed5a27553175f4e0a44e98d 100644
--- a/ash/display/multi_display_manager.cc
+++ b/ash/display/multi_display_manager.cc
@@ -59,18 +59,13 @@ MultiDisplayManager::~MultiDisplayManager() {
}
// static
-void MultiDisplayManager::AddRemoveDisplay() {
- MultiDisplayManager* manager = static_cast<MultiDisplayManager*>(
- aura::Env::GetInstance()->display_manager());
- manager->AddRemoveDisplayImpl();
-}
-
void MultiDisplayManager::CycleDisplay() {
MultiDisplayManager* manager = static_cast<MultiDisplayManager*>(
aura::Env::GetInstance()->display_manager());
manager->CycleDisplayImpl();
}
+// static
void MultiDisplayManager::ToggleDisplayScale() {
MultiDisplayManager* manager = static_cast<MultiDisplayManager*>(
aura::Env::GetInstance()->display_manager());
@@ -282,8 +277,10 @@ void MultiDisplayManager::OnRootWindowResized(const aura::RootWindow* root,
const gfx::Size& old_size) {
if (!use_fullscreen_host_window()) {
gfx::Display& display = FindDisplayForRootWindow(root);
- display.SetSize(root->GetHostSize());
- NotifyBoundsChanged(display);
+ if (display.size() != root->GetHostSize()) {
+ display.SetSize(root->GetHostSize());
+ NotifyBoundsChanged(display);
+ }
}
}
@@ -301,7 +298,7 @@ void MultiDisplayManager::Init() {
AddDisplayFromSpec(std::string() /* default */);
}
-void MultiDisplayManager::AddRemoveDisplayImpl() {
+void MultiDisplayManager::CycleDisplayImpl() {
std::vector<gfx::Display> new_displays;
if (displays_.size() > 1) {
// Remove if there is more than one display.
@@ -311,25 +308,12 @@ void MultiDisplayManager::AddRemoveDisplayImpl() {
} else {
// Add if there is only one display.
new_displays.push_back(displays_[0]);
- new_displays.push_back(CreateDisplayFromSpec("50+50-1280x768"));
+ new_displays.push_back(CreateDisplayFromSpec("100+200-500x400"));
}
if (new_displays.size())
OnNativeDisplaysChanged(new_displays);
}
-void MultiDisplayManager::CycleDisplayImpl() {
- if (displays_.size() > 1) {
- std::vector<gfx::Display> new_displays;
- for (Displays::const_iterator iter = displays_.begin() + 1;
- iter != displays_.end(); ++iter) {
- gfx::Display display = *iter;
- new_displays.push_back(display);
- }
- new_displays.push_back(displays_.front());
- OnNativeDisplaysChanged(new_displays);
- }
-}
-
void MultiDisplayManager::ScaleDisplayImpl() {
if (displays_.size() > 0) {
std::vector<gfx::Display> new_displays;
@@ -349,6 +333,8 @@ void MultiDisplayManager::ScaleDisplayImpl() {
gfx::Display& MultiDisplayManager::FindDisplayForRootWindow(
const aura::RootWindow* root_window) {
int64 id = root_window->GetProperty(kDisplayIdKey);
+ // if id is |kInvaildDisplayID|, it's being deleted.
+ DCHECK(id != gfx::Display::kInvalidDisplayID);
for (Displays::iterator iter = displays_.begin();
iter != displays_.end(); ++iter) {
if ((*iter).id() == id)
« no previous file with comments | « ash/display/multi_display_manager.h ('k') | ash/display/multi_display_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698