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/webrtc@5487 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/modules/desktop_capture/mouse_cursor_monitor_win.cc b/modules/desktop_capture/mouse_cursor_monitor_win.cc
index 01dace9..fc041ef 100644
--- a/modules/desktop_capture/mouse_cursor_monitor_win.cc
+++ b/modules/desktop_capture/mouse_cursor_monitor_win.cc
@@ -105,9 +105,12 @@
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);