Menu

#1472 Add support for high resolution scrolling on Windows

Initial
open
nobody
5
2023-02-05
2022-12-29
minemodder
No

For most mice, 1 'scroll' on windows with a scroll wheel results in a change of 1 delta value, which scrolls 3 lines by default. However, some mice and Windows (8/10/11) precision touchpads support much (120 times as much) higher precision, with 3 lines being equivalent to 120 delta values.

Currently, Scintilla appears to ignore these higher delta values, and simply acts as if 120 high resolution delta values are equivalent to 1 delta value on a normal mouse, and scrolls 3 lines once these 120 delta values have been hit.

By supporting high resolution scrolling, we could scroll line-by-line on touchpads: each 40 high resolution deltas would be 1 line by default. This would make scrolling much smoother on touchpads; note that the same amount of finger movement would still result in 3 lines of scrolling, although this time stopping on any of the 2 other lines would also be possible with smaller movements.

Likewise, support for high resolution scrolling would also allow for very smooth horizontal scrolling. By simply interpreting the raw delta values , due to horizontal scrolling supporting pixel-based offsets, it is possible to create a very smooth scrolling experience for touchpads on Windows, as opposed to the current horizontal scrolling which happens at a fixed speed on touchpads. By purely interpreting these values (which only required a few lines of code), I got very smooth scrolling, complete with proper velocity and inertia as those are computed by Windows before it provides the delta values to the application.

If useful, I would be happy to provide a proof of concept for how this would work; I have partially written one already. Although I must warn that that code is not production-ready. If more explanation is needed, I would be happy to provide it.

Discussion

  • Neil Hodgson

    Neil Hodgson - 2023-01-03

    This seems a bit confused. Windows defines WHEEL_DELTA to always be 120.

    Any change should behave sensibly when the user has chosen to scroll by page in Settings which is seen in the code as WHEEL_PAGESCROLL.

     
  • minemodder

    minemodder - 2023-01-25

    For some devices, like Precision Touchpads, WHEEL_DELTA can be 1 and is given in increments of 1. See: https://learn.microsoft.com/en-us/windows/win32/w8cookbook/windows-precision-touchpad-devices#mitigation

    On a side note, I noticed that on touch screens (in SciTE), line by line scrolling already works as described in this feature request. At least when testing it using Microsoft Remote Desktop on a smartphone, with touch screen (emulation) mode, as my device does not have such a screen.

     
    • Neil Hodgson

      Neil Hodgson - 2023-01-25

      WHEEL_DELTA is a preprocessor definition in the WinUser.h file from the Windows SDK:

      /* Value for rolling one detent */
      #define WHEEL_DELTA                     120
      
       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.