Added workaround for the issue that skins disappear when resuming from sleep mode.

http://rainmeter.net/forum/viewtopic.php?f=5&t=11313
This commit is contained in:
spx 2012-02-20 15:33:13 +00:00
parent 0fec35edaa
commit 3254520ced
4 changed files with 35 additions and 7 deletions

View File

@ -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. // 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 // Only redraw if we are not in a remote session
if (!m_Rainmeter->GetDisableRDP() || !GetSystemMetrics(SM_REMOTESESSION)) if (m_Rainmeter->IsRedrawable())
{ {
Redraw(); Redraw();
} }

View File

@ -181,6 +181,7 @@ public:
void Deactivate(); void Deactivate();
void Refresh(bool init, bool all = false); void Refresh(bool init, bool all = false);
void Redraw(); void Redraw();
void RedrawWindow() { UpdateTransparency(m_TransparencyValue, false); }
void SetVariable(const std::wstring& variable, const std::wstring& value); 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); 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 GetMeterToolTipHidden() { return m_ToolTipHidden; }
bool GetMeterMouseActionCursor() { return m_MouseActionCursor; } bool GetMeterMouseActionCursor() { return m_MouseActionCursor; }
void AddMeasureBang(const WCHAR* bang, int index, CMeasure* measure);
void MakePathAbsolute(std::wstring& path); void MakePathAbsolute(std::wstring& path);
Gdiplus::PrivateFontCollection* GetPrivateFontCollection() { return m_FontCollection; } Gdiplus::PrivateFontCollection* GetPrivateFontCollection() { return m_FontCollection; }

View File

@ -190,6 +190,7 @@ public:
void DeleteLogFile(); void DeleteLogFile();
bool GetDisableRDP() { return m_DisableRDP; } bool GetDisableRDP() { return m_DisableRDP; }
bool IsRedrawable() { return (!GetDisableRDP() || !GetSystemMetrics(SM_REMOTESESSION)); }
bool GetDisableDragging() { return m_DisableDragging; } bool GetDisableDragging() { return m_DisableDragging; }
void SetDisableDragging(bool dragging); void SetDisableDragging(bool dragging);

View File

@ -32,12 +32,14 @@ using namespace Gdiplus;
enum TIMER enum TIMER
{ {
TIMER_SHOWDESKTOP = 1 TIMER_SHOWDESKTOP = 1,
TIMER_RESUME = 2
}; };
enum INTERVAL enum INTERVAL
{ {
INTERVAL_SHOWDESKTOP = 250, INTERVAL_SHOWDESKTOP = 250,
INTERVAL_RESTOREWINDOWS = 100 INTERVAL_RESTOREWINDOWS = 100,
INTERVAL_RESUME = 1000
}; };
MULTIMONITOR_INFO CSystem::c_Monitors = { 0 }; MULTIMONITOR_INFO CSystem::c_Monitors = { 0 };
@ -133,6 +135,7 @@ void CSystem::Initialize(HINSTANCE instance)
void CSystem::Finalize() void CSystem::Finalize()
{ {
KillTimer(c_Window, TIMER_SHOWDESKTOP); KillTimer(c_Window, TIMER_SHOWDESKTOP);
KillTimer(c_Window, TIMER_RESUME);
if (c_WinEventHook) if (c_WinEventHook)
{ {
@ -999,9 +1002,26 @@ LRESULT CALLBACK CSystem::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
break; break;
case WM_TIMER: 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<std::wstring, CMeterWindow*>::const_iterator iter = Rainmeter->GetAllMeterWindows().begin();
for ( ; iter != Rainmeter->GetAllMeterWindows().end(); ++iter)
{
(*iter).second->RedrawWindow();
}
}
break;
} }
break; break;
@ -1028,6 +1048,14 @@ LRESULT CALLBACK CSystem::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
} }
break; 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: default:
return DefWindowProc(hWnd, uMsg, wParam, lParam); return DefWindowProc(hWnd, uMsg, wParam, lParam);
} }