Skip to content

Commit

Permalink
Add One-Hand mice wheel scroll diff and merge (WinMerge#2435) (10)
Browse files Browse the repository at this point in the history
  • Loading branch information
sdottaka authored and z committed Oct 13, 2024
1 parent f0bd86e commit 22321f8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Src/DirView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#include "SyntaxColors.h"
#include "Shell.h"
#include "DirTravel.h"
#include "MouseHook.h"
#include <numeric>
#include <functional>

Expand Down Expand Up @@ -638,6 +639,8 @@ void CDirView::Redisplay()
*/
void CDirView::OnContextMenu(CWnd*, CPoint point)
{
if (CMouseHook::IsRightWheelScrolling())
return;
if (GetListCtrl().GetItemCount() == 0)
return;
// Make sure window is active
Expand Down
4 changes: 4 additions & 0 deletions Src/MergeEditView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "Shell.h"
#include "SelectPluginDlg.h"
#include "Constants.h"
#include "MouseHook.h"

#ifdef _DEBUG
#define new DEBUG_NEW
Expand Down Expand Up @@ -2870,6 +2871,9 @@ void CMergeEditView::OnUpdateEditReplace(CCmdUI* pCmdUI)
*/
void CMergeEditView::OnContextMenu(CWnd* pWnd, CPoint point)
{
if (CMouseHook::IsRightWheelScrolling())
return;

CRect rect;
GetClientRect(rect);
ClientToScreen(rect);
Expand Down
9 changes: 5 additions & 4 deletions Src/MouseHook.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <StdAfx.h>
#include "MouseHook.h"
#include <chrono>

BOOL CMouseHook::PreTranslateMessage(MSG* pMsg)
{
Expand Down Expand Up @@ -77,14 +78,14 @@ BOOL CMouseHook::PreTranslateMessage(MSG* pMsg)
if (zDelta > 0)
{
// RButton+ScrollUp as Alt+Up
m_bIgnoreRBUp = true;
StartRightWheelScrolling();
PostMessage(hwndTarget, WM_COMMAND, ID_PREVDIFF, 0);
return TRUE;
}
else if (zDelta < 0)
{
// RButton+ScrollDown as Alt+Down
m_bIgnoreRBUp = true;
StartRightWheelScrolling();
PostMessage(hwndTarget, WM_COMMAND, ID_NEXTDIFF, 0);
return TRUE;
}
Expand Down Expand Up @@ -139,14 +140,14 @@ BOOL CMouseHook::PreTranslateMessage(MSG* pMsg)
if (zDelta > 0)
{
// RButton+ScrollRight as Alt+Right
m_bIgnoreRBUp = true;
StartRightWheelScrolling();
PostMessage(hwndTarget, WM_COMMAND, ID_L2R, 0);
return TRUE;
}
else if (zDelta < 0)
{
// RButton+ScrollLeft as Alt+Left
m_bIgnoreRBUp = true;
StartRightWheelScrolling();
PostMessage(hwndTarget, WM_COMMAND, ID_R2L, 0);
return TRUE;
}
Expand Down

0 comments on commit 22321f8

Please sign in to comment.