Fixed a issue that MouseOver/LeaveAction loops infinitely.

http://www.rainmeter.net/forum/viewtopic.php?f=14&t=5560
This commit is contained in:
spx 2010-10-02 04:13:50 +00:00
parent 9da555a187
commit 54362780c3

View File

@ -3068,6 +3068,7 @@ LRESULT CMeterWindow::OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam)
MapWindowPoints(NULL, m_Window, &pos, 1); MapWindowPoints(NULL, m_Window, &pos, 1);
} }
while (DoMoveAction(pos.x, pos.y, MOUSE_LEAVE)) ;
while (DoMoveAction(pos.x, pos.y, MOUSE_OVER)) ; while (DoMoveAction(pos.x, pos.y, MOUSE_OVER)) ;
// Handle buttons // Handle buttons
@ -4257,28 +4258,31 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSE mouse)
} }
else else
{ {
if ((*j)->IsMouseOver()) if (mouse == MOUSE_LEAVE)
{ {
// Handle button if ((*j)->IsMouseOver())
if (m_HasButtons)
{ {
CMeterButton* button = dynamic_cast<CMeterButton*>(*j); // Handle button
if (button) if (m_HasButtons)
{ {
if (button->IsExecutable()) CMeterButton* button = dynamic_cast<CMeterButton*>(*j);
if (button)
{ {
button->SetExecutable(false); if (button->IsExecutable())
{
button->SetExecutable(false);
}
} }
} }
}
//DebugLog(L"MeterLeave: %s - [%s]", m_SkinName.c_str(), (*j)->GetName()); //DebugLog(L"MeterLeave: %s - [%s]", m_SkinName.c_str(), (*j)->GetName());
(*j)->SetMouseOver(false); (*j)->SetMouseOver(false);
if (!((*j)->GetMouseLeaveAction().empty())) if (!((*j)->GetMouseLeaveAction().empty()))
{ {
m_Rainmeter->ExecuteCommand((*j)->GetMouseLeaveAction().c_str(), this); m_Rainmeter->ExecuteCommand((*j)->GetMouseLeaveAction().c_str(), this);
return true; return true;
}
} }
} }
} }
@ -4305,17 +4309,20 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSE mouse)
} }
else else
{ {
// Mouse leave happens when the mouse is outside the window if (mouse == MOUSE_LEAVE)
if (m_MouseOver)
{ {
//DebugLog(L"Leave: %s", m_SkinName.c_str()); // Mouse leave happens when the mouse is outside the window
m_MouseOver = false; if (m_MouseOver)
SetMouseLeaveEvent(true);
if (!m_MouseLeaveAction.empty())
{ {
m_Rainmeter->ExecuteCommand(m_MouseLeaveAction.c_str(), this); //DebugLog(L"Leave: %s", m_SkinName.c_str());
return true; m_MouseOver = false;
SetMouseLeaveEvent(true);
if (!m_MouseLeaveAction.empty())
{
m_Rainmeter->ExecuteCommand(m_MouseLeaveAction.c_str(), this);
return true;
}
} }
} }
} }