@@ -44,17 +44,20 @@ public sealed class ControlSession
4444 private readonly DesktopCommandExecutor commandExecutor ;
4545 private readonly IPointerProfileProvider pointerProfileProvider ;
4646 private readonly MouseRepeatController ? mouseRepeatController ;
47+ private readonly PointerSpeedController ? pointerSpeedController ;
4748
4849 public ControlSession (
4950 CommandAuthValidator authValidator ,
5051 DesktopCommandExecutor commandExecutor ,
5152 IPointerProfileProvider pointerProfileProvider ,
52- MouseRepeatController ? mouseRepeatController = null )
53+ MouseRepeatController ? mouseRepeatController = null ,
54+ PointerSpeedController ? pointerSpeedController = null )
5355 {
5456 this . authValidator = authValidator ;
5557 this . commandExecutor = commandExecutor ;
5658 this . pointerProfileProvider = pointerProfileProvider ;
5759 this . mouseRepeatController = mouseRepeatController ;
60+ this . pointerSpeedController = pointerSpeedController ;
5861 }
5962
6063 public async Task < ControlSessionResult > ProcessMessageAsync ( string rawMessage , CancellationToken cancellationToken = default )
@@ -124,9 +127,21 @@ public async Task<ControlSessionResult> ProcessMessageAsync(string rawMessage, C
124127 await StopRepeatAsync ( auth . DeviceId ?? "" ) . ConfigureAwait ( false ) ;
125128 result = CommandExecutionResult . Success ;
126129 }
130+ else if ( type == "pointer.speed.set" )
131+ {
132+ if ( pointerSpeedController is null )
133+ {
134+ result = CommandExecutionResult . Failure ( "unsupported_command" , "Pointer speed settings are not available." ) ;
135+ }
136+ else
137+ {
138+ pointerSpeedController . SetScalePercent ( request . GetProperty ( "payload" ) . GetProperty ( "scalePercent" ) . GetDouble ( ) ) ;
139+ result = CommandExecutionResult . Success ;
140+ }
141+ }
127142 else
128143 {
129- if ( type is not ( "connection.ping" or "pointer.profile" ) )
144+ if ( type is not ( "connection.ping" or "pointer.profile" or "pointer.speed.set" ) )
130145 {
131146 await StopRepeatAsync ( auth . DeviceId ?? "" ) . ConfigureAwait ( false ) ;
132147 }
@@ -273,6 +288,17 @@ private static JsonObject PointerProfileResponse(string id, PointerMovementProfi
273288 [ "scrollIntervalMs" ] = profile . Capabilities . MouseRepeat . ScrollIntervalMs ,
274289 [ "minIntervalMs" ] = profile . Capabilities . MouseRepeat . MinIntervalMs ,
275290 [ "maxIntervalMs" ] = profile . Capabilities . MouseRepeat . MaxIntervalMs
291+ } ,
292+ [ "pointerSpeed" ] = new JsonObject
293+ {
294+ [ "supported" ] = profile . Capabilities . PointerSpeed . Supported ,
295+ [ "setSupported" ] = profile . Capabilities . PointerSpeed . SetSupported ,
296+ [ "scalePercent" ] = profile . Capabilities . PointerSpeed . ScalePercent ,
297+ [ "minScalePercent" ] = profile . Capabilities . PointerSpeed . MinScalePercent ,
298+ [ "maxScalePercent" ] = profile . Capabilities . PointerSpeed . MaxScalePercent ,
299+ [ "stepPercent" ] = profile . Capabilities . PointerSpeed . StepPercent ,
300+ [ "baseMoveDelta" ] = profile . Capabilities . PointerSpeed . BaseMoveDelta ,
301+ [ "effectiveMoveDelta" ] = profile . Capabilities . PointerSpeed . EffectiveMoveDelta
276302 }
277303 }
278304 } ,
0 commit comments