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

Unified Diff: ash/display/display_util.cc

Issue 1261693004: Allow dynamic enabling/disabling of unified desktop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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/display_util.h ('k') | ash/display/display_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/display/display_util.cc
diff --git a/ash/display/display_util.cc b/ash/display/display_util.cc
index 5219dad09bf4e5f09078885aabee29ce52d7d3f4..291b9a3de7c8acbac845f6b29da05c83e8747b5b 100644
--- a/ash/display/display_util.cc
+++ b/ash/display/display_util.cc
@@ -339,15 +339,19 @@ int FindDisplayIndexContainingPoint(const std::vector<gfx::Display>& displays,
}
DisplayIdPair CreateDisplayIdPair(int64 id1, int64 id2) {
+ return CompareDisplayIds(id1, id2) ? std::make_pair(id1, id2)
+ : std::make_pair(id2, id1);
+}
+
+bool CompareDisplayIds(int64 id1, int64 id2) {
DCHECK_NE(id1, id2);
// Output index is stored in the first 8 bits. See GetDisplayIdFromEDID
// in edid_parser.cc.
int index_1 = id1 & 0xFF;
int index_2 = id2 & 0xFF;
- if (gfx::Display::IsInternalDisplayId(id2) || index_2 < index_1)
- return std::make_pair(id2, id1);
- else
- return std::make_pair(id1, id2);
+ DCHECK_NE(index_1, index_2) << id1 << " and " << id2;
+ return gfx::Display::IsInternalDisplayId(id1) ||
+ (index_1 < index_2 && !gfx::Display::IsInternalDisplayId(id2));
}
} // namespace ash
« no previous file with comments | « ash/display/display_util.h ('k') | ash/display/display_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698