-
Notifications
You must be signed in to change notification settings - Fork 2.2k
x11: add support for precision/pixel scrolling #5382
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
base: main
Are you sure you want to change the base?
Conversation
I tested this with my trackball and it worked fine |
https://github.com/libsdl-org/SDL/runs/5441478306?check_suite_focus=true#step:6:190
|
Apologies for the back and forth over the CI compiler warnings, specifically with C89/C90 compliance, for some reason I cannot get cmake to produce warnings or errors for shadowing or mixed code and declarations locally. |
Possibly needs autotools and cmake checks for |
Or, since |
I added checks for both cmake and autotools, though I'm not sure if I set up the autotools check properly for this. |
During further testing, I found a bug in my PR where both precise and non-precise scrolling events will still get sent even if a precision scrolling device is detected. |
xinput2 valuators have many pitfalls I was not aware of when I started this pull request, so I’m going to leave this as a draft until I’m more confident that this is free of bugs. Currently I’m aware of the following issues, though I suspect I will find more:
|
This is still in progress, so I'm tentatively putting it in the 2.0.22 milestone, but we'll slide it to 2.0.24 if necessary. |
I've fixed all of the issues I am currently aware of, so I'm going to continue to test this over the next few days to try and find any remaining edge cases. This should support multiple distinct logical pointers, but I'm not certain it works 100% properly as I was unable to set up multiple pointers under FVWM, XFCE, or herbstluftwm. However, given that SDL makes no attempts to support multiple logical cursors (at least as far as I can tell, based on the wiki excerpt below), and my assumption that it's used relatively rarely, I believe this should not be an issue in practice. I suspect any issues caused by multiple logical pointers would be limited to not detecting creation and removal of logical pointers, and jumpy scrolling when both provide scroll events at the same time.
Regardless, if it's something deemed worth further investigation, I'm willing to put more effort into attempting to test multiple logical cursors. |
It's worth noting that the first scroll event after any of the following will be discarded:
This is an known deficiency in XInput2, due to scrolling being represented as absolute coordinates, any event that prevents us from knowing the previous coordinate forces us to eat the next input event. As far as I can tell, there is zero reliable ways around this, as Chrome, GTK, or QT all share this behavior. |
Is this ready for review and testing in 2.26.0? |
@wooosh, can you review this and update it for the latest main code? |
Yes, I will update this to the latest code in main and review it. |
@wooosh ping? I'd like to get this in for release if it's ready. |
I resolved the merge conflicts but have not tested this...at this point, I think we bump to 2.28.0 or SDL3 and merge right away, as it's probably good but way too late for 2.26.0. |
3.0 it is. :) |
@wooosh, can you update this PR? It would be great to get in for SDL 3.0. Thanks! |
tried compiling 55231f4
this field is only defined if macro it seems to work just fine for me when i forcibly compile with |
Let's kick this to 3.4 and I'll get it updated and tested, for real this time. |
This patch adds support for pixel scrolling for the x11 backend for xinput2.
Description
This patch will automatically detect precision scroll devices using xinput2, allowing for SDL applications to detect scrolling changes smaller than one line, allowing for smooth scrolling on devices with touchpads, trackpoints, and trackballs.
There are a few things about this patch I'm not certain about:
Existing Issue(s)
When precision scrolling was originally added to SDL, the X11 backend was left out:
#1267
On 2016-06-01 16:12:29 +0000, Martijn Courteaux wrote: