From 7152c349d7b4704d951e97af42d33cab1753ea7e Mon Sep 17 00:00:00 2001 From: "erikkay@google.com" Date: Wed, 3 Jun 2009 14:43:09 +0000 Subject: Fix client coordinates when forwarding mouse events to RenderWidgetHostView parents. A commit on behalf of tangjie: (already reviewed) http://codereview.chromium.org/113671 BUG=http://code.google.com/p/chromium/issues/detail?id=11901 TEST=click anywhere in the extension bar and note whether this also gets counted as a click on the tab that's directly above it veritcally. Review URL: http://codereview.chromium.org/119065 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17478 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/renderer_host/render_widget_host_view_win.cc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'chrome') diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.cc b/chrome/browser/renderer_host/render_widget_host_view_win.cc index f8e50c7..f6fa297 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_win.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc @@ -1025,7 +1025,18 @@ LRESULT RenderWidgetHostViewWin::OnMouseEvent(UINT message, WPARAM wparam, // Give the TabContents first crack at the message. It may want to // prevent forwarding to the renderer if some higher level browser // functionality is invoked. - if (SendMessage(GetParent(), message, wparam, lparam) != 0) + LPARAM parent_msg_lparam = lparam; + if (message != WM_MOUSELEAVE) { + // For the messages except WM_MOUSELEAVE, before forwarding them to + // parent window, we should adjust cursor position from client + // coordinates in current window to client coordinates in its parent + // window. + CPoint cursor_pos(GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)); + ClientToScreen(&cursor_pos); + GetParent().ScreenToClient(&cursor_pos); + parent_msg_lparam = MAKELPARAM(cursor_pos.x, cursor_pos.y); + } + if (SendMessage(GetParent(), message, wparam, parent_msg_lparam) != 0) return 1; } } -- cgit v1.1