Skip to content

Commit

Permalink
Add One-Hand mice wheel scroll diff and merge (#2435) (7). Use WH_MOU…
Browse files Browse the repository at this point in the history
…SE instead of WM_MOUSE_LL (2)
  • Loading branch information
sdottaka committed Oct 12, 2024
1 parent 28c99cc commit 3c9dda6
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Src/DirView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
#include "SyntaxColors.h"
#include "Shell.h"
#include "DirTravel.h"
#include "LowLevelMouseHook.h"
#include "MouseHook.h"
#include <numeric>
#include <functional>

Expand Down
2 changes: 1 addition & 1 deletion Src/Merge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
#include "RegKey.h"
#include "Win_VersionHelper.h"
#include "BCMenu.h"
#include "LowLevelMouseHook.h"
#include "MouseHook.h"

#ifdef _DEBUG
#define new DEBUG_NEW
Expand Down
4 changes: 2 additions & 2 deletions Src/Merge.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -945,8 +945,8 @@
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName)2.pch</PrecompiledHeaderOutputFile>
</ClCompile>
<ClCompile Include="LowLevelMouseHook.cpp" />
<ClCompile Include="MergeDocDiffCopy.cpp" />
<ClCompile Include="MouseHook.cpp" />
<ClCompile Include="MyReBar.cpp" />
<ClCompile Include="PropCompareWebPage.cpp" />
<ClCompile Include="PropEditorCompareMerge.cpp" />
Expand Down Expand Up @@ -1448,7 +1448,7 @@
<ClInclude Include="AboutDlg.h" />
<ClInclude Include="BasicFlatStatusBar.h" />
<ClInclude Include="ClipboardHistory.h" />
<ClInclude Include="LowLevelMouseHook.h" />
<ClInclude Include="MouseHook.h" />
<ClInclude Include="MenuBar.h" />
<ClInclude Include="Common\cio.h" />
<ClInclude Include="Common\DebugNew.h" />
Expand Down
6 changes: 6 additions & 0 deletions Src/Merge.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,9 @@
<ClCompile Include="TitleBarHelper.cpp">
<Filter>MFCGui\Common\Source Files</Filter>
</ClCompile>
<ClCompile Include="MouseHook.cpp">
<Filter>MFCGui\Main\Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="charsets.h">
Expand Down Expand Up @@ -1412,6 +1415,9 @@
<ClInclude Include="TitleBarHelper.h">
<Filter>MFCGui\Common\Header Files</Filter>
</ClInclude>
<ClInclude Include="MouseHook.h">
<Filter>MFCGui\Main\Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="res\binarydiff.ico">
Expand Down
2 changes: 1 addition & 1 deletion Src/MergeEditView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "Shell.h"
#include "SelectPluginDlg.h"
#include "Constants.h"
#include "LowLevelMouseHook.h"
#include "MouseHook.h"

#ifdef _DEBUG
#define new DEBUG_NEW
Expand Down
6 changes: 3 additions & 3 deletions Src/LowLevelMouseHook.cpp → Src/MouseHook.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <StdAfx.h>
#include "LowLevelMouseHook.h"
#include "MouseHook.h"

void CALLBACK CMouseHook::TimerProc(HWND unnamedParam1, UINT unnamedParam2, UINT_PTR id, DWORD unnamedParam4HWND)
{
Expand All @@ -8,7 +8,7 @@ void CALLBACK CMouseHook::TimerProc(HWND unnamedParam1, UINT unnamedParam2, UINT
m_bIgnoreRBUp = false;
}

LRESULT CALLBACK CMouseHook::LowLevelMouseProc(int nCode, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK CMouseHook::MouseProc(int nCode, WPARAM wParam, LPARAM lParam)
{
if (nCode < 0)
return CallNextHookEx(m_hMouseHook, nCode, wParam, lParam);
Expand Down Expand Up @@ -172,7 +172,7 @@ LRESULT CALLBACK CMouseHook::LowLevelMouseProc(int nCode, WPARAM wParam, LPARAM

void CMouseHook::SetMouseHook()
{
m_hMouseHook = SetWindowsHookEx(WH_MOUSE, LowLevelMouseProc, GetModuleHandle(nullptr), GetCurrentThreadId());
m_hMouseHook = SetWindowsHookEx(WH_MOUSE, MouseProc, GetModuleHandle(nullptr), GetCurrentThreadId());
}

void CMouseHook::UnhookMouseHook()
Expand Down
2 changes: 1 addition & 1 deletion Src/LowLevelMouseHook.h → Src/MouseHook.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class CMouseHook
static void UnhookMouseHook();
static bool IsRightWheelScrolling() { return m_bIgnoreRBUp; }
private:
static LRESULT CALLBACK LowLevelMouseProc(int nCode, WPARAM wParam, LPARAM lParam);
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;
Expand Down

0 comments on commit 3c9dda6

Please sign in to comment.