The SW_SHOWXXX values are not bitfields, so using "&" is incorrect. BUG=none TEST=Verify that Chrome's WebRTC window-capture feature can capture an unoccluded, non-maximized window correctly under Windows 8 or above. R=wez@chromium.org Review URL: https://codereview.webrtc.org/1180673009 Cr-Commit-Position: refs/heads/master@{#9421}
47 lines
1.4 KiB
C++
47 lines
1.4 KiB
C++
/*
|
|
* Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
|
|
#include "webrtc/modules/desktop_capture/win/window_capture_utils.h"
|
|
|
|
namespace webrtc {
|
|
|
|
bool
|
|
GetCroppedWindowRect(HWND window,
|
|
DesktopRect* cropped_rect,
|
|
DesktopRect* original_rect) {
|
|
RECT rect;
|
|
if (!GetWindowRect(window, &rect)) {
|
|
return false;
|
|
}
|
|
WINDOWPLACEMENT window_placement;
|
|
window_placement.length = sizeof(window_placement);
|
|
if (!GetWindowPlacement(window, &window_placement)) {
|
|
return false;
|
|
}
|
|
|
|
*original_rect = DesktopRect::MakeLTRB(
|
|
rect.left, rect.top, rect.right, rect.bottom);
|
|
|
|
if (window_placement.showCmd == SW_SHOWMAXIMIZED) {
|
|
DesktopSize border = DesktopSize(GetSystemMetrics(SM_CXSIZEFRAME),
|
|
GetSystemMetrics(SM_CYSIZEFRAME));
|
|
*cropped_rect = DesktopRect::MakeLTRB(
|
|
rect.left + border.width(),
|
|
rect.top,
|
|
rect.right - border.width(),
|
|
rect.bottom - border.height());
|
|
} else {
|
|
*cropped_rect = *original_rect;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
} // namespace webrtc
|