diff --git a/Library/MeterWindow.cpp b/Library/MeterWindow.cpp index 1a654e58..39f45ba6 100644 --- a/Library/MeterWindow.cpp +++ b/Library/MeterWindow.cpp @@ -2921,7 +2921,7 @@ void CMeterWindow::Update(bool nodraw) // If our option is to disable when in an RDP session, then check if in an RDP session. // Only redraw if we are not in a remote session - if (!m_Rainmeter->GetDisableRDP() || !GetSystemMetrics(SM_REMOTESESSION)) + if (m_Rainmeter->IsRedrawable()) { Redraw(); } diff --git a/Library/MeterWindow.h b/Library/MeterWindow.h index 5cabe4c4..9b57a505 100644 --- a/Library/MeterWindow.h +++ b/Library/MeterWindow.h @@ -181,6 +181,7 @@ public: void Deactivate(); void Refresh(bool init, bool all = false); void Redraw(); + void RedrawWindow() { UpdateTransparency(m_TransparencyValue, false); } void SetVariable(const std::wstring& variable, const std::wstring& value); void SetOption(const std::wstring& section, const std::wstring& option, const std::wstring& value, bool group); @@ -240,8 +241,6 @@ public: bool GetMeterToolTipHidden() { return m_ToolTipHidden; } bool GetMeterMouseActionCursor() { return m_MouseActionCursor; } - void AddMeasureBang(const WCHAR* bang, int index, CMeasure* measure); - void MakePathAbsolute(std::wstring& path); Gdiplus::PrivateFontCollection* GetPrivateFontCollection() { return m_FontCollection; } diff --git a/Library/Rainmeter.h b/Library/Rainmeter.h index 4a1a14f4..7af0f35f 100644 --- a/Library/Rainmeter.h +++ b/Library/Rainmeter.h @@ -190,6 +190,7 @@ public: void DeleteLogFile(); bool GetDisableRDP() { return m_DisableRDP; } + bool IsRedrawable() { return (!GetDisableRDP() || !GetSystemMetrics(SM_REMOTESESSION)); } bool GetDisableDragging() { return m_DisableDragging; } void SetDisableDragging(bool dragging); diff --git a/Library/System.cpp b/Library/System.cpp index d47c47cb..af9d8bbc 100644 --- a/Library/System.cpp +++ b/Library/System.cpp @@ -32,12 +32,14 @@ using namespace Gdiplus; enum TIMER { - TIMER_SHOWDESKTOP = 1 + TIMER_SHOWDESKTOP = 1, + TIMER_RESUME = 2 }; enum INTERVAL { INTERVAL_SHOWDESKTOP = 250, - INTERVAL_RESTOREWINDOWS = 100 + INTERVAL_RESTOREWINDOWS = 100, + INTERVAL_RESUME = 1000 }; MULTIMONITOR_INFO CSystem::c_Monitors = { 0 }; @@ -133,6 +135,7 @@ void CSystem::Initialize(HINSTANCE instance) void CSystem::Finalize() { KillTimer(c_Window, TIMER_SHOWDESKTOP); + KillTimer(c_Window, TIMER_RESUME); if (c_WinEventHook) { @@ -999,9 +1002,26 @@ LRESULT CALLBACK CSystem::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP break; case WM_TIMER: - if (wParam == TIMER_SHOWDESKTOP) + switch (wParam) { - CheckDesktopState(GetWorkerW()); + case TIMER_SHOWDESKTOP: + if (wParam == TIMER_SHOWDESKTOP) + { + CheckDesktopState(GetWorkerW()); + } + break; + + case TIMER_RESUME: + KillTimer(hWnd, TIMER_RESUME); + if (Rainmeter->IsRedrawable()) + { + std::map::const_iterator iter = Rainmeter->GetAllMeterWindows().begin(); + for ( ; iter != Rainmeter->GetAllMeterWindows().end(); ++iter) + { + (*iter).second->RedrawWindow(); + } + } + break; } break; @@ -1028,6 +1048,14 @@ LRESULT CALLBACK CSystem::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP } break; + case WM_POWERBROADCAST: + if (wParam == PBT_APMRESUMESUSPEND) + { + // Deliver PBT_APMRESUMESUSPEND event to all meter windows + SetTimer(hWnd, TIMER_RESUME, INTERVAL_RESUME, NULL); + } + return TRUE; + default: return DefWindowProc(hWnd, uMsg, wParam, lParam); }