Skip to content

fix(desktop): refuse pointer points outside the live screen - #437

Merged
ElbertePlinio merged 5 commits into
mainfrom
fix/424-pointer-bounds
Oct 29, 2026
Merged

ElbertePlinio merged 5 commits into
mainfrom
fix/424-pointer-bounds

Conversation

@ElbertePlinio

Copy link
Copy Markdown
Member

Desktop pointer input now refuses a point outside the session's screen before anything is sent. Before this change, X moved a point past the edge to the edge and wrapped values above 32767, so click 32768 100 on a 640x480 session clicked at 0,100 and succeeded.

The bounds come from the live Xvfb, not the session record. After the ownership check, pointer input opens the verified X11 socket and reads the default screen's current size from the setup reply, within the same 3 s budget. Sessions run Xvfb with -noreset, so a new connection sees a RandR resize. A forged or stale record cannot widen the allowed area. When the size cannot be read, input is refused. A refusal uses DesktopPointerOutOfBoundsError, a DesktopInputTargetError, so evidence records it as not attempted and the click pulse does not fire. Key presses, scroll without a point and pointer markers open no extra connection.

Closes #424

Requirement Verified by Scenario and edge cases Result Evidence
Refuse points outside the screen for click, double click, move, drag (both ends) and scroll, in the CLI and MCP Unit tests per command, MCP and CLI pointer evidence tests, live MCP bounds test 639,479 accepted; 640,479, 639,480, 32768,100 refused; drag start and end; scroll with and without a point Refused before dispatch, recorded as not attempted, no pulse; tests fail on the old code 424/before-old-code.log, 424/after-new-code.log
Test the edge and the 16-bit wrap pointer-target.test.ts, pointer-bounds-live.test.ts Last pixel, one past it, 32768 and 65537 Pass 424/round2/after-new-code.log
Bounds follow the real screen (review) Live tests on a private Xvfb xrandr --fb 320x240 shrink; record set to 40000x40000; server stopped with SIGSTOP Refused off-screen points, 319,239 accepted after the shrink; unreadable size refused after 3 s; 8 tests fail on the old code 424/round2/before-old-code.log
CLI journey QA on a private session Edge, wrap, then a RandR shrink Errors name the axis, value and screen; the pointer does not move on a refusal 424/round2/qa.sh, 424/round2/qa-cli-output.txt

Evidence paths are under ~/.pickforge/investigations/ on the review host.

CI has no xrandr: ci.yml installs x11-utils, and xrandr is in x11-xserver-utils on Ubuntu. The live shrink test skips there; the forged-record and unreadable-size live tests need only Xvfb and xdotool and run in CI.

Sol review, round 1: 6/10, one blocker, that the bounds came from the session record. Fixed in d96a659 with the live screen read. Round 2: 6/10, one should: a RandR resize in the few milliseconds between the size read and the xdotool connection can still move an on-screen point to the new edge. Declined: the same window already exists for a server that replaces the owned Xvfb before xdotool connects, and closing both needs dispatch through our own connection under a server grab instead of xdotool. 7e68bb3 documents the window next to the existing note.

Checks on 4b0223c: oxlint, typecheck, build; full vitest coverage run with the desktop, window, wait, browser and viewer requirements on (3440 passed, 4 skipped; two unrelated CLI tests timed out at the 5 s default at load average 18 and passed on rerun, filed as #436); PICKFORGE_REQUIRE_XVFB=1 cargo test --workspace --locked (328 passed). 7e68bb3 changes only a comment. PickCheck 0.4.0 against main is clean.

X moves a point past the screen edge to the edge and wraps a value above
32767, so a click could land on a different point and still succeed.
Pointer input now checks every point against the screen size in the
verified session record and refuses it before dispatch. A record without
a size refuses pointer input. The refusal extends DesktopInputTargetError,
so CLI and MCP evidence record it as not attempted and no click pulse fires.

Closes #424
Read the default screen's current width and height from the X11 setup
reply over the verified socket, after the ownership check and within its
3 s budget. The session record only holds the size at creation, so a
RandR resize or a wrong record no longer widens the allowed area. When
the size cannot be read, pointer input is refused before dispatch.
@ElbertePlinio
ElbertePlinio merged commit 4f26ae1 into main Oct 29, 2026
10 checks passed
@ElbertePlinio
ElbertePlinio deleted the fix/424-pointer-bounds branch October 29, 2026 14:22
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.

desktop: pointer input accepts points off the screen, and X wraps values above 32767

1 participant