-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
High res scrolling support #1246
Conversation
I guess accumulation for |
Yeah, that seems like a good approach to me. I would love to handle of the backwards compatibility inside the specific pointer targets (e.g. WlSurface's implementation) and just use the more precise values all out through smithay. That way we also don't have to replicate the This might be a bit annoying for toolkit integrations like smithay-egui or cosmic-comp's iced code, but they should be able to copy the WlSurface implementation, if they need to. Maybe we can make this conversion/caching into a helper function?
Yes probably.
Totally fine imo, even debian stable already has libinput 1.22.
Given not all compositors support this (and I am not sure if Xwayland does and will ever), we need a way to generate the new events from the old values. I guess that shouldn't be too difficult though, no? |
Conversion in that direction is much easier, I think. Nothing needs to be accumulated, and the discrete values can just be multiplied by 120 to get the "v120" value. |
cb4fb28
to
a2fc9c6
Compare
This adds support for `wl_pointer` version 8, calling `wl_pointer::axis_value120` with the v120 values from libinput. For clients not binding version 8, values are accumulated to multiples of 120 to send the old `axis_discrete` event. This helps even for clients using `wl_pointer::axis` with old versions of `wl_pointer`, since the old libinput event only was emitted where there was a whole discrete scroll step. Raises libinput requirement to 1.19, which should be widely available now. Removes handling of versions before that. It should be possible to support high res scrolling in the X11 and Winit backends, where the platform supports it, but for now this just converts the low-res value to v120.
This should be working well now. Instead of adding 2 more associated types, I used an |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not super sure, we want the renaming from discrete
->v120
now. Is this intended to introduce breakage on purpose?
I don't find the name particular descriptive and the 120 values are still discrete, so if we want to rename, we might as well do amount_discrete_v120
at least, no?
Leaving the name the same could/will break behavior. At a minimum the code in Anvil/Smallvil/Cosmic-Comp tries to use Changing the name seems appropriate if users are going to have to change the code using it anyway, to have correct behavior after this change. As for the specific naming, Wayland named the event |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. Given I got nothing on the actual code, I am going to merge this then.
I've been thinking about how to handle high res scroll. Might as well hack together an initial implementation. Very WIP, but shows what is still needed here.
Testing things, it seems
PointerScrollWheelEvent
is emitted whenever a scroll is sent from the device, whilePointerAxisEvent
is only sent after accumulating change. So this impacts even clients not using the new protocol version, so they can get more precise scrolling fromwl_pointer::axis
.In particular, this works in Firefox.
Issues:
axis_value120
events into aaxis_discrete
eventPointerTarget<D> for WlSurface
somehow?PointerAxisEvent
with anAxisSource
enum, there are multiplePointerScroll*
event typesPointerScrollWheelEvent
smithay::backend::input
currently models its API here on libinput. So do we want to remove ourAxisSource
and splittype PointerAxisEvent
into 3 types?PointerAxisEvent