From 34160d4038597dabf9f346ec85992b71b874fc15 Mon Sep 17 00:00:00 2001 From: spx Date: Fri, 24 Dec 2010 10:47:31 +0000 Subject: [PATCH] Modified. (Added the workaround for MessageBox loops on MouseOverAction.) --- Library/MeterWindow.cpp | 14 +++++++++++--- Library/MeterWindow.h | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Library/MeterWindow.cpp b/Library/MeterWindow.cpp index 1c69e67d..129c5c6a 100644 --- a/Library/MeterWindow.cpp +++ b/Library/MeterWindow.cpp @@ -130,6 +130,7 @@ CMeterWindow::CMeterWindow(const std::wstring& path, const std::wstring& config, m_SolidBevel = BEVELTYPE_NONE; m_UpdateCounter = 0; + m_MouseMoveCounter = 0; m_FontCollection = NULL; ++c_InstanceCount; @@ -3071,6 +3072,8 @@ LRESULT CMeterWindow::OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam) MapWindowPoints(NULL, m_Window, &pos, 1); } + ++m_MouseMoveCounter; + while (DoMoveAction(pos.x, pos.y, MOUSE_LEAVE)) ; while (DoMoveAction(pos.x, pos.y, MOUSE_OVER)) ; @@ -3094,6 +3097,8 @@ LRESULT CMeterWindow::OnMouseLeave(UINT uMsg, WPARAM wParam, LPARAM lParam) HWND hWnd = WindowFromPoint(pos); if (!hWnd || (hWnd != m_Window && GetParent(hWnd) != m_Window)) // ignore tooltips { + ++m_MouseMoveCounter; + POINT pos = {SHRT_MIN, SHRT_MIN}; while (DoMoveAction(pos.x, pos.y, MOUSE_LEAVE)) ; // Leave all forcibly @@ -4221,8 +4226,9 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSE mouse) if (!m_MouseOverAction.empty()) { + UINT currCounter = m_MouseMoveCounter; m_Rainmeter->ExecuteCommand(m_MouseOverAction.c_str(), this); - return true; + return (currCounter == m_MouseMoveCounter); } } @@ -4262,8 +4268,9 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSE mouse) if (!((*j)->GetMouseOverAction().empty())) { + UINT currCounter = m_MouseMoveCounter; m_Rainmeter->ExecuteCommand((*j)->GetMouseOverAction().c_str(), this); - return true; + return (currCounter == m_MouseMoveCounter); } } } @@ -4314,8 +4321,9 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSE mouse) if (!m_MouseOverAction.empty()) { + UINT currCounter = m_MouseMoveCounter; m_Rainmeter->ExecuteCommand(m_MouseOverAction.c_str(), this); - return true; + return (currCounter == m_MouseMoveCounter); } } } diff --git a/Library/MeterWindow.h b/Library/MeterWindow.h index 77eb7723..1698f7ba 100644 --- a/Library/MeterWindow.h +++ b/Library/MeterWindow.h @@ -378,6 +378,7 @@ private: const std::wstring m_SkinIniFile; // Name of the current skin iniFile int m_UpdateCounter; + UINT m_MouseMoveCounter; CRainmeter* m_Rainmeter; // Pointer to the main object