| Index: ash/display/display_controller.cc
|
| diff --git a/ash/display/display_controller.cc b/ash/display/display_controller.cc
|
| index a4eceb48bb21abb1c6697eb46ab5557eebcdd370..172f72dd968a583d220f6d809dd2e24843f04cdf 100644
|
| --- a/ash/display/display_controller.cc
|
| +++ b/ash/display/display_controller.cc
|
| @@ -23,7 +23,8 @@ namespace ash {
|
| namespace internal {
|
|
|
| DisplayController::DisplayController()
|
| - : secondary_display_layout_(RIGHT) {
|
| + : secondary_display_layout_(RIGHT),
|
| + allow_warp_during_lock_(false) {
|
| aura::Env::GetInstance()->display_manager()->AddObserver(this);
|
| }
|
|
|
| @@ -122,7 +123,11 @@ void DisplayController::SetSecondaryDisplayLayout(
|
|
|
| bool DisplayController::WarpMouseCursorIfNecessary(
|
| aura::RootWindow* current_root,
|
| - const gfx::Point& point_in_root) {
|
| + const gfx::Point& point_in_root,
|
| + bool is_cursor_locked) {
|
| + if (is_cursor_locked && !allow_warp_during_lock_)
|
| + return false;
|
| +
|
| if (root_windows_.size() < 2)
|
| return false;
|
|
|
| @@ -130,13 +135,14 @@ bool DisplayController::WarpMouseCursorIfNecessary(
|
| int offset_x = 0;
|
| int offset_y = 0;
|
| if (point_in_root.x() <= root_bounds.x()) {
|
| - offset_x = -1;
|
| + // Use -2, not -1, to avoid infinite loop of pointer warp.
|
| + offset_x = -2;
|
| } else if (point_in_root.x() >= root_bounds.right() - 1) {
|
| - offset_x = 1;
|
| + offset_x = 2;
|
| } else if (point_in_root.y() <= root_bounds.y()) {
|
| - offset_y = -1;
|
| + offset_y = -2;
|
| } else if (point_in_root.y() >= root_bounds.bottom() - 1) {
|
| - offset_y = 1;
|
| + offset_y = 2;
|
| } else {
|
| return false;
|
| }
|
|
|