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

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

Issue 10802085: Correct behaviour of touch wrt mouse capture. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_view_win.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_win.cc b/content/browser/renderer_host/render_widget_host_view_win.cc
index d6dcddd16aa9c767bf2628e576b67a27b488a339..ebb6b73aadeb0d6932da96b254d7f5e32d9825fa 100644
--- a/content/browser/renderer_host/render_widget_host_view_win.cc
+++ b/content/browser/renderer_host/render_widget_host_view_win.cc
@@ -292,6 +292,15 @@ WebKit::WebMouseWheelEvent MakeFakeScrollWheelEvent(HWND hwnd,
return result;
}
+// Windows emulates mouse messages for touch events.
+bool IsEmulatedMouseEvent(UINT message) {
sky 2012/07/24 16:41:40 Move this to ui/base/win/events_win.h/events_win.c
girard 2012/07/24 19:49:01 Done.
+ return (message == WM_MOUSEMOVE ||
+ message == WM_LBUTTONDOWN || message == WM_LBUTTONUP ||
+ message == WM_RBUTTONDOWN || message == WM_RBUTTONUP) &&
+ (GetMessageExtraInfo() & MOUSEEVENTF_FROMTOUCH) ==
+ MOUSEEVENTF_FROMTOUCH;
+}
+
static const int kTouchMask = 0x7;
inline int GetTouchType(const TOUCHINPUT& point) {
@@ -1857,15 +1866,6 @@ LRESULT RenderWidgetHostViewWin::OnMouseEvent(UINT message, WPARAM wparam,
TRACE_EVENT0("browser", "RenderWidgetHostViewWin::OnMouseEvent");
handled = TRUE;
- // Windows sends (fake) mouse messages for touch events. Ignore these since
- // we're processing WM_TOUCH elsewhere.
- if (touch_events_enabled_ && (message == WM_MOUSEMOVE ||
- message == WM_LBUTTONDOWN || message == WM_LBUTTONUP ||
- message == WM_RBUTTONDOWN || message == WM_RBUTTONUP) &&
- (GetMessageExtraInfo() & MOUSEEVENTF_FROMTOUCH) ==
- MOUSEEVENTF_FROMTOUCH)
- return 0;
-
if (message == WM_MOUSELEAVE)
ignore_mouse_movement_ = true;
@@ -2919,9 +2919,13 @@ void RenderWidgetHostViewWin::ForwardMouseEventToRenderer(UINT message,
last_mouse_position_.unlocked_global.SetPoint(event.globalX, event.globalY);
}
- // Send the event to the renderer before changing mouse capture, so that the
- // capturelost event arrives after mouseup.
- render_widget_host_->ForwardMouseEvent(event);
+ // Windows sends (fake) mouse messages for touch events. Don't send these to
+ // the render widget.
+ if (!(touch_events_enabled_ && IsEmulatedMouseEvent(message))) {
+ // Send the event to the renderer before changing mouse capture, so that the
+ // capturelost event arrives after mouseup.
+ render_widget_host_->ForwardMouseEvent(event);
+ }
switch (event.type) {
case WebInputEvent::MouseMove:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698