Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: webrtc/modules/desktop_capture/win/window_capture_utils.cc

Issue 1199073002: Enable cropping window capturing for Win7 when Aero is disabled. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 12
13 #include "webrtc/base/criticalsection.h"
14
13 namespace webrtc { 15 namespace webrtc {
14 16
15 bool 17 bool
16 GetCroppedWindowRect(HWND window, 18 GetCroppedWindowRect(HWND window,
17 DesktopRect* cropped_rect, 19 DesktopRect* cropped_rect,
18 DesktopRect* original_rect) { 20 DesktopRect* original_rect) {
19 RECT rect; 21 RECT rect;
20 if (!GetWindowRect(window, &rect)) { 22 if (!GetWindowRect(window, &rect)) {
21 return false; 23 return false;
22 } 24 }
(...skipping 13 matching lines...) Expand all
36 rect.left + border.width(), 38 rect.left + border.width(),
37 rect.top, 39 rect.top,
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
48 bool IsAeroEnabled() {
49 typedef HRESULT (WINAPI *DwmIsCompositionEnabledFunc)(BOOL* enabled);
50
51 static rtc::GlobalLockPod lock;
Sergey Ulanov 2015/07/14 20:15:50 I'm not sure it's safe to have this static inside
jiayl2 2015/07/14 22:25:32 Removed
52 rtc::GlobalLockScope lock_scope(&lock);
53
54 static bool initialized = false;
55 static BOOL aero_enabled = FALSE;
56
57 if (!initialized) {
58 // Try to load dwmapi.dll dynamically since it is not available on XP.
59 HMODULE dwmapi_library = LoadLibrary(L"dwmapi.dll");
60 if (dwmapi_library) {
61 DwmIsCompositionEnabledFunc is_composition_enabled_func =
62 reinterpret_cast<DwmIsCompositionEnabledFunc>(
63 GetProcAddress(dwmapi_library, "DwmIsCompositionEnabled"));
64 is_composition_enabled_func(&aero_enabled);
Sergey Ulanov 2015/07/14 20:15:50 You can store is_composition_enabled_func between
jiayl2 2015/07/14 22:25:32 The static method way doesn't work since it doesn'
65 FreeLibrary(dwmapi_library);
66 }
67 initialized = true;
68 }
69
70 return aero_enabled != FALSE;
71 }
72
46 } // namespace webrtc 73 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/desktop_capture/win/window_capture_utils.h ('k') | webrtc/modules/desktop_capture/window_capturer_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698