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

Unified Diff: ash/display/display_controller.cc

Issue 10835047: Allow the cursor to warp even when a window is dragged (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: do not move modal windows to another display Created 8 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
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;
}

Powered by Google App Engine
This is Rietveld 408576698