Additional changes to af8befd

This commit is contained in:
spx 2013-03-11 04:59:05 +09:00
parent 5717c38577
commit aecef0b5f9
3 changed files with 26 additions and 7 deletions

View File

@ -137,7 +137,7 @@ CMeterWindow::CMeterWindow(const std::wstring& folderPath, const std::wstring& f
m_FadeStartValue(), m_FadeStartValue(),
m_FadeEndValue(), m_FadeEndValue(),
m_TransparencyValue(), m_TransparencyValue(),
m_Refreshing(false), m_State(STATE_INITIALIZING),
m_Hidden(false), m_Hidden(false),
m_ResizeWindow(RESIZEMODE_NONE), m_ResizeWindow(RESIZEMODE_NONE),
m_UpdateCounter(), m_UpdateCounter(),
@ -215,6 +215,8 @@ void CMeterWindow::Dispose(bool refresh)
KillTimer(m_Window, TIMER_FADE); KillTimer(m_Window, TIMER_FADE);
KillTimer(m_Window, TIMER_TRANSITION); KillTimer(m_Window, TIMER_TRANSITION);
m_FadeStartTime = 0;
UnregisterMouseInput(); UnregisterMouseInput();
m_HasMouseScrollAction = false; m_HasMouseScrollAction = false;
@ -389,6 +391,8 @@ void CMeterWindow::RemoveWindowExStyle(LONG_PTR flag)
*/ */
void CMeterWindow::Deactivate() void CMeterWindow::Deactivate()
{ {
m_State = STATE_CLOSING;
Rainmeter->RemoveMeterWindow(this); Rainmeter->RemoveMeterWindow(this);
HideFade(); HideFade();
@ -403,6 +407,9 @@ void CMeterWindow::Refresh(bool init, bool all)
{ {
assert(Rainmeter != NULL); assert(Rainmeter != NULL);
if (m_State == STATE_CLOSING) return;
m_State = STATE_REFRESHING;
Rainmeter->SetCurrentParser(&m_Parser); Rainmeter->SetCurrentParser(&m_Parser);
std::wstring notice = L"Refreshing skin \"" + m_FolderPath; std::wstring notice = L"Refreshing skin \"" + m_FolderPath;
@ -411,7 +418,6 @@ void CMeterWindow::Refresh(bool init, bool all)
notice += L'"'; notice += L'"';
Log(LOG_NOTICE, notice.c_str()); Log(LOG_NOTICE, notice.c_str());
m_Refreshing = true;
SetResizeWindowMode(RESIZEMODE_RESET); SetResizeWindowMode(RESIZEMODE_RESET);
if (!init) if (!init)
@ -473,7 +479,7 @@ void CMeterWindow::Refresh(bool init, bool all)
Rainmeter->SetCurrentParser(NULL); Rainmeter->SetCurrentParser(NULL);
m_Refreshing = false; m_State = STATE_RUNNING;
if (!m_OnRefreshAction.empty()) if (!m_OnRefreshAction.empty())
{ {
@ -3375,7 +3381,10 @@ LRESULT CMeterWindow::OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam)
break; break;
case IDM_CLOSESKIN: case IDM_CLOSESKIN:
Rainmeter->DeactivateSkin(this, -1); if (m_State != STATE_CLOSING)
{
Rainmeter->DeactivateSkin(this, -1);
}
break; break;
case IDM_SKIN_FROMRIGHT: case IDM_SKIN_FROMRIGHT:
@ -3718,7 +3727,7 @@ LRESULT CMeterWindow::OnWindowPosChanging(UINT uMsg, WPARAM wParam, LPARAM lPara
{ {
LPWINDOWPOS wp = (LPWINDOWPOS)lParam; LPWINDOWPOS wp = (LPWINDOWPOS)lParam;
if (!m_Refreshing) if (m_State != STATE_REFRESHING)
{ {
if (m_WindowZPosition == ZPOSITION_NORMAL && Rainmeter->IsNormalStayDesktop() && CSystem::GetShowDesktop()) if (m_WindowZPosition == ZPOSITION_NORMAL && Rainmeter->IsNormalStayDesktop() && CSystem::GetShowDesktop())
{ {

View File

@ -237,6 +237,8 @@ public:
bool GetMeterToolTipHidden() { return m_ToolTipHidden; } bool GetMeterToolTipHidden() { return m_ToolTipHidden; }
bool IsClosing() { return m_State == STATE_CLOSING; }
const CMouse& GetMouse() { return m_Mouse; } const CMouse& GetMouse() { return m_Mouse; }
void MakePathAbsolute(std::wstring& path); void MakePathAbsolute(std::wstring& path);
@ -290,6 +292,14 @@ protected:
LRESULT OnSetWindowFocus(UINT uMsg, WPARAM wParam, LPARAM lParam); LRESULT OnSetWindowFocus(UINT uMsg, WPARAM wParam, LPARAM lParam);
private: private:
enum STATE
{
STATE_INITIALIZING,
STATE_REFRESHING,
STATE_RUNNING,
STATE_CLOSING
};
enum OPTION enum OPTION
{ {
OPTION_POSITION = 0x00000001, OPTION_POSITION = 0x00000001,
@ -433,7 +443,7 @@ private:
int m_FadeEndValue; int m_FadeEndValue;
int m_TransparencyValue; int m_TransparencyValue;
bool m_Refreshing; STATE m_State;
bool m_Hidden; bool m_Hidden;
RESIZEMODE m_ResizeWindow; RESIZEMODE m_ResizeWindow;

View File

@ -2884,7 +2884,7 @@ void CRainmeter::ShowContextMenu(POINT pos, CMeterWindow* meterWindow)
MENU_ITEM(IDM_QUIT, ID_STR_EXIT) MENU_ITEM(IDM_QUIT, ID_STR_EXIT)
}; };
if (!m_MenuActive) if (!m_MenuActive && (!meterWindow || !meterWindow->IsClosing()))
{ {
m_MenuActive = true; m_MenuActive = true;