mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Fix that unloaded skin is displayed in context menu until fade is complete
This commit is contained in:
parent
3552a928dd
commit
af8befd22b
@ -389,6 +389,8 @@ void CMeterWindow::RemoveWindowExStyle(LONG_PTR flag)
|
|||||||
*/
|
*/
|
||||||
void CMeterWindow::Deactivate()
|
void CMeterWindow::Deactivate()
|
||||||
{
|
{
|
||||||
|
Rainmeter->RemoveMeterWindow(this);
|
||||||
|
|
||||||
HideFade();
|
HideFade();
|
||||||
SetTimer(m_Window, TIMER_DEACTIVATE, m_FadeDuration + 50, NULL);
|
SetTimer(m_Window, TIMER_DEACTIVATE, m_FadeDuration + 50, NULL);
|
||||||
}
|
}
|
||||||
@ -2879,7 +2881,7 @@ LRESULT CMeterWindow::OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
if (m_FadeStartTime == 0)
|
if (m_FadeStartTime == 0)
|
||||||
{
|
{
|
||||||
KillTimer(m_Window, TIMER_DEACTIVATE);
|
KillTimer(m_Window, TIMER_DEACTIVATE);
|
||||||
Rainmeter->DeleteMeterWindow(this, true); // "delete this;"
|
delete this;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -728,7 +728,7 @@ CRainmeter::~CRainmeter()
|
|||||||
{
|
{
|
||||||
KillTimer(m_Window, TIMER_NETSTATS);
|
KillTimer(m_Window, TIMER_NETSTATS);
|
||||||
|
|
||||||
DeleteMeterWindow(NULL);
|
DeleteAllMeterWindows();
|
||||||
|
|
||||||
delete m_TrayWindow;
|
delete m_TrayWindow;
|
||||||
|
|
||||||
@ -1528,36 +1528,34 @@ void CRainmeter::CreateMeterWindow(const std::wstring& folderPath, const std::ws
|
|||||||
CDialogManage::UpdateSkins(mw);
|
CDialogManage::UpdateSkins(mw);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRainmeter::DeleteMeterWindow(CMeterWindow* meterWindow, bool force)
|
void CRainmeter::DeleteAllMeterWindows()
|
||||||
{
|
{
|
||||||
std::map<std::wstring, CMeterWindow*>::iterator iter = m_MeterWindows.begin();
|
for (auto it = m_MeterWindows.cbegin(); it != m_MeterWindows.end(); ++it)
|
||||||
for (; iter != m_MeterWindows.end(); ++iter)
|
|
||||||
{
|
{
|
||||||
if (meterWindow == NULL)
|
CDialogManage::UpdateSkins((*it).second, true);
|
||||||
|
delete (*it).second;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_MeterWindows.clear();
|
||||||
|
CDialogAbout::UpdateSkins();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Removes the skin from m_MeterWindow. The skin should delete itself.
|
||||||
|
**
|
||||||
|
*/
|
||||||
|
void CRainmeter::RemoveMeterWindow(CMeterWindow* meterWindow)
|
||||||
|
{
|
||||||
|
for (auto it = m_MeterWindows.cbegin(); it != m_MeterWindows.end(); ++it)
|
||||||
|
{
|
||||||
|
if ((*it).second == meterWindow)
|
||||||
{
|
{
|
||||||
// Delete all meter windows
|
m_MeterWindows.erase(it);
|
||||||
CDialogManage::UpdateSkins((*iter).second, true);
|
CDialogManage::UpdateSkins(meterWindow, true);
|
||||||
delete (*iter).second;
|
CDialogAbout::UpdateSkins();
|
||||||
}
|
|
||||||
else if ((*iter).second == meterWindow)
|
|
||||||
{
|
|
||||||
m_MeterWindows.erase(iter);
|
|
||||||
force = true;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (meterWindow == NULL)
|
|
||||||
{
|
|
||||||
m_MeterWindows.clear();
|
|
||||||
}
|
|
||||||
else if (force)
|
|
||||||
{
|
|
||||||
CDialogManage::UpdateSkins(meterWindow, true);
|
|
||||||
delete meterWindow;
|
|
||||||
}
|
|
||||||
|
|
||||||
CDialogAbout::UpdateSkins();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CMeterWindow* CRainmeter::GetMeterWindow(const std::wstring& folderPath)
|
CMeterWindow* CRainmeter::GetMeterWindow(const std::wstring& folderPath)
|
||||||
@ -2592,8 +2590,7 @@ bool CRainmeter::LoadLayout(const std::wstring& name)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete all meter windows
|
DeleteAllMeterWindows();
|
||||||
DeleteMeterWindow(NULL);
|
|
||||||
|
|
||||||
std::wstring backup = GetLayoutPath();
|
std::wstring backup = GetLayoutPath();
|
||||||
backup += L"@Backup";
|
backup += L"@Backup";
|
||||||
|
@ -126,7 +126,8 @@ public:
|
|||||||
const std::vector<SkinFolder>& GetFolders() { return m_SkinFolders; }
|
const std::vector<SkinFolder>& GetFolders() { return m_SkinFolders; }
|
||||||
const std::vector<std::wstring>& GetAllLayouts() { return m_Layouts; }
|
const std::vector<std::wstring>& GetAllLayouts() { return m_Layouts; }
|
||||||
|
|
||||||
void DeleteMeterWindow(CMeterWindow* meterWindow, bool force = false);
|
void DeleteAllMeterWindows();
|
||||||
|
void RemoveMeterWindow(CMeterWindow* meterWindow);
|
||||||
|
|
||||||
void ActivateSkin(int folderIndex, int fileIndex);
|
void ActivateSkin(int folderIndex, int fileIndex);
|
||||||
void DeactivateSkin(CMeterWindow* meterWindow, int folderIndex, bool save = true);
|
void DeactivateSkin(CMeterWindow* meterWindow, int folderIndex, bool save = true);
|
||||||
|
Loading…
Reference in New Issue
Block a user