From 844225a76a98aa3be5aca09c19ab72a5e7b6c38a Mon Sep 17 00:00:00 2001 From: memetao Date: Sun, 10 Dec 2023 13:42:20 +0800 Subject: [PATCH] Fix 'Image will be cropped if WindowCapturerWinGdi used' Bug: webrtc:15719 Change-Id: I7daf8ee5b90fbe9f1246f1d99211ffa0d8a19f73 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/330780 Reviewed-by: Alexander Cooper Commit-Queue: Alexander Cooper Cr-Commit-Position: refs/heads/main@{#41503} --- AUTHORS | 1 + modules/desktop_capture/win/window_capture_utils.cc | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/AUTHORS b/AUTHORS index 6e922401d0..968c896856 100644 --- a/AUTHORS +++ b/AUTHORS @@ -120,6 +120,7 @@ Silviu Caragea Stefan Gula Stephan Hartmann Steve Reid +Tao chen Takaaki Suzuki Tarun Chawla Todd Wong diff --git a/modules/desktop_capture/win/window_capture_utils.cc b/modules/desktop_capture/win/window_capture_utils.cc index ccfef49bc5..13f498f332 100644 --- a/modules/desktop_capture/win/window_capture_utils.cc +++ b/modules/desktop_capture/win/window_capture_utils.cc @@ -183,6 +183,13 @@ bool GetCroppedWindowRect(HWND window, is_maximized) { // Only apply this cropping to windows with a resize border (otherwise, // it'd clip the edges of captured pop-up windows without this border). + RECT rect; + DwmGetWindowAttribute(window, DWMWA_EXTENDED_FRAME_BOUNDS, &rect, + sizeof(RECT)); + // it's means that the window edge is not transparent + if (rect.left == original_rect->left()) { + return true; + } LONG style = GetWindowLong(window, GWL_STYLE); if (style & WS_THICKFRAME || style & DS_MODALFRAME) { int width = GetSystemMetrics(SM_CXSIZEFRAME);