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 |
(...skipping 24 matching lines...) Expand all Loading... | |
35 DWORD selected_window_process_id; | 35 DWORD selected_window_process_id; |
36 DesktopRect selected_window_rect; | 36 DesktopRect selected_window_rect; |
37 }; | 37 }; |
38 | 38 |
39 // The function is called during EnumWindow for every window enumerated and is | 39 // The function is called during EnumWindow for every window enumerated and is |
40 // responsible for verifying if the selected window is on top. | 40 // responsible for verifying if the selected window is on top. |
41 BOOL CALLBACK TopWindowVerifier(HWND hwnd, LPARAM param) { | 41 BOOL CALLBACK TopWindowVerifier(HWND hwnd, LPARAM param) { |
42 TopWindowVerifierContext* context = | 42 TopWindowVerifierContext* context = |
43 reinterpret_cast<TopWindowVerifierContext*>(param); | 43 reinterpret_cast<TopWindowVerifierContext*>(param); |
44 | 44 |
45 if (hwnd == context->selected_window) { | |
46 context->is_top_window = true; | |
47 return FALSE; | |
48 } | |
49 | |
50 // Ignore the excluded window. | 45 // Ignore the excluded window. |
51 if (hwnd == context->excluded_window) { | 46 if (hwnd == context->excluded_window) { |
52 return TRUE; | 47 return TRUE; |
53 } | 48 } |
54 | 49 |
55 // Ignore hidden or minimized window. | 50 // Ignore hidden or minimized window. |
56 if (IsIconic(hwnd) || !IsWindowVisible(hwnd)) { | 51 if (IsIconic(hwnd) || !IsWindowVisible(hwnd)) { |
57 return TRUE; | 52 return TRUE; |
58 } | 53 } |
59 | 54 |
55 if (hwnd == context->selected_window) { | |
Hzj_jie
2017/08/07 19:28:29
After this change, unnecessary checks for other wi
| |
56 context->is_top_window = true; | |
57 return FALSE; | |
58 } | |
60 // Ignore descendant/owned windows since we want to capture them. | 59 // Ignore descendant/owned windows since we want to capture them. |
61 // This check does not work for tooltips and context menus. Drop down menus | 60 // This check does not work for tooltips and context menus. Drop down menus |
62 // and popup windows are fine. | 61 // and popup windows are fine. |
63 if (GetAncestor(hwnd, GA_ROOTOWNER) == context->selected_window) { | 62 if (GetAncestor(hwnd, GA_ROOTOWNER) == context->selected_window) { |
64 return TRUE; | 63 return TRUE; |
65 } | 64 } |
66 | 65 |
67 // If |hwnd| has no title and belongs to the same process, assume it's a | 66 // If |hwnd| has no title and belongs to the same process, assume it's a |
68 // tooltip or context menu from the selected window and ignore it. | 67 // tooltip or context menu from the selected window and ignore it. |
69 const size_t kTitleLength = 32; | 68 const size_t kTitleLength = 32; |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
210 } // namespace | 209 } // namespace |
211 | 210 |
212 // static | 211 // static |
213 std::unique_ptr<DesktopCapturer> CroppingWindowCapturer::CreateCapturer( | 212 std::unique_ptr<DesktopCapturer> CroppingWindowCapturer::CreateCapturer( |
214 const DesktopCaptureOptions& options) { | 213 const DesktopCaptureOptions& options) { |
215 return std::unique_ptr<DesktopCapturer>( | 214 return std::unique_ptr<DesktopCapturer>( |
216 new CroppingWindowCapturerWin(options)); | 215 new CroppingWindowCapturerWin(options)); |
217 } | 216 } |
218 | 217 |
219 } // namespace webrtc | 218 } // namespace webrtc |
OLD | NEW |