Skip to content
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

Incorrect Implementation of GetIntermediatePoints Method in UNO Framework #17527

Open
lindexi opened this issue Jul 15, 2024 · 1 comment
Open
Labels
area/skia ✏️ Categorizes an issue or PR as relevant to Skia difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI kind/bug Something isn't working project/input ⌨️ Categorizes an issue or PR as relevant to input (Button, CheckBox, Toggle, Scroll, Map, Numeric,...)

Comments

@lindexi
Copy link
Contributor

lindexi commented Jul 15, 2024

Current behavior

I have discovered an issue with the implementation of the GetIntermediatePoints method in the UNO Framework.

In the design of WinUI or UWP, developers can use GetIntermediatePoints to obtain historical input point data. This is particularly useful when the UI is busy, as it means that when the UI is unable to process input points in time, the accumulated input points will be added to the historical input point data, preventing a large number of input triggers from further slowing down the UI.

However, in the UNO Framework, the GetIntermediatePoints method is not implemented correctly. Instead of returning historical input point data, it only returns the current point. This means that in the UNO Framework, when the UI is too busy to process input, it will continuously trigger input events or lose input data. On the X11 platform, this will exacerbate UI lag by continuously triggering input events. On the WPF platform, this will result in lost input data.

Expected behavior

I would like to see the GetIntermediatePoints method in the UNO Framework implemented in the same way as in WinUI, where input points are collected and added to the historical input point data when the UI is too busy. This would reduce the triggering of input events when the UI thread is unable to process input data in time.

How to reproduce it (as minimally and precisely as possible)

  1. Create an empty UNO project.
  2. Add the PointerMoved handler.
  3. Call the GetIntermediatePoints and make the UI busy.

Run the project between WinUI and UNO. And you can find the count of GetIntermediatePoints will always be one.

You can find my demo code in https://github.com/lindexi/lindexi_gd/tree/1111c23e4c76a3aa7e3418db8ff7b6661cd0d1d2/UnoDemo/NeejabaykugoWerjekeeja

Workaround

No response

Works on UWP/WinUI

Yes

Environment

No response

NuGet package version(s)

gloabl.json

{
  // To update the version of Uno please update the version of the Uno.Sdk here. See https://aka.platform.uno/upgrade-uno-packages for more information.
  "msbuild-sdks": 
  {
    "Uno.Sdk": "5.2.175"
  }
}

Affected platforms

Skia (WPF), Skia (Linux X11), Skia (macOS), Skia (Linux Framebuffer), Skia (GTK)

IDE

Visual Studio 2022

IDE version

No response

Relevant plugins

No response

Anything else we need to know?

public IList<PointerPoint> GetIntermediatePoints()
=> new List<PointerPoint> { CurrentPoint };

public IList<PointerPoint> GetIntermediatePoints(UIElement relativeTo)
=> new List<PointerPoint>(1) { GetCurrentPoint(relativeTo) };

@lindexi lindexi added difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification labels Jul 15, 2024
@lindexi
Copy link
Contributor Author

lindexi commented Jul 16, 2024

Furthering the issue, I believe it's an unsound design within the UNO framework to bifurcate threads into X11 threads and the UNO main thread. It's also unreasonable to have a design where each window has an X11 thread. When the UI thread fails to process input messages in a timely manner, it results in message accumulation. Even with the correct implementation of the GetIntermediatePoints function, due to input messages being scheduled to the UI thread with higher priority, rendering messages can't be pushed promptly, leading to a halt in interface rendering.

@MartinZikmund MartinZikmund added area/skia ✏️ Categorizes an issue or PR as relevant to Skia project/input ⌨️ Categorizes an issue or PR as relevant to input (Button, CheckBox, Toggle, Scroll, Map, Numeric,...) difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI and removed triage/untriaged Indicates an issue requires triaging or verification difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. labels Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/skia ✏️ Categorizes an issue or PR as relevant to Skia difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI kind/bug Something isn't working project/input ⌨️ Categorizes an issue or PR as relevant to input (Button, CheckBox, Toggle, Scroll, Map, Numeric,...)
Projects
None yet
Development

No branches or pull requests

2 participants