Skip to content

GDK W32: Support smooth scrolling (GTK4)

LRN requested to merge lrn/gtk:win32-smooth-scrolling-gtk4 into master

Set delta_x or delta_y for GdkScrollEvent. HIWORD (wParam) in WM_MOUSE(H)WHEEL is the scroll delta. A delta value of WHEEL_DELTA (which is 120) means scrolling one full unit of something (for example, a line).

The delta should also be multiplied by the value that the SystemParametersInfo (SPI_GETWHEELSCROLL(LINES|CHARS), 0, &value, 0) call gives back, unless it gives back 0xffffffff, in which case it indicates that scrolling is page- or screen-based, not line-based (GDK doesn't support that at the moment).

Also, all deltas should be inverted, since MS sends negative deltas when scrolling down (rotating the wheel back, in the direction of the user).

With deltas set the mode should be set to GDK_SCROLL_SMOOTH.

Fixes issue 1263.

This is a GTK4 version of !292 (merged)

Merge request reports