uno
uno copied to clipboard
feat: implement the X Input extension to support touch input, smooth scrolling, etc.
GitHub Issue (If applicable): closes https://github.com/unoplatform/uno-private/issues/409, closes #17912
PR Type
What kind of change does this PR introduce?
What is the current behavior?
What is the new behavior?
PR Checklist
Please check if your PR fulfills the following requirements:
- [ ] Docs have been added/updated which fit documentation template (for bug fixes / features)
- [ ] Unit Tests and/or UI Tests for the changes have been added (for bug fixes / features) (if applicable)
- [ ] Validated PR
Screenshots Compare Test Runresults. - [ ] Contains NO breaking changes
- [ ] Associated with an issue (GitHub or internal) and uses the automatic close keywords.
- [ ] Commits must be following the Conventional Commits specification.
Other information
Internal Issue (If applicable):
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-15799/index.html
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-15799/index.html
@ramezgerges other than the rebase, is there anything missing in this PR? Once it is, I'll test it on actual hardware.
@jeromelaban There's nothing that I plan to add, no. But considering I haven't tested touch at all, the PR will probably have some stuff "missing.
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-15799/index.html
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-15799/index.html
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-15799/index.html
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-15799/index.html
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-15799/index.html
@ramezgerges could you resolve the conflicts? Thanks!
My version of X input support: https://github.com/lindexi/uno/blob/f2f4d7980fcbf3cef4cbd4a56172e0cb1121aa74/src/Uno.UI.Runtime.Skia.X11/X11PointerInputSource.XInput.cs
I tested the code on a touch device and it passed.
But there are some points worth discussing:
- Within XInput, the size of touch is no longer represented by width and height, but by the long and short axes of an ellipse.
- Is there a need to perform DPI scaling calculations for width and height?
- In XInput, if there is no change in the size of touch and pressure sensitivity, no values will be received. It may be necessary to use the data from the previous touch event at the lower level. Currently, my approach is to return a default value of 0 when no values are received.
Update:
I reimplemente the X11PointerInputSource.XInput.cs to make it to support GetIntermediatePoints, which can alleviates the problem of input message stacking.
See https://github.com/lindexi/uno/blob/218e2016093af8523a1ad2b54cd169d20da09722/src/Uno.UI.Runtime.Skia.X11/X11PointerInputSource.XInput.cs#L277
Reference: https://github.com/unoplatform/uno/issues/17527
@jeromelaban Sorry to be pushing, can I know any update here?
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-15799/index.html
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-15799/index.html
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-15799/index.html
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-15799/index.html
@ramezgerges I've never used custom-built/debug Uno SDK before, but if you want me to try your changes please let me know and I'll figure it out.
@HakanL You may find the nuget package in the CI. Which will output the nuget to Artifacts in Azure: https://dev.azure.com/uno-platform/Uno%20Platform/_build/results?buildId=136084&view=artifacts&pathAsName=false&type=publishedArtifacts
@lindexi I see, so I have to go through all the non-sample artifacts and download locally from DevOps, extract and update my project? Or am I misunderstanding the process? Sorry if this isn't the place to discuss that.
@HakanL I will pull the code and build my version, see https://platform.uno/docs/articles/uno-development/building-uno-ui.html
Any luck on testing this?
@HakanL unfortunately not working properly yet, the input gets duplicated with both mouse and touch coming in, we need to investigate further, but very soon
@HakanL unfortunately not working properly yet, the input gets duplicated with both mouse and touch coming in, we need to investigate further, but very soon
@MartinZikmund Do you means that one touch will receive both the XI_ButtonXxx and XI_TouchXxx event? If so, you can check the XIDeviceEvent's flags to know the XI_ButtonXxx from Emulated:
if ((xiDeviceEvent->flags & XiDeviceEventFlags.XIPointerEmulated) ==
XiDeviceEventFlags.XIPointerEmulated)
{
... // Ignore
}
Demo code: https://github.com/lindexi/lindexi_gd/blob/774d821dc66a01e985ba401fbab107c7b8ac2afa/X11/BujeeberehemnaNurgacolarje/X11App.cs#L499-L505