uno icon indicating copy to clipboard operation
uno copied to clipboard

feat: implement the X Input extension to support touch input, smooth scrolling, etc.

Open ramezgerges opened this issue 1 year ago • 24 comments

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:

Other information

Internal Issue (If applicable):

ramezgerges avatar Mar 07 '24 20:03 ramezgerges

🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-15799/index.html

unodevops avatar Mar 07 '24 21:03 unodevops

🤖 Your WebAssembly Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-15799/index.html

unodevops avatar Mar 07 '24 22:03 unodevops

@ramezgerges other than the rebase, is there anything missing in this PR? Once it is, I'll test it on actual hardware.

jeromelaban avatar Mar 27 '24 12:03 jeromelaban

@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.

ramezgerges avatar Mar 27 '24 13:03 ramezgerges

🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-15799/index.html

unodevops avatar Mar 28 '24 11:03 unodevops

🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-15799/index.html

unodevops avatar Apr 02 '24 09:04 unodevops

🤖 Your WebAssembly Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-15799/index.html

unodevops avatar Apr 02 '24 09:04 unodevops

🤖 Your WebAssembly Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-15799/index.html

unodevops avatar Apr 02 '24 15:04 unodevops

🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-15799/index.html

unodevops avatar Apr 02 '24 16:04 unodevops

@ramezgerges could you resolve the conflicts? Thanks!

jeromelaban avatar Apr 23 '24 15:04 jeromelaban

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:

  1. Within XInput, the size of touch is no longer represented by width and height, but by the long and short axes of an ellipse.
  2. Is there a need to perform DPI scaling calculations for width and height?
  3. 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.

lindexi avatar Jun 29 '24 03:06 lindexi

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

lindexi avatar Jul 16 '24 06:07 lindexi

@jeromelaban Sorry to be pushing, can I know any update here?

lindexi avatar Jul 24 '24 08:07 lindexi

🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-15799/index.html

unodevops avatar Aug 12 '24 19:08 unodevops

🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-15799/index.html

unodevops avatar Aug 12 '24 20:08 unodevops

🤖 Your WebAssembly Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-15799/index.html

unodevops avatar Aug 12 '24 20:08 unodevops

🤖 Your WebAssembly Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-15799/index.html

unodevops avatar Aug 12 '24 21:08 unodevops

@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 avatar Aug 14 '24 02:08 HakanL

@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 avatar Aug 14 '24 06:08 lindexi

@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 avatar Aug 14 '24 13:08 HakanL

@HakanL I will pull the code and build my version, see https://platform.uno/docs/articles/uno-development/building-uno-ui.html

lindexi avatar Aug 15 '24 01:08 lindexi

Any luck on testing this?

HakanL avatar Aug 28 '24 02:08 HakanL

@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 avatar Aug 28 '24 08:08 MartinZikmund

@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

lindexi avatar Aug 28 '24 08:08 lindexi