diff --git a/Src/DirView.cpp b/Src/DirView.cpp index 61325181d89..57a68e0a7bf 100644 --- a/Src/DirView.cpp +++ b/Src/DirView.cpp @@ -49,7 +49,6 @@ #include "SyntaxColors.h" #include "Shell.h" #include "DirTravel.h" -#include "MouseHook.h" #include #include @@ -639,8 +638,6 @@ void CDirView::Redisplay() */ void CDirView::OnContextMenu(CWnd*, CPoint point) { - if (CMouseHook::IsRightWheelScrolling()) - return; if (GetListCtrl().GetItemCount() == 0) return; // Make sure window is active diff --git a/Src/MergeEditView.cpp b/Src/MergeEditView.cpp index a8336a032a5..2cbf3245186 100644 --- a/Src/MergeEditView.cpp +++ b/Src/MergeEditView.cpp @@ -33,7 +33,6 @@ #include "Shell.h" #include "SelectPluginDlg.h" #include "Constants.h" -#include "MouseHook.h" #ifdef _DEBUG #define new DEBUG_NEW @@ -2869,9 +2868,6 @@ void CMergeEditView::OnUpdateEditReplace(CCmdUI* pCmdUI) */ void CMergeEditView::OnContextMenu(CWnd* pWnd, CPoint point) { - if (CMouseHook::IsRightWheelScrolling()) - return; - CRect rect; GetClientRect(rect); ClientToScreen(rect); diff --git a/Src/MouseHook.cpp b/Src/MouseHook.cpp index 5982d92f4ce..e9d1f76c0a3 100644 --- a/Src/MouseHook.cpp +++ b/Src/MouseHook.cpp @@ -1,19 +1,16 @@ #include #include "MouseHook.h" -void CALLBACK CMouseHook::TimerProc(HWND unnamedParam1, UINT unnamedParam2, UINT_PTR id, DWORD unnamedParam4HWND) -{ - KillTimer(nullptr, id); - EndMenu(); - m_bIgnoreRBUp = false; -} - LRESULT CALLBACK CMouseHook::MouseProc(int nCode, WPARAM wParam, LPARAM lParam) { if (nCode < 0) return CallNextHookEx(m_hMouseHook, nCode, wParam, lParam); - if (wParam == WM_RBUTTONDOWN) + if (wParam == WM_LBUTTONDOWN) + { + m_bIgnoreRBUp = false; + } + else if (wParam == WM_RBUTTONDOWN) { m_bRButtonDown = true; } @@ -22,9 +19,8 @@ LRESULT CALLBACK CMouseHook::MouseProc(int nCode, WPARAM wParam, LPARAM lParam) m_bRButtonDown = false; if (m_bIgnoreRBUp) { - LRESULT result = CallNextHookEx(m_hMouseHook, nCode, wParam, lParam); - SetTimer(nullptr, 0, USER_TIMER_MINIMUM, TimerProc); - return result; + m_bIgnoreRBUp = false; + return 1; } } else if (wParam == WM_MOUSEWHEEL) @@ -172,7 +168,7 @@ LRESULT CALLBACK CMouseHook::MouseProc(int nCode, WPARAM wParam, LPARAM lParam) void CMouseHook::SetMouseHook() { - m_hMouseHook = SetWindowsHookEx(WH_MOUSE, MouseProc, GetModuleHandle(nullptr), GetCurrentThreadId()); + m_hMouseHook = SetWindowsHookEx(WH_MOUSE, MouseProc, AfxGetInstanceHandle(), GetCurrentThreadId()); } void CMouseHook::UnhookMouseHook() diff --git a/Src/MouseHook.h b/Src/MouseHook.h index 033f0a15b1f..a819cfcb921 100644 --- a/Src/MouseHook.h +++ b/Src/MouseHook.h @@ -6,7 +6,6 @@ class CMouseHook static bool IsRightWheelScrolling() { return m_bIgnoreRBUp; } private: static LRESULT CALLBACK MouseProc(int nCode, WPARAM wParam, LPARAM lParam); - static void CALLBACK TimerProc(HWND unnamedParam1, UINT unnamedParam2, UINT_PTR id, DWORD unnamedParam4HWND); inline static HHOOK m_hMouseHook; inline static bool m_bIgnoreRBUp; inline static bool m_bRButtonDown;