From 141706f72738be2debfa9ee5ed471c6bbc61bc0d Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Sat, 26 Nov 2022 16:21:04 +0600 Subject: [PATCH] Changed the way DispatcherPriority values are defined, added PreComposition priority --- .../Threading/DispatcherPriority.cs | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/Avalonia.Base/Threading/DispatcherPriority.cs b/src/Avalonia.Base/Threading/DispatcherPriority.cs index f041590fc0..1ae292f280 100644 --- a/src/Avalonia.Base/Threading/DispatcherPriority.cs +++ b/src/Avalonia.Base/Threading/DispatcherPriority.cs @@ -45,32 +45,37 @@ namespace Avalonia.Threading /// /// The job will be processed after other non-idle operations have completed. /// - public static readonly DispatcherPriority Background = new(1); + public static readonly DispatcherPriority Background = new(MinValue + 1); /// /// The job will be processed with the same priority as input. /// - public static readonly DispatcherPriority Input = new(2); + public static readonly DispatcherPriority Input = new(Background + 1); /// /// The job will be processed after layout and render but before input. /// - public static readonly DispatcherPriority Loaded = new(3); - + public static readonly DispatcherPriority Loaded = new(Input + 1); + /// /// The job will be processed with the same priority as render. /// - public static readonly DispatcherPriority Render = new(5); - + public static readonly DispatcherPriority Render = new(Loaded + 1); + /// /// The job will be processed with the same priority as composition updates. /// - public static readonly DispatcherPriority Composition = new(6); - + public static readonly DispatcherPriority Composition = new(Render + 1); + /// - /// The job will be processed with the same priority as render. + /// The job will be processed with the same priority as composition updates. + /// + public static readonly DispatcherPriority PreComposition = new(Composition + 1); + + /// + /// The job will be processed with the same priority as layout. /// - public static readonly DispatcherPriority Layout = new(7); + public static readonly DispatcherPriority Layout = new(PreComposition + 1); /// /// The job will be processed with the same priority as data binding. @@ -80,7 +85,7 @@ namespace Avalonia.Threading /// /// The job will be processed before other asynchronous operations. /// - public static readonly DispatcherPriority Send = new(8); + public static readonly DispatcherPriority Send = new(Layout + 1); /// /// Maximum possible priority