diff --git a/Library/System.cpp b/Library/System.cpp index 457e5906..6736319b 100644 --- a/Library/System.cpp +++ b/Library/System.cpp @@ -29,14 +29,14 @@ enum TIMER { TIMER_SHOWDESKTOP = 1, - TIMER_COMPOSITION = 2, +// TIMER_COMPOSITION = 2, TIMER_NETSTATS = 3, TIMER_DELETELATER = 4 }; enum INTERVAL { INTERVAL_SHOWDESKTOP = 250, - INTERVAL_COMPOSITION = 250, +// INTERVAL_COMPOSITION = 250, INTERVAL_NETSTATS = 60000, INTERVAL_DELETELATER = 1000 }; @@ -48,7 +48,7 @@ HWND CSystem::c_HelperWindow = NULL; HWINEVENTHOOK CSystem::c_WinEventHook = NULL; -bool CSystem::c_DwmCompositionEnabled = false; +//bool CSystem::c_DwmCompositionEnabled = false; bool CSystem::c_ShowDesktop = false; OSPLATFORM CSystem::c_Platform = OSPLATFORM_UNKNOWN; @@ -109,7 +109,7 @@ void CSystem::Initialize(HINSTANCE instance) c_Monitors.monitors.reserve(8); SetMultiMonitorInfo(); - c_DwmCompositionEnabled = (DwmIsCompositionEnabled() == TRUE); +// c_DwmCompositionEnabled = (DwmIsCompositionEnabled() == TRUE); c_WinEventHook = SetWinEventHook( EVENT_SYSTEM_FOREGROUND, @@ -134,7 +134,7 @@ void CSystem::Initialize(HINSTANCE instance) void CSystem::Finalize() { KillTimer(c_Window, TIMER_SHOWDESKTOP); - KillTimer(c_Window, TIMER_COMPOSITION); +// KillTimer(c_Window, TIMER_COMPOSITION); KillTimer(c_Window, TIMER_NETSTATS); KillTimer(c_Window, TIMER_DELETELATER); @@ -905,29 +905,29 @@ LRESULT CALLBACK CSystem::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP CheckDesktopState(GetWorkerW()); return 0; - case TIMER_COMPOSITION: - { - if (GetShellDesktopWindow() || DesktopCompositionCheckCount >= 10) // 250ms * 10 = 2.5s - { - KillTimer(c_Window, TIMER_COMPOSITION); + //case TIMER_COMPOSITION: + // { + // if (GetShellDesktopWindow() || DesktopCompositionCheckCount >= 10) // 250ms * 10 = 2.5s + // { + // KillTimer(c_Window, TIMER_COMPOSITION); - c_WinEventHook = SetWinEventHook( - EVENT_SYSTEM_FOREGROUND, - EVENT_SYSTEM_FOREGROUND, - NULL, - MyWinEventProc, - 0, - 0, - WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS); + // c_WinEventHook = SetWinEventHook( + // EVENT_SYSTEM_FOREGROUND, + // EVENT_SYSTEM_FOREGROUND, + // NULL, + // MyWinEventProc, + // 0, + // 0, + // WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS); - SetTimer(c_Window, TIMER_SHOWDESKTOP, INTERVAL_SHOWDESKTOP, NULL); - } - else - { - ++DesktopCompositionCheckCount; - } - } - return 0; + // SetTimer(c_Window, TIMER_SHOWDESKTOP, INTERVAL_SHOWDESKTOP, NULL); + // } + // else + // { + // ++DesktopCompositionCheckCount; + // } + // } + // return 0; case TIMER_NETSTATS: CMeasureNet::UpdateIFTable(); @@ -944,24 +944,24 @@ LRESULT CALLBACK CSystem::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP } break; - case WM_DWMCOMPOSITIONCHANGED: - Log(LOG_NOTICE, L"System: DWM desktop composition has been changed."); + //case WM_DWMCOMPOSITIONCHANGED: + // Log(LOG_NOTICE, L"System: DWM desktop composition has been changed."); - KillTimer(c_Window, TIMER_SHOWDESKTOP); - KillTimer(c_Window, TIMER_COMPOSITION); + // KillTimer(c_Window, TIMER_SHOWDESKTOP); + // KillTimer(c_Window, TIMER_COMPOSITION); - if (c_WinEventHook) - { - UnhookWinEvent(c_WinEventHook); - c_WinEventHook = NULL; - } + // if (c_WinEventHook) + // { + // UnhookWinEvent(c_WinEventHook); + // c_WinEventHook = NULL; + // } - c_DwmCompositionEnabled = (DwmIsCompositionEnabled() == TRUE); + // c_DwmCompositionEnabled = (DwmIsCompositionEnabled() == TRUE); - DesktopCompositionCheckCount = 0; - SetTimer(c_Window, TIMER_COMPOSITION, INTERVAL_COMPOSITION, NULL); + // DesktopCompositionCheckCount = 0; + // SetTimer(c_Window, TIMER_COMPOSITION, INTERVAL_COMPOSITION, NULL); - return 0; + // return 0; case WM_DISPLAYCHANGE: Log(LOG_NOTICE, L"System: Display setting has been changed."); @@ -1093,30 +1093,30 @@ HMODULE CSystem::RmLoadLibrary(LPCWSTR lpLibFileName, DWORD* dwError, bool ignor ** Returns TRUE if the DWM desktop composition is enabled. ** */ -BOOL CSystem::DwmIsCompositionEnabled() -{ - BOOL fEnabled = FALSE; - - typedef HRESULT (WINAPI * FPDWMISCOMPOSITIONENABLED)(BOOL* pfEnabled); - - if (CSystem::GetOSPlatform() >= OSPLATFORM_VISTA) - { - HINSTANCE h = RmLoadLibrary(L"dwmapi.dll"); - if (h) - { - FPDWMISCOMPOSITIONENABLED DwmIsCompositionEnabled = (FPDWMISCOMPOSITIONENABLED)GetProcAddress(h, "DwmIsCompositionEnabled"); - if (DwmIsCompositionEnabled) - { - if (DwmIsCompositionEnabled(&fEnabled) != S_OK) - { - fEnabled = FALSE; - } - } - FreeLibrary(h); - } - } - return fEnabled; -} +//BOOL CSystem::DwmIsCompositionEnabled() +//{ +// BOOL fEnabled = FALSE; +// +// typedef HRESULT (WINAPI * FPDWMISCOMPOSITIONENABLED)(BOOL* pfEnabled); +// +// if (CSystem::GetOSPlatform() >= OSPLATFORM_VISTA) +// { +// HINSTANCE h = RmLoadLibrary(L"dwmapi.dll"); +// if (h) +// { +// FPDWMISCOMPOSITIONENABLED DwmIsCompositionEnabled = (FPDWMISCOMPOSITIONENABLED)GetProcAddress(h, "DwmIsCompositionEnabled"); +// if (DwmIsCompositionEnabled) +// { +// if (DwmIsCompositionEnabled(&fEnabled) != S_OK) +// { +// fEnabled = FALSE; +// } +// } +// FreeLibrary(h); +// } +// } +// return fEnabled; +//} /* ** CopyFiles diff --git a/Library/System.h b/Library/System.h index ea799b91..3905fef3 100644 --- a/Library/System.h +++ b/Library/System.h @@ -66,7 +66,7 @@ public: static const MULTIMONITOR_INFO& GetMultiMonitorInfo() { return c_Monitors; } static size_t GetMonitorCount(); - static bool GetDwmCompositionEnabled() { return c_DwmCompositionEnabled; } +// static bool GetDwmCompositionEnabled() { return c_DwmCompositionEnabled; } static bool GetShowDesktop() { return c_ShowDesktop; } static HWND GetShellDesktopWindow(bool findWorkerW = false); @@ -107,7 +107,7 @@ private: static MULTIMONITOR_INFO c_Monitors; // Multi-Monitor info - static bool c_DwmCompositionEnabled; +// static bool c_DwmCompositionEnabled; static bool c_ShowDesktop; static OSPLATFORM c_Platform;