Skip to content

Multi-PC: drag the rulers on the remote's screens - #840

Merged
mgth merged 8 commits into
v6from
feat/mpc-remote-rulers-input
Nov 25, 2026
Merged

mgth merged 8 commits into
v6from
feat/mpc-remote-rulers-input

Conversation

@mgth

@mgth mgth commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

The maintainer asked that the rulers on a remote's screens be handled there as they are on the master's own. Until now (#817) they were passive on the remote: aligning meant dragging those on the master's screens.

How it works

The remote edits nothing. The master's window stays the layout's only editor.

  • Remote (lbm-overlay::Standalone::interactive, lbm-agent/src/peers/actor.rs): asked with Overlay { Interactive: true }, it draws the rulers taking the pointer (the master's, injected there) and the keyboard. Every gesture goes back to the master whose rulers they are, in order, as OverlayInput { Revision, Input }: press, move, release, wheel, Escape.
    • The gestures are sent by one task fed through a bounded queue (256), so they arrive in order. A link that stalls loses the latest ones.
    • Windows: the gestures are taken after each dispatched message.
    • Linux: the helper's reader thread wakes the overlay thread. The lease is still renewed once per pulse, not at the mouse's rate.
  • Master agent: it passes an OverlayInput to the frontend that showed those rulers, and to no other (PeerOverlayInput event). It does so only while that frontend asks for them interactive, and only for a revision it sent.
  • lbm-app (remote_rulers::gesture, screen_overlay_input): it asks for Interactive when the agent announces PeerOverlayInput. It takes a gesture only on a band it sent to that machine and still shows, then runs it through screen_input exactly like its own screens' gestures: a drag moves that screen's monitor, the wheel scales it, Escape hides the rulers.
  • Two masters: the remote shows the rulers of the master that asked last, and only that master hears the gestures. On the master, the rulers belong to the window that wrote them last (feat(multi-pc): rulers on the remote's screens #817 review), and only that window gets the gestures.
  • Older pieces: an older remote ignores Interactive and draws passive rulers. An older agent never announces the capability, so the window asks for nothing new.

Also

  • docs/multi-pc.md on v6 still held two sets of conflict markers from an earlier merge: the clipboard section against "Rulers on a remote's screens", and the wire list. This PR removes them and keeps both sides, since it edits those very sections.
  • examples/peer_drive gains dragrulers N and prints the gestures it receives.

Tests

  • lbm-net: round-trip of Overlay { Interactive } and OverlayInput.
  • lbm-agent/tests/peers.rs:
    • passive rulers hand nothing back;
    • draggable rulers are redrawn interactive, and gestures reach the master in order under the shown revision, still after an update;
    • with two masters, the second's rulers take the gestures and the first hears none of them.
  • lbm-agent/tests/api.rs: the gesture reaches the window that showed the rulers, unread. It is not sent to another window, nor for a revision never sent, nor once the rulers are passive again.
  • lbm-app:
    • Interactive is asked only with the capability;
    • a gesture is taken only on a band sent to that machine (not from another machine, not at another place, not passive, not unreadable, not once taken down);
    • a press, move and release on the laptop's ruler, coming from the agent, move the laptop's monitor in the layout by the expected millimetres, while strays and gestures after Off are dropped.
  • cargo clippy --workspace --all-targets: clean. lbm-agent and lbm-hook for x86_64-pc-windows-gnu: clean.
  • Tests of lbm-agent, lbm-app, lbm-net, lbm-overlay, lbm-ipc and lbm-hook: 1030 pass. Not run: the inotify tests (this machine is out of inotify instances), and supervise, which fails here as before because a real hook is running.

Tried on real hardware

Windows remote, vm124 (4K at 1.5 + 1080p). peer_drive dragrulers 0 on the Linux machine played the master, and peer_remote (MSVC release) the remote, next to the maintainer's installed agent, which was not touched. Gestures were injected into the VM's session with SetCursorPos, mouse_event and keybd_event.

  • The rulers take the pointer: WindowFromPoint on the top ruler returns LittleBigMouse.ScreenOverlay.v7 (with passive rulers it returned the desktop beneath, feat(multi-pc): rulers on the remote's screens #817).
  • A press at 1000 px, a 400 px drag in 20 steps, the release, one wheel notch and Escape all reached the master, in order, as OverlayInput under revision 1. at is in points: the press came at 666.7 of 2560, the release at 933.3, which is 1000 px and 1400 px at scale 1.5.
  • Cleaned up afterwards: tasks, firewall rule and C:\temp\mpc-rulers removed. The build reused the VM's existing target folder: C: went from 2.6 GB to 2.2 GB free.

Never run on real hardware

  • lbm-app on a real master applying those gestures to the layout: covered by tests only. peer_drive prints the gestures but edits nothing.
  • A Linux remote's interactive surfaces.

Independent of #838 (the toggle being available when a remote's screen is selected). Both edit the same "Faiblesses connues" line of docs/multi-pc-etat.md; whichever merges second will merge v6 first.

🤖 Generated with Claude Code

The rulers a master shows on a remote (#817) were passive there: aligning meant
dragging those on the master's own screens. They can now be dragged where they are.

- lbm-overlay: Standalone::interactive takes the pointer and hands every gesture to a
  callback, from the overlay thread (Windows: after each dispatched message; Linux:
  the helper's reader wakes the thread, which renews the lease once per pulse only).
- Wire: Overlay gains Interactive (default false: an older remote draws them passive),
  and OverlayInput { Revision, Input } goes back, in order, from a bounded queue, to
  the master whose rulers are shown only.
- Agent: the master hands an OverlayInput to the frontend that showed those rulers
  alone (event PeerOverlayInput, capability PeerOverlayInput), only while it asks for
  them interactive and for a revision it sent.
- lbm-app: asks Interactive when the agent offers it; takes a gesture only on a band it
  sent to that machine and still shows, and feeds it to screen_input like its own
  screens' (drag moves the monitor, wheel scales, Escape hides).
- peer_drive gains `dragrulers N` and prints the gestures.
- docs/multi-pc.md: conflict markers left by an earlier merge removed, both sides kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@mgth mgth left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Le test du déplacement d’un écran depuis sa règle distante passe en local. Deux cas restent à couvrir sur un lien chargé ou retardé.

mgth and others added 2 commits November 25, 2026 09:39
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…input

# Conflicts:
#	rust/crates/lbm-agent/src/api.rs

@mgth mgth left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Le compte rendu ajouté décrit un glisser de 400 pixels sur vm124 dont le maître a reçu le Release. J’ai revérifié les deux cas limites sur cbdf31f6, après l’intégration de v6. Sur une file pleine, try_send peut encore perdre le Release qui valide le déplacement. Après fermeture et réouverture des règles, le filtre revision <= sent accepte encore un événement retardé de la session précédente. Les deux discussions restent ouvertes.

mgth and others added 2 commits November 25, 2026 09:51
…late one

Review of #840:
- The gestures waited in a bounded channel whose try_send could drop the Release
  that commits a drag, leaving the master's preview pending until the next press.
  They now wait in overlay::Gestures: a move following a move on the same band
  replaces it, and nothing else is merged or dropped short of 1024 waiting. One task
  sends them in order, then what is left once the surfaces are gone.
- `revision <= sent` let a late gesture from rulers since closed commit a drag of
  those reopened on the same band. The master's agent now keeps, per remote, the
  revision the current interactive showing began with (rulers on, made draggable, or
  sent again on a new link) and takes only gestures from it on.

Tests: moves merge and the release survives a lagging link; a stalled link keeps the
oldest; a Release made under rulers since closed is dropped, those of the reopened
showing, before and after an update, are taken.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@mgth mgth left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Le test du relâchement tardif après fermeture et réouverture des règles passe sur f3d29e46 : la borne inférieure de révision écarte l’ancienne session. Le test du glisser ordinaire passe aussi. Il reste une perte de Release dans l’interface maître lorsque sa file atteint 1 024 événements. J’ai reproduit le cas dans le test de l’éditeur et ajouté les résultats à la discussion sur la fin du glisser.

mgth and others added 2 commits November 25, 2026 10:33
…cels

Review of #840 (f3d29e4): the master window held the remote's gestures in a Vec
capped at 1024 until the next frame, so a Press, 1023 Moves and a Release arriving
together lost the Release and left the drag pending; the remote's queue could do
the same with 1024 gestures that cannot merge.

Both stages now share lbm_overlay::input::Gestures (moved from the agent): moves
merge, nothing else is dropped, and a queue that fills all the same gives up what
waits for a Cancel, which ends the gesture under way rather than leave it open.

Tests: the window test now delivers Press, 1023 Moves and Release before a frame and
checks the monitor moved and no drag is left; an overflow of presses and releases
leaves none either; the queue's own tests moved to lbm-overlay with the cancel case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@mgth mgth left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Le cas reproduit à la revue précédente est corrigé dans f0d0b6dc. J’ai relancé le test de l’éditeur avec un appui, 1 023 mouvements, puis le relâchement avant la frame suivante. Le panneau atteint la position attendue et le glisser se termine. L’agent et l’éditeur utilisent désormais la même file : elle regroupe les mouvements consécutifs et émet Cancel si des événements non regroupables la saturent. Les tests de saturation et de rejet d’un événement retardé après réouverture passent aussi. La dernière remarque est traitée.

…/mpc-remote-rulers-input

# Conflicts:
#	rust/crates/lbm-agent/src/peers/actor.rs
@mgth
mgth merged commit 36e1f05 into v6 Nov 25, 2026
3 checks passed
@mgth
mgth deleted the feat/mpc-remote-rulers-input branch November 25, 2026 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant