From 27d5ad074c9121f0a2ae2f676c8a67b4e1c9e2b7 Mon Sep 17 00:00:00 2001 From: Julien Isorce Date: Tue, 2 Apr 2019 10:01:36 -0700 Subject: [PATCH] Fix mouse not being shared with Handgouts on Win10 When setting display scale to 200%, the mouse was shared only for the top left quarter. Regressed since https://chromium-review.googlesource.com/641075. Indeed frame->rect() takes into account scale_factor while the frame is constructed with a size that does not take this scale factor into account. Also make sure to do a float disivison in DesktopFrame::scale_factor() so that it returns 1.5 instead of 1 when dpi is 144 (i.e. 150%). Bug: chromium:948362 Change-Id: Ic10f44946c9f1b53181244a44a5b45109c259f9f Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/130371 Reviewed-by: Brave Yao Commit-Queue: Julien Isorce Cr-Commit-Position: refs/heads/master@{#27424} --- modules/desktop_capture/desktop_frame.cc | 5 +++++ modules/desktop_capture/desktop_frame.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/desktop_capture/desktop_frame.cc b/modules/desktop_capture/desktop_frame.cc index 2758ffa59e..eaee0aa26d 100644 --- a/modules/desktop_capture/desktop_frame.cc +++ b/modules/desktop_capture/desktop_frame.cc @@ -69,8 +69,13 @@ DesktopRect DesktopFrame::rect() const { float DesktopFrame::scale_factor() const { float scale = 1.0f; + +#if defined(WEBRTC_MAC) + // At least on Windows the logical and physical pixel are the same + // See http://crbug.com/948362. if (!dpi().is_zero() && dpi().x() == dpi().y()) scale = dpi().x() / kStandardDPI; +#endif return scale; } diff --git a/modules/desktop_capture/desktop_frame.h b/modules/desktop_capture/desktop_frame.h index 5c595a58e1..ef5ed7226f 100644 --- a/modules/desktop_capture/desktop_frame.h +++ b/modules/desktop_capture/desktop_frame.h @@ -22,7 +22,7 @@ namespace webrtc { -const int kStandardDPI = 96; +const float kStandardDPI = 96.0f; // DesktopFrame represents a video frame captured from the screen. class RTC_EXPORT DesktopFrame {