Linux backend: how to start, and where the seams are #4
iagodpassos
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
The platform matrix lists Linux as planned, and that is still true. This is
the map for anyone who wants to start it — including how to make the first
useful contribution without implementing the whole thing.
How backends are structured here
There is no backend trait, deliberately —
backend/mod.rsexplains why: only one backend exists in any given build, so a trait would buy
dynamic dispatch nobody wants and hide which implementation is in play. The
contract is instead structural: a
pub(crate) struct Innerexposing a fixedset of methods, selected by
cfginautoit.rs.So a Linux backend is
autoitx/src/backend/linux/inner.rswith the same 47methods as
backend/macos/inner.rs,plus one
cfgarm inautoit.rs. The macOS backend is the model to copy: itis the one that was written against an API bearing no resemblance to AutoIt's,
which is exactly the position X11 is in.
Please do not send it in one PR
The macOS backend is ~3,000 lines across nine modules and took several weeks.
Reviewing that in one piece serves nobody. Suggested slices, each independently
useful and mergeable:
send,send_text,mouse_*,clip_get,clip_put,clip_sequence. XTEST viax11rbfor input;
XFIXESselection-notify for the clipboard counter. Note thatclip_sequencereturningOption<u32>is what makesrecipes::read_screen_textrace-free — if X11 cannot give a real counter,return
Nonerather than a fake one, and say so in the module docs._NET_CLIENT_LIST,_NET_WM_NAME,_NET_WM_PID.Covers
win_exists/win_activate/win_get_*/win_set_state.Selector'sCLASS:maps toWM_CLASShere, which is a closer fit thanit was on macOS.
XGetImage, orxcb_shmif you want it fast.run— mostly/procandstd::process, little X11.zbusfor the control APIand
recipes::wait_until_idle. Last, because it is the piece that needs themost design and the least of it is shared with the rest.
Wayland is explicitly out of scope for a first pass. There is no portable
input injection there; it needs
libeior a portal, and that is its own issue.Starting X11-only is the right call, and the matrix should say X11.
Rules the backend has to hold to
platform. That invariant is what lets the portable core mean one thing
everywhere — read the Coordinates section at the top of
backend/macos/mod.rsbefore writing any geometry.
cannot do goes in
ext::linux, and the matrix in the README gets an honest❌. Do not add an
Err(Unsupported)arm to a portable method.Optionsdefaults are emulated, not reinvented — same table asAU3_Initleaves behind. Seeoptions.rs.#![deny(missing_docs)]is on, and CI runs clippy with-D warningsforevery feature combination.
Before you invest time
Please say here which slice you are taking, so two people do
not write the same one. I would rather answer design questions early than
review a large PR that took a different shape than the rest of the crate.
All reactions