summaryrefslogtreecommitdiffstats
path: root/content/browser/renderer_host/render_widget_host_view_win.h
diff options
context:
space:
mode:
authoryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-22 03:36:37 +0000
committeryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-22 03:36:37 +0000
commit67bfb83fbdd401bba2cfdbe330edebf2b3105a6f (patch)
treea7ed2dc89b3161efdb13cf5b163aa1a61d2e07b6 /content/browser/renderer_host/render_widget_host_view_win.h
parent88de6c013ddad04c6896f10714c787ce21cf858a (diff)
downloadchromium_src-67bfb83fbdd401bba2cfdbe330edebf2b3105a6f.zip
chromium_src-67bfb83fbdd401bba2cfdbe330edebf2b3105a6f.tar.gz
chromium_src-67bfb83fbdd401bba2cfdbe330edebf2b3105a6f.tar.bz2
Mouse lock implementation, including the renderer side and the Windows version of the browser side.
BUG=41781 TEST=Manual test in ppapi/examples/mouse_lock Review URL: http://codereview.chromium.org/7863003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102234 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/renderer_host/render_widget_host_view_win.h')
-rw-r--r--content/browser/renderer_host/render_widget_host_view_win.h20
1 files changed, 20 insertions, 0 deletions
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 74e58a6..6a9511f 100644
--- a/content/browser/renderer_host/render_widget_host_view_win.h
+++ b/content/browser/renderer_host/render_widget_host_view_win.h
@@ -26,6 +26,7 @@
#include "content/common/notification_registrar.h"
#include "ui/base/win/ime_input.h"
#include "ui/gfx/native_widget_types.h"
+#include "ui/gfx/point.h"
#include "webkit/glue/webcursor.h"
class BackingStore;
@@ -181,6 +182,8 @@ class RenderWidgetHostViewWin
virtual void OnAccessibilityNotifications(
const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params
) OVERRIDE;
+ virtual bool LockMouse() OVERRIDE;
+ virtual void UnlockMouse() OVERRIDE;
// Implementation of NotificationObserver:
virtual void Observe(int type,
@@ -291,6 +294,11 @@ class RenderWidgetHostViewWin
const gfx::Rect& pos,
DWORD ex_style);
+ CPoint GetClientCenter() const;
+ void MoveCursorToCenter() const;
+
+ void HandleLockedMouseEvent(UINT message, WPARAM wparam, LPARAM lparam);
+
// The associated Model. While |this| is being Destroyed,
// |render_widget_host_| is NULL and the Windows message loop is run one last
// time. Message handlers must check for a NULL |render_widget_host_|.
@@ -386,6 +394,18 @@ class RenderWidgetHostViewWin
// Is the widget fullscreen?
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.
+ // Relative to the upper-left corner of the view.
+ gfx::Point last_mouse_position_;
+ // Relative to the upper-left corner of the screen.
+ gfx::Point last_global_mouse_position_;
+
+ // In the case of the mouse being moved away from the view and then moved
+ // back, we regard the mouse movement as (0, 0).
+ bool ignore_mouse_movement_;
+
DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewWin);
};