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()
|
||||
{
|
||||
Rainmeter->RemoveMeterWindow(this);
|
||||
|
||||
HideFade();
|
||||
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)
|
||||
{
|
||||
KillTimer(m_Window, TIMER_DEACTIVATE);
|
||||
Rainmeter->DeleteMeterWindow(this, true); // "delete this;"
|
||||
delete this;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -728,7 +728,7 @@ CRainmeter::~CRainmeter()
|
||||
{
|
||||
KillTimer(m_Window, TIMER_NETSTATS);
|
||||
|
||||
DeleteMeterWindow(NULL);
|
||||
DeleteAllMeterWindows();
|
||||
|
||||
delete m_TrayWindow;
|
||||
|
||||
@ -1528,36 +1528,34 @@ void CRainmeter::CreateMeterWindow(const std::wstring& folderPath, const std::ws
|
||||
CDialogManage::UpdateSkins(mw);
|
||||
}
|
||||
|
||||
void CRainmeter::DeleteMeterWindow(CMeterWindow* meterWindow, bool force)
|
||||
void CRainmeter::DeleteAllMeterWindows()
|
||||
{
|
||||
std::map<std::wstring, CMeterWindow*>::iterator iter = m_MeterWindows.begin();
|
||||
for (; iter != m_MeterWindows.end(); ++iter)
|
||||
for (auto it = m_MeterWindows.cbegin(); it != m_MeterWindows.end(); ++it)
|
||||
{
|
||||
if (meterWindow == NULL)
|
||||
{
|
||||
// Delete all meter windows
|
||||
CDialogManage::UpdateSkins((*iter).second, true);
|
||||
delete (*iter).second;
|
||||
CDialogManage::UpdateSkins((*it).second, true);
|
||||
delete (*it).second;
|
||||
}
|
||||
else if ((*iter).second == meterWindow)
|
||||
|
||||
m_MeterWindows.clear();
|
||||
CDialogAbout::UpdateSkins();
|
||||
}
|
||||
|
||||
/*
|
||||
** Removes the skin from m_MeterWindow. The skin should delete itself.
|
||||
**
|
||||
*/
|
||||
void CRainmeter::RemoveMeterWindow(CMeterWindow* meterWindow)
|
||||
{
|
||||
m_MeterWindows.erase(iter);
|
||||
force = true;
|
||||
for (auto it = m_MeterWindows.cbegin(); it != m_MeterWindows.end(); ++it)
|
||||
{
|
||||
if ((*it).second == meterWindow)
|
||||
{
|
||||
m_MeterWindows.erase(it);
|
||||
CDialogManage::UpdateSkins(meterWindow, true);
|
||||
CDialogAbout::UpdateSkins();
|
||||
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)
|
||||
@ -2592,8 +2590,7 @@ bool CRainmeter::LoadLayout(const std::wstring& name)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Delete all meter windows
|
||||
DeleteMeterWindow(NULL);
|
||||
DeleteAllMeterWindows();
|
||||
|
||||
std::wstring backup = GetLayoutPath();
|
||||
backup += L"@Backup";
|
||||
|
@ -126,7 +126,8 @@ public:
|
||||
const std::vector<SkinFolder>& GetFolders() { return m_SkinFolders; }
|
||||
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 DeactivateSkin(CMeterWindow* meterWindow, int folderIndex, bool save = true);
|
||||
|
Loading…
Reference in New Issue
Block a user