forked from AvaloniaUI/Avalonia
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix input starvation issues on resource-constrained devices. (Avaloni…
…aUI#15137) * Use 0.2 seconds for input starvation cutoff. 1 second was too long when running on resource-constrained devices. * Allow input starvation code to run. Using `ScheduleRender(true)` here prevented the input starvation code from running. * Add DispatcherOptions. And allow setting the input starvation timeout there.
- Loading branch information
Showing
3 changed files
with
32 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System; | ||
|
||
namespace Avalonia.Threading; | ||
|
||
/// <summary> | ||
/// AppBuilder options for configuring the <see cref="Dispatcher"/>. | ||
/// </summary> | ||
public class DispatcherOptions | ||
{ | ||
/// <summary> | ||
/// Gets or sets a timeout after which the dispatcher will start prioritizing input events over | ||
/// rendering. The default value is 1 second. | ||
/// </summary> | ||
/// <remarks> | ||
/// If no input events are processed within this time, the dispatcher will start prioritizing | ||
/// input events over rendering to prevent the application from becoming unresponsive. This may | ||
/// need to be lowered on resource-constrained platforms where input events are processed on | ||
/// the same thread as rendering. | ||
/// </remarks> | ||
public TimeSpan InputStarvationTimeout { get; set; } = TimeSpan.FromSeconds(1); | ||
} |