move_axisField-generic motion verb

fn move_axis(&self, motion: Motion, timing: MoveTiming, pending: PendingMotion) -> Result<()>

Fire-and-forget

ParameterTypeDescription
motionMotionAxis and delta: Cursor { dx, dy }, Wheel(dz), or Pan(dz).
timingMoveTimingRide native motion, or emit on the next report.
pendingPendingMotionKeep, flush or discard motion already held for a ride.

Backs MOVE, whose flags byte holds the last two parameters. With movement riding off, Now still skips spreading and rendering. Flush and Discard then act on what spreading and rendering hold of earlier moves.

EXAMPLE
use medius::{Motion, MoveTiming, PendingMotion};

device.move_axis(Motion::Cursor { dx: 20, dy: 20 }, MoveTiming::Ride, PendingMotion::Keep)?;
device.move_axis(Motion::Wheel(1), MoveTiming::Ride, PendingMotion::Keep)?;
// Send this one now, and the held motion with it.
device.move_axis(Motion::Cursor { dx: 5, dy: 0 }, MoveTiming::Now, PendingMotion::Flush)?;

move_relRelative cursor motion

fn move_rel(&self, dx: i16, dy: i16) -> Result<()>

Fire-and-forget

move_axis with Motion::Cursor.

ParameterTypeDescription
dxi16Horizontal offset in mouse counts. Positive right, negative left.
dyi16Vertical offset in mouse counts. Positive down, negative up.

dx and dy span the full i16 range (-32768 to 32767). The OS pointer speed and acceleration curve scale counts to pixels.

EXAMPLE
device.move_rel(20, 20)?;  // right and down
device.move_rel(-40, 0)?;  // left
device.move_rel(0, -10)?;  // up

wheelWheel scroll

fn wheel(&self, delta: i16) -> Result<()>

Fire-and-forget

A wrapper over move_axis with Motion::Wheel.

ParameterTypeDescription
deltai16Scroll steps. Positive up, negative down.

delta spans the full i16 range (-32768 to 32767). It feeds the same accumulator as cursor motion, which paces large values across reports.

EXAMPLE
device.wheel(3)?;   // up three notches
device.wheel(-1)?;  // down one notch

panAC Pan (horizontal scroll)

fn pan(&self, delta: i16) -> Result<()>

Fire-and-forget

move_axis with Motion::Pan, a full peer of wheel.

ParameterTypeDescription
deltai16Pan steps (horizontal scroll). Positive right, negative left.

delta spans the full i16 range (-32768 to 32767). It feeds the same accumulator as the wheel, which paces large values across reports. It works only on a real device whose descriptor declares AC Pan (check caps).

EXAMPLE
device.pan(3)?;   // pan right
device.pan(-1)?;  // pan left

move_rel_nowCursor motion that bypasses riding

fn move_rel_now(&self, dx: i16, dy: i16) -> Result<()>

Fire-and-forget

ParameterTypeDescription
dxi16Horizontal offset in mouse counts. Positive right, negative left.
dyi16Vertical offset in mouse counts. Positive down, negative up.

move_rel with MoveTiming::Now: the delta is emitted on the box's next mouse report instead of riding native motion, and held motion stays held.

The box emits a report for the delta on the first poll that no native report can be ready for. If a native report reaches the box first, that report carries the delta. But if it already carries injected motion and the real device leaves polls free, the delta takes a separate poll.

EXAMPLE
device.set_movement_riding(Some(Duration::from_millis(20)))?;
device.move_rel(100, 0)?;      // rides native motion, dropped without it
device.move_rel_now(100, 0)?;  // emits either way

wheel_nowScroll that bypasses riding

fn wheel_now(&self, delta: i16) -> Result<()>

Fire-and-forget

ParameterTypeDescription
deltai16Scroll steps. Positive scrolls up, negative scrolls down.

wheel with MoveTiming::Now.

EXAMPLE
device.wheel_now(-1)?;  // one notch down, on the next report

pan_nowPan that bypasses riding

fn pan_now(&self, delta: i16) -> Result<()>

Fire-and-forget

ParameterTypeDescription
deltai16Pan steps (horizontal scroll). Positive pans right, negative pans left.

pan with MoveTiming::Now.

EXAMPLE
device.pan_now(-1)?;  // one step left, on the next report

flush_motionEmit what riding holds

fn flush_motion(&self) -> Result<()>

Fire-and-forget

EFFECT
AccumulatorAfter flush
RidingEmptied into the immediate accumulator, regardless of the ride window. Emits no motion itself.
ImmediateGains that amount, emitted on the box's next mouse report.
EXAMPLE
for _ in 0..10 {
    device.move_rel(4, 0)?;   // accumulates, waiting for native motion
}
device.flush_motion()?;       // 40 counts, now

discard_motionDrop what riding holds

fn discard_motion(&self) -> Result<()>

Fire-and-forget

EFFECT
StateAfter discard
Riding accumulatorZeroed; never reaches the game PC.
Immediate accumulatorUntouched, so a move sent with MoveTiming::Now is still emitted.
BearingCleared, so every With / Against scale stops applying until the box injects again.

Unlike reset, no held usage or lock is released.

EXAMPLE
device.move_rel(400, 0)?;   // queued
device.discard_motion()?;   // it never reaches the game PC

On AsyncDeviceMotion stays synchronous

AsyncDevice keeps every motion verb synchronous: no .await, same signatures. block_on is only for async queries.

EXAMPLE
let dev = Device::find()?.into_async();
dev.move_rel(40, 0)?;  // no .await
dev.wheel(1)?;