summaryrefslogtreecommitdiffstats
path: root/win8
diff options
context:
space:
mode:
authorananta <ananta@chromium.org>2014-09-10 17:43:12 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-11 00:45:04 +0000
commitb306b1e61ab3178f8d5ab54a2233e748d926bd4d (patch)
tree57de5209ebad24095ba64c7179a866cab3cec6b8 /win8
parent6226ba678c3a1ad61db05cdd9174da335856ef48 (diff)
downloadchromium_src-b306b1e61ab3178f8d5ab54a2233e748d926bd4d.zip
chromium_src-b306b1e61ab3178f8d5ab54a2233e748d926bd4d.tar.gz
chromium_src-b306b1e61ab3178f8d5ab54a2233e748d926bd4d.tar.bz2
Ensure that mouse lock works correctly on Chrome ASH in Windows 8.
The lock mouse operation invoked by plugins or pages hides the mouse cursor and ensures that the cursor stays within the bounds of the webpage. To ensure that the mouse stays within the bounds of the page, the SetCursorPos operation is executed by the host. In ASH, the SetCursorPos API is executed by the viewer process for historical reasons. As a result on Windows 8 there is a faint possibility that the user may move the mouse to the charms section of the OS, which causes the cursor to become visible. Fix for this is to track if the mouse changed from what was last set in the viewer process and restore it. The other change is in the RemoteWindowTreeHostWin class where the member ignore_mouse_moves_until_set_cursor_ack_ has been changed to a count from a bool flag. This is because the RemoteWindowTreeHostWin::MoveCursorToNative function can be called multiple times before the acks are received causing DCHECKs to fire on the ignore_mouse_moves_until_set_cursor_ack_ flag. BUG=398792 Review URL: https://codereview.chromium.org/560633002 Cr-Commit-Position: refs/heads/master@{#294274}
Diffstat (limited to 'win8')
-rw-r--r--win8/metro_driver/chrome_app_view_ash.cc11
-rw-r--r--win8/metro_driver/chrome_app_view_ash.h3
2 files changed, 12 insertions, 2 deletions
diff --git a/win8/metro_driver/chrome_app_view_ash.cc b/win8/metro_driver/chrome_app_view_ash.cc
index 9af58b7..2f615d3 100644
--- a/win8/metro_driver/chrome_app_view_ash.cc
+++ b/win8/metro_driver/chrome_app_view_ash.cc
@@ -530,7 +530,8 @@ ChromeAppViewAsh::ChromeAppViewAsh()
ui_channel_(nullptr),
core_window_hwnd_(NULL),
metro_dpi_scale_(0),
- win32_dpi_scale_(0) {
+ win32_dpi_scale_(0),
+ last_cursor_(NULL) {
DVLOG(1) << __FUNCTION__;
globals.previous_state =
winapp::Activation::ApplicationExecutionState_NotRunning;
@@ -815,7 +816,8 @@ void ChromeAppViewAsh::OnOpenURLOnDesktop(const base::FilePath& shortcut,
}
void ChromeAppViewAsh::OnSetCursor(HCURSOR cursor) {
- ::SetCursor(HCURSOR(cursor));
+ ::SetCursor(cursor);
+ last_cursor_ = cursor;
}
void ChromeAppViewAsh::OnDisplayFileOpenDialog(
@@ -1082,6 +1084,11 @@ HRESULT ChromeAppViewAsh::OnPointerMoved(winui::Core::ICoreWindow* sender,
return hr;
if (pointer.IsMouse()) {
+ // If the mouse was moved towards the charms or the OS specific section,
+ // the cursor may change from what the browser last set. Restore it here.
+ if (::GetCursor() != last_cursor_)
+ SetCursor(last_cursor_);
+
GenerateMouseEventFromMoveIfNecessary(pointer);
ui_channel_->Send(new MetroViewerHostMsg_MouseMoved(
pointer.x(),
diff --git a/win8/metro_driver/chrome_app_view_ash.h b/win8/metro_driver/chrome_app_view_ash.h
index 102d010..ca0dad5 100644
--- a/win8/metro_driver/chrome_app_view_ash.h
+++ b/win8/metro_driver/chrome_app_view_ash.h
@@ -238,6 +238,9 @@ class ChromeAppViewAsh
// The win32 dpi scale which is queried via GetDeviceCaps. Please refer to
// ui/gfx/win/dpi.cc for more information.
float win32_dpi_scale_;
+
+ // The cursor set by the chroem browser process.
+ HCURSOR last_cursor_;
};
#endif // WIN8_METRO_DRIVER_CHROME_APP_VIEW_ASH_H_