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

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: win fix, adjust test screen size 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
Index: ash/display/multi_display_manager.cc
diff --git a/ash/display/multi_display_manager.cc b/ash/display/multi_display_manager.cc
index 26c0c64c0f5094abad7d50def4747ef12391d7e2..b6710dbc6daf81ba23b1a90fbcfaa148a89bd0fc 100644
--- a/ash/display/multi_display_manager.cc
+++ b/ash/display/multi_display_manager.cc
@@ -53,18 +53,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());
@@ -222,8 +217,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);
+ }
}
}
@@ -241,7 +238,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.
@@ -251,25 +248,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;
@@ -289,6 +273,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)

Powered by Google App Engine
This is Rietveld 408576698