Move
Cursor motion and scrollOne field-generic verb, move_axis, drives the relative axes. move_rel and wheel are thin wrappers over it. Each call queues one fire-and-forget MOVE frame.
| You want | Method | Same as |
|---|---|---|
| move the cursor | move_rel(dx, dy) | move_axis(Motion::Cursor { dx, dy }) |
| scroll the wheel | wheel(delta) | move_axis(Motion::Wheel(dz)) |
move_axis
Field-generic motion verbfn move_axis(&self, motion: Motion) -> Result<()>
Fire-and-forget
motion is a Motion: Cursor { dx, dy } for pointer movement or Wheel(dz) for scroll. Backs the MOVE command.
use medius::Motion;
device.move_axis(Motion::Cursor { dx: 20, dy: 20 })?; // right and down
device.move_axis(Motion::Wheel(1))?; // one notch upmove_rel
Relative cursor movementfn move_rel(&self, dx: i16, dy: i16) -> Result<()>
Fire-and-forget
A wrapper over move_axis with Motion::Cursor.
| Parameter | Type | Description |
|---|---|---|
dx | i16 | Horizontal offset in mouse counts. Positive moves right, negative moves left. |
dy | i16 | Vertical offset in mouse counts. Positive moves down, negative moves up (screen-style, not math-style). |
Offsets are mouse counts, not pixels, scaled by the OS pointer-speed and acceleration curve. Both span the full i16 range (-32768 to 32767).
device.move_rel(20, 20)?; // right and down
device.move_rel(-40, 0)?; // left
device.move_rel(0, -10)?; // upwheel
Wheel scrollfn wheel(&self, delta: i16) -> Result<()>
Fire-and-forget
A wrapper over move_axis with Motion::Wheel.
| Parameter | Type | Description |
|---|---|---|
delta | i16 | Scroll steps. Positive scrolls up, negative scrolls down. |
delta spans the full i16 range (-32768 to 32767) and feeds the same accumulator as cursor motion, pacing large values across reports.
device.wheel(3)?; // up three notches
device.wheel(-1)?; // down one notchOn AsyncDevice
Movement stays synchronousAsyncDevice keeps move_axis, move_rel, and wheel synchronous: no .await, same signatures. The block_on pattern is only for async queries.
let dev = Device::find()?.into_async();
dev.move_rel(40, 0)?; // no .await
dev.wheel(1)?;