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

Unified Diff: content/browser/renderer_host/render_widget_host_view_win.h

Issue 8791001: Fix mouse lock perf issue on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years 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: content/browser/renderer_host/render_widget_host_view_win.h
diff --git a/content/browser/renderer_host/render_widget_host_view_win.h b/content/browser/renderer_host/render_widget_host_view_win.h
index 0424f7a18b9b08fc4fd193b60d5619c35496c73f..d1426f600cde2355d644c24d068c66fe3cd2c8fe 100644
--- a/content/browser/renderer_host/render_widget_host_view_win.h
+++ b/content/browser/renderer_host/render_widget_host_view_win.h
@@ -335,7 +335,9 @@ class RenderWidgetHostViewWin
DWORD ex_style);
CPoint GetClientCenter() const;
- void MoveCursorToCenter() const;
+ // In mouse lock mode, moves the mouse cursor to the center of the view if it
+ // is too close to the border.
+ void MoveCursorToCenterIfNecessary();
void HandleLockedMouseEvent(UINT message, WPARAM wparam, LPARAM lparam);
@@ -479,12 +481,20 @@ class RenderWidgetHostViewWin
bool is_fullscreen_;
// Used to record the last position of the mouse.
- // While the mouse is locked, they store the last known position just as mouse
- // lock was entered.
+ // While the mouse is locked, |last_unlocked_mouse_position_| and
+ // |last_unlocked_global_mouse_position_| store the last known position just
+ // as mouse lock was entered.
// Relative to the upper-left corner of the view.
- gfx::Point last_mouse_position_;
+ gfx::Point last_unlocked_mouse_position_;
// Relative to the upper-left corner of the screen.
- gfx::Point last_global_mouse_position_;
+ gfx::Point last_unlocked_global_mouse_position_;
+ // Valid while the mouse is locked.
+ gfx::Point last_locked_global_mouse_position_;
+
+ // When the mouse cursor is moved to the center of the view by
+ // MoveCursorToCenterIfNecessary(), we ignore the resulting WM_MOUSEMOVE
+ // message.
+ bool ignore_move_to_center_message_;
// In the case of the mouse being moved away from the view and then moved
// back, we regard the mouse movement as (0, 0).

Powered by Google App Engine
This is Rietveld 408576698