Fix a cursor capturing issue on Windows.

The input position to WindowFromPoint should be relative to the desktop, not
relative to the window; if the result from WindowFromPoint is a child window
of the shared top window, it should be captured.

BUG=
R=sergeyu@chromium.org

Review URL: https://webrtc-codereview.appspot.com/7959004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5487 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
jiayl@webrtc.org 2014-02-04 17:49:12 +00:00
parent 0e5a2b5de6
commit 20a60ea39d

View File

@ -105,9 +105,12 @@ void MouseCursorMonitorWin::Capture() {
position.set(0, 0);
inside = false;
} else {
if (inside) {
HWND windowUnderCursor = WindowFromPoint(cursor_info.ptScreenPos);
inside = windowUnderCursor ?
(window_ == GetAncestor(windowUnderCursor, GA_ROOT)) : false;
}
position = position.subtract(DesktopVector(rect.left, rect.top));
if (inside)
inside = (window_ == WindowFromPoint(cursor_info.ptScreenPos));
}
} else {
assert(screen_ != kInvalidScreenId);