Skip to content

Conversation

GalaxyShard
Copy link

Fixes #106168

get_delta() on Wayland is set to return a value intended to be interpreted as a measure of some amount of pixels, however previously it was being multiplied by another pixel value (page size) before scrolling was applied, which makes no sense dimensionally.

As for MacOS, get_delta() returns a value that seems to be set with unspecified units by the documentation. When hasPreciseScrollingDeltas is true, the docs imply the value can be used as-is, and based on the mulitpliers within the MacOS input handling code and the get_delta() code that was originally written only for MacOS, it's presumably a similar measurement to what Wayland uses, although I don't have a Mac to test this on.

As for when hasPreciseScrollingDeltas is false, the units are supposed to be application-defined rows or lines; panning events don't make sense to use here, however there is already code that switches between emitting panning events and scroll events on MacOS; presumably, this code works and this PR would have no effect on it.

Relevant docs:
https://developer.apple.com/documentation/appkit/nsevent/scrollingdeltay
https://developer.apple.com/documentation/appkit/nsevent/scrollingdeltax

Panning events only appear to be used on Wayland and MacOS, whereas other platforms use scroll events, so this should not affect Windows or other platforms.

This PR will probably result in some changes to the scroll speed on MacOS, and I don't have a Macbook with a trackpad to test it on. By some rough math it shouldn't change significantly, but it's difficult to measure because previously the scroll speed depended on the size of the window; splitting the screen one app on top and Godot on the bottom could cut the scroll speed of individual panels into thirds or less.

get_delta() on Wayland is set to return a value intended to be interpreted as
a measure of some amount of pixels, however previously it was being multiplied by another
pixel value (page size) before scrolling was applied, which makes no sense dimensionally.

As for MacOS, get_delta() seems to be set to a value with unspecified units by the documentation.
When hasPreciseScrollingDeltas is true, the docs imply the value can be used as-is,
and based on the mulitpliers within the MacOS input handling code and the get_delta()
code that was originally written only for MacOS, it's presumably a similar
measurement to what Wayland uses, although I don't have a Mac to test this on.

As for when hasPreciseScrollingDeltas is false, the units are supposed to be
application-defined rows or lines; panning events don't make sense to use
here, however there is already code that switches between emitting panning
events and scroll events on MacOS; presumably, this code works and this PR
would have no effect on it.

Relevant docs:
    https://developer.apple.com/documentation/appkit/nsevent/scrollingdeltay
    https://developer.apple.com/documentation/appkit/nsevent/scrollingdeltax

Panning events only appear to be used on Wayland and MacOS, so this should
not affect Windows or other platforms.

Fixes godotengine#106168
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wayland: scrolling with touchpad is extremely fast

2 participants