OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include "webrtc/modules/desktop_capture/win/window_capture_utils.h" | 11 #include "webrtc/modules/desktop_capture/win/window_capture_utils.h" |
12 #include "webrtc/base/win32.h" | |
Do not use (sergeyu)
2017/07/06 20:35:49
add empty line here. https://google.github.io/styl
Do not use (sergeyu)
2017/07/06 20:35:49
I think you want to include webrtc/rtc_base/win32.
braveyao1
2017/07/06 22:10:47
Done.
braveyao1
2017/07/06 22:10:47
Done.
| |
12 | 13 |
13 namespace webrtc { | 14 namespace webrtc { |
14 | 15 |
15 bool | 16 bool |
16 GetCroppedWindowRect(HWND window, | 17 GetCroppedWindowRect(HWND window, |
17 DesktopRect* cropped_rect, | 18 DesktopRect* cropped_rect, |
18 DesktopRect* original_rect) { | 19 DesktopRect* original_rect) { |
19 RECT rect; | 20 RECT rect; |
20 if (!GetWindowRect(window, &rect)) { | 21 if (!GetWindowRect(window, &rect)) { |
21 return false; | 22 return false; |
22 } | 23 } |
23 WINDOWPLACEMENT window_placement; | 24 WINDOWPLACEMENT window_placement; |
24 window_placement.length = sizeof(window_placement); | 25 window_placement.length = sizeof(window_placement); |
25 if (!GetWindowPlacement(window, &window_placement)) { | 26 if (!GetWindowPlacement(window, &window_placement)) { |
26 return false; | 27 return false; |
27 } | 28 } |
28 | 29 |
29 *original_rect = DesktopRect::MakeLTRB( | 30 *original_rect = DesktopRect::MakeLTRB( |
30 rect.left, rect.top, rect.right, rect.bottom); | 31 rect.left, rect.top, rect.right, rect.bottom); |
31 | 32 |
32 if (window_placement.showCmd == SW_SHOWMAXIMIZED) { | 33 if (rtc::IsWindows8OrLater() || |
Do not use (sergeyu)
2017/07/06 20:36:37
Please add a comment here to explain why we want t
braveyao1
2017/07/06 22:10:47
Done.
| |
34 window_placement.showCmd == SW_SHOWMAXIMIZED) { | |
33 DesktopSize border = DesktopSize(GetSystemMetrics(SM_CXSIZEFRAME), | 35 DesktopSize border = DesktopSize(GetSystemMetrics(SM_CXSIZEFRAME), |
34 GetSystemMetrics(SM_CYSIZEFRAME)); | 36 GetSystemMetrics(SM_CYSIZEFRAME)); |
35 *cropped_rect = DesktopRect::MakeLTRB( | 37 *cropped_rect = DesktopRect::MakeLTRB( |
36 rect.left + border.width(), | 38 rect.left + border.width(), |
37 rect.top, | 39 rect.top, |
Do not use (sergeyu)
2017/07/06 20:35:49
Here we don't crop the top border. Is that the beh
braveyao1
2017/07/06 22:10:47
Yes. The top doesn't have that border.
| |
38 rect.right - border.width(), | 40 rect.right - border.width(), |
39 rect.bottom - border.height()); | 41 rect.bottom - border.height()); |
40 } else { | 42 } else { |
41 *cropped_rect = *original_rect; | 43 *cropped_rect = *original_rect; |
42 } | 44 } |
43 return true; | 45 return true; |
44 } | 46 } |
45 | 47 |
46 AeroChecker::AeroChecker() : dwmapi_library_(nullptr), func_(nullptr) { | 48 AeroChecker::AeroChecker() : dwmapi_library_(nullptr), func_(nullptr) { |
47 // Try to load dwmapi.dll dynamically since it is not available on XP. | 49 // Try to load dwmapi.dll dynamically since it is not available on XP. |
(...skipping 12 matching lines...) Expand all Loading... | |
60 | 62 |
61 bool AeroChecker::IsAeroEnabled() { | 63 bool AeroChecker::IsAeroEnabled() { |
62 BOOL result = FALSE; | 64 BOOL result = FALSE; |
63 if (func_) { | 65 if (func_) { |
64 func_(&result); | 66 func_(&result); |
65 } | 67 } |
66 return result != FALSE; | 68 return result != FALSE; |
67 } | 69 } |
68 | 70 |
69 } // namespace webrtc | 71 } // namespace webrtc |
OLD | NEW |