@@ -263,11 +263,11 @@ public void SortMonitorsByIndex()
263263 {
264264 for ( var j = i ; j > 0 ; -- j )
265265 {
266- // Sort by complexities only to keep the sort stable
267- // i.e. don't reverse the order of controls which have the same complexity
268- var firstComplexity = InputActionState . GetComplexityFromMonitorIndex ( listeners [ j - 1 ] . monitorIndex ) ;
269- var secondComplexity = InputActionState . GetComplexityFromMonitorIndex ( listeners [ j ] . monitorIndex ) ;
270- if ( firstComplexity >= secondComplexity )
266+ // Sort by priorities only to keep the sort stable
267+ // i.e. don't reverse the order of controls which have the same priority
268+ var firstPriority = InputActionState . GetPriorityFromMonitorIndex ( listeners [ j - 1 ] . monitorIndex ) ;
269+ var secondPriority = InputActionState . GetPriorityFromMonitorIndex ( listeners [ j ] . monitorIndex ) ;
270+ if ( firstPriority >= secondPriority )
271271 break ;
272272
273273 listeners . SwapElements ( j , j - 1 ) ;
@@ -408,6 +408,7 @@ internal unsafe void FireStateChangeNotifications(int deviceIndex, double intern
408408 if ( ! previouslyHandled && eventPtr ->handled )
409409 {
410410 var groupIndex = listeners [ i ] . groupIndex ;
411+ var handlerPriority = InputActionState . GetPriorityFromMonitorIndex ( listener . monitorIndex ) ;
411412 for ( var n = i + 1 ; n < signals . length ; ++ n )
412413 {
413414 // NOTE: We restrict the preemption logic here to a single monitor. Otherwise,
@@ -419,7 +420,13 @@ internal unsafe void FireStateChangeNotifications(int deviceIndex, double intern
419420 // Note that this implies there there is *NO* preemption between singleton
420421 // InputActions. This isn't intuitive.
421422 if ( listeners [ n ] . groupIndex == groupIndex && listeners [ n ] . monitor == listener . monitor )
422- signals . ClearBit ( n ) ;
423+ {
424+ // Only clear strictly lower binding priorities so equal priorities still
425+ // fire in unison (same as priority 0, but with consumption among lower tiers).
426+ var candidatePriority = InputActionState . GetPriorityFromMonitorIndex ( listeners [ n ] . monitorIndex ) ;
427+ if ( candidatePriority < handlerPriority )
428+ signals . ClearBit ( n ) ;
429+ }
423430 }
424431 }
425432
0 commit comments