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

Unified Diff: ash/display/display_util.cc

Issue 1823913002: Allow moving cursors between connected displays. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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/display_util.cc
diff --git a/ash/display/display_util.cc b/ash/display/display_util.cc
index 7c1b7c9238d79305c3613c5109e3641c718d1fce..02fa6c98c9be7251846848ee490f41c111c8b066 100644
--- a/ash/display/display_util.cc
+++ b/ash/display/display_util.cc
@@ -222,7 +222,7 @@ bool HasDisplayModeForUIScale(const DisplayInfo& info, float ui_scale) {
return std::find_if(modes.begin(), modes.end(), comparator) != modes.end();
}
-void ComputeBoundary(const gfx::Display& a_display,
+bool ComputeBoundary(const gfx::Display& a_display,
const gfx::Display& b_display,
gfx::Rect* a_edge_in_screen,
gfx::Rect* b_edge_in_screen) {
@@ -240,18 +240,20 @@ void ComputeBoundary(const gfx::Display& a_display,
// top bottom
if (a_bounds.bottom() == b_bounds.y()) {
position = DisplayPlacement::BOTTOM;
- } else {
- DCHECK_EQ(a_bounds.y(), b_bounds.bottom());
+ } else if (a_bounds.y() == b_bounds.bottom()) {
position = DisplayPlacement::TOP;
+ } else {
+ return false;
}
} else {
- DCHECK((rr - rx) == 0);
// left right
if (a_bounds.right() == b_bounds.x()) {
position = DisplayPlacement::RIGHT;
- } else {
- DCHECK_EQ(a_bounds.x(), b_bounds.right());
+ } else if (a_bounds.x() == b_bounds.right()) {
position = DisplayPlacement::LEFT;
+ } else {
+ DCHECK_NE(rr, rx);
+ return false;
}
}
@@ -278,11 +280,12 @@ void ComputeBoundary(const gfx::Display& a_display,
b_edge_in_screen->SetRect(b_bounds.right() - 1, top, 1, bottom - top);
} else {
a_edge_in_screen->SetRect(a_bounds.right() - 1, top, 1, bottom - top);
- b_edge_in_screen->SetRect(b_bounds.y(), top, 1, bottom - top);
+ b_edge_in_screen->SetRect(b_bounds.x(), top, 1, bottom - top);
}
break;
}
}
+ return true;
}
gfx::Rect GetNativeEdgeBounds(AshWindowTreeHost* ash_host,
@@ -383,7 +386,13 @@ void SortDisplayIdList(DisplayIdList* ids) {
}
std::string DisplayIdListToString(const ash::DisplayIdList& list) {
- return base::Int64ToString(list[0]) + "," + base::Int64ToString(list[1]);
+ std::stringstream s;
+ const char* sep = "";
+ for (int64_t id : list) {
+ s << sep << id;
+ sep = ",";
+ }
+ return s.str();
}
bool CompareDisplayIds(int64_t id1, int64_t id2) {

Powered by Google App Engine
This is Rietveld 408576698