gtkeventcontrollerscroll: Send lores scroll in the middle of the detent
authorJosé Expósito <jose.exposito89@gmail.com>
Mon, 17 Oct 2022 17:10:37 +0000 (19:10 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 5 Jun 2023 11:57:52 +0000 (07:57 -0400)
commit2092d21bad455cea8f3a440dd6a23113f63f53a0
tree5501826d361eaa47e59167a5529641b8ded60201
parent23c044d060a2bc914ae3957b261848cb18edfa55
gtkeventcontrollerscroll: Send lores scroll in the middle of the detent

Some mice send a value slightly lower than 120 for some detents. The
current approach waits until a value of 120 is reached before sending a
low-resolution scroll event.

For example, the MX Master 3 sends a value of 112 in some detents:

              detent                   detent
    |                        |                       |
                        ^    ^                    ^
                        112  REL_WHEEL            224

As illustrated, only one event was sent but two were expected. However,
sending the low-resolution scroll event in the middle plus the existing
heuristics to reset the accumulator solve this issue:

              detent                   detent
    |                        |                       |
                ^          ^             ^          ^
                REL_WHEEL  112           REL_WHEEL  224

Send low-resolution scroll events in the middle of the detent to solve
this problem.

Related to https://gitlab.gnome.org/GNOME/mutter/-/issues/2469
gtk/gtkeventcontrollerscroll.c