Chromium Code Reviews| Index: webrtc/modules/desktop_capture/win/window_capture_utils.cc |
| diff --git a/webrtc/modules/desktop_capture/win/window_capture_utils.cc b/webrtc/modules/desktop_capture/win/window_capture_utils.cc |
| index bfe7363f32d8c69b64a59e2388b47cb1a6c08ef5..bfa064d4d69ebca720ef589ba02277438b3ccf25 100644 |
| --- a/webrtc/modules/desktop_capture/win/window_capture_utils.cc |
| +++ b/webrtc/modules/desktop_capture/win/window_capture_utils.cc |
| @@ -10,6 +10,8 @@ |
| #include "webrtc/modules/desktop_capture/win/window_capture_utils.h" |
| +#include "webrtc/base/criticalsection.h" |
| + |
| namespace webrtc { |
| bool |
| @@ -43,4 +45,29 @@ GetCroppedWindowRect(HWND window, |
| return true; |
| } |
| +bool IsAeroEnabled() { |
| + typedef HRESULT (WINAPI *DwmIsCompositionEnabledFunc)(BOOL* enabled); |
| + |
| + 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
|
| + rtc::GlobalLockScope lock_scope(&lock); |
| + |
| + static bool initialized = false; |
| + static BOOL aero_enabled = FALSE; |
| + |
| + if (!initialized) { |
| + // Try to load dwmapi.dll dynamically since it is not available on XP. |
| + HMODULE dwmapi_library = LoadLibrary(L"dwmapi.dll"); |
| + if (dwmapi_library) { |
| + DwmIsCompositionEnabledFunc is_composition_enabled_func = |
| + reinterpret_cast<DwmIsCompositionEnabledFunc>( |
| + GetProcAddress(dwmapi_library, "DwmIsCompositionEnabled")); |
| + 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'
|
| + FreeLibrary(dwmapi_library); |
| + } |
| + initialized = true; |
| + } |
| + |
| + return aero_enabled != FALSE; |
| +} |
| + |
| } // namespace webrtc |