Adjust cursor position to take multiple screens into consideration

The position returned from last_mouse_position() is in screen
co-ordinates but the calculation steps for the composition expect that
the cursor position be relative to the desktop dimentions.

This change transforms the screen relative position into a position
relative to the desktop window and hence relative to the secondary
display.

BUG=371761
TEST=Under ChromeOS capture a secondary screen and observe that the
pointer is now composed into the video steam in the correct place

Review URL: https://codereview.chromium.org/278873002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269650 0039d316-1c4b-4281-b951-d872f2087c98
parent 1d9d3b0f
......@@ -19,6 +19,7 @@
#include "media/video/capture/video_capture_types.h"
#include "skia/ext/image_operations.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/aura/client/screen_position_client.h"
#include "ui/aura/env.h"
#include "ui/aura/window.h"
#include "ui/aura/window_observer.h"
......@@ -458,6 +459,8 @@ gfx::Point DesktopVideoCaptureMachine::UpdateCursorState(
}
gfx::Point cursor_position = aura::Env::GetInstance()->last_mouse_location();
aura::client::GetScreenPositionClient(desktop_window_->GetRootWindow())->
ConvertPointFromScreen(desktop_window_, &cursor_position);
const gfx::Point hot_point_in_dip = ui::ConvertPointToDIP(
desktop_layer_, cursor_hot_point_);
cursor_position.Offset(-desktop_bounds.x() - hot_point_in_dip.x(),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment