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

Unified Diff: ash/display/extended_mouse_warp_controller.cc

Issue 1631023002: Fix moving the mouse between two displays after the secondary display becomes primary. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Created 4 years, 11 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/extended_mouse_warp_controller.cc
diff --git a/ash/display/extended_mouse_warp_controller.cc b/ash/display/extended_mouse_warp_controller.cc
index 8d044637b91f67dcbd7fd421bff48944cbe86f6e..e1846c540fc2b86b179f07b100ffb5704b05ad0f 100644
--- a/ash/display/extended_mouse_warp_controller.cc
+++ b/ash/display/extended_mouse_warp_controller.cc
@@ -88,18 +88,21 @@ ExtendedMouseWarpController::ExtendedMouseWarpController(
drag_source != nullptr);
}
} else {
+ // Make sure to set |a| as the primary display, and |b| as the secondary
+ // display. DisplayLayout::Position is defined in terms of primary.
DisplayLayout::Position position =
display_manager->GetCurrentDisplayLayout().position;
- const gfx::Display& a = display_manager->GetDisplayAt(0);
- const gfx::Display& b = display_manager->GetDisplayAt(1);
+ const gfx::Display& a = Shell::GetScreen()->GetPrimaryDisplay();
+ const gfx::Display& b = ScreenUtil::GetSecondaryDisplay();
// TODO(oshima): Use ComputeBondary instead.
- if (position == DisplayLayout::TOP || position == DisplayLayout::BOTTOM)
+ if (position == DisplayLayout::TOP || position == DisplayLayout::BOTTOM) {
AddWarpRegion(CreateHorizontalEdgeBounds(a, b, position),
drag_source != nullptr);
- else
+ } else {
AddWarpRegion(CreateVerticalEdgeBounds(a, b, position),
drag_source != nullptr);
+ }
}
}
@@ -148,8 +151,8 @@ void ExtendedMouseWarpController::SetEnabled(bool enabled) {
void ExtendedMouseWarpController::AddWarpRegion(
scoped_ptr<WarpRegion> warp_region,
- bool drag_source) {
- if (drag_source) {
+ bool has_drag_source) {
+ if (has_drag_source) {
warp_region->shared_display_edge_indicator.reset(
new SharedDisplayEdgeIndicator);
warp_region->shared_display_edge_indicator->Show(

Powered by Google App Engine
This is Rietveld 408576698