Prune commentary and stale Rust port notes
This commit is contained in:
1 parent
3ae034a47b
commit
1e6d3b1edd
84 files changed
+334
-5648
No files matched your search
+3
-19
@@ -3,30 +3,14 @@ name = "rig-input"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
|
||||
# Layer 2's input half (docs/RUST.md's "Three test layers"): replays one
|
||||
# of the `.touch` files the headless tests use into whatever window is
|
||||
# under a Wayland compositor, so the *same recording* drives the
|
||||
# assertion layer and the layer a person looks at.
|
||||
#
|
||||
# It exists because this machine's compositor has no pointer to move.
|
||||
# `run-headless.sh` starts sway on the headless backend with no input
|
||||
# devices at all (`WLR_LIBINPUT_NO_DEVICES=1`, `LIBSEAT_BACKEND=noop`),
|
||||
# so `swaymsg seat - cursor press` reports success and nothing reaches
|
||||
# the client -- `swaymsg -t get_seats` shows `capabilities: 0`. wlroots
|
||||
# 0.19 dropped `WLR_HEADLESS_INPUTS`, and ydotool's uinput device would
|
||||
# be ignored by a compositor that is not reading libinput. The
|
||||
# virtual-pointer protocol is what is left, and it is a client protocol,
|
||||
# so it needs no devices and no root.
|
||||
|
||||
# Named for what it does rather than for the crate, since the crate may
|
||||
# grow a keyboard replay beside it.
|
||||
# Replays harness `.touch` files through Wayland's virtual-pointer protocol;
|
||||
# headless sway has no input devices for coordinate-driving tools to move.
|
||||
[[bin]]
|
||||
name = "replay-touch"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
# `TouchScript` -- the same parser the harness uses, so a file that
|
||||
# replays here and one that replays headless can never disagree.
|
||||
# Share the harness parser so both layers interpret recordings identically.
|
||||
iris = { path = ".." }
|
||||
wayland-client = "0.31.15"
|
||||
wayland-protocols-wlr = { version = "0.3.12", features = ["client"] }
|
||||
@@ -1,19 +1,3 @@
|
||||
//! Replays a `.touch` file into the compositor as a left-button drag --
|
||||
//! see this crate's `Cargo.toml` for why it exists rather than
|
||||
//! `swaymsg seat - cursor`.
|
||||
//!
|
||||
//! WAYLAND_DISPLAY=… replay-touch WIDTH HEIGHT FILE
|
||||
//!
|
||||
//! `WIDTH`/`HEIGHT` are the output's own size, because the virtual
|
||||
//! pointer protocol positions absolutely against an extent rather than
|
||||
//! in pixels; passing the output size makes a script's coordinates mean
|
||||
//! the same pixels they mean in the headless tests.
|
||||
//!
|
||||
//! Replayed in real time (the sleeps between samples are the gaps in the
|
||||
//! file), because winit has no timestamp on a pointer event and dates
|
||||
//! each one when it arrives -- so a 20ms flick has to actually take
|
||||
//! 20ms here, unlike layer 1 where the sample carries its own time.
|
||||
|
||||
use iris::harness::{TouchAction, TouchScript};
|
||||
use std::time::Duration;
|
||||
use wayland_client::protocol::wl_pointer::ButtonState;
|
||||
@@ -24,12 +8,8 @@ use wayland_protocols_wlr::virtual_pointer::v1::client::{
|
||||
zwlr_virtual_pointer_v1::ZwlrVirtualPointerV1,
|
||||
};
|
||||
|
||||
/// `linux/input-event-codes.h`. The protocol takes the kernel's own
|
||||
/// button code, not a wayland enum.
|
||||
const BTN_LEFT: u32 = 0x110;
|
||||
|
||||
/// How long the pointer sits at the gesture's first position before the
|
||||
/// script starts -- see the comment at the pre-step in `main`.
|
||||
const SETTLE: Duration = Duration::from_millis(200);
|
||||
|
||||
#[derive(Default)]
|
||||
@@ -126,9 +106,6 @@ fn main() {
|
||||
previous = sample.t_ms;
|
||||
let t = sample.t_ms as u32;
|
||||
pointer.motion_absolute(t, sample.pos.x as u32, sample.pos.y as u32, width, height);
|
||||
// One frame per sample, so the compositor delivers them as
|
||||
// separate pointer frames rather than coalescing the whole
|
||||
// gesture -- the shape the file recorded is the point.
|
||||
pointer.frame();
|
||||
// The button goes in a frame of its own, *after* the motion has
|
||||
// been committed. Sent in the same frame as the motion that
|
||||
|
||||
Reference in new issue
Block a user