mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Improved r277 fix.
This commit is contained in:
parent
85e59b5583
commit
808dca7afe
@ -48,7 +48,8 @@ enum TIMER
|
||||
TIMER_METER = 1,
|
||||
TIMER_MOUSE = 2,
|
||||
TIMER_FADE = 3,
|
||||
TIMER_TRANSITION = 4
|
||||
TIMER_TRANSITION = 4,
|
||||
TIMER_DEACTIVATE = 5
|
||||
};
|
||||
enum INTERVAL
|
||||
{
|
||||
@ -320,6 +321,18 @@ void CMeterWindow::IgnoreAeroPeek()
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Deactivate
|
||||
**
|
||||
** Unloads the skin with delay to avoid crash (and for fade to complete).
|
||||
**
|
||||
*/
|
||||
void CMeterWindow::Deactivate()
|
||||
{
|
||||
HideFade();
|
||||
SetTimer(m_Window, TIMER_DEACTIVATE, m_FadeDuration + 50, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
** Refresh
|
||||
**
|
||||
@ -343,9 +356,6 @@ void CMeterWindow::Refresh(bool init, bool all)
|
||||
if (!init)
|
||||
{
|
||||
// First destroy everything
|
||||
// WriteConfig(); //Not clear why this is needed and it messes up resolution changes
|
||||
|
||||
// Kill the timer
|
||||
KillTimer(m_Window, TIMER_METER);
|
||||
KillTimer(m_Window, TIMER_MOUSE);
|
||||
KillTimer(m_Window, TIMER_FADE);
|
||||
@ -3094,6 +3104,14 @@ LRESULT CMeterWindow::OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
UpdateTransparency((int)value, false);
|
||||
}
|
||||
}
|
||||
else if (wParam == TIMER_DEACTIVATE)
|
||||
{
|
||||
if (m_FadeStartTime == 0)
|
||||
{
|
||||
KillTimer(m_Window, TIMER_DEACTIVATE);
|
||||
Rainmeter->DeleteMeterWindow(this);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -4796,7 +4814,6 @@ LRESULT CALLBACK CMeterWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
|
||||
MESSAGE(OnMiddleButtonDoubleClick, WM_NCMBUTTONDBLCLK)
|
||||
MESSAGE(OnWindowPosChanging, WM_WINDOWPOSCHANGING)
|
||||
MESSAGE(OnCopyData, WM_COPYDATA)
|
||||
MESSAGE(OnDelayedExecute, WM_DELAYED_EXECUTE)
|
||||
MESSAGE(OnDelayedRefresh, WM_DELAYED_REFRESH)
|
||||
MESSAGE(OnDelayedMove, WM_DELAYED_MOVE)
|
||||
MESSAGE(OnDwmColorChange, WM_DWMCOLORIZATIONCOLORCHANGED)
|
||||
@ -4827,29 +4844,6 @@ LRESULT CALLBACK CMeterWindow::InitialWndProc(HWND hWnd, UINT uMsg, WPARAM wPara
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
/*
|
||||
** OnDelayedExecute
|
||||
**
|
||||
** Handles delayed executes
|
||||
**
|
||||
*/
|
||||
LRESULT CMeterWindow::OnDelayedExecute(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (lParam)
|
||||
{
|
||||
LPCTSTR szExecute = (LPCTSTR)lParam;
|
||||
COPYDATASTRUCT copyData;
|
||||
|
||||
copyData.dwData = 1;
|
||||
copyData.cbData = (DWORD)((wcslen(szExecute) + 1) * sizeof(WCHAR));
|
||||
copyData.lpData = (void*)szExecute;
|
||||
|
||||
OnCopyData(WM_COPYDATA, NULL, (LPARAM)©Data);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** OnDelayedRefresh
|
||||
**
|
||||
|
@ -32,7 +32,6 @@
|
||||
#define REJECT_MESSAGE(msg) case msg: return 0;
|
||||
#define END_MESSAGEPROC } return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
|
||||
#define WM_DELAYED_EXECUTE WM_APP + 0
|
||||
#define WM_DELAYED_REFRESH WM_APP + 1
|
||||
#define WM_DELAYED_MOVE WM_APP + 3
|
||||
|
||||
@ -179,6 +178,7 @@ public:
|
||||
void EnableMeasure(const std::wstring& name, bool group = false);
|
||||
void ToggleMeasure(const std::wstring& name, bool group = false);
|
||||
void UpdateMeasure(const std::wstring& name, bool group = false);
|
||||
void Deactivate();
|
||||
void Refresh(bool init, bool all = false);
|
||||
void Redraw();
|
||||
void SetVariable(const std::wstring& variable, const std::wstring& value);
|
||||
@ -242,8 +242,6 @@ public:
|
||||
|
||||
void AddMeasureBang(const WCHAR* bang, int index, CMeasure* measure);
|
||||
|
||||
LRESULT OnCopyData(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
void MakePathAbsolute(std::wstring& path);
|
||||
|
||||
Gdiplus::PrivateFontCollection* GetPrivateFontCollection() { return m_FontCollection; }
|
||||
@ -280,9 +278,9 @@ protected:
|
||||
LRESULT OnLeftButtonDoubleClick(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
LRESULT OnRightButtonDoubleClick(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
LRESULT OnMiddleButtonDoubleClick(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
LRESULT OnDelayedExecute(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
LRESULT OnDelayedRefresh(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
LRESULT OnDelayedMove(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
LRESULT OnCopyData(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
LRESULT OnDwmColorChange(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
LRESULT OnDwmCompositionChange(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
LRESULT OnSettingChange(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
@ -655,7 +655,7 @@ CRainmeter::CRainmeter() :
|
||||
*/
|
||||
CRainmeter::~CRainmeter()
|
||||
{
|
||||
DeleteMeterWindow(NULL, false); // This removes the window from the vector
|
||||
DeleteMeterWindow(NULL);
|
||||
|
||||
delete m_TrayWindow;
|
||||
|
||||
@ -1098,7 +1098,7 @@ bool CRainmeter::DeactivateConfig(CMeterWindow* meterWindow, int configIndex, bo
|
||||
WriteActive(meterWindow->GetSkinName(), -1);
|
||||
}
|
||||
|
||||
return DeleteMeterWindow(meterWindow, true);
|
||||
meterWindow->Deactivate();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -1150,76 +1150,29 @@ void CRainmeter::CreateMeterWindow(const std::wstring& config, const std::wstrin
|
||||
}
|
||||
}
|
||||
|
||||
void CRainmeter::ClearDeleteLaterList()
|
||||
bool CRainmeter::DeleteMeterWindow(CMeterWindow* meterWindow)
|
||||
{
|
||||
if (!m_DelayDeleteList.empty())
|
||||
std::map<std::wstring, CMeterWindow*>::iterator iter = m_Meters.begin();
|
||||
for (; iter != m_Meters.end(); ++iter)
|
||||
{
|
||||
do
|
||||
{
|
||||
CMeterWindow* meterWindow = m_DelayDeleteList.front();
|
||||
|
||||
// Remove from the delete later list
|
||||
m_DelayDeleteList.remove(meterWindow);
|
||||
|
||||
// Remove from the meter window list if it is still there
|
||||
std::map<std::wstring, CMeterWindow*>::iterator iter = m_Meters.begin();
|
||||
for (; iter != m_Meters.end(); ++iter)
|
||||
{
|
||||
if ((*iter).second == meterWindow)
|
||||
{
|
||||
m_Meters.erase(iter);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
CDialogManage::UpdateSkins(meterWindow, true);
|
||||
delete meterWindow;
|
||||
}
|
||||
while (!m_DelayDeleteList.empty());
|
||||
|
||||
CDialogAbout::UpdateSkins();
|
||||
}
|
||||
}
|
||||
|
||||
bool CRainmeter::DeleteMeterWindow(CMeterWindow* meterWindow, bool bLater)
|
||||
{
|
||||
if (bLater)
|
||||
{
|
||||
if (meterWindow)
|
||||
{
|
||||
m_DelayDeleteList.push_back(meterWindow);
|
||||
meterWindow->HideFade();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (meterWindow)
|
||||
{
|
||||
m_DelayDeleteList.remove(meterWindow); // Remove the window from the delete later list if it is there
|
||||
}
|
||||
|
||||
std::map<std::wstring, CMeterWindow*>::iterator iter = m_Meters.begin();
|
||||
for (; iter != m_Meters.end(); ++iter)
|
||||
{
|
||||
if (meterWindow == NULL)
|
||||
{
|
||||
// Delete all meter windows
|
||||
CDialogManage::UpdateSkins((*iter).second, true);
|
||||
delete (*iter).second;
|
||||
}
|
||||
else if ((*iter).second == meterWindow)
|
||||
{
|
||||
m_Meters.erase(iter);
|
||||
delete meterWindow;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (meterWindow == NULL)
|
||||
{
|
||||
m_Meters.clear();
|
||||
// Delete all meter windows
|
||||
CDialogManage::UpdateSkins((*iter).second, true);
|
||||
delete (*iter).second;
|
||||
}
|
||||
else if ((*iter).second == meterWindow)
|
||||
{
|
||||
m_Meters.erase(iter);
|
||||
delete meterWindow;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (meterWindow == NULL)
|
||||
{
|
||||
m_Meters.clear();
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -2179,7 +2132,7 @@ void CRainmeter::RefreshAll()
|
||||
void CRainmeter::LoadTheme(const std::wstring& name)
|
||||
{
|
||||
// Delete all meter windows
|
||||
DeleteMeterWindow(NULL, false);
|
||||
DeleteMeterWindow(NULL);
|
||||
|
||||
std::wstring backup = GetSettingsPath() + L"Themes\\Backup";
|
||||
CreateDirectory(backup.c_str(), NULL);
|
||||
|
@ -133,6 +133,8 @@ public:
|
||||
const std::vector<CONFIG>& GetAllConfigs() { return m_ConfigStrings; }
|
||||
const std::vector<std::wstring>& GetAllThemes() { return m_Themes; }
|
||||
|
||||
bool DeleteMeterWindow(CMeterWindow* meterWindow);
|
||||
|
||||
void ActivateConfig(int configIndex, int iniIndex);
|
||||
bool DeactivateConfig(CMeterWindow* meterWindow, int configIndex, bool save = true);
|
||||
void ToggleConfig(int configIndex, int iniIndex);
|
||||
@ -205,8 +207,6 @@ public:
|
||||
void LoadTheme(const std::wstring& name);
|
||||
void PreserveSetting(const std::wstring& from, LPCTSTR key, bool replace = true);
|
||||
|
||||
void ClearDeleteLaterList();
|
||||
|
||||
static std::vector<std::wstring> ParseString(LPCTSTR str);
|
||||
static std::wstring ExtractPath(const std::wstring& strFilePath);
|
||||
static void ExpandEnvironmentVariables(std::wstring& strPath);
|
||||
@ -229,7 +229,6 @@ private:
|
||||
|
||||
void ActivateActiveConfigs();
|
||||
void CreateMeterWindow(const std::wstring& config, const std::wstring& iniFile);
|
||||
bool DeleteMeterWindow(CMeterWindow* meterWindow, bool bLater);
|
||||
void WriteActive(const std::wstring& config, int iniIndex);
|
||||
void ScanForConfigs(const std::wstring& path);
|
||||
void ScanForThemes(const std::wstring& path);
|
||||
@ -307,8 +306,6 @@ private:
|
||||
|
||||
ULONG_PTR m_GDIplusToken;
|
||||
|
||||
std::list<CMeterWindow*> m_DelayDeleteList;
|
||||
|
||||
GlobalConfig m_GlobalConfig;
|
||||
};
|
||||
|
||||
|
@ -31,15 +31,13 @@
|
||||
enum TIMER
|
||||
{
|
||||
TIMER_SHOWDESKTOP = 1,
|
||||
TIMER_NETSTATS = 2,
|
||||
TIMER_DELETELATER = 3
|
||||
TIMER_NETSTATS = 2
|
||||
};
|
||||
enum INTERVAL
|
||||
{
|
||||
INTERVAL_SHOWDESKTOP = 250,
|
||||
INTERVAL_RESTOREWINDOWS = 100,
|
||||
INTERVAL_NETSTATS = 60000,
|
||||
INTERVAL_DELETELATER = 1000
|
||||
INTERVAL_NETSTATS = 60000
|
||||
};
|
||||
|
||||
MULTIMONITOR_INFO CSystem::c_Monitors = { 0 };
|
||||
@ -124,7 +122,6 @@ void CSystem::Initialize(HINSTANCE instance)
|
||||
WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS);
|
||||
|
||||
SetTimer(c_Window, TIMER_SHOWDESKTOP, INTERVAL_SHOWDESKTOP, NULL);
|
||||
SetTimer(c_Window, TIMER_DELETELATER, INTERVAL_DELETELATER, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -137,7 +134,6 @@ void CSystem::Finalize()
|
||||
{
|
||||
KillTimer(c_Window, TIMER_SHOWDESKTOP);
|
||||
KillTimer(c_Window, TIMER_NETSTATS);
|
||||
KillTimer(c_Window, TIMER_DELETELATER);
|
||||
|
||||
if (c_WinEventHook)
|
||||
{
|
||||
@ -1019,11 +1015,6 @@ LRESULT CALLBACK CSystem::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
|
||||
CMeasureNet::UpdateIFTable();
|
||||
CMeasureNet::UpdateStats();
|
||||
Rainmeter->WriteStats(false);
|
||||
|
||||
return 0;
|
||||
|
||||
case TIMER_DELETELATER:
|
||||
Rainmeter->ClearDeleteLaterList();
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user