View Issue Details

IDProjectCategoryView StatusLast Update
0001638OpenMPTUser Interfacepublic2023-04-04 23:58
Reporterc0d3h4x0r Assigned To 
Status newResolutionopen 
Platformx64OSWindowsOS Version10
Product VersionOpenMPT / libopenmpt 0.6.6 (upgrade first) 
Summary0001638: Laptop precision touchpad 2-finger scrolling: slow/fine scrolling does nothing in pattern editor

My laptop is an MSI GS65 Stealth Thin 8RF. It has a Synaptics touchpad that Windows 10 x64 recognizes as a "Precision TouchPad". I have two-finger vertical scrolling enabled. Fine/slow vertical scrolling works fine in other apps (such as Google Chrome or Notepad). But in OpenMPT's pattern editor, fine/slow vertical scrolling doesn't work. The pattern editor only scrolls if I slide my two fingers rapidly enough up/down the touchpad surface.

Steps To Reproduce
  1. Launch OpenMPT
  2. New song
  3. Go to pattern editor
  4. Resize main window so pattern editor doesn't fit within window height.
  5. Place cursor inside pattern editor
  6. Use 2-finger scrolling on touchpad
Additional Information

EXPECTED: slow 2-finger scrolling should work

ACTUAL: slow 2-finger scrolling does nothing

TagsNo tags attached.
Has the bug occurred in previous versions?don't know
Tested code revision (in case you know it)


Saga Musix

Saga Musix

2022-11-21 18:28

administrator   ~0005378

Last edited: 2022-11-21 18:30

I don't think CScrollView::DoMouseWheel can handle scroll sizes less than one line. I think that was also an issue with the scroll messages created by touch gestures, in which case explicitly implementing touch support fixed the issue but WM_MOUSEWHEEL message with smaller scroll amounts will remain problematic.



2022-11-21 20:00

reporter   ~0005379

Thanks. I'll look into it. I may be able to come up with something.



2022-11-22 08:51

reporter   ~0005389

I have a working fix. I'll create a pull request on GitHub.



2022-11-22 09:24

reporter   ~0005390

PR created:

Saga Musix

Saga Musix

2022-12-02 20:09

administrator   ~0005400

The code looks sensible, but I suppose this also affects horizontal scrolling (e.g. when there's lots of pattern channels)? Or is the different implementation of CModScrollView::OnMouseHWheel causing that to work? If so, taking the horizontal scrolling code and reusing it for vertical scrolling would be a one-liner fix.



2022-12-03 22:39

reporter   ~0005401

Last edited: 2022-12-04 00:02

I've never seen a mouse device with fine-grained horizontal mouse wheel (just tilt left/right, which are typically binary switches). However, the MFC base class automatically converts vertical mouse wheel rotation into horizontal scrolling when there's no vertical scrollbar, so fine-grained horizontal scrolling via vertical mouse wheel rotation is possible. And yes, it is still broken even with my fix.

CScrollView::DoMouseWheel contains the defect/limitation, but CModScrollView::OnMouseHWheel doesn't use it, so a somewhat different form of my fix is needed here -- especially because horizontal scrolling is only permitted to occur in whole-column increments.

I'll get to work on a revised fix.



2022-12-04 03:25

reporter   ~0005406

Pull request updated. Please review.

Saga Musix

Saga Musix

2023-01-02 14:54

administrator   ~0005446

I tested the updated code now, and it breaks the intended horizontal scroll behaviour (direction is inverted and one mouse wheel notch jumps by two channels instead of one - probably because the truncation now happens in a different place).
I think the attached patch is simpler and may also solve your problem. Can you give it a try?

Globals.cpp.patch (1,290 bytes)   
Index: Globals.cpp
--- Globals.cpp	(revision 18395)
+++ Globals.cpp	(working copy)
@@ -647,23 +647,32 @@
+static short RoundMouseWheelToWholeStep(int value)
+	if(value > 0)
+		return mpt::saturate_cast<short>(mpt::align_up(value, WHEEL_DELTA));
+	else
+		return mpt::saturate_cast<short>(-mpt::align_up(-value, WHEEL_DELTA));
 BOOL CModScrollView::OnMouseWheel(UINT fFlags, short zDelta, CPoint point)
 	// we don't handle anything but scrolling just now
-	if (fFlags & (MK_SHIFT | MK_CONTROL)) return FALSE;
+	if(fFlags & (MK_SHIFT | MK_CONTROL))
+		return FALSE;
-	//if the parent is a splitter, it will handle the message
-	//if (GetParentSplitter(this, TRUE)) return FALSE;
 	// we can't get out of it--perform the scroll ourselves
-	return DoMouseWheel(fFlags, zDelta, point);
+	return DoMouseWheel(fFlags, RoundMouseWheelToWholeStep(zDelta), point);
 void CModScrollView::OnMouseHWheel(UINT fFlags, short zDelta, CPoint point)
+	zDelta = RoundMouseWheelToWholeStep(zDelta);
 	// we don't handle anything but scrolling just now
-	if (fFlags & (MK_SHIFT | MK_CONTROL))
+	if(fFlags & (MK_SHIFT | MK_CONTROL))
 		CScrollView::OnMouseHWheel(fFlags, zDelta, point);
Globals.cpp.patch (1,290 bytes)   


2023-01-23 21:08

reporter   ~0005497

Sorry for the delayed response. Between holiday travels, a 2 week bout of COVID, layoffs and reorgs at my employer, and my personal PCs all getting jacked up by upgrading them to Windows 11, I've been pretty busy dealing with other things.

Yes, I'll give your patch a try soon and report back.

Saga Musix

Saga Musix

2023-04-04 21:59

administrator   ~0005649

Did you get a chance to try my patch yet?



2023-04-04 23:58

reporter   ~0005650

Sorry, not yet. I've had a lot going on lately. It's still on my radar though.

Issue History

Date Modified Username Field Change
2022-11-21 18:21 c0d3h4x0r New Issue
2022-11-21 18:28 Saga Musix Note Added: 0005378
2022-11-21 18:30 Saga Musix Note Edited: 0005378
2022-11-21 18:33 Saga Musix Product Version OpenMPT / libopenmpt 0.6.6 (upgrade first) => OpenMPT / libopenmpt 0.6.6 (upgrade first)
2022-11-21 18:33 Saga Musix Summary [ (missing option)] laptop precision touchpad 2-finger scrolling: slow/fine scrolling does nothing in pattern editor => Laptop precision touchpad 2-finger scrolling: slow/fine scrolling does nothing in pattern editor
2022-11-21 20:00 c0d3h4x0r Note Added: 0005379
2022-11-22 08:51 c0d3h4x0r Note Added: 0005389
2022-11-22 09:24 c0d3h4x0r Note Added: 0005390
2022-12-02 20:09 Saga Musix Note Added: 0005400
2022-12-03 22:39 c0d3h4x0r Note Added: 0005401
2022-12-04 00:02 c0d3h4x0r Note Edited: 0005401
2022-12-04 03:25 c0d3h4x0r Note Added: 0005406
2023-01-02 14:54 Saga Musix Note Added: 0005446
2023-01-02 14:54 Saga Musix File Added: Globals.cpp.patch
2023-01-23 21:08 c0d3h4x0r Note Added: 0005497
2023-04-04 21:59 Saga Musix Note Added: 0005649
2023-04-04 23:58 c0d3h4x0r Note Added: 0005650